diff --git a/app/api/folder.py b/app/api/folder.py index 54f9d08..deafdcf 100644 --- a/app/api/folder.py +++ b/app/api/folder.py @@ -68,14 +68,24 @@ def get_all_drives(is_win: bool = False): """ Returns a list of all the drives on a Windows machine. """ - drives = psutil.disk_partitions() + drives = psutil.disk_partitions(all=True) drives = [d.mountpoint for d in drives] if is_win: drives = [win_replace_slash(d) for d in drives] else: - remove = ["/boot", "/boot/efi", "/tmp"] - drives = [d for d in drives if d not in remove] + remove = ( + "/boot", + "/tmp", + "/snap", + "/var", + "/sys", + "/proc", + "/etc", + "/run", + "/dev", + ) + drives = [d for d in drives if not d.startswith(remove)] return drives @@ -94,8 +104,6 @@ def list_folders(): req_dir = "$root" if req_dir == "$root": - # req_dir = settings.USER_HOME_DIR - # if is_win: return { "folders": [{"name": d, "path": d} for d in get_all_drives(is_win=is_win)] } diff --git a/app/enums/album_versions.py b/app/enums/album_versions.py index 40a84c2..6894a67 100644 --- a/app/enums/album_versions.py +++ b/app/enums/album_versions.py @@ -40,7 +40,7 @@ class AlbumVersionEnum(Enum): BONUS_EDITION = ("bonus",) BONUS_TRACK = ("bonus track",) - ORIGINAL = ("original",) + ORIGINAL = ("original", "og") INTL_VERSION = ("international",) UK_VERSION = ("uk version",) US_VERSION = ("us version",) diff --git a/app/lib/lyrics.py b/app/lib/lyrics.py index b51e98b..98a2a6a 100644 --- a/app/lib/lyrics.py +++ b/app/lib/lyrics.py @@ -143,7 +143,11 @@ def get_extras(filepath: str, keys: list[str]): """ Get extra tags from an audio file. """ - tags = TinyTag.get(filepath) + try: + tags = TinyTag.get(filepath) + except Exception: + return [""] * len(keys) + extras = tags.extra return [extras.get(key, "").strip() for key in keys] diff --git a/app/models/album.py b/app/models/album.py index 3d09c45..52f54ab 100644 --- a/app/models/album.py +++ b/app/models/album.py @@ -159,6 +159,8 @@ class Album: """ return self.title.strip().endswith(" EP") + # TODO: check against number of tracks + def check_is_single(self, tracks: list[Track]): """ Checks if the album is a single. diff --git a/app/plugins/lyrics.py b/app/plugins/lyrics.py index 24b4bc1..2cb2473 100644 --- a/app/plugins/lyrics.py +++ b/app/plugins/lyrics.py @@ -68,7 +68,11 @@ class LyricsProvider(LRCProvider): t = str(int(time.time() * 1000)) query.append(("t", t)) - url = self.ROOT_URL + action + + try: + url = self.ROOT_URL + action + except TypeError: + return None try: response = self.session.get(url, params=query)