mirror of
https://github.com/Wojtek242/qobuz-dl.git
synced 2024-11-22 11:05:25 +01:00
Support embedding images for multiple discs. Close #34.
This commit is contained in:
parent
cf1a14a2d8
commit
8b73001129
@ -65,14 +65,20 @@ def tag_flac(filename, root_dir, final_name, d, album, istrack=True, em_image=Fa
|
|||||||
audio["ALBUM"] = album["title"] # ALBUM TITLE
|
audio["ALBUM"] = album["title"] # ALBUM TITLE
|
||||||
audio["YEAR"] = album["release_date_original"].split("-")[0] # YEAR
|
audio["YEAR"] = album["release_date_original"].split("-")[0] # YEAR
|
||||||
|
|
||||||
emb_image = os.path.join(root_dir, "cover.jpg")
|
if em_image:
|
||||||
if os.path.isfile(emb_image) and em_image:
|
emb_image = os.path.join(root_dir, "cover.jpg")
|
||||||
|
multi_emb_image = os.path.join(
|
||||||
|
os.path.abspath(os.path.join(root_dir, os.pardir)), "cover.jpg"
|
||||||
|
)
|
||||||
|
print(emb_image)
|
||||||
|
print(multi_emb_image)
|
||||||
|
cover_image = emb_image if os.path.isfile(emb_image) else multi_emb_image
|
||||||
try:
|
try:
|
||||||
image = Picture()
|
image = Picture()
|
||||||
image.type = 3
|
image.type = 3
|
||||||
image.mime = "image/jpeg"
|
image.mime = "image/jpeg"
|
||||||
image.desc = "cover"
|
image.desc = "cover"
|
||||||
with open(emb_image, "rb") as img:
|
with open(cover_image, "rb") as img:
|
||||||
image.data = img.read()
|
image.data = img.read()
|
||||||
audio.add_picture(image)
|
audio.add_picture(image)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
Loading…
Reference in New Issue
Block a user