handle discs in album page

This commit is contained in:
geoffrey45
2022-08-02 22:47:19 +03:00
parent 11d33e9617
commit 3dcb8ed2ef
8 changed files with 60 additions and 12 deletions
+1 -1
View File
@@ -68,7 +68,7 @@ def get_album():
album.count == 1
and tracks[0].title == album.title
and tracks[0].tracknumber == 1
and tracks[0].disknumber == 1
and tracks[0].discnumber == 1
):
album.is_single = True
+1 -1
View File
@@ -97,7 +97,7 @@ class CheckArtistImages:
@staticmethod
def check_if_exists(img_path: str):
"""
Checks if an image exists on disk.
Checks if an image exists on c.
"""
if os.path.exists(img_path):
+2 -2
View File
@@ -147,7 +147,7 @@ def parse_track_number(tags):
def parse_disc_number(tags):
"""
Parses the disk number from an audio file.
Parses the disc number from an audio file.
"""
try:
disc_number = int(tags["discnumber"][0])
@@ -183,7 +183,7 @@ def get_tags(fullpath: str) -> dict | None:
"genre": parse_genre_tag(tags),
"date": parse_date_tag(tags)[:4],
"tracknumber": parse_track_number(tags),
"disknumber": parse_disc_number(tags),
"discnumber": parse_disc_number(tags),
"copyright": parse_copyright(tags),
"length": round(tags.info.length),
"bitrate": round(int(tags.info.bitrate) / 1000),
+2 -2
View File
@@ -25,7 +25,7 @@ class Track:
genre: str
bitrate: int
tracknumber: int
disknumber: int
discnumber: int
albumhash: str
date: str
image: str
@@ -42,7 +42,7 @@ class Track:
self.genre = tags["genre"]
self.bitrate = int(tags["bitrate"])
self.length = int(tags["length"])
self.disknumber = int(tags["disknumber"])
self.discnumber = int(tags["discnumber"])
self.albumhash = tags["albumhash"]
self.date = tags["date"]
self.image = tags["albumhash"] + ".webp"