document + rename stuff

This commit is contained in:
cwilvx
2024-07-07 16:07:27 +03:00
parent 32a2684ea2
commit 2ba5d6c1d7
11 changed files with 72 additions and 72 deletions
+1 -9
View File
@@ -2,17 +2,11 @@
Contains methods relating to albums.
"""
from dataclasses import asdict
from typing import Any
from itertools import groupby
from app.models.track import Track
from app.store.albums import AlbumStore
from app.store.tracks import TrackStore
def remove_duplicate_on_merge_versions(tracks: list[Track]) -> list[Track]:
def remove_duplicate_on_merge_versions(tracks: list[Track]):
"""
Removes duplicate tracks when merging versions of the same album.
"""
@@ -21,8 +15,6 @@ def remove_duplicate_on_merge_versions(tracks: list[Track]) -> list[Track]:
def sort_by_track_no(tracks: list[Track]):
# tracks = [asdict(t) for t in tracks]
for t in tracks:
track = str(t.track).zfill(3)
t._pos = int(f"{t.disc}{track}")
-31
View File
@@ -145,34 +145,3 @@ class CheckArtistImages:
if url is not None:
return DownloadImage(url, name=f"{artist['artisthash']}.webp")
# def fetch_album_bio(title: str, albumartist: str) -> str | None: """ Returns the album bio for a given album. """
# last_fm_url = "http://ws.audioscrobbler.com/2.0/?method=album.getinfo&api_key={}&artist={}&album={
# }&format=json".format( settings.Paths.LAST_FM_API_KEY, albumartist, title )
# try:
# response = requests.get(last_fm_url)
# data = response.json()
# except:
# return None
# try:
# bio = data["album"]["wiki"]["summary"].split('<a href="https://www.last.fm/')[0]
# except KeyError:
# bio = None
# return bio
# class FetchAlbumBio:
# """
# Returns the album bio for a given album.
# """
# def __init__(self, title: str, albumartist: str):
# self.title = title
# self.albumartist = albumartist
# def __call__(self):
# return fetch_album_bio(self.title, self.albumartist)