nicfit / eyeD3

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).
http://eyed3.nicfit.net/
GNU General Public License v3.0
532 stars 58 forks source link

Crash when output passed to pipe #625

Open WGroleau opened 3 months ago

WGroleau commented 3 months ago

Doesn't matter what command is downstream of the pipe.  If I pipe to ls, I get the same exception, but then ls lists the directory.  Crash reproduced with several MP3 files, but without pipe, eyeD3 (and the alias) works as expected on all of them.

Blank lines between commands added for readability:

WGroleau@MBP I Could Sing of Your Love Forever 2 % alias ID3
ID3='eyeD3 --to-v2.4 --encoding utf8 --fs-encoding utf8'

WGroleau@MBP I Could Sing of Your Love Forever 2 % ID3 2-02* | head -1
... Sing of Your Love Forever 2/2-02 Open the Eyes of My Heart.mp3[ 3.88 MB ]
[Errno 32] Broken pipe
Exception ignored in: <_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>
BrokenPipeError: [Errno 32] Broken pipe

WGroleau@MBP I Could Sing of Your Love Forever 2 % eyeD3 --vers
0.9.6

WGroleau@MBP I Could Sing of Your Love Forever 2 % ID3 2-02*          
... Sing of Your Love Forever 2/2-02 Open the Eyes of My Heart.mp3            [ 3.88 MB ]
------------------------------------------------------------------------------------------
Time: 04:06 MPEG1, Layer III    [ 128 kb/s @ 44100 Hz - Joint stereo ]
------------------------------------------------------------------------------------------
ID3 v2.4:
title: Open the Eyes of My Heart
artist: SONICFLOOd
album: I Could Sing of Your Love Forever 2
album artist: Various Artists
composer: Paul Baloche
recording date: 2001
track: 2/12     genre: Duplicate (id None)
disc: 2/2
Comment: [Description: ] [Lang: eng]
Language
Lyrics: [Description: ] [Lang: eng]
[ Get Lyrical : http://lyrics.wikia.com/Sonicflood:Open_The_Eyes_Of_My_Heart ]
OTHER Image: [Size: 115145 bytes] [Type: image/jpeg]
Description: 

Writing ID3 version v2.4
------------------------------------------------------------------------------------------

WGroleau@MBP I Could Sing of Your Love Forever 2 % locale
LANG="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_CTYPE="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_ALL="en_US.UTF-8"

WGroleau@MBP I Could Sing of Your Love Forever 2 % 
WGroleau commented 3 months ago

Not sure where the bug is (which end of the pipe). If the second command is head or ls the command works and the exception info is after that. If the second command is tail or more, the command works and there is no exception.

WhitePeter commented 2 months ago

Even though your original report lacks information on what is going on and being done, I think I know what the problem is. As a workaround you can try using mbuffer as the first consumer of the pipeline, e.g.:

eyeD3 ... | mbuffer | head -1

I intend to prepare a PR to fix this but have other issues on my plate, so it might take a while. If someone else wants to jump on this, they should not wait on me. ;-)