change to not download the album photo
This commit is contained in:
72
app.py
72
app.py
@@ -76,46 +76,46 @@ player = GaplessPlayer()
|
|||||||
|
|
||||||
print("add queue")
|
print("add queue")
|
||||||
|
|
||||||
# player.add_to_queue(
|
|
||||||
# Song(
|
|
||||||
# "/mnt/HDD/Downloads/72 Pantera.wav",
|
|
||||||
# "Bullseye",
|
|
||||||
# 1,
|
|
||||||
# "KDrew",
|
|
||||||
# "",
|
|
||||||
# "KDrew",
|
|
||||||
# )
|
|
||||||
# )
|
|
||||||
|
|
||||||
albums = client.jellyfin.user_items(
|
|
||||||
params={
|
|
||||||
"IncludeItemTypes": "MusicAlbum",
|
|
||||||
"SearchTerm": "Dawn FM", # album name
|
|
||||||
"Recursive": True,
|
|
||||||
},
|
|
||||||
)
|
|
||||||
|
|
||||||
album = albums["Items"][0] # pick the album you want
|
|
||||||
album_id = album["Id"]
|
|
||||||
|
|
||||||
|
|
||||||
tracks = client.jellyfin.user_items(
|
|
||||||
params={
|
|
||||||
"ParentId": album_id,
|
|
||||||
"IncludeItemTypes": "Audio",
|
|
||||||
"SortBy": "IndexNumber",
|
|
||||||
"SortOrder": "Ascending",
|
|
||||||
},
|
|
||||||
)
|
|
||||||
|
|
||||||
for track in tracks["Items"]:
|
|
||||||
player.add_to_queue(
|
player.add_to_queue(
|
||||||
song_data_to_Song(
|
Song(
|
||||||
track, server
|
"/mnt/HDD/Downloads/72 Pantera.wav",
|
||||||
|
"Bullseye",
|
||||||
|
1,
|
||||||
|
"KDrew",
|
||||||
|
"",
|
||||||
|
"KDrew",
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
print("add queue done")
|
# albums = client.jellyfin.user_items(
|
||||||
|
# params={
|
||||||
|
# "IncludeItemTypes": "MusicAlbum",
|
||||||
|
# "SearchTerm": "Dawn FM", # album name
|
||||||
|
# "Recursive": True,
|
||||||
|
# },
|
||||||
|
# )
|
||||||
|
|
||||||
|
# album = albums["Items"][0] # pick the album you want
|
||||||
|
# album_id = album["Id"]
|
||||||
|
|
||||||
|
|
||||||
|
# tracks = client.jellyfin.user_items(
|
||||||
|
# params={
|
||||||
|
# "ParentId": album_id,
|
||||||
|
# "IncludeItemTypes": "Audio",
|
||||||
|
# "SortBy": "IndexNumber",
|
||||||
|
# "SortOrder": "Ascending",
|
||||||
|
# },
|
||||||
|
# )
|
||||||
|
|
||||||
|
# for track in tracks["Items"]:
|
||||||
|
# player.add_to_queue(
|
||||||
|
# song_data_to_Song(
|
||||||
|
# track, server
|
||||||
|
# )
|
||||||
|
# )
|
||||||
|
|
||||||
|
# print("add queue done")
|
||||||
# player.load_state("data/player.json")
|
# player.load_state("data/player.json")
|
||||||
# close_event = threading.Event()
|
# close_event = threading.Event()
|
||||||
# def save_state_loop():
|
# def save_state_loop():
|
||||||
|
|||||||
@@ -53,12 +53,14 @@ def song_data_to_Song(data, client_data) -> Song:
|
|||||||
client_data["address"], f"/Items/{data['AlbumId']}/Images/Primary"
|
client_data["address"], f"/Items/{data['AlbumId']}/Images/Primary"
|
||||||
)
|
)
|
||||||
|
|
||||||
r = requests.get(album_cover_url)
|
# r = requests.get(album_cover_url)
|
||||||
r.raise_for_status()
|
# r.raise_for_status()
|
||||||
|
|
||||||
content_type = r.headers.get("Content-Type") # e.g. "image/jpeg"
|
# content_type = r.headers.get("Content-Type") # e.g. "image/jpeg"
|
||||||
|
|
||||||
ext = mimetypes.guess_extension(content_type) # ".jpg"
|
# ext = mimetypes.guess_extension(content_type) # ".jpg"
|
||||||
|
|
||||||
|
ext = None
|
||||||
|
|
||||||
if ext is None:
|
if ext is None:
|
||||||
ext = ".jpg" # safe fallback for album art
|
ext = ".jpg" # safe fallback for album art
|
||||||
|
|||||||
Reference in New Issue
Block a user