Save complete tracks and albums to the db for faster startup

- refactor function locations
- add logger
- check for new tracks instead of re-processing all files
This commit is contained in:
geoffrey45
2022-04-21 10:16:45 +03:00
parent ef68cae625
commit d98cc0547e
22 changed files with 448 additions and 380 deletions
+9 -7
View File
@@ -53,7 +53,7 @@ class Album:
Album class
"""
album: str
title: str
artist: str
count: int
duration: int
@@ -62,20 +62,22 @@ class Album:
image: str
def __init__(self, tags):
self.album = tags["album"]
self.title = tags["album"]
self.artist = tags["artist"]
self.count = tags["count"]
self.duration = tags["duration"]
self.date = tags["date"]
self.artistimage = settings.IMG_ARTIST_URI + tags["artistimage"]
self.image = settings.IMG_THUMB_URI + tags["image"]
self.artistimage = tags["artistimage"]
self.image = tags["image"]
def get_p_track(ptrack):
for track in api.TRACKS:
if (track.title == ptrack["title"]
and track.artists == ptrack["artists"]
and ptrack["album"] == track.album):
if (
track.title == ptrack["title"]
and track.artists == ptrack["artists"]
and ptrack["album"] == track.album
):
return track