Code Monkey home page Code Monkey logo

nicfit / eyed3 Goto Github PK

View Code? Open in Web Editor NEW
535.0 535.0 58.0 2.4 MB

eyeD3 is a Python module and command line program for processing ID3 tags. Information about mp3 files (i.e bit rate, sample frequency, play time, etc.) is also provided. The formats supported are ID3v1 (1.0/1.1) and ID3v2 (2.3/2.4).

Home Page: http://eyed3.nicfit.net/

License: GNU General Public License v3.0

Shell 0.14% Python 98.31% Makefile 1.55%
id3v1 id3v2 mp3 mp3tag music python

eyed3's Introduction

Hi there 👋

✨ Check out My GitHub Stars for a lot of good stuff and inspiration.

eyed3's People

Contributors

0-wiz-0 avatar boukeversteegh avatar chamatht avatar deoren avatar dependabot-preview[bot] avatar dependabot[bot] avatar gabrieldiego avatar gaetano-guerriero avatar gersonkurz avatar gobater avatar gruns avatar guiweber avatar hmeine avatar hpjansson avatar jonher937 avatar mafrosis avatar mgorny avatar mic92 avatar nicfit avatar pyup-bot avatar redshodan avatar sludgefeast avatar timgates42 avatar yaph avatar zhu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

eyed3's Issues

0.8.3/python3: plugin display with ID3 tag COMM (comment): TypeError: must be str, not CommentFrame

Using 0.8.3 over python3 to display comments, with this:

eyeD3 --plugin display --pattern '%comment%'

With any file containing the ID3 tag COMM, such as this one, for example:

/home/paulo/tmp/Atrium Musicæ de Madrid/Monodia Cortesana Medieval • Música Arábigo-Andaluza/11 Ondas do mar de Vigo.mp3                                                              [ 2.60 MB ]
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Time: 01:55	MPEG1, Layer III	[ ~188 kb/s @ 44100 Hz - Joint stereo ]
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
ID3 v2.3:
title: Ondas do mar de Vigo
artist: Atrium Musicæ de Madrid
album: Monodia Cortesana Medieval • Música Arábigo-Andaluza
album artist: José Luis Ochoa de Olza, Orchesta Marroquí de Tetuán (Abdessadak Chkara)
recording date: 1969
eyed3.id3:WARNING: Non standard genre name: Medieval
track: 11		genre: Medieval (id None)
Comment: [Description: ] [Lang: XXX]
Cantigas de amigo
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

it chokes with this error:

Uncaught exception: must be str, not CommentFrame

eyed3:ERROR: must be str, not CommentFrame
Traceback (most recent call last):
  File "/home/paulo/.local/lib/python3.6/site-packages/eyed3/main.py", line 279, in _main
    retval = mainFunc(args, config)
  File "/home/paulo/.local/lib/python3.6/site-packages/eyed3/main.py", line 50, in main
    fs_encoding=args.fs_encoding)
  File "/home/paulo/.local/lib/python3.6/site-packages/eyed3/utils/__init__.py", line 91, in walk
    handler.handleFile(os.path.abspath(path))
  File "/home/paulo/.local/lib/python3.6/site-packages/eyed3/plugins/display.py", line 1046, in handleFile
    print(self.__pattern.output_for(self.audio_file),
  File "/home/paulo/.local/lib/python3.6/site-packages/eyed3/plugins/display.py", line 47, in output_for
    output += sub_pattern.output_for(audio_file)
TypeError: must be str, not CommentFrame

crash "'utf16' codec can't decode byte" on some files

i'm getting this on some files with 0.8.2

Uncaught exception: 'utf16' codec can't decode byte 0xfe in position 2: truncated data

eyed3:ERROR: 'utf16' codec can't decode byte 0xfe in position 2: truncated data
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/eyed3/main.py", line 279, in _main
retval = mainFunc(args, config)
File "/Library/Python/2.7/site-packages/eyed3/main.py", line 50, in main
fs_encoding=args.fs_encoding)
File "/Library/Python/2.7/site-packages/eyed3/utils/init.py", line 91, in walk
handler.handleFile(os.path.abspath(path))
File "/Library/Python/2.7/site-packages/eyed3/plugins/classic.py", line 457, in handleFile
super(ClassicPlugin, self).handleFile(f, tag_version=parse_version)
File "/Library/Python/2.7/site-packages/eyed3/plugins/init.py", line 172, in handleFile
self.audio_file = core.load(f, *args, **kwargs)
File "/Library/Python/2.7/site-packages/eyed3/core.py", line 78, in load
return mp3.Mp3AudioFile(path, tag_version)
File "/Library/Python/2.7/site-packages/eyed3/mp3/init.py", line 172, in init
core.AudioFile.init(self, path)
File "/Library/Python/2.7/site-packages/eyed3/core.py", line 256, in init
self._read()
File "/Library/Python/2.7/site-packages/eyed3/mp3/init.py", line 178, in _read
tag_found = self._tag.parse(file_obj, self._tag_version)
File "/Library/Python/2.7/site-packages/eyed3/id3/tag.py", line 101, in parse
tag_found, padding = self._loadV2Tag(fileobj)
File "/Library/Python/2.7/site-packages/eyed3/id3/tag.py", line 133, in _loadV2Tag
self.extended_header)
File "/Library/Python/2.7/site-packages/eyed3/id3/frames.py", line 1418, in parse
frame = createFrame(tag_header, frame_header, data)
File "/Library/Python/2.7/site-packages/eyed3/id3/frames.py", line 1518, in createFrame
frame.parse(data, frame_header)
File "/Library/Python/2.7/site-packages/eyed3/id3/frames.py", line 274, in parse
self.text = decodeUnicode(self.data[1:], self.encoding)
File "/Library/Python/2.7/site-packages/eyed3/id3/frames.py", line 1534, in decodeUnicode
return unicode(bites, codec).rstrip("\x00")
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/encodings/utf_16.py", line 16, in decode
return codecs.utf_16_decode(input, errors, True)
UnicodeDecodeError: 'utf16' codec can't decode byte 0xfe in position 2: truncated data

