From da3f3cd42f7fc7b7706be5c245b799348d12cb6c Mon Sep 17 00:00:00 2001 From: Terry Geng Date: Sat, 28 Mar 2020 21:54:33 +0800 Subject: [PATCH] fix: path is None error --- database.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/database.py b/database.py index abb5df3..01f4eb7 100644 --- a/database.py +++ b/database.py @@ -433,9 +433,14 @@ class MusicDatabase: def query_all_paths(self): conn = sqlite3.connect(self.db_path) cursor = conn.cursor() - results = cursor.execute("SELECT path FROM music WHERE id != 'info'").fetchall() + results = cursor.execute("SELECT path FROM music WHERE id != 'info' AND type = 'file'").fetchall() conn.close() - return [ result[0] for result in results ] + paths = [] + for result in results: + if result and result[0]: + paths.append(result[0]) + + return paths def query_all_tags(self): conn = sqlite3.connect(self.db_path)