fix scanner tests

This commit is contained in:
evilchili
2022-11-30 23:42:06 -08:00
parent 26b7fde93d
commit 4acd16bdde
2 changed files with 18 additions and 5 deletions
+8 -5
View File
@@ -49,14 +49,17 @@ class MediaScanner:
asyncio.run(_do_import())
self.db.commit()
async def _import_one_track(self, path):
def _get_tags(self, path): # pragma: no cover
tags = music_tag.load_file(path)
relpath = str(path.relative_to(self.root))
stmt = groove.db.track.insert({
'relpath': relpath,
return {
'artist': str(tags.resolve('album_artist')),
'title': str(tags['title']),
}).prefix_with('OR IGNORE')
}
async def _import_one_track(self, path):
tags = self._get_tags(path)
tags['relpath'] = str(path.relative_to(self.root))
stmt = groove.db.track.insert(tags).prefix_with('OR IGNORE')
logging.debug(f"{tags['artist']} - {tags['title']}")
self.db.execute(stmt)