Git Product home page Git Product logo

mutagen's Introduction

image

Mutagen is a Python module to handle audio metadata. It supports ASF, FLAC, MP4, Monkey's Audio, MP3, Musepack, Ogg Opus, Ogg FLAC, Ogg Speex, Ogg Theora, Ogg Vorbis, True Audio, WavPack, OptimFROG, and AIFF audio files. All versions of ID3v2 are supported, and all standard ID3v2.4 frames are parsed. It can read Xing headers to accurately calculate the bitrate and length of MP3s. ID3 and APEv2 tags can be edited regardless of audio format. It can also manipulate Ogg streams on an individual packet/page level.

Mutagen works with Python 3.8+ (CPython and PyPy) on Linux, Windows and macOS, and has no dependencies outside the Python standard library. Mutagen is licensed under the GPL version 2 or later.

For more information visit https://mutagen.readthedocs.org

image

mutagen's People

Contributors

borewit avatar cephian avatar citrin avatar cushy007 avatar destroid11 avatar docbobo avatar drizzt avatar edent avatar evanpurkhiser avatar faebd7 avatar frestr avatar halaei avatar jaysandhu avatar joewreschnig avatar jvoisin avatar lalinsky avatar lazka avatar lordsputnik avatar michaelurman avatar mweinelt avatar nchammas avatar nirzak avatar obskyr avatar phw avatar point-source avatar radarhere avatar sampsyo avatar timgates42 avatar tomfryers avatar vallyly 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  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

mutagen's Issues

ASF: Can't delete some tags

Originally reported by: Christoph Reiter (Bitbucket: lazka, GitHub: lazka)


From [email protected] on September 30, 2009 03:26:26

Example..

import mutagen
a = mutagen.File("blabla.wma")
print a -> Description is there
del(a["Description"])
print a -> Description is gone
a.save()
a = mutagen.File("blabla.wma")
print a -> Description is back but empty

Tried it with a few tags and it only happens with tags that don't start
with "WM/" like Title, Author, Description, Copyright etc...

Attached are the first 32kB of the file.

Attachment: wma_cant_delete_comment.wma

Original issue: http://code.google.com/p/mutagen/issues/detail?id=29


MP3: MPEG-2/2.5 Layer III frame headers parsed incorrectly

Originally reported by: Christoph Reiter (Bitbucket: lazka, GitHub: lazka)


From [email protected] on December 28, 2009 01:58:23

Given VBR MP3s made with LAME as follows:

flac -d -c silence-44-s.flac | lame --resample 24 -V9 --vbr-old - silence-44-s-mpeg2.mp3
flac -d -c silence-44-s.flac | lame --resample 12 -V9 --vbr-old - silence-44-s-mpeg25.mp3

Mutagen fails to extract correct header information from the resulting MP3:

>>> import mutagen, os
>>> a1 = mutagen.File(os.path.join('tests', 'data', 'silence-44-s-mpeg2.mp3'))
>>> a2 = mutagen.File(os.path.join('tests', 'data', 'silence-44-s-mpeg25.mp3'))
>>> vars(a1.info)
{'bitrate': 288000, 'layer': 1, 'length': 0.23799999999999999, 'mode': 1, 'padding': False, 'protected': True, 
'sample_rate': 48000, 'version': 1}
>>> vars(a2.info)
{'bitrate': 5101, 'layer': 3, 'length': 7, 'mode': 1, 'padding': False, 'protected': False, 'sample_rate': 12000, 'sketchy': 
False, 'version': 2.5}

Because it calculates the frame lengths incorrectly, it's essentially pulling out random header-like data when it can't 
find a second frame.

Going on the documentation about frame length calculation here[1], I'm able to get the headers correctly:

>>> import mutagen, os
>>> a1 = mutagen.File(os.path.join('tests', 'data', 'silence-44-s-mpeg2.mp3'))
>>> a2 = mutagen.File(os.path.join('tests', 'data', 'silence-44-s-mpeg25.mp3'))
>>> vars(a1.info)
{'bitrate': 18191, 'layer': 3, 'length': 3.7679999999999998, 'mode': 1, 'padding': False, 'protected': False, 
'sample_rate': 24000, 'sketchy': False, 'version': 2}
>>> vars(a2.info)
{'bitrate': 9300, 'layer': 3, 'length': 3.8399999999999999, 'mode': 1, 'padding': False, 'protected': False, 
'sample_rate': 12000, 'sketchy': False, 'version': 2.5}

I'm also including a prerequisite patch that fixes integer division being used to calculate MP3 lengths for VBR files.

[1] http://www.codeproject.com/KB/audio-video/mpegaudioinfo.aspx

