Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update mid3v2.py #507

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
23 changes: 18 additions & 5 deletions mutagen/_tools/mid3v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,11 +258,24 @@ def write_files(edits, filenames, escape):

encoding = get_frame_encoding(frame, desc)

try:
with open(fn, "rb") as h:
data = h.read()
except IOError as e:
error(str(e))
# START - J.Smolka (ttimer) - Mime type: -->
# With mime type '-->' a URL has to be stored in 'data' instead of the embedded picture.
#
# try:
# with open(fn, "rb") as h:
# data = h.read()
# except IOError as e:
# error(str(e))

if mime == "-->":
data = fn
else:
try:
with open(fn, "rb") as h:
data = h.read()
except IOError as e:
error(text_type(e))
# END - J.Smolka (ttimer) - Mime type: -->

frame = mutagen.id3.APIC(encoding=encoding, mime=mime,
desc=desc, type=picture_type, data=data)
Expand Down