python-mutagen looks like a possibility but it gives different output for different filetypes. This is what it looks like on a .ogg file
-- /home/timeshift/snapshots/2018-08-31_16-56-03/localhost/usr/share/cinnamon/sounds/bell.ogg - Ogg Vorbis, 0.23 seconds, 96000 bps (audio/vorbis) TITLE=bell COMMENTS= I do not have any other filetypes to experiment on (flac?...) but we would have to at least internally manage ID3 frame names vs vobis comments etc ---Fran On Sat, 2 May 2020 at 04:41, Yoni Rabkin <[email protected]> wrote: > "Fran Burstall (Gmail)" <[email protected]> writes: > > > pyprinttags fails to provide playing-time which emms-print-metadata > > does get by querying TagLib::AudioProperties. > > > > Is this a show-stopper? > > I've just had a look at python-mutagen, which installs > mutagen-inspect. It's output on my machine looks like this (ignoring the > non-standard PRIV tag): > > -- /home/yrk/audio/classical/Verdi__La_Traviata__Netrebko/01 - Prelude - > Prelude.mp3 > - MPEG 1 layer 3, 256000 bps (CBR?), 44100 Hz, 2 chn, 216.93 seconds > (audio/mp3) > APIC= (image/jpeg, 205990 bytes) > COMM==eng=Amazon.com Song ID: 204947184 > TALB=Verdi: La Traviata > TCOM=Giuseppe Verdi > TCON=Classical > TCOP=(C) 2005 Deutsche Grammophon GmbH, Hamburg > TDRC=2005 > TIT2=Prelude - Prelude > TPE1=Wiener Philharmoniker > TPE2=Anna Netrebko > TPE3=Carlo Rizzi > TPOS=1/2 > TRCK=1/22 > > Do you see mutagen-inspect from python-mutagen as a candidate? > > > > > > > ************************************************************************* > > > TAGS OF '02. Peter Gunn (live) _ Where's Your Head At > > > (Head-a-Pella).mp3' > > > > > > ************************************************************************* > > > ALBUM = As Heard on Radio > > Soulwax, > > > Part 2 > > > ALBUM ARTIST CREDIT = 2 Many DJ’s > > > ALBUMARTIST = 2 Many DJ’s > > > ALBUMARTISTSORT = 2 Many DJ’s > > > ARTIST = Emerson, Lake & Palmer > > / > > > Basement Jaxx > > > ARTIST CREDIT = Emerson, Lake & Palmer > > / > > > > [snip] > > > > I got something like this: > > > > ************************************ > > TAGS OF '01 - Prelude - Prelude.mp3' > > ************************************ > > ALBUM = Verdi: La Traviata > > COMMENT = Amazon.com Song ID: 204947184 > > COPYRIGHT = (C) 2005 Deutsche Grammophon GmbH, Hamburg > > CONDUCTOR = Carlo Rizzi > > ARTIST = Wiener Philharmoniker > > TITLE = Prelude - Prelude > > GENRE = Classical > > ALBUMARTIST = Anna Netrebko > > COMPOSER = Giuseppe Verdi > > DATE = 2005 > > TRACKNUMBER = 1/22 > > DISCNUMBER = 1/2 > > Unsupported tag elements: PRIV; APIC > > > > ...which looks easy enough to parse. > > > > Unfortunately, installing pytaglib on my Trisquel machine was as > > much > > work as emms-print-metadata. It involved manually downloading > > pytaglib-0.3.4, then installing cython, then: > > > > $ python setup.py build > > $ python setup.py install --user > > > > But I assume that it is easier on systems with pip, so this isn't > > a > > show-stopper. Moreover, it shows that this can run on a > > completely free > > system. If it couldn't then that would be another show-stopper. > > > > As an aside: looking at the command line of pyprinttags I note > > that > > we'll have to add the "-b" (batch) option so that pyprinttags > > doesn't > > try to ask the user questions and hang the elisp process call. > > > > > Clearly a little parsing would be necessary to get this into a > > shape > > > that emms could work with. > > > > > > I see two ways to go with this: > > > > > > 1. write emms-info-pytaglib.el which does the parsing. > > > > > > 2. write a python version of emms-print-metadata that is a > > drop-in > > > replacement for the C version. > > > > > > Both are easy though option 2 is probably easier. The downside > > of > > > option 2 is that we still have a piece of non-elisp to install > > in the > > > user's path. > > > > > > Preferences? > > > > Absolutely option 1, since otherwise we would be shipping C, C++, > > Perl, > > and Python; no thank you. The idea is to let the OS provide the > > packages, and let elisp do the rest. This is as opposed to what > > we do > > now, which is: let the OS provide a package, provide some glue > > code, and > > then let elisp do the rest. We are trying to get rid of the glue. > > > > I can write an implementation of emms-info-pytaglib and ping you > > to test > > it once I'm done, or you can do that. It really depends on > > whether you > > feel like writing that would be fun for you; your choice. Thank > > you > > nevertheless. > > > > -- > > "Cut your own wood and it will warm you twice" > > > > > > > > -- > "Cut your own wood and it will warm you twice" >
