fix: tmp folder issue, more logs #91

This commit is contained in:
Terry Geng 2020-03-07 23:54:25 +08:00
parent 9e6072526c
commit 01a59852a3
2 changed files with 10 additions and 3 deletions

View File

@ -75,7 +75,12 @@ class MusicLibrary(dict):
def delete(self, item): def delete(self, item):
if item.type == 'file' and item.path in self.file_id_lookup: if item.type == 'file' and item.path in self.file_id_lookup:
del self.file_id_lookup[item.path] self.log.debug("library: DELETE item from the database: %s" % item.format_debug_string())
if item.id in self:
del self[item.id]
if item.path in self.file_id_lookup:
del self.file_id_lookup[item.path]
self.files.remove(item.path) self.files.remove(item.path)
self.save_dir_cache() self.save_dir_cache()
@ -83,9 +88,11 @@ class MusicLibrary(dict):
def free(self, id): def free(self, id):
if id in self: if id in self:
self.log.debug("library: cache freed for item: %s" % self[id].format_debug_string())
del self[id] del self[id]
def free_all(self): def free_all(self):
self.log.debug("library: all cache freed")
self.clear() self.clear()
def build_dir_cache(self, bot): def build_dir_cache(self, bot):

View File

@ -54,7 +54,7 @@ class URLItem(BaseItem):
self.type = "url" self.type = "url"
def uri(self): def uri(self):
return var.music_folder + self.path if self.path[0] != "/" else self.path return self.path
def is_ready(self): def is_ready(self):
if self.downloading or self.ready != 'yes': if self.downloading or self.ready != 'yes':
@ -80,7 +80,7 @@ class URLItem(BaseItem):
info = self._get_info_from_url() info = self._get_info_from_url()
self.validating_lock.release() self.validating_lock.release()
if self.duration == 0 and not info: if not info:
return False return False
if self.duration > var.config.getint('bot', 'max_track_duration') != 0: if self.duration > var.config.getint('bot', 'max_track_duration') != 0: