rewrite populate.py to minimize db and hdd reads

+ change process name in manage.py
+ update db query to save show albums as single, as an integer
+ enable periodic scans
+ misc
This commit is contained in:
mungai-njoroge
2023-09-11 11:37:36 +03:00
parent e9284de91f
commit bacf68248b
10 changed files with 143 additions and 19 deletions
+3 -1
View File
@@ -228,6 +228,8 @@ def get_artist(artisthash: str):
except ValueError:
year = 0
decade = None
if year:
decade = math.floor(year / 10) * 10
decade = str(decade)[2:] + "s"
@@ -273,8 +275,8 @@ def get_artist_albums(artisthash: str):
eps = [a for a in all_albums if a.is_EP]
def remove_EPs_and_singles(albums_: list[Album]):
albums_ = [a for a in albums_ if not a.is_EP]
albums_ = [a for a in albums_ if not a.is_single]
albums_ = [a for a in albums_ if not a.is_EP]
return albums_
albums = filter(lambda a: artisthash in a.albumartists_hashes, all_albums)