Empty string is not written

I'm trying to remove some tags, however eyeD3 -c '' test.mp3 doesn't remove the comment tag but simply displays the current values. How do I do this?

Removing comments doesn't work

Hello,

I'd like to remove comments using the python3 interface of eyed3 (v0.8.0):

audiofile = eyed3.load("somefile.mp3")
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)

The comment is correctly printed (text & lang). The description is an empty string.
But calling remove returns None and doesn't remove the comment.

fcntl not defined (for Win 10/64) for console.py

installed eyed3 0.8.4 on Win 10/64, python 3.6.3 with libmagic dlls (and maybe there's the problem) but just running eyed3 somefile.mp3 throws an exception
File "c:\users\billh\appdata\local\programs\python\python36\lib\site-packages\eyed3\utils\console.py", line 500, in getTtySize data = fcntl.ioctl(fd, termios.TIOCGWINSZ, '\0' * 4) NameError: name 'fcntl' is not defined
as fcntl isn't defined under Windows (at least with the libraries here...), but happily:

adding NameError to the exceptions list for that try in eyed3\utils\console.py fixes the problem, allowing the pass and fallthru to the other console size tests:
if check_tty: try: data = fcntl.ioctl(fd, termios.TIOCGWINSZ, '\0' * 4) hw = struct.unpack("hh", data) except (OSError, IOError, NameError): pass

Renaming files with multiple artists

Hi. According to the ID3 spec

The 'Lead artist(s)/Lead performer(s)/Soloist(s)/Performing group' is used for the main artist(s). They are seperated with the "/" character.

If I do this:

from eyed3.id3.tag import TagTemplate
import eyed3

audio_file = eyed3.load('test.mp3')
# clear any existing tags
audio_file.initTag()

tag = audio_file.tag
tag.artist = 'A/B'
tag.title = 'foobar'

new_name = TagTemplate('$artist - $title').substitute(tag, zeropad=True) # A-B - foobar

audio_file.rename(new_name)

I end up with: A-B - foobar.mp3. The artists are set properly in the tag, and are correctly listed as individuals. The '/' characters are getting replaced so as to not cause path issues and while that's a good general fix, I think the relatively common case of multiple artists warrants independent handling.

In particular, I would like to see this being the result of the above code: A, B - foobar, with a comma delimiter between artists.

Thanks for the awesome library and tool!

v0.8.3 over Python3: 'OSError' object has no attribute 'message': trying to rename a file

I'm trying to rename these files:

paulo@monk:~/tmp/Atrium Musicæ de Madrid/Monodia Cortesana Medieval • Música Arábigo-Andaluza$ ls -1
01 Marcabru: Pax in nomine Domini.mp3
02 Palou: De la iensor.mp3
03 Palou: Dona, la ienser.mp3
04 Montaudo: Fort m'enoia.mp3
05 Borneil: Reis glorios.mp3
06 Cardenal: Un sirventés.mp3
07.mp3
08.mp3
09.mp3
10.mp3
11.mp3
12.mp3
13.mp3
14.mp3
15.mp3
16.mp3
17.mp3
18.mp3
19.mp3
20.mp3

using:

eyeD3 --rename '$track:num $title' .

and I'm getting this error:

/home/paulo/tmp/Atrium Musicæ de Madrid/Monodia Cortesana Medieval • Música Arábigo-Andaluza/01 Marcabru: Pax in nomine Domini.mp3                                                    [ 2.50 MB ]
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Time: 01:51	MPEG1, Layer III	[ ~188 kb/s @ 44100 Hz - Joint stereo ]
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
ID3 v2.3:
title: Marcabru: Pax in nomine Domini
artist: Atrium Musicæ de Madrid
album: Monodia Cortesana Medieval • Música Arábigo-Andaluza
album artist: José Luis Ochoa de Olza, Orchesta Marroquí de Tetuán (Abdessadak Chkara)
recording date: 1969
eyed3.id3:WARNING: Non standard genre name: Medieval
track: 1		genre: Medieval (id None)
Comment: [Description: ] [Lang: XXX]
Trovadores catalanes y provenzales
Uncaught exception: 'OSError' object has no attribute 'message'

eyed3:ERROR: 'OSError' object has no attribute 'message'
Traceback (most recent call last):
  File "/home/paulo/.local/lib/python3.6/site-packages/eyed3/plugins/classic.py", line 520, in handleFile
    self.audio_file.rename(name)
  File "/home/paulo/.local/lib/python3.6/site-packages/eyed3/core.py", line 207, in rename
    raise IOError(u"File '%s' exists, will not overwrite" % new_path)
OSError: File '/home/paulo/tmp/Atrium Musicæ de Madrid/Monodia Cortesana Medieval • Música Arábigo-Andaluza/01 Marcabru: Pax in nomine Domini.mp3' exists, will not overwrite

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/paulo/.local/lib/python3.6/site-packages/eyed3/main.py", line 279, in _main
    retval = mainFunc(args, config)
  File "/home/paulo/.local/lib/python3.6/site-packages/eyed3/main.py", line 50, in main
    fs_encoding=args.fs_encoding)
  File "/home/paulo/.local/lib/python3.6/site-packages/eyed3/utils/__init__.py", line 103, in walk
    handler.handleFile(f)
  File "/home/paulo/.local/lib/python3.6/site-packages/eyed3/plugins/classic.py", line 524, in handleFile
    printError(ex.message)
AttributeError: 'OSError' object has no attribute 'message'

Here's my version, encoding and Python version:

paulo@monk:~/tmp$ eyeD3 --version
0.8.3
paulo@monk:~/tmp$ python3 --version
Python 3.6.3
paulo@monk:~/tmp$ python3 -c 'import sys; print(sys.getfilesystemencoding())'
utf-8

Let me know how I can help debug this further.

eyeD3 destroys m4a files

I used eye3D from the command-line to fix a series of tags in a batch. Some of them were m4a with aac audio. It is far from obvious from eye3D's description that this kind of file is not supported. More importantly, eye3D does not simply fail to operate. Instead, the file is damaged so the contents cannot be played any more. This should never ever happen. I suggest displaying an error message instead.

I use Ubuntu 16.04. eye3D is executed with Python 3.5.2. Issue exists in eyeD3
versions 0.6.18 and current 0.8.1 taken from commit acb2b22 .

For example, I tried to tag the audio downloaded from https://www.youtube.com/watch?v=W_oJf54ZoRE . Prior to tagging, the audio was remuxed by ffmpeg version 2.8.11. Here is the debug console output:

$ eye3D -l debug --artist='Das Flug' --title='Alles musz in Flammen stehen (B-17 Edit)' 'Das Flug - Alles musz in Flammen stehen (B-17 Edit).m4a'
eyed3:DEBUG: command line args: Namespace(album=None, album_artist=None, artist='Das Flug', backup=False, bpm=None, comments=[], config=None, convert_version=None, debug_pdb=False, debug_profile=False, disc_num=None, disc_total=None, encoding_date=None, excludes=None, force_update=False, fs_encoding='utf-8', genre=None, images=[], list_plugins=False, log_level=[['debug']], lyrics=[], max_padding=True, no_color=False, no_config=False, non_std_genres=False, objects=[], orig_release_date=None, paths=['Das Flug - Alles musz in Flammen stehen (B-17 Edit).m4a'], play_count=None, plugin=<classic.ClassicPlugin object at 0x7fd65f68fcc0>, popularities=[], preserve_file_time=False, publisher=None, quiet=False, recording_date=None, release_date=None, release_year=None, remove_all=False, remove_all_comments=False, remove_all_images=False, remove_all_lyrics=False, remove_all_objects=False, remove_comment=[], remove_fids=[], remove_image=[], remove_lyrics=[], remove_object=[], remove_popularity=[], remove_v1=False, remove_v2=False, rename_pattern=None, simple_comment=None, tag_version=(3, None, None), tagging_date=None, text_encoding=None, text_frames=[], title='Alles musz in Flammen stehen (B-17 Edit)', track=None, track_offset=None, track_total=None, unique_file_ids=[], url_frames=[], user_text_frames=[], user_url_frames=[], verbose=False, write_images_dir=None, write_objects_dir=None)
eyed3:DEBUG: plugin is: <classic.ClassicPlugin object at 0x7fd65f68fcc0>
eyed3.core:DEBUG: Loading file: Das Flug - Alles musz in Flammen stehen (B-17 Edit).m4a
eyed3.core:DEBUG: File mime-type: audio/mpeg
eyed3.mp3:DEBUG: mp3 header search starting @ 0
eyed3.mp3.headers:DEBUG: invalid mpeg layer
eyed3.mp3.headers:DEBUG: invalid mpeg version
eyed3.mp3.headers:DEBUG: invalid mpeg layer
eyed3.mp3.headers:DEBUG: invalid mpeg version
eyed3.mp3.headers:DEBUG: invalid mpeg version
eyed3.mp3.headers:DEBUG: invalid mpeg bitrate
eyed3.mp3.headers:DEBUG: invalid mpeg bitrate
eyed3.mp3.headers:DEBUG: invalid mpeg layer
eyed3.mp3.headers:DEBUG: invalid mpeg bitrate
eyed3.mp3.headers:DEBUG: invalid mpeg sample rate
eyed3.mp3.headers:DEBUG: invalid mpeg sample rate
eyed3.mp3.headers:DEBUG: invalid mpeg sample rate
eyed3.mp3.headers:DEBUG: MPEG audio version: 1.0
eyed3.mp3.headers:DEBUG: MPEG audio layer: I
eyed3.mp3.headers:DEBUG: MPEG sampling frequency: 48000
eyed3.mp3.headers:DEBUG: MPEG bit rate: 352
eyed3.mp3.headers:DEBUG: MPEG channel mode: Joint stereo
eyed3.mp3.headers:DEBUG: MPEG channel mode extension: 1
eyed3.mp3.headers:DEBUG: MPEG CRC error protection: False
eyed3.mp3.headers:DEBUG: MPEG original: 1
eyed3.mp3.headers:DEBUG: MPEG copyright: 0
eyed3.mp3.headers:DEBUG: MPEG private bit: 1
eyed3.mp3.headers:DEBUG: MPEG padding: 1
eyed3.mp3.headers:DEBUG: MPEG emphasis: 50/15 ms
eyed3.mp3.headers:DEBUG: MPEG frame length: 368
eyed3.mp3:DEBUG: mp3 header ffffb755 found at position: 0x3405
/media/ssd/Das Flug - Alles musz in Flammen stehen (B-17 Edit).m4a [ 6.03 MB ]
-------------------------------------------------------------------------------
Setting artist: Das Flug
Setting title: Alles musz in Flammen stehen (B-17 Edit)
Time: 02:17	MPEG1, Layer I	[ 352 kb/s @ 48000 Hz - Joint stereo ]
-------------------------------------------------------------------------------
ID3 v2.4:
title: Alles musz in Flammen stehen (B-17 Edit)
artist: Das Flug
album: 
album artist: None
track: 		
Writing ID3 version v2.4
eyed3.id3.tag:DEBUG: Rendering tag version: v2.4
eyed3.id3.tag:DEBUG: Rendering frame: b'TIT2'
eyed3.id3.tag:DEBUG: Rendered 51 bytes
eyed3.id3.tag:DEBUG: Rendering frame: b'TPE1'
eyed3.id3.tag:DEBUG: Rendered 19 bytes
eyed3.id3.tag:DEBUG: Rendered 70 total frame bytes
eyed3.id3.tag:DEBUG: Using 256 bytes of padding
eyed3.id3.tag:DEBUG: Rendering v2.4 tag header with size 326
eyed3.id3.headers:DEBUG: Setting tag size to 326
eyed3.id3.headers:DEBUG: TagHeader rendered 10 bytes
eyed3.id3.tag:DEBUG: Writing 80 bytes of tag data and 256 bytes of padding
eyed3.id3.tag:DEBUG: Seeking to beginning of audio data, byte 0 (0)
eyed3.id3.tag:DEBUG: Tag write complete. Updating FileInfo state.
-------------------------------------------------------------------------------

some files are ignored with "Nothing to do"

eyeD3 0.8.2 is unable to display any tags on some of my files.
trying "eyeD3 -1" or "eyeD3" on them just displays:
Nothing to do

happy to send some 'offending' files by mail

how to fix this?

Can someone help me?
i run myscript.py and i got this
WARNING:eyed3.id3.frames:Non ascii url, clearing.
(title of mysong)

your program work fine but i need to know how to remove WARNING message.

thx :)

pip/pip3 install eyeD3 doesn't install grako automatically

Trying to run eyeD3 right after install (both python2 and python3), it complains of missing grako:

Unknown module 'grako'
Please install grako! E.g. with $ pip install grako

Of course, I then installed it, but shouldn't it be installed automatically, as a dependency, like pathlib, python-magic and six ?

crash "encoding argument must be a valid constant" on some files in eyeD3 version 0.8.2

hey. i just tried out eyeD3 ... works great but it seems to crash on some files... i get this backtrace:

$ eyeD3 -2 t.mp3
Uncaught exception: encoding argument must be a valid constant.

eyed3:ERROR: encoding argument must be a valid constant.
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/eyed3/main.py", line 279, in _main
retval = mainFunc(args, config)
File "/Library/Python/2.7/site-packages/eyed3/main.py", line 50, in main
fs_encoding=args.fs_encoding)
File "/Library/Python/2.7/site-packages/eyed3/utils/init.py", line 91, in walk
handler.handleFile(os.path.abspath(path))
File "/Library/Python/2.7/site-packages/eyed3/plugins/classic.py", line 457, in handleFile
super(ClassicPlugin, self).handleFile(f, tag_version=parse_version)
File "/Library/Python/2.7/site-packages/eyed3/plugins/init.py", line 172, in handleFile
self.audio_file = core.load(f, *args, **kwargs)
File "/Library/Python/2.7/site-packages/eyed3/core.py", line 78, in load
return mp3.Mp3AudioFile(path, tag_version)
File "/Library/Python/2.7/site-packages/eyed3/mp3/init.py", line 172, in init
core.AudioFile.init(self, path)
File "/Library/Python/2.7/site-packages/eyed3/core.py", line 256, in init
self._read()
File "/Library/Python/2.7/site-packages/eyed3/mp3/init.py", line 178, in _read
tag_found = self._tag.parse(file_obj, self._tag_version)
File "/Library/Python/2.7/site-packages/eyed3/id3/tag.py", line 101, in parse
tag_found, padding = self._loadV2Tag(fileobj)
File "/Library/Python/2.7/site-packages/eyed3/id3/tag.py", line 133, in _loadV2Tag
self.extended_header)
File "/Library/Python/2.7/site-packages/eyed3/id3/frames.py", line 1418, in parse
frame = createFrame(tag_header, frame_header, data)
File "/Library/Python/2.7/site-packages/eyed3/id3/frames.py", line 1518, in createFrame
frame.parse(data, frame_header)
File "/Library/Python/2.7/site-packages/eyed3/id3/frames.py", line 273, in parse
self.encoding = self.data[0:1]
File "/Library/Python/2.7/site-packages/eyed3/id3/frames.py", line 246, in encoding
raise ValueError("encoding argument must be a valid constant.")
ValueError: encoding argument must be a valid constant.

