fix baco
This commit is contained in:
parent
88f34c6257
commit
cd9d47ad8d
1 changed files with 11 additions and 5 deletions
|
@ -1,10 +1,11 @@
|
||||||
import requests
|
|
||||||
import urllib.parse
|
|
||||||
import os.path
|
|
||||||
import os
|
import os
|
||||||
|
import os.path
|
||||||
import sys
|
import sys
|
||||||
|
import urllib.parse
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
|
|
||||||
|
import requests
|
||||||
|
|
||||||
sys.path.append("/yt-dlp")
|
sys.path.append("/yt-dlp")
|
||||||
import yt_dlp
|
import yt_dlp
|
||||||
|
|
||||||
|
@ -42,11 +43,16 @@ def _lastfm_getinfo(name: str, artist: str) -> tuple[str, list[str]]: # ( image
|
||||||
|
|
||||||
track_info = response.json()["track"]
|
track_info = response.json()["track"]
|
||||||
|
|
||||||
image_url = urllib.parse.urlparse(track_info["album"]["image"][0]["#text"])
|
image_id = ""
|
||||||
|
if "album" in track_info:
|
||||||
|
image_url = urllib.parse.urlparse(track_info["album"]["image"][0]["#text"])
|
||||||
|
image_id = os.path.splitext(os.path.basename(image_url.path))[0]
|
||||||
|
else:
|
||||||
|
print("this song haas no image", flush=True)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
# track_info["mbid"],
|
# track_info["mbid"],
|
||||||
os.path.splitext(os.path.basename(image_url.path))[0],
|
image_id,
|
||||||
[t["name"] for t in track_info["toptags"]["tag"]],
|
[t["name"] for t in track_info["toptags"]["tag"]],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue