Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

id3: Remove various mutagen hacks which no longer work with newer mutagen #479

Merged
merged 1 commit into from Aug 22, 2016

Conversation

@lazka
Copy link
Contributor

lazka commented Jul 27, 2016

Three parts:

(1) The monkey patching of EncodedTextSpec to ignore encoding errors
when using latin1 as encoding.

This gets replaced with a new id3text function which makes sure
that any value passed to mutagen can be encoded with the selected
encoding

(2) MultiSpec monkey patch to not null terminate a list of strings.

While this is valid according to the spec mutagen decided to terminate
all strings (not only the text lists handled here). If this is a
problem it should be discussed upstream (mutagen).

(3) compatid3 which implemented id3v2.3 support and added some
additional frames.

This gets replaced with the id3v2.3 support implemented upstream.
The additional frames still get passed to mutagen and, to match
the previous implementation, update_to_v23() gets wrapped to
allow some v2.4 only frames.

@@ -90,6 +57,16 @@ def patched_MultiSpec_write(self, frame, value):
__ID3_REVERSE_IMAGE_TYPE_MAP = dict([(v, k) for k, v in __ID3_IMAGE_TYPE_MAP.iteritems()])


def id3text(text, encoding):
"""Returns a string which only contains code points which can
be encododed with passed id3 encoding.

This comment has been minimized.

Copy link
@Freso

Freso Aug 2, 2016

Member

Typo.

@phw

This comment has been minimized.

Copy link
Member

phw commented Aug 9, 2016

Thanks a lot for this. I am glad this code got cleaned up, and looks good to me.

Not too sure about the implications of the string termination, but as you said if this has any issues it should be discussed upstream. I'd say we merge it this way for now, unless somebody is aware of any specific issues with this.

Just for reference: PICARD-833

@phw

This comment has been minimized.

Copy link
Member

phw commented Aug 9, 2016

One question: Does this raise the minimum supported mutagen version? If so, we should document this.

Apart from this once the conflicts are resolved and the typo is fixed I think this is good to merge.

@lazka

This comment has been minimized.

Copy link
Contributor Author

lazka commented Aug 10, 2016

(sorry, was without Internet for a few days)

One question: Does this raise the minimum supported mutagen version? If so, we should document this.

The newly added code depends on 1.22+

@lazka

This comment has been minimized.

Copy link
Contributor Author

lazka commented Aug 12, 2016

I'll make a 1.34.1 release including this: quodlibet/mutagen@681a37f

@lazka

This comment has been minimized.

Copy link
Contributor Author

lazka commented Aug 13, 2016

@Freso

This comment has been minimized.

Copy link
Member

Freso commented Aug 22, 2016

Picard had stopped running for me. Running it patched with this PR makes it work again.

@zas

This comment has been minimized.

Copy link
Collaborator

zas commented Aug 22, 2016

The newly added code depends on 1.22+

So it raises the minimum version required, not much an issue, but https://github.com/metabrainz/picard/blob/master/INSTALL.txt#L15 should be modified accordingly.

…agen

Three parts:

(1) The monkey patching of EncodedTextSpec to ignore encoding errors
when using latin1 as encoding.

This gets replaced with a new id3text function which makes sure
that any value passed to mutagen can be encoded with the selected
encoding

(2) MultiSpec monkey patch to not null terminate a list of strings.

While this is valid according to the spec mutagen decided to terminate
all strings (not only the text lists handled here). If this is a
problem it should be discussed upstream (mutagen).

(3) compatid3 which implemented id3v2.3 support and added some
additional frames.

This gets replaced with the id3v2.3 support implemented upstream.
The additional frames still get passed to mutagen and, to match
the previous implementation, update_to_v23() gets wrapped to
allow some v2.4 only frames.

The newly added id3v2.3 code depends on mutagen 1.22+
@lazka

This comment has been minimized.

Copy link
Contributor Author

lazka commented Aug 22, 2016

So it raises the minimum version required, not much an issue, but https://github.com/metabrainz/picard/blob/master/INSTALL.txt#L15 should be modified accordingly.

Updated the INSTALL and added a note in the commit message

@zas zas merged commit fb3e993 into metabrainz:master Aug 22, 2016
1 check passed
1 check passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@lazka

This comment has been minimized.

Copy link
Contributor Author

lazka commented Aug 22, 2016

Thanks!

jsonn pushed a commit to jsonn/pkgsrc that referenced this pull request May 9, 2017
pkgsrc changes:
 - Update MASTER_SITES to MASTER_SITE_PYPI
 - Update HOMEPAGE
 - Clarify - a bit - comments regarding patches/patch-aa, they're needed to omit
   respectively {script,module} installations due the mutagen-tools separation

Changes (changelog regarding 1.27...1.31 was adjusted to only reflect changes
pertinent to mutagen-tools that was not previosly synced with py-mutagen):
1.37 - 2017.02.24
-----------------

* Relicense "GPLv2" → "GPLv2 or later" 🐛`291`
* DSF: add `mutagen.dsf` module for DSF (DSD Stream File) support
  :pr:`283` (Boris Pruessmann)
* MP3: Add `mp3.MPEGInfo.encoder_settings` containing a guess of the encoder
  settings used, for example ``"-V2"`` for LAME 🐛`66`
* ID3: add iTunes movement related frames `id3.MVIN` and `id3.MVNM`
* MP4: support ``©mvi``, ``©mvc``, ``shwm``, ``stik``, ``rtng``, ``tves``,
  ``tvsn``, ``plID``, ``cnID``, ``geID``, ``atID``, ``sfID``, ``cmID``,
  ``akID`` 🐛`130`


1.36.3 - 2017.02.24
-------------------

* MP3: fix error with xing frames without a frame count 🐛`292`


1.36.2 - 2017.01.25
-------------------

* ID3: Always write little endian utf-16 with BOM.
  Fixes tests on big endian machines :pr:`289`


1.36.1 - 2017.01.22
-------------------

* Support GAE runtime 🐛`286`
* FLAC: Fix crash when loading files with zero samples 🐛`287`
* MP3: Handle broken lame tags written by older lame versions


1.36 - 2016.12.22
-----------------

* ID3: Ignore trailing empty values for v2.3 text frames 🐛`276`
* ID3: Write large APIC frames last 🐛`278`
* EasyID3: support saving as v2.3 🐛`188`
* FLAC: Add StreamInfo.bitrate 🐛`279`
* mid3cp: Add ``--merge`` option 🐛`277`
* MP4: Allow loading files without audio tracks 🐛`272`


1.35.1 - 2016.11.09
-------------------

* Revert back to distutils 🐛`273`


1.35 - 2016.11.02
-----------------

* Tests: Require pytest
* Tools: Install .exe launchers on Windows
* setup.py: Require setuptools
* ID3:

  * Fix loading files with CRM frames 🐛`239`
  * Fix loading AENC, LINK, GRID frames with no payload
  * Merge duplicate text frames with same key on load 🐛`172`
  * Allow parsing of duplicate APIC frames 🐛`172`
  * Parse utf-16 text fields with missing BOM 🐛`267`
  * Increase max resyncs for the mpeg frame search 🐛`268`


1.34.1 - 2016.08.13
-------------------

* ID3: Expose some internals again to make Picard (mostly) work again.

  * http://tickets.musicbrainz.org/browse/PICARD-833
  * metabrainz/picard#479


1.34 - 2016.07.20
-----------------

* ID3:

  * Add `CTOC <id3.CTOC>` and `CHAP <id3.CHAP>` frames. New classes:
    `ID3Tags <id3.ID3Tags>`, `CTOCFlags <id3.CTOCFlags>`. 🐛`6`
  * Add `TCAT <id3.TCAT>`, `TKWD <id3.TKWD>`, `PCST <id3.PCST>` frames.
    🐛`249`
  * Validate user provided LNK/LINK frameid. 🐛`242`
  * Add `RVAD <id3.RVAD>`, RVA frames
  * Add TST, TSA, TS2, TSP and TSC frames
  * Fix not writing optional fields when saving to v2.3
  * Add default field values for all frames

* Drop Python 2.6 support
* EasyID3: Fix TXXX frame encoding when setting a non-latin1 encodable
  value after a latin1 one. 🐛`263`


1.33.2 - 2016.07.05
-------------------

* Fix loading of small ogg/apev2 files (1.33 regression)


1.33.1 - 2016.06.29
-------------------

* Fix Overeager deprecation warnings 🐛`261`


1.33 - 2016.06.29
-----------------

* FileType, Metadata: File-like object support 🐛`1`
* mid3v2: Add APIC support. 🐛`47`
* EasyID3: Fix handling of RVA2 frames with non-lowercase description
  🐛`215`
* mid3v2: Add UFID support. 🐛`234`
* ID3: Include human-readable representation of the picture type in
  APIC._pprint() 🐛`244`
* EasyID3: make albumartist use TPE2 and move performer to TXXX. 🐛`252`
* ID3: id3.ID3TimeStamp comparator: check type :pr:`260`
  (Fabian Peter Hammerle)
* setup.py: follow PEP440 for the development version
* FileType/Metadata.load/save/delete no longer raise IOError or IOError
  subclasses. They only raise subclasses of MutagenError.


1.32 - 2016.05.02
-----------------

* Add basic SMF (Standard MIDI File) support (:mod:`mutagen.smf`)
* FLAC: add ``audio/flac`` mime type. 🐛`235`
* ASF: Fixed crash when object size is longer than the header and file length
  (Ben Ockmore)
* ID3: Validate attributes set after frame creation :bb-pr:`8`
  (Daniel Plachotich)
* MP4: validate values in ``__setitem__`` so things don't fail in save()
  🐛`236`
* tests: Fix SynchronizedTextSpec test on big-endian machines 🐛`247`
  (Daniel Plachotich)
* ID3: do type checking in ``__setitem__`` 🐛`251`
* Building the documentation now requires sphinx >= 1.3
* New :class:`mutagen.Tags` base class for tags
* Moved from Bitbucket to GitHub

1.31 - 2015.09.10
-----------------

* Tools: Support Unicode output under Windows 🐛`232`

1.30 - 2015.08.22
-----------------

* No change relevant for tools

1.29 - 2015.05.09
-----------------

* mid3v2: Fix an error under Python 3 with files without tags 🐛`219`
* mid3v2: Various Windows+Python2+Unicode fixes 🐛`214`

1.28 - 2015.03.06
-----------------

* Tools:

  * Add signal handling 🐛`170`
  * mid3cp: Make it work under Windows.
  * mutagen-inspect: Make it work under Windows+Python3 🐛`216`
  * Support unicode file paths under Windows+Python2 🐛`214`
  * Support file paths with invalid encoding under Unix+Python3.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.