Attachment: silence-44-s-mpeg2.mp3 silence-44-s-mpeg25.mp3 mpeg2-header.patch

Original issue: http://code.google.com/p/mutagen/issues/detail?id=46


mid3iconv - PairedTextFrame text property issue

Originally reported by: Christoph Reiter (Bitbucket: lazka, GitHub: lazka)


From [email protected] on December 03, 2009 06:09:57

It looks like the for-loop located at https://code.google.com/p/mutagen/source/browse/trunk/tools/mid3iconv?r=64#65 assumes
that all text frames except TimeStampTextFrame have a text property which
doesn't seem to be the case for the PairedTextFrame
( https://code.google.com/p/mutagen/source/browse/trunk/mutagen/id3.py?r=64#1359 ).

Original bug report: https://bugzilla.redhat.com/show_bug.cgi?id=542315 Traceback: https://bugzilla.redhat.com/attachment.cgi?id=374530 Version: 1.16

Let me know if you need any additional information and sorry I don't have
an example file.

Thanks,

Original issue: http://code.google.com/p/mutagen/issues/detail?id=41


Mutagen EasyID3 function throws LookupError when compiled

Originally reported by: Christoph Reiter (Bitbucket: lazka, GitHub: lazka)


From [email protected] on September 04, 2009 22:10:39

I compiled my python program with PY2EXE. If i simply run the program i 
get no error, only in the compiled version. 
(I'm using latest PY2EXE and latest python 2.6)

This is the line in my code that throws the error:
EasyID3("someFile.mp3")    # this is line 131 in my code
the exception log:
Traceback (most recent call last):
  File "main.py", line 96, in OnSearch
  File "main.py", line 131, in searchMP3s
  File "mutagen\easyid3.pyo", line 63, in __init__
  File "mutagen\id3.pyo", line 136, in load
  File "mutagen\id3.pyo", line 282, in __read_frames
  File "mutagen\id3.pyo", line 305, in __load_framedata
  File "mutagen\id3.pyo", line 1047, in fromData
  File "mutagen\id3.pyo", line 980, in _readData
  File "mutagen\id3.pyo", line 702, in read
  File "mutagen\id3.pyo", line 683, in read
LookupError: unknown encoding: latin1

Original issue: http://code.google.com/p/mutagen/issues/detail?id=22


moggsplit generation of m3u file [with patch]

Originally reported by: Christoph Reiter (Bitbucket: lazka, GitHub: lazka)


From [email protected] on November 14, 2009 21:22:32

When splitting a large chained Ogg file it would be useful to have the
option to automatically generate an m3u playlist file.

The patch adds the command line option --m3u and a man page update.

Attachment: mutagen-moggsplitm3u-1.18-rev1.patch

Original issue: http://code.google.com/p/mutagen/issues/detail?id=39


Missing Ogg MIME-types

Originally reported by: Christoph Reiter (Bitbucket: lazka, GitHub: lazka)


From [email protected] on January 03, 2010 09:34:53

OggFileType currently claims to support the MIME types application/ogg and
application/x-ogg.

According to http://wiki.xiph.org/index.php/MIME_Types_and_File_Extensions the following MIME types have also been registered:

audio/ogg and audio/vorbis

A lot of content seem to use these MIME types, so it would be a good idea
to add these types to OggFileType._mimes

Original issue: http://code.google.com/p/mutagen/issues/detail?id=49


GPL v2 or later?

Originally reported by: Christoph Reiter (Bitbucket: lazka, GitHub: lazka)


From [email protected] on November 13, 2009 08:40:34

mutagen is currently licensed under GPL v2 only. This means that programs
using GPL v3 cannot use it, as far as I can see, because GPL v2 is not
compatible with GPL v3. Would it be possible to license mutagen under GPL
v2 or later, or is there an issue there that I am not aware of?

Thanks for your time,
Erik Hetzner

Original issue: http://code.google.com/p/mutagen/issues/detail?id=38


FLAC: Media Jukebox writes \x00-terminated FLAC tags

Originally reported by: Christoph Reiter (Bitbucket: lazka, GitHub: lazka)


From [email protected] on September 07, 2009 03:18:06

Using svn mutagen, running mutagen.File(filepath, easy=True) on a file
returns a dict where every value has \x00 appended. For example:

{'album': [u'Symphony No. 9\x00'], 'peak level':
[u'0.8750600218772888\x00'], 'title': [u'Allegro\x00'], 'replay gain':
[u'-5.7582697868347168\x00'], 'tool version': [u'12.0.37\x00'], 'artist':
[u'Shostakovitch\x00'], 'bpm': [u'134\x00'], 'date': [u'1899/12/30\x00'],
'intensity': [u'1\x00'], 'tool name': [u'Media Jukebox\x00'], 'genre':
[u'Classical\x00'], 'tracknumber': [u'1\x00']}

I've attached the first 32KB of the file of which mutagen created the above
output.

This happens on all flac files I have. I didn't encode them myself, but the
"tool name" field seems to yield which tool was used to encode. Now I can
workaround this with:

mutagenObj = mutagen.File(filepath, easy=True)
mutagenObj = dict((a, [e.strip("\0") for e in b]) for a, b in
mutagenObj.iteritems())

but that's kinda annoying. I wonder if all my flac files are broken, or if
mutagen does something weird when reading the file?

Attachment: samplefile

Original issue: http://code.google.com/p/mutagen/issues/detail?id=23


mutagen -- id3v2 interop

Originally reported by: Christoph Reiter (Bitbucket: lazka, GitHub: lazka)


From [email protected] on July 03, 2009 22:51:42

Writing an id3v2 tag to a file will using mutagen not be readable by id3v2
Linux command line (and anything using the same library).

$ id3v2 -l Mouse\ Power\ Scroll\ -\ Tekzilla\ Daily\ Tip.mp4.id3 
id3v1 tag info for Mouse Power Scroll - Tekzilla Daily Tip.mp4.id3:
Title  : Mouse Power Scroll - Tekzilla   Artist: Tekzilla (HD Quicktime)       
Album  :                                 Year:     , Genre: Unknown (255)
Comment:                                 Track: 0


$ mid3v2 -l Mouse\ Power\ Scroll\ -\ Tekzilla\ Daily\ Tip.mp4.id3 
IDv2 tag info for Mouse Power Scroll - Tekzilla Daily Tip.mp4.id3:
TYER=2009
TDAT=1206
APIC=None (image/jpeg, 76462 bytes)
TPE1=Tekzilla (HD Quicktime)
TIT2=Mouse Power Scroll - Tekzilla Daily Tip
COMM=None='\x00\x00\x00'=Supercharge your mouse


This is using mutagen 1.16 on a Kubuntu 8.10 system. I have attached the
gpodder support script that I am hacking.

Attachment: gdfs-init.py

Original issue: http://code.google.com/p/mutagen/issues/detail?id=8


ID3: Per-field ID3v1 fallback

Originally reported by: Christoph Reiter (Bitbucket: lazka, GitHub: lazka)


From [email protected] on November 02, 2009 02:58:27

Many of my files have some useless data in ID3v2.4 & then important fields
stored in ID3v1. Mutagen just reads the ID3v2 tags and ignores the
important stuff in ID3v1, since ID3v1 is handled as a fallback case. I've
attached a rudimentary enhancement (12 lines at ln. 132) which will try to
read ID3v1 and then let ID3v2 override where appropriate.

Original issue: http://code.google.com/p/mutagen/issues/detail?id=34


EasyID3 + MP3 leads parsing ID3 information twice.

Originally reported by: Christoph Reiter (Bitbucket: lazka, GitHub: lazka)


From [email protected] on December 19, 2009 22:19:48

I have noticed that EasyID3 is missing TLAN (Languages) for instance.

And now that I'd like to use EasyID3 *and* "raw" MP3 access, I've found out 
that I have to parse the ID3 tags *twice* to be able to use EasyID3 and raw 
access, why is that? E.g:

from mutagen.easyid3 import EasyID3
from mutagen.mp3 import MP3

easymp3 = EasyID3(path_to_mp3_file)
rawmp3 = MP3(path_to_mp3_file) # Unneccessary second parsing, why?

languages = unicode(rawmp3.get('TLAN', ""))
tracknumber = easymp3.get('tracknumber', [""]).pop(0)
...

# Btw, above line is another problem, accessing EasyID3 without problems in 
one line is such a pain. (I have MP3 files where TRCK is missing thus 
easymp3['tracknumber'][0] won't do, it raises the KeyError in internal)

Original issue: http://code.google.com/p/mutagen/issues/detail?id=44


ID3: POPM: Does not support empty counts as per ID3v2.4 spec.

Originally reported by: Christoph Reiter (Bitbucket: lazka, GitHub: lazka)


From [email protected] on October 27, 2009 17:21:58

http://www.id3.org/id3v2.4.0-frames Here's a fix:

class POPM(Frame):
    """Popularimeter.

    This frame keys a rating (out of 255) and a play count to an email
    address.

    Attributes:
    email -- email this POPM frame is for
    rating -- rating from 0 to 255
    count -- number of times the files has been played
    """
    _framespec = [Latin1TextSpec('email'), ByteSpec('rating')]
    _optionalspec = [ IntegerSpec('count') ]
    HashKey = property(lambda s: '%s:%s' % (s.FrameID, s.email))

    def __eq__(self, other): return self.rating == other
    def __pos__(self): return self.rating
    def _pprint(self):
        try: return "%s=%s %s/255" % (self.email, self.count, self.rating)
        except AttributeError: return "%s=%s %s/255" % (self.email, '0',
self.rating)

Original issue: http://code.google.com/p/mutagen/issues/detail?id=33


Using a ID3v2.3 file failes to add year to ID3v1 files

Originally reported by: Christoph Reiter (Bitbucket: lazka, GitHub: lazka)


From [email protected] on December 11, 2009 18:02:57

If a file is configured with ID3v2.3 and MakeID3v1 is called on it, a year
is not set.  This patch adds the ability to pull the year out of the v2.3
tag (iff the v2.4 tag isn't present).

This patch is against: python-mutagen-1.16-2.fc12.noarch

Attachment: mutagen-id3v2.3-id3v1.1-year.patch

Original issue: http://code.google.com/p/mutagen/issues/detail?id=42


mid3v2: setting multiple values/frame - bugfix attached

Originally reported by: Christoph Reiter (Bitbucket: lazka, GitHub: lazka)


From [email protected] on January 05, 2010 20:28:07

Hi there-

This is a followup to issue#37 . I made a python coding mistake in my diff
which can lead to the program aborting with a runtime error. Note that this
only happens when the new functionality is being exercised, so it is not a
regression. Still, I'm very sorry for introducing a bug into your codebase.
Should have tested more...

Attached is the fix.

Cheers

Hans

Attachment: mid3v2.diff

Original issue: http://code.google.com/p/mutagen/issues/detail?id=50


mid3v2: add verbose mode and command line options [with patch]

Originally reported by: Christoph Reiter (Bitbucket: lazka, GitHub: lazka)


From [email protected] on November 17, 2009 19:16:11

When driven by a script, mid3v2 can be rather verbose in its output. I don't really care to know
everything it is doing, only if there is a problem.

The attached patch adds command line options -v (--verbose) and -q (--quiet) to control the
wordiness.

Cheers

Hans

Original issue: http://code.google.com/p/mutagen/issues/detail?id=40


Musepack: Support new Musepack SV8 API

Originally reported by: Christoph Reiter (Bitbucket: lazka, GitHub: lazka)


From towolf on July 02, 2009 14:40:10

Support for the new libmcpdec API was added to Gstreamer Plugins Bad in
version 0.10.7.

To use this revised format in Mutagen-based apps it will ne necessary to
update Mutagen as well.

The main advantage of SV8 is much faster seeking and the ability to split
CD-sized tracks into it’s constituents. SV7 files can be converted to SV8. http://trac.musepack.net/trac/wiki/SV8Specification

Original issue: http://code.google.com/p/mutagen/issues/detail?id=7


Patch: Recover from faulty frames

Originally reported by: Christoph Reiter (Bitbucket: lazka, GitHub: lazka)


From [email protected] on June 16, 2009 08:25:29

From https://code.google.com/p/quodlibet/issues/detail?id=104 :

I tried to parse a mp3 file, using mutagen. It had problems with
termination of the SYLT frame.I modified the mutagen.id3 module to avoid
reading of SYLT frame in case of such errors.
Follow the link given below to read my discussion with Michael Urman,
regarding this error. http://groups.google.com/group/quod-libet-development/browse_thread/thread/03f329ee48102c60# See the attachment for the patch.

Original issue: http://code.google.com/p/mutagen/issues/detail?id=2


Allow RVA2 without peak value

Originally reported by: Christoph Reiter (Bitbucket: lazka, GitHub: lazka)


From [email protected] on August 03, 2009 09:57:54

I am currently working on a project in which I need to write replaygain
data to MP3 files.  However, finding the peak values is impractical for
this project.  According to the specs, "Bits representing peak can be any
number between 0 and 255. 0 means that there is no peak volume field." 
However, there doesn't appear to be any way to make this happen with
mutagen. (omiting the peak value results in an exception being thrown).

Taking a quick look at the code, it looks like this might be accomplished
by changing:
    return "\x10" + pack('>H', int(round(value * 32768)))
into:
    if type(value) == type(None):
        return "\x00"
    else:
        return "\x10" + pack('>H', int(round(value * 32768)))
but I don't really know enough about it to be sure.

Original issue: http://code.google.com/p/mutagen/issues/detail?id=18


How to load a file with path?

Originally reported by: Christoph Reiter (Bitbucket: lazka, GitHub: lazka)


From AloneRoad on August 30, 2009 15:28:45

>>> from mutagen import mp3
>>> audio = mp3("X:/WorkSpace/Test Environment/Music/18. Bad Day - Daniel
Powter.mp3")
Traceback (most recent call last):
  File "<string>", line 1, in <fragment>
TypeError: 'module' object is not callable

Original issue: http://code.google.com/p/mutagen/issues/detail?id=20


Unicode support when *reading* tags

Originally reported by: Christoph Reiter (Bitbucket: lazka, GitHub: lazka)


From [email protected] on September 26, 2009 17:01:08

This may or may not be a bug. I'd ask first on a mailing list or a forum,
but I can't find one :/

I have a file which has it's tags stored as UTF16 (encoding=1, at least
that's what mutagen tells me). I open the file as follows:

meta = File( localpath )
title = meta.get( 'TIT2' ).text[0]

This will return a python unicode object. Which (AFAIK) is stored
internally as UCS2 or UCS4 (depending on compile options). So if I want the
data in UTF8, all I should need to do is:

title.encode("utf8")

This works without throwing an exception, but the string I get is not at
all what is stored in the ID3 tag. Instead I get a result with plenty of
Chinese characters and whatnot.

Any ideas what that might be?

Original issue: http://code.google.com/p/mutagen/issues/detail?id=28


MP3: Replaygain values from LAME tag.

Originally reported by: Christoph Reiter (Bitbucket: lazka, GitHub: lazka)


From [email protected] on November 05, 2009 02:21:44

The following patch gives access to Replay Gain information obtained from
an mp3 file's LAME tag if present.

Usage example:
>>> import mutagen
>>> audio = mutagen.File('quiettest.mp3')
>>> audio.info.track_peak
0.040146470069885254
>>> audio.info.track_gain
23.400000000000002

Original issue: http://code.google.com/p/mutagen/issues/detail?id=36


VCommentDict: duplicate keys in rare cases in keys() and as_dict()

Originally reported by: Christoph Reiter (Bitbucket: lazka, GitHub: lazka)


From [email protected] on December 22, 2009 13:20:04

VCommentDict: duplicate keys in rare cases in keys() and as_dict()

This only happens when identical differently cased keys are present.

Most of the time, this is not a problem, because keys are usually
normalized to lowercase before any operation.

But it is possible to sneak in differently cased keys by using list
methods like append (possibly insert and extend) where no normalization
takes place.
It is also possible, though unlikely, that a file might contain
differently cased keys, in which case it would also be preserved.

VCommentDict methods keys(self) and as_dict(self) seem to be having 
trouble with such cases.

keys(self):
  First set() is called on all keys to weed out any duplicates.
  Afterwards str.lower() is preformed on every member in the key set.
  This is OK for removing duplicate keys with identical casing, 
  but set() should probably be called after str.lower().

  At this point, if there are three keys ("key", "KEY", "Key"),
  the keys method returns ["key", "key", "key"],
  I assume the intended behavior should be a return value of ["key"]

as_dict(self):
  No lowercase normalization is preformed.
  This might be the intended behavior, but an implementation that
  Does not differentiate between case, passes all other tests,
  so i assume this is not the case.

  At this point, if there are three keys ("key", "KEY", "Key"),
  the as_dict method returns a dictionary which contains the very same
  three keys. The attached patch changes it so that it only returns a
  dictionary containing "key".

A diff with simple fixes and a simple test attached.

Attachment: VCommentDict_dup_keys_fix_and_test.diff

Original issue: http://code.google.com/p/mutagen/issues/detail?id=45


how to install mutagen on window xp

Originally reported by: Christoph Reiter (Bitbucket: lazka, GitHub: lazka)


From [email protected] on July 11, 2009 20:11:07

hello,guys.I'm new to python.I got a problem when try to install mutagen on
window xp.Before I install,I've installed python3.1 on windows.
I google the problem,one answer is such as:run command: python set.up
install in cmd.I got a error:
File "setup.py",line 51
    print "You're  not Joe,so this might not work."

really much thanks to any tips!

Original issue: http://code.google.com/p/mutagen/issues/detail?id=12


ID3: Improper extended header flags are detected but not corrected

Originally reported by: Christoph Reiter (Bitbucket: lazka, GitHub: lazka)


From [email protected] on August 31, 2009 07:36:44

mutagen-inspect says:
- MPEG 1 layer 3, 256000 bps, 44100 Hz, 298.89 seconds (audio/mp3)



mplayer says:

Audio only file format detected.
Clip info:
 Title: Punk To Funk
 Artist: FatBoy Slim
 Album: Better Living Through Chemistr
 Year: 1996
 Comment: 
 Track: 9
 Genre: Unknown
==========================================================================
Opening audio decoder: [mp3lib] MPEG layer-2, layer-3
AUDIO: 44100 Hz, 2 ch, s16le, 256.0 kbit/18.14&#37; (ratio: 32000->176400)


first 32Kb of the file are attached

Attachment: 32k_of_failed_file.mp3

Original issue: http://code.google.com/p/mutagen/issues/detail?id=21


Mutagen fails on ID3v2.4 tags with footer

Originally reported by: Christoph Reiter (Bitbucket: lazka, GitHub: lazka)


From [email protected] on June 18, 2009 19:06:00

From https://code.google.com/p/quodlibet/issues/detail?id=200 :

There is a bug in mutagen's penantic check on ID3v2 header flags. This
check always fails on ID3v2.4 tags with a tag footer.

In id3.py, there is the following bit of code which intends to disallow
flag 0x10 (footer present) for ID3v2.3. However, the code effectively also
disallows this flag for ID3v2.4 flags:

  if (2,4,0) <= self.version and (flags & 0x0f):
    raise ValueError("'&#37;s' has invalid flags &#37;#02x" &#37; (fn, flags))
  elif (2,3,0) <= self.version and (flags & 0x1f):
    raise ValueError("'&#37;s' has invalid flags &#37;#02x" &#37; (fn, flags))

I suggest chaning it into:
  if (2,4,0) <= self.version:
    if (flags & 0x0f):
      raise ValueError("'&#37;s' has invalid flags &#37;#02x" &#37; (fn, flags))
  elif (2,3,0) <= self.version:
    if (flags & 0x1f):
      raise ValueError("'&#37;s' has invalid flags &#37;#02x" &#37; (fn, flags))

Error message:
>>> f = mutagen.File('01_preludium.mp3')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.5/site-packages/mutagen/__init__.py", line 199, in
File
    if score > 0: return Kind(filename)
  File "/usr/lib/python2.5/site-packages/mutagen/__init__.py", line 74, in

init
self.load(filename, _args, *_kwargs)
File "/usr/lib/python2.5/site-packages/mutagen/id3.py", line 1945, in load
try: self.tags = ID3(filename, *_kwargs)
File "/usr/lib/python2.5/site-packages/mutagen/id3.py", line 74, in init
super(ID3, self).init(_args, *_kwargs)
File "/usr/lib/python2.5/site-packages/mutagen/_util.py", line 103, in
init
super(DictProxy, self).init(_args, *_kwargs)
File "/usr/lib/python2.5/site-packages/mutagen/init.py", line 38, in
init
self.load(_args, **kwargs)
File "/usr/lib/python2.5/site-packages/mutagen/id3.py", line 113, in load
self.__load_header()
File "/usr/lib/python2.5/site-packages/mutagen/id3.py", line 220, in
__load_header
raise ValueError("'%s' has invalid flags %#02x" % (fn, flags))
ValueError: '01_id3v22_preludium.mp3' has invalid flags 0x90

Original issue: http://code.google.com/p/mutagen/issues/detail?id=5


Cannot read MP3 and AAC files

Originally reported by: Christoph Reiter (Bitbucket: lazka, GitHub: lazka)


From [email protected] on July 19, 2009 23:18:46

bradford:deAmarokization$ ./deAmarokization.py music.aac
Traceback (most recent call last):
  File "./deAmarokization.py", line 33, in <module>
    audio=MP4(filename)
  File "/usr/lib/python2.6/site-packages/mutagen/__init__.py", line 73, in

init
self.load(filename, _args, *_kwargs)
File "/usr/lib/python2.6/site-packages/mutagen/mp4.py", line 652, in load
try: self.info = MP4Info(atoms, fileobj)
File "/usr/lib/python2.6/site-packages/mutagen/mp4.py", line 581, in init
for trak in list(atoms["moov"].findall("trak")):
File "/usr/lib/python2.6/site-packages/mutagen/mp4.py", line 177, in
getitem
raise KeyError, "%s not found" % names[0]
mutagen.mp4.MP4StreamInfoError: 'moov not found'
bradford:deAmarokization$ ./deAmarokization.py music.mp3
Traceback (most recent call last):
File "./deAmarokization.py", line 29, in
audio = ID3(filename)
File "/usr/lib/python2.6/site-packages/mutagen/id3.py", line 74, in init
super(ID3, self).init(_args, *_kwargs)
File "/usr/lib/python2.6/site-packages/mutagen/_util.py", line 103, in
init
super(DictProxy, self).init(_args, *_kwargs)
File "/usr/lib/python2.6/site-packages/mutagen/init.py", line 37, in
init
self.load(_args, *_kwargs)
File "/usr/lib/python2.6/site-packages/mutagen/id3.py", line 113, in load
self.__load_header()
File "/usr/lib/python2.6/site-packages/mutagen/id3.py", line 211, in
__load_header
raise ID3NoHeaderError("'%s' doesn't start with an ID3 tag" % fn)
mutagen.id3.ID3NoHeaderError: 'music.mp3' doesn't start with an ID3 tag
bradford:deAmarokization$

Attachment: deAmarokization.py music.aac

Original issue: http://code.google.com/p/mutagen/issues/detail?id=14


Installer does not install properly

Originally reported by: Christoph Reiter (Bitbucket: lazka, GitHub: lazka)


From [email protected] on August 13, 2009 07:02:33

Running setup.py build then sudo setup.py install failed to set the
permissions properly.

I was unable to even import anything mutagen, until I discovered that the
permissions on /usr/local/lib/python2.6/dist-packages/mutagen* where all wrong.

The folder mutagen was 770, and all the files were 660, everything owned by
root:staff.  Once I manually changed the folder to 775 and the files to 664
everything seems to be working better.

Original issue: http://code.google.com/p/mutagen/issues/detail?id=19


mutagen.easyid3: Circular dependency on mutagen.id3

Originally reported by: Christoph Reiter (Bitbucket: lazka, GitHub: lazka)


From [email protected] on October 23, 2009 02:50:37

Importing mutagen.easyid3 fails when mutagen.id3 or mutagen.mp3 have not
been imported prior to.

Mutagen 1.16 does not have this problem.

>>> import mutagen.easyid3
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.6/site-packages/mutagen/easyid3.py", line 18, in
<module>
    import mutagen.id3
  File "/usr/lib/python2.6/site-packages/mutagen/id3.py", line 1989, in
<module>
    class EasyID3FileType(ID3FileType):
  File "/usr/lib/python2.6/site-packages/mutagen/id3.py", line 1990, in
EasyID3FileType
    from mutagen.easyid3 import EasyID3 as ID3
ImportError: cannot import name EasyID3
>>>

Original issue: http://code.google.com/p/mutagen/issues/detail?id=32


easyid3.py module raises ValueError instead of KeyError

Originally reported by: Christoph Reiter (Bitbucket: lazka, GitHub: lazka)


From [email protected] on January 01, 2010 23:55:09

https://bugs.launchpad.net/ubuntu/+source/mutagen/+bug/498610 The module/usr/share/pyshared/mutagen/easyid3.py raises the ValueError
exception instead of the proper KeyError.

Here's an example:
>>> m = EasyID3('Reencarnación - Reencarnación.mp3')
>>> m
{'album': [u'888 Metal'], 'date': [u'1988'], 'artist':
[u'Reencarnaci\xf3n'], 'tracknumber': [u'01'], 'title': [u'Reencarnaci\xf3n
(888 Metal)']}
>>> m['date']
[u'1988']
>>> m['year']
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.6/dist-packages/mutagen/easyid3.py", line 94, in

getitem
else: raise ValueError("%r is not a valid key" % key)
ValueError: 'year' is not a valid key

Attachment: patch.txt

Original issue: http://code.google.com/p/mutagen/issues/detail?id=48


ID3: Incorrect __eq__ method in TextFrame class

Originally reported by: Christoph Reiter (Bitbucket: lazka, GitHub: lazka)


From [email protected] on December 19, 2009 13:48:50

This is not really causing me any problems, just found this 
while messing with the code.

TextFrame class defines both __str__ and __unicode__ methods.
When compared for equality (using __eq__(self, other) method):
In case other is string:
  It converts itself with str(self) for comparison
In case other is unicode:
  It creates a unicode literal u'\u0000'.join(self.text)
  and uses that for comparison. This identical to what the __unicode__
  method returns and at this point is just a slight code duplication.

But there's trouble when a subclass redefines __unicode__,
which is what TimeStampTextFrame does.

What's even more, because TimeStampTextFrame's text attribute is a list
of ID3TimeStamp objects, it actually raises an exception because join()
expects a list of string or unicode literals.

In effect, comparing an instance of TimeStampTextFrame class or it's
subclasses to a unicode literal raises a TypeError, while comparing
to a string does not.

I've attached an obvious solution of just using unicode(self). Don't
really know how to go about tests, so just added a simple TestCase
subclass, also included in the diff. Should I've incorporated it into a
previous test (perhaps somewhere in TestReadTags?), or maybe was it not
necessary at all?

Attachment: TextFrame_eq_patch_and_test.diff

Original issue: http://code.google.com/p/mutagen/issues/detail?id=43


mid3v2: setting multiple values/frame; deleting and setting frames at the same time (with PATCH)

Originally reported by: Christoph Reiter (Bitbucket: lazka, GitHub: lazka)


From [email protected] on November 06, 2009 19:53:33

Hi there-

I'm using mid3v2 as a command line MP3 tag editor. There are a couple things
it does not do, which I have implemented and attach a patch. Could you
please review and (if okay) apply? This patch is against SVN as of today.

====

1.) "mid3v2 --delete-frames=...." and "mid3v2 --frame value" can not be
called at the same time

The parser structure checks whether we are setting/adding frames or whether
we are deleting frames, and it then executes delete_frames() or
write_files(). It does not call both, if both option categories are given.

The attached patch fixes it so that if we are both deleting and setting
frames, we are executing both operations serially. This is not optimal
(better would be to parse and write the file only once) but it _works_.

2.) "mid3v2 -g genre1 -g genre2" does not work

Inside write_file(), the variable edits will be a list of (frame,value)
pairs. If a frame recurs (i.e. I'm trying to set multiple genres), the last
pair will override all earlier choices.

I added a preprocessing stage for edits, where it will collapse all pairs
with identical frame name to have value lists instead of scalars.

===

This functionality has been tested and seems to work fine. However I'm
neither a python expert, nor did I want to change the overall structure of
mid3v2 to more organically support my use case. Feel free to rewrite my
patch. But some way - any way - to support my usecase would be great in
upstream mutagen.

Thank you!

Hans

Original issue: http://code.google.com/p/mutagen/issues/detail?id=37


Patch to modify mid3v2 to write APIC frame (covert art) into media file.

Originally reported by: Christoph Reiter (Bitbucket: lazka, GitHub: lazka)


From [email protected] on December 30, 2009 03:09:50

Thanks in advance for considering this patch.

I've attached a patch to to mutagen-1.18.tar.gz that modifies the script
mid3v2 and the man page mid3v2.1.

The patch allows mid3v2 to add an APIC frame to a media file.

I did not modify the tests, because AFAIK there is no test for mid3v2.

I've tested the patched version of mid3v2 on a few dozen mp3 files and have
had no problems.

If there's something else I need to do to support this patch please let me
know.

Attachment: mutagen-1.18-patch-mid3v2.patch

Original issue: http://code.google.com/p/mutagen/issues/detail?id=47


Some shitty encoders write corrupt Ogg/Vorbis files

Originally reported by: Christoph Reiter (Bitbucket: lazka, GitHub: lazka)


From [email protected] on July 17, 2009 02:41:44

Mutagen relies on the string "OggS" being in the exact beginning of the
file to parse the metadata.

This is bad as some encoders (grip, for example) put a ID3v2 tag before the
vorbis comments by default, so as to allow shitty portable audio players to
read the metadata.

Anyway, the Vorbis I spec does not specify that the file should start with
"OggS". At least I couldn't find it ;)

And vorbis-tools read and edit correctly the comments that have an offset,
so I think it's cool to support them.

Original issue: http://code.google.com/p/mutagen/issues/detail?id=13


Performance: NFS shares are slow to list tags

Originally reported by: Christoph Reiter (Bitbucket: lazka, GitHub: lazka)


From [email protected] on September 17, 2009 21:32:03

i am a quodlibet user and am experiencing laggy behavior while listing
meta-data for a nfs share. the nfs share is not slow to browse, so its not
a network problem. 


here is the post i made on the quodlibet google-code page and they
explained that the issue may be with mutagen instead. 

----------

i have some music mounted over nfs, and i do not want to add it to my
library. i  just play it through the filesystem browser. 

this works, but is very slow to load a directory's contents into the
tracklist pane (to the right of filesystem tree pane). 

the filesystem tree browses quickly, the lagginess is just in the
tracklisting pane.

the nfs mount can be browsed quickly with other applications, so i think it
is a quodlibet specific problem. 

----

if there is a way to isolate and troubleshoot the mutagen part of it i
would be glad to help. 

thanks
alex

Original issue: http://code.google.com/p/mutagen/issues/detail?id=25


MP4Tags.__update_parents corrupts 64-bit atoms

Originally reported by: Christoph Reiter (Bitbucket: lazka, GitHub: lazka)


From lalinsky on July 24, 2009 15:02:17

MP4Tags.__update_parents always tries to update the 32-bit size, which is
set to a special value 1 for 64-bit atoms. Changing this value means that
the atom will have incorrect size and contain "garbage" data (the 64-bit
size, which is no longer used as 64-bit size).

Attachment: mp4-64bit-update-parents.diff 64bit.mp4

Original issue: http://code.google.com/p/mutagen/issues/detail?id=17


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.