• Vítejte na XBMC-Kodi.cz
  • Česko-slovenská komunita fanoušků XBMC/Kodi
Vítejte návštevníku! Přihlášení Registrace


Hodnocení tématu:
  • 0 Hlas(ů) - 0 Průměr
  • 1
  • 2
  • 3
  • 4
  • 5
Zmena časového intervalu mazania
#1
Ahojte, chcel by som si upraviť časový interval mazania Thumbnails súborov starších ako 1 mesiac na dlhší interval,povedzme roky. Je správne ak tu zmením interval z -1 month na -3 years ?

class TexturesDb:
    def __init__(self):
        path = 'special://database/Textures{}.db'.format(KodiDbMap.Textures[SYSTEM_VERSION])
        self._db = Sqlite(path)

    def clean(self):
        zoznam = self.to_clean()
        total = len(zoznam)
        d = dprogressgb()
        d.create('mazanie', 'mazem')
        for pos, i in enumerate(zoznam):
            p = int(pos/total*100)
            debug('item: {}/{} {}'.format(pos, total, TexturesDb.file_name(i)))
            self.remove_item(i)
            d.update(p, 'mazanie', 'mazem {}'.format(i[1]))
        d.close()

    @staticmethod
    def file_name(item):
        return translate_path("special://masterprofile/Thumbnails/{}".format(item[1]))

    def remove_item(self, item):
        xbmcvfs.delete(TexturesDb.file_name(item))
        self._db.execute('delete from sizes where idtexture=?', item[0])
        self._db.execute('delete from texture where id=?', item[0])

    def to_clean(self):
        q = "SELECT s.idtexture, t.cachedurl, s.lastusetime FROM sizes AS s JOIN texture t ON (t.id=s.idtexture) WHERE lastusetime <= DATETIME('now', '-1 month') ORDER BY 3 ASC"
        return self._db.execute(q).fetchall()



Vopred dakujem za rady....
 Sony bravia Android TV Android 9 ,Kodi 21.2 Omega ,NAS Synology DS224+, 
 
Citovat
  


Příspěvků v tématu
Zmena časového intervalu mazania - od karci78 - 23.5.2025, 19:24

Přejít na fórum:


Prochází: 1 host(ů)