Closed fluidblue closed 6 years ago
Your script does not save the tag. Here's my modified test script:
(eyeD3) travis@bjm:~/devel/eyeD3[master|!?]
└> cat issue111.py
import eyed3
audiofile = eyed3.load("song.id3")
print(f"# comments: {len(audiofile.tag.comments)}")
for comment in audiofile.tag.comments:
# Show comment
print(comment.description)
print(comment.text)
print(comment.lang)
# Remove comment. Doesn't work with empty descriptions.
audiofile.tag.comments.remove(comment.description)
print(f"# comments (after remove): {len(audiofile.tag.comments)}")
audiofile.tag.save()
And running it:
(eyeD3) travis@bjm:~/devel/eyeD3[master|!?]
└> eyeD3 song.id3
/home/travis/devel/eyeD3/song.id3 [ 1.00 KB ]
----------------------------------------------------------------------------------------------------------
ID3 v2.3:
title:
artist: bazz
album: foo
album artist: None
track:
Comment: [Description: ] [Lang: eng]
FOO
----------------------------------------------------------------------------------------------------------
(eyeD3) travis@bjm:~/devel/eyeD3[master|!?]
└> python issue111.py
# comments: 1
FOO
b'eng'
# comments (after remove): 0
(eyeD3) travis@bjm:~/devel/eyeD3[master|!?]
└> eyeD3 song.id3
/home/travis/devel/eyeD3/song.id3 [ 1.00 KB ]
----------------------------------------------------------------------------------------------------------
ID3 v2.3:
title:
artist: bazz
album: foo
album artist: None
track:
----------------------------------------------------------------------------------------------------------
Seems that in your example this works, however with my setup (eyed3 v0.8.0, python 3.6.1, macOS 10.12.6) it doesn't.
After calling audiofile.tag.comments.remove
the comment is still in audiofile.tag.comments
.
Can you check latest eyeD3 0.8.3. Feel free email me a sample file to reproduce, if needed.
It happened on files that were produced originally with CUERipper. I already used mutagen to remove the comments, though.
Doesn't work with 0.8.4 either. Not unless I delete ALL comments.
I realize this is a very old issue, but I ran into the same problem. Appears that it could be related to the lang
field. Trying to remove it as described above doesn't work, unless I include the option lang parameter:
>>> audiofile.tag.comments.remove('')
>>> audiofile.tag.save()
>>> audiofile.tag.comments[0]
<eyed3.id3.frames.CommentFrame object at 0x7f162d21cd50>
>>> audiofile.tag.comments[0].text
'Comment Here'
>>> audiofile.tag.comments[0].lang
b' '
>>> audiofile.tag.comments.remove('', b' ')
<eyed3.id3.frames.CommentFrame object at 0x7f162d22dfd0>
>>> audiofile.tag.comments[0].text
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/kit/PythonVenv/rssparser/lib64/python3.11/site-packages/eyed3/id3/tag.py", line 1525, in __getitem__
raise IndexError("list index out of range")
IndexError: list index out of range
Hello,
I'd like to remove comments using the python3 interface of eyed3 (v0.8.0):
The comment is correctly printed (text & lang). The description is an empty string. But calling remove returns None and doesn't remove the comment.