mirror of
https://github.com/tcsenpai/swingmusic.git
synced 2025-06-06 19:25:34 +00:00
use all flag to check drives
This commit is contained in:
parent
5f1bb28f5d
commit
1d71ba856b
@ -68,14 +68,24 @@ def get_all_drives(is_win: bool = False):
|
|||||||
"""
|
"""
|
||||||
Returns a list of all the drives on a Windows machine.
|
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]
|
drives = [d.mountpoint for d in drives]
|
||||||
|
|
||||||
if is_win:
|
if is_win:
|
||||||
drives = [win_replace_slash(d) for d in drives]
|
drives = [win_replace_slash(d) for d in drives]
|
||||||
else:
|
else:
|
||||||
remove = ["/boot", "/boot/efi", "/tmp"]
|
remove = (
|
||||||
drives = [d for d in drives if d not in remove]
|
"/boot",
|
||||||
|
"/tmp",
|
||||||
|
"/snap",
|
||||||
|
"/var",
|
||||||
|
"/sys",
|
||||||
|
"/proc",
|
||||||
|
"/etc",
|
||||||
|
"/run",
|
||||||
|
"/dev",
|
||||||
|
)
|
||||||
|
drives = [d for d in drives if not d.startswith(remove)]
|
||||||
|
|
||||||
return drives
|
return drives
|
||||||
|
|
||||||
@ -94,8 +104,6 @@ def list_folders():
|
|||||||
req_dir = "$root"
|
req_dir = "$root"
|
||||||
|
|
||||||
if req_dir == "$root":
|
if req_dir == "$root":
|
||||||
# req_dir = settings.USER_HOME_DIR
|
|
||||||
# if is_win:
|
|
||||||
return {
|
return {
|
||||||
"folders": [{"name": d, "path": d} for d in get_all_drives(is_win=is_win)]
|
"folders": [{"name": d, "path": d} for d in get_all_drives(is_win=is_win)]
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,7 @@ class AlbumVersionEnum(Enum):
|
|||||||
BONUS_EDITION = ("bonus",)
|
BONUS_EDITION = ("bonus",)
|
||||||
BONUS_TRACK = ("bonus track",)
|
BONUS_TRACK = ("bonus track",)
|
||||||
|
|
||||||
ORIGINAL = ("original",)
|
ORIGINAL = ("original", "og")
|
||||||
INTL_VERSION = ("international",)
|
INTL_VERSION = ("international",)
|
||||||
UK_VERSION = ("uk version",)
|
UK_VERSION = ("uk version",)
|
||||||
US_VERSION = ("us version",)
|
US_VERSION = ("us version",)
|
||||||
|
@ -143,7 +143,11 @@ def get_extras(filepath: str, keys: list[str]):
|
|||||||
"""
|
"""
|
||||||
Get extra tags from an audio file.
|
Get extra tags from an audio file.
|
||||||
"""
|
"""
|
||||||
tags = TinyTag.get(filepath)
|
try:
|
||||||
|
tags = TinyTag.get(filepath)
|
||||||
|
except Exception:
|
||||||
|
return [""] * len(keys)
|
||||||
|
|
||||||
extras = tags.extra
|
extras = tags.extra
|
||||||
|
|
||||||
return [extras.get(key, "").strip() for key in keys]
|
return [extras.get(key, "").strip() for key in keys]
|
||||||
|
@ -159,6 +159,8 @@ class Album:
|
|||||||
"""
|
"""
|
||||||
return self.title.strip().endswith(" EP")
|
return self.title.strip().endswith(" EP")
|
||||||
|
|
||||||
|
# TODO: check against number of tracks
|
||||||
|
|
||||||
def check_is_single(self, tracks: list[Track]):
|
def check_is_single(self, tracks: list[Track]):
|
||||||
"""
|
"""
|
||||||
Checks if the album is a single.
|
Checks if the album is a single.
|
||||||
|
@ -68,7 +68,11 @@ class LyricsProvider(LRCProvider):
|
|||||||
|
|
||||||
t = str(int(time.time() * 1000))
|
t = str(int(time.time() * 1000))
|
||||||
query.append(("t", t))
|
query.append(("t", t))
|
||||||
url = self.ROOT_URL + action
|
|
||||||
|
try:
|
||||||
|
url = self.ROOT_URL + action
|
||||||
|
except TypeError:
|
||||||
|
return None
|
||||||
|
|
||||||
try:
|
try:
|
||||||
response = self.session.get(url, params=query)
|
response = self.session.get(url, params=query)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user