i can send you the 'offending' file by mail if you want to have a look

Using an unknown tag in --pattern (plugin display) throws: display.PatternCompileException: Unknown tag

I was plugging an eyeD3 command into a quodlibet plugin, made a mistake which resulted in using a unknown tag in --pattern (plugin display):

eyeD3 --plugin display --pattern '%TAG%' Atrium\ Musicæ\ de\ Madrid/

causing eyeD3 to throw an uncaught exception:

Unknown tag 'TAG'
Uncaught exception: Unknown tag 'TAG'

eyed3:ERROR: Unknown tag 'TAG'
Traceback (most recent call last):
  File "/home/paulo/.local/lib/python3.6/site-packages/eyed3/plugins/display.py", line 65, in __compile
    self.sub_patterns = self.__compile_asts(asts)
  File "/home/paulo/.local/lib/python3.6/site-packages/eyed3/plugins/display.py", line 73, in __compile_asts
    patterns.append(self.__compile_ast(ast))
  File "/home/paulo/.local/lib/python3.6/site-packages/eyed3/plugins/display.py", line 84, in __compile_ast
    parameters)
  File "/home/paulo/.local/lib/python3.6/site-packages/eyed3/plugins/display.py", line 106, in __create_complex_pattern
    class_name + "'")
display.PatternCompileException: Unknown tag 'TAG'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/paulo/.local/lib/python3.6/site-packages/eyed3/main.py", line 277, in _main
    retval = mainFunc(args, config)
  File "/home/paulo/.local/lib/python3.6/site-packages/eyed3/main.py", line 50, in main
    fs_encoding=args.fs_encoding)
  File "/home/paulo/.local/lib/python3.6/site-packages/eyed3/utils/__init__.py", line 103, in walk
    handler.handleFile(f)
  File "/home/paulo/.local/lib/python3.6/site-packages/eyed3/plugins/display.py", line 1046, in handleFile
    print(self.__pattern.output_for(self.audio_file),
  File "/home/paulo/.local/lib/python3.6/site-packages/eyed3/plugins/display.py", line 46, in output_for
    for sub_pattern in self.sub_patterns or []:
  File "/home/paulo/.local/lib/python3.6/site-packages/eyed3/plugins/display.py", line 52, in __get_sub_patterns
    self.__compile()
  File "/home/paulo/.local/lib/python3.6/site-packages/eyed3/plugins/display.py", line 68, in __compile
    raise PatternCompileException(parsing_error.message)
display.PatternCompileException: Unknown tag 'TAG'

I would imagine this will follow the same route as #114: catching the exception and showing an error message.

Running 0.8.3 54b4735 with python 3.6.3 on Xubuntu 17.10

Add option to disable color in the output

I call eyeD3 from bash scripts, capturing the output in log files: even though the colored output from the classic plugin really helps to read the results on the terminal, it doesn't look so clear when edited in a file or filtered through text utilities. For instance:

-------------------------
ESC[1mESC[32m...ition)(ape+cue')/split/Bobby Hutcherson - Oblique (1967)/06.mp3ESC[39mESC[22mESC[32m[ 8.42 MB ]ESC[39m
-------------------------
ESC[1mTime: ESC[22m05:04        MPEG1, Layer III        [ ~231 kb/s @ 44100 Hz - Joint stereo ]
-------------------------
ID3 v2.4:
ESC[1mtitleESC[22m: Bi-Sectional
ESC[1martistESC[22m: Bobby Hutcherson
ESC[1malbumESC[22m: Oblique
ESC[1malbum artistESC[22m: None
ESC[1mtrackESC[22m: 6           
ESC[33mRenamed '/home/paulo/stage/cd/2_Bobby Hutcherson -1967- Oblique (2005 RVG Edition)(ape+cue')/split/Bobby Hutcherson - Oblique (1967)/06.mp3' to '/home/paulo/stage/cd/2_Bobby Hutcherson -1967- Oblique (2005 RVG Edition)(ape+cue')/split/Bobby Hutcherson - Oblique (1967)/06 Bi-Sectional.mp3'ESC[39m

```-------------------------

It might be useful to have a general command line option to disable color in the output, particularly from the classic plugin.

MagicException(err) on import eyed3

Python v3.7.0a3 , eyed3 v0.8.4 , python_magic v0.4.15 ,
os Windows 7 , and x64 dll's from libmagicwin64-master (files timestamped 2015).

import magic returns no error, but upon import eyed3, the following is output (in IDLE):

Traceback (most recent call last):
File "<pyshell#123>", line 1, in
import eyed3
File "D:\Python\Python3\lib\site-packages\eyed3_init_.py", line 36, in
from .core import load # noqa
File "D:\Python\Python3\lib\site-packages\eyed3\core.py", line 9, in
from .utils import guessMimetype
File "D:\Python\Python3\lib\site-packages\eyed3\utils_init_.py", line 53, in
mime_types = MagicTypes()
File "D:\Python\Python3\lib\site-packages\eyed3\utils_init
.py", line 41, in init
keep_going=False)
File "D:\Python\Python3\lib\site-packages\magic.py", line 67, in init
magic_load(self.cookie, magic_file)
File "D:\Python\Python3\lib\site-packages\magic.py", line 264, in magic_load
return _magic_load(cookie, coerce_filename(filename))
File "D:\Python\Python3\lib\site-packages\magic.py", line 195, in errorcheck_negative_one
raise MagicException(err)
magic.MagicException: None
[end output]

Very interested in adding this to my mp3 scripting flow; hopefully, we can get this to work. Yes, I know the documents indicate python >=3.3, but I can hope can't I?

Thanks!

Cannot set time earlier than 1000 (10:00 am) in TIME Date frame.

(Only relevant parts posted for brevity)

eyeD3 --text-frame TIME:0800 --text-frame TYER:2017 --text-frame TDAT:3012 ok.mp3

Setting b'TYER' text frame to '2017'
Setting b'TDAT' text frame to '3012'
ID3 v2.3:
recording date: 2017-12-30T08:00
Writing ID3 version v2.3
--------------------------------------------------------------------------------```

 eyeD3 ok.mp3

eyed3.core:WARNING: Invalid date: 0800

Time: 00:32 MPEG1, Layer III [ 320 kb/s @ 44100 Hz - Joint stereo ]

ID3 v2.3:
eyed3.id3.tag:WARNING: Invalid v2.3 TYER, TDAT, or TIME frame: Invalid date string: 2017-12-30T:
recording date: 2017-12-30
disc: 1/1
UserTextFrame: [Description: TOTALDISCS]
1
UserTextFrame: [Description: TOTALTRACKS]
8
FRONT_COVER Image: [Size: 1318206 bytes] [Type: image/jpeg]
Description:


This will, however work if you set time to 1200

How can we set time to four characters without using a zero at the beginning?

3 characters doesn't work, either.

Failed to find magiclib

I am running Windows 10 version 1703 with Python 3.6.2 installed.

I created a python script that uses eyeD3 simply by importing it after running pip install eyed3 which worked until I updated to version 1703.

Now when I try to run the script I get this output:

Traceback (most recent call last):
  File ".\script.py", line 6, in <module>
    import eyed3
  File "C:\Users\User\AppData\Local\Programs\Python\Python36-32\lib\site-packages\eyed3\__init__.py", line 35, in <module>
    from .utils.log import log                                            # noqa
  File "C:\Users\User\AppData\Local\Programs\Python\Python36-32\lib\site-packages\eyed3\utils\__init__.py", line 27, in <module>
    import magic
  File "C:\Users\User\AppData\Local\Programs\Python\Python36-32\lib\site-packages\magic.py", line 176, in <module>
    raise ImportError('failed to find libmagic.  Check your installation')
ImportError: failed to find libmagic.  Check your installation

I have tried reinstalling magiclib but it's not helping. What should I try?

UnicodeEncodeError: 'ascii' codec can't encode character

Does 0.8 version work with unicode characters? This error not occurred with 0.7.11.

eyeD3 01.\ Discothèque.mp3 
Uncaught exception: 'ascii' codec can't encode character u'\xe8' in position 32: ordinal not in range(128)

eyed3:ERROR: 'ascii' codec can't encode character u'\xe8' in position 32: ordinal not in range(128)
Traceback (most recent call last):
  File "/home/pavel/.local/lib/python2.7/site-packages/eyed3/main.py", line 279, in _main
    retval = mainFunc(args, config)
  File "/home/pavel/.local/lib/python2.7/site-packages/eyed3/main.py", line 50, in main
    fs_encoding=args.fs_encoding)
  File "/home/pavel/.local/lib/python2.7/site-packages/eyed3/utils/__init__.py", line 81, in walk
    handler.handleFile(os.path.abspath(path))
  File "/home/pavel/.local/lib/python2.7/site-packages/eyed3/plugins/classic.py", line 457, in handleFile
    super(ClassicPlugin, self).handleFile(f, tag_version=parse_version)
  File "/home/pavel/.local/lib/python2.7/site-packages/eyed3/plugins/__init__.py", line 172, in handleFile
    self.audio_file = core.load(f, *args, **kwargs)
  File "/home/pavel/.local/lib/python2.7/site-packages/eyed3/core.py", line 77, in load
    path = pathlib.Path(path)
  File "/usr/lib/python2.7/dist-packages/pathlib.py", line 936, in __new__
    self = cls._from_parts(args, init=False)
  File "/usr/lib/python2.7/dist-packages/pathlib.py", line 613, in _from_parts
    drv, root, parts = self._parse_args(args)
  File "/usr/lib/python2.7/dist-packages/pathlib.py", line 606, in _parse_args
    return cls._flavour.parse_parts(parts)
  File "/usr/lib/python2.7/dist-packages/pathlib.py", line 75, in parse_parts
    parts = _py2_fsencode(parts)
  File "/usr/lib/python2.7/dist-packages/pathlib.py", line 58, in _py2_fsencode
    else part for part in parts]
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe8' in position 32: ordinal not in range(128)

Feature request: Allow "track-total" (total number of tracks) to be empty

I use eyeD3 with the CD-ripping software abcde, which allows you to pass in command-line parameters (e.g., --no-zero-padding) to eyeD3. However, I have not been able to find a way to force eyeD3 to empty the "track-total" field.

The manpage of eyeD3 notes: "Options for manipulating tag data have the side-effect of removing a frame when the data specified is the empty string. For example, --artist="" (or -a "") would cause the artist frame to be removed. This is especially useful for removing comment frames."

However, the argument of "--track-total" is a number, not a string, so it appears that it is not possible to empty this field.

I attempted to accomplish this by passing in a value of zero (i.e., "--track-total=0"). After running that command and using eyeD3 to check the mp3 file, the total number of tracks is no longer shown. However, if I use another program (e.g., puddletag) to check the mp3 file, the "track" field is still populated with a zero: e.g., "01/00".

If it helps, my eyeD3 version number is 0.6.18.

no need for ord() on Python 3

Seems this always breaks for me on Python 3! How do you work with that? I never get it to work. Only in Python 2.7x

This line gets an index from a bytes object and is already the integer then. Asking it for ord() breaks:

  File "C:\Python36\lib\site-packages\eyed3\mp3\headers.py", line 311, in decode
    version = (ord(frame[1]) >> 3) & 0x1
TypeError: ord() expected string of length 1, but int found

Apperently its a Python 3 feature. We could implement something like

def _ordinal(one_char_string):
    if isinstance(one_char_string, int):
        return one_char_string
    else:
        return ord(one_char_string)

But maybe this should be just different code when got from pip for Python 3 like?:

    def decode(self, frame):
        # mp3 version
        version = (_frame[1] >> 3) & 0x1

But wait a second... It doesn't even work then! Doesn't even complain! .tag is of type None then.
Aaaahhhh! Is this something that release 0.8.0 is fixing!? When will it be in?

How to get/set ID3v2 Tags?

so I have used eyed3 for editing tags for my media but they doesn't update on my windows media player , so is there a way to show them in Windows media player?

AttributeError: module 'eyed3' has no attribute 'id3'

I used Ubuntu 16.04, Python 3.5.2, eyed3 0.8. And get this error when call eyed3.id3:

In [1]: import eyed3

In [2]: eyed3.version
Out[2]: '0.8'

In [3]: eyed3.id3.ID3_V2_3
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-3-feda78fb783d> in <module>()
----> 1 eyed3.id3.ID3_V2_3

AttributeError: module 'eyed3' has no attribute 'id3'

But if call the method eyed3.load before eyed3.id3, it works normally.

--remove-v1 also clears ID3V2 tag on some files on v0.8.2

the documentation implies
eyeD3 --remove-v1 FILE.MP3
only removes the id3v1 tag but leaves the id3v2 tag intact.

however for some files the id3v2 tag is totally cleared as well. (can send sample files)

i just lost tags for 10.000+ mp3s because of this malfunction

apetag remove support

Hi,

first of all, thank you for this great piece of software. I use it mostly for stripping all IDv1/2 tags so I can tag them properly in EasyTag.

I have just recently become aware of apetag (thanx to getID3). Would it be possible to add functionality to remove apetag from mp3 in eyeD3? Searching the web didn't return obvious solution for easy apetag removal from large mp3 collections.

Thank you in advance,

utils.console module missing

Hi,

I'm using ubuntu 14.04; Python 2.7.6

To reproduce:

  1. create virtual env with mkdir .venv && virtualenv -p /usr/bin/python --no-site-packages .venv'
  2. initialize virtualenv ```'source .venv/bin/activate````
  3. pip install eyed3 returned Successfully installed eyed3-0.7.11
  4. eyeD3 returns /home/myusername/myfilepath/eyed3_env/.venv/bin/python: No module named utils.console

Seems like it's not finding the utils class in the install. Would it be a path problem on my end?

windows 10: ImportError: failed to find libmagic. Check your installation

I installed libmagic and python-magic before installing eydD3 but still get this error. I am using python 2.7 and eyeD3 0.8.4. Here is the entire error message:

c:\Python27\Lib\site-packages>eyeD3
Traceback (most recent call last):
  File "c:\python27\lib\runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "c:\python27\lib\runpy.py", line 72, in _run_code
    exec code in run_globals
  File "C:\Python27\Scripts\eyeD3.exe\__main__.py", line 5, in <module>
  File "c:\python27\lib\site-packages\eyed3\__init__.py", line 35, in <module>
    from .utils.log import log                                            # noqa
  File "c:\python27\lib\site-packages\eyed3\utils\__init__.py", line 27, in <module>
    import magic
  File "c:\python27\lib\site-packages\magic.py", line 181, in <module>
    raise ImportError('failed to find libmagic.  Check your installation')
ImportError: failed to find libmagic.  Check your installation


It looks like I need magic1.dll, but why wasn't it already downloaded when I installed libmagic? So where would I get this DLL do download it manually, assuming I have correctly identified the problem?

0.8.0 Release

  • Final docs
  • Mailing list message and shutdown
  • Reddit announce

CPU loop on import (Python 2.7.8 on Windows 10)

I updated today from eyeD3 0.6.18 to 0.8.1. eyeD3 now loops on import. The script is non-responsive, even to a CTRL-C; Process Explorer sees CPU to the python task go to nearly 25% (i.e., one core).

Script to reproduce:

import sys
print "OS info:\n ", sys.getwindowsversion()
print "Python info:\n ", sys.version
print "about to import"
import eyeD3
print "import completed"

Output:

OS info:
  sys.getwindowsversion(major=6, minor=2, build=9200, platform=2, service_pack='')
Python info:
  2.7.8 (default, Jul  2 2014, 19:50:44) [MSC v.1500 32 bit (Intel)]
about to import

at which point it hangs, the import never completing. I can kill the Python task from Process Explorer.

I have not yet delved into the eyeD3 code. I'll try to do that over the weekend. I first wanted to check if this is known (I searched the existing issues and didn't see any likely candidates).

Writing lyrics file containing LATIN1 text failed

Writing lyrics failed when lyrics file contains LATIN1 song text with special chars.

eyeD3 --encoding latin1 --to-v2.3 --add-lyrics /tmp/lyrics.txt song.mp3

eyeD3: error: argument --add-lyrics: invalid LyricsArg value: '/tmp/lyrics.txt'

Recoding file /tmp/lyrics.txt from LATIN1 to UTF-8 and repeating same command from above now workes. ID3v2.3 standard should support writing LATIN1 lyrics.

I'm using latest Debian Linux (buster) with eyed3 08-1

Writing lyrics deletes TSOP tag (ARTISTSORT)

A strange side effect of writing lyrics is that TSOP tags are deleted.

I'm using these artist tags (TPE1, TPE2, TSOP, TSO2). TSOP disappeares after writing lyrics tag.

I'm using latest Debian Linux (buster) with eyeD3 version 0.8-1

Traceback issue?

I'm using Python 3.6.4 on Windows 10 (x64) and installed eyeD3 via pip as mentioned in the documentation: pip install eyeD3. It worked but when I type any command with eyeD3 this happens:

Traceback (most recent call last):
File "c:\python36\lib\runpy.py", line 193, in run_module_as_main
"main", mod_spec)
File "c:\python36\lib\runpy.py", line 85, in run_code
exec(code, run_globals)
File "C:\Python36\Scripts\eyeD3.exe_main
.py", line 5, in
File "c:\python36\lib\site-packages\eyed3_init
.py", line 35, in
from .utils.log import log # noqa
File "c:\python36\lib\site-packages\eyed3\utils_init_.py", line 27, in
import magic
File "c:\python36\lib\site-packages\magic.py", line 181, in
raise ImportError('failed to find libmagic. Check your installation')
ImportError: failed to find libmagic. Check your installation

So I did: pip install libmagic but it seems to be already installed:

Requirement already satisfied: libmagic in c:\python36\lib\site-packages

What is the problem?

dangerous auto-recursive

When applying eyeD3 to a folder without any switch, it finds and acts recursively on all subfolders and files, which is not normally expected and may lead to unwanted results specially when used with --remove switch. I suggest make a -r or -R switch mandatory for this type of action.

Installation fails

Hello,

when installing eyed3 on macOS 10.12.6 with

pip3 install eyed3

the installation completes, but afterwards when importing eyed3 with

import eyed3

in python3, the following exception occurs:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/name/.virtualenvs/id3/lib/python3.6/site-packages/eyed3/__init__.py", line 35, in <module>
    from .utils.log import log                                            # noqa
  File "/Users/name/.virtualenvs/id3/lib/python3.6/site-packages/eyed3/utils/__init__.py", line 27, in <module>
    import magic
  File "/Users/name/.virtualenvs/id3/lib/python3.6/site-packages/magic.py", line 176, in <module>
    raise ImportError('failed to find libmagic.  Check your installation')
ImportError: failed to find libmagic.  Check your installation

Edit: Installing eyed3 version 0.8 works, whereas 0.8.1, 0.8.2 and 0.8.3 show the above exception.

I cant read tags mp3 with python 3.5.0

Hello guys!
I try read mp3 file, but nothing happened.

$ audiofile = eyed3.load(mp3_file.name)
$ print(audiofile.tag)
None

I check id3 in mp3 file
link

How i can read mp3 file and get tags, title, images?
Tks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.