def cleanIfIdle(self, path=None):
# RecordTimer calls this when preparing a recording. That is a
# nice moment to clean up. It also mentions the path, so mark
# it as dirty.
self.markDirty(path)
if not self.dirty:
return
if self.isCleaning:
print "[Trashcan] Cleanup already running"
return
if (self.session is not None) and self.session.nav.getRecordings():
return
self.isCleaning = True
ctimeLimit = time.time() - (config.usage.movielist_trashcan_days.value * 3600 * 24)
reserveBytes = 1024*1024*1024 * int(config.usage.movielist_trashcan_reserve.value)
cleanset = self.dirty
self.dirty = set()
threads.deferToThread(purge, cleanset, ctimeLimit, reserveBytes).addCallbacks(self.cleanReady, self.cleanFail)
评论列表
文章目录