[Python-modules-commits] [mutagen] 02/12: Import mutagen_1.38.orig.tar.gz

Tristan Seligmann mithrandi at moszumanska.debian.org
Tue Aug 8 02:38:41 UTC 2017


This is an automated email from the git hooks/post-receive script.

mithrandi pushed a commit to branch master
in repository mutagen.

commit d68e483fbb42ae4ea1cd174e4169629d961cdb68
Author: Tristan Seligmann <mithrandi at debian.org>
Date:   Tue Aug 8 03:26:12 2017 +0200

    Import mutagen_1.38.orig.tar.gz
---
 MANIFEST.in                                  |   2 +-
 NEWS                                         |  61 ++++-
 PKG-INFO                                     |  13 +-
 README.rst                                   |   9 +-
 docs/api/dsf.rst                             |  11 +
 docs/api/id3_frames.rst                      |  21 +-
 docs/api/index.rst                           |   1 +
 docs/conf.py                                 |  23 +-
 docs/ext.py                                  |  36 ---
 docs/extra.css                               |  32 +++
 docs/id3_frames_gen.py                       |   5 +-
 docs/index.rst                               |  10 +-
 docs/user/examples/fileobj-gio.py            |   5 +-
 docs/user/id3.rst                            |  54 ++++
 mutagen/__init__.py                          |   9 +-
 mutagen/_compat.py                           |   6 +-
 mutagen/_constants.py                        |   5 +
 mutagen/_file.py                             |  10 +-
 mutagen/_tags.py                             |   5 +-
 mutagen/_tools/__init__.py                   |   5 +-
 mutagen/_tools/_util.py                      |   5 +-
 mutagen/_tools/mid3cp.py                     |   7 +-
 mutagen/_tools/mid3iconv.py                  |  10 +-
 mutagen/_tools/mid3v2.py                     |   8 +-
 mutagen/_tools/moggsplit.py                  |   8 +-
 mutagen/_tools/mutagen_inspect.py            |   8 +-
 mutagen/_tools/mutagen_pony.py               |   5 +-
 mutagen/_util.py                             |  79 +++++-
 mutagen/_vorbis.py                           |   8 +-
 mutagen/aac.py                               |   5 +-
 mutagen/aiff.py                              |   6 +-
 mutagen/apev2.py                             |   6 +-
 mutagen/asf/__init__.py                      |   5 +-
 mutagen/asf/_attrs.py                        |   5 +-
 mutagen/asf/_objects.py                      |   5 +-
 mutagen/asf/_util.py                         |   5 +-
 mutagen/dsf.py                               | 358 +++++++++++++++++++++++++++
 mutagen/easyid3.py                           |   6 +-
 mutagen/easymp4.py                           |   6 +-
 mutagen/flac.py                              |  19 +-
 mutagen/id3/__init__.py                      |   6 +-
 mutagen/id3/_file.py                         |   6 +-
 mutagen/id3/_frames.py                       |  31 ++-
 mutagen/id3/_id3v1.py                        |   6 +-
 mutagen/id3/_specs.py                        |  16 +-
 mutagen/id3/_tags.py                         |   5 +-
 mutagen/id3/_util.py                         |   6 +-
 mutagen/m4a.py                               |   5 +-
 mutagen/monkeysaudio.py                      |   6 +-
 mutagen/mp3/__init__.py                      |  27 +-
 mutagen/mp3/_util.py                         | 118 ++++++++-
 mutagen/mp4/__init__.py                      | 103 ++++++--
 mutagen/mp4/_as_entry.py                     |   5 +-
 mutagen/mp4/_atom.py                         |   6 +-
 mutagen/mp4/_util.py                         |   5 +-
 mutagen/musepack.py                          |   6 +-
 mutagen/ogg.py                               |  30 ++-
 mutagen/oggflac.py                           |  10 +-
 mutagen/oggopus.py                           |   8 +-
 mutagen/oggspeex.py                          |   8 +-
 mutagen/oggtheora.py                         |   8 +-
 mutagen/oggvorbis.py                         |   8 +-
 mutagen/optimfrog.py                         |   6 +-
 mutagen/smf.py                               |   5 +-
 mutagen/trueaudio.py                         |   6 +-
 mutagen/wavpack.py                           |   6 +-
 setup.py                                     |   5 +-
 tests/__init__.py                            |  26 +-
 tests/data/2822400-1ch-0s-silence.dsf        | Bin 0 -> 4188 bytes
 tests/data/5644800-2ch-s01-silence.dsf       | Bin 0 -> 112988 bytes
 tests/data/audacious-trailing-id32-apev2.mp3 | Bin 0 -> 2906 bytes
 tests/data/audacious-trailing-id32-id31.mp3  | Bin 0 -> 15272 bytes
 tests/data/lame397v9short.mp3                | Bin 0 -> 552 bytes
 tests/data/with-id3.dsf                      | Bin 0 -> 1147 bytes
 tests/data/without-id3.dsf                   | Bin 0 -> 4188 bytes
 tests/quality/__init__.py                    |   5 +-
 tests/quality/test_pep8.py                   |  53 ++--
 tests/quality/test_pyflakes.py               |   5 +-
 tests/test___init__.py                       |   9 +
 tests/test__id3frames.py                     |   6 +
 tests/test__id3specs.py                      |   9 +-
 tests/test__util.py                          |  59 ++++-
 tests/test_dsf.py                            | 124 ++++++++++
 tests/test_encoding.py                       |   5 +-
 tests/test_flac.py                           |   9 +
 tests/test_id3.py                            |  35 ++-
 tests/test_mp3.py                            |  89 ++++++-
 tests/test_mp4.py                            |  39 ++-
 tests/test_ogg.py                            |  43 ++++
 tests/test_tools_mid3cp.py                   |   8 +-
 tools/mid3cp                                 |   5 +-
 tools/mid3iconv                              |   5 +-
 tools/mid3v2                                 |   5 +-
 tools/moggsplit                              |   5 +-
 tools/mutagen-inspect                        |   5 +-
 tools/mutagen-pony                           |   5 +-
 96 files changed, 1568 insertions(+), 330 deletions(-)

diff --git a/MANIFEST.in b/MANIFEST.in
index e466433..bf03042 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -8,5 +8,5 @@ include tests/quality/*
 include tests/*.py
 include man/*.1
 recursive-include mutagen README.rst
-recursive-include docs *.py Makefile *.rst *.png *.svg *.ico
+recursive-include docs *.py Makefile *.rst *.png *.svg *.ico *.css
 prune docs/_build
diff --git a/NEWS b/NEWS
index 6e2589c..bf1bc0e 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,53 @@
+1.38 - 2017-06-01
+-----------------
+
+* Note: New release tarballs are now hosted on github:
+  https://github.com/quodlibet/mutagen/releases
+* ID3:
+
+  * Add iTunes grouping frame `id3.GRP1` :bug:`304`
+  * Fix exposing text frames where the text can't be encoded with the
+    reported encoding due to merging of frames :bug:`307`
+
+* OGG: Fix wrong StreamInfo.length (small negative value) for all
+  ogg based formats in rare cases. :bug:`308`
+
+
+1.37 - 2017.02.24
+-----------------
+
+* Relicense "GPLv2" → "GPLv2 or later" :bug:`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 :bug:`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`` :bug:`130`
+
+
+1.36.3 - 2017.02.24
+-------------------
+
+* MP3: fix error with xing frames without a frame count :bug:`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 :bug:`286`
+* FLAC: Fix crash when loading files with zero samples :bug:`287`
+* MP3: Handle broken lame tags written by older lame versions
+
+
 1.36 - 2016.12.22
 -----------------
 
@@ -97,8 +147,8 @@
 * FLAC: add ``audio/flac`` mime type. :bug:`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)
+* ID3: Validate attributes set after frame creation :commit:`69368c31e00`
+  (:user:`Daniel Plachotich <danpla>`)
 * MP4: validate values in ``__setitem__`` so things don't fail in save()
   :bug:`236`
 * tests: Fix SynchronizedTextSpec test on big-endian machines :bug:`247`
@@ -207,7 +257,8 @@
 * MP4:
 
   * New ``MP4Info.codec`` for identifying the contained audio codec
-    e.g. ``"mp4a"``, ``"alac"``, ``"mp4a.40.2"``, ``"ac-3"`` etc. :bb-pr:`6`
+    e.g. ``"mp4a"``, ``"alac"``, ``"mp4a.40.2"``, ``"ac-3"`` etc.
+    :commit:`b2f22b81c77`
   * New ``MP4Info.codec_description``: name of the audio codec
     e.g. ``"ALAC"``, ``"AAC LC"``, ``"AC-3"``
 
@@ -228,7 +279,7 @@
 * MP4:
 
   * Parse channels/sample_rate/bits_per_sample/bitrate for ALAC files
-    :bug:`199` :bb-pr:`5` (Adrian Sampson, Christoph Reiter)
+    :bug:`199` :commit:`192cfcaf14` (Adrian Sampson, Christoph Reiter)
 
 * ASF:
 
@@ -243,7 +294,7 @@
 
 * docs:
 
-  * New logo :bb-pr:`4` (Samuel Messner)
+  * New logo :commit:`b728fa75` (:user:`Samuel Messner <obskyr>`)
   * Add examples for handling cover art in vorbiscomment :bug:`200`
   * Add examples for id3v2.3
 
diff --git a/PKG-INFO b/PKG-INFO
index 0d2e275..15eca7c 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,12 +1,18 @@
 Metadata-Version: 1.1
 Name: mutagen
-Version: 1.36
+Version: 1.38
 Summary: read and write audio tags for many formats
 Home-page: https://github.com/quodlibet/mutagen
 Author: Michael Urman
 Author-email: quod-libet-development at groups.google.com
 License: GNU GPL v2
-Description: Mutagen is a Python module to handle audio metadata. It supports ASF, FLAC,
+Description: .. image:: https://cdn.rawgit.com/quodlibet/mutagen/master/docs/images/logo.svg
+           :align: center
+           :width: 400px
+        
+        |
+        
+        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.
@@ -15,7 +21,8 @@ Description: Mutagen is a Python module to handle audio metadata. It supports AS
         manipulate Ogg streams on an individual packet/page level.
         
         Mutagen works with Python 2.7, 3.3+ (CPython and PyPy) on Linux, Windows and
-        macOS, and has no dependencies outside the Python standard library.
+        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
         
diff --git a/README.rst b/README.rst
index 7293508..dd5dce4 100644
--- a/README.rst
+++ b/README.rst
@@ -1,3 +1,9 @@
+.. image:: https://cdn.rawgit.com/quodlibet/mutagen/master/docs/images/logo.svg
+   :align: center
+   :width: 400px
+
+|
+
 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
@@ -7,7 +13,8 @@ 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 2.7, 3.3+ (CPython and PyPy) on Linux, Windows and
-macOS, and has no dependencies outside the Python standard library.
+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
 
diff --git a/docs/api/dsf.rst b/docs/api/dsf.rst
new file mode 100644
index 0000000..a1bfb0a
--- /dev/null
+++ b/docs/api/dsf.rst
@@ -0,0 +1,11 @@
+DSF
+---
+
+.. automodule:: mutagen.dsf
+
+.. autoclass:: mutagen.dsf.DSF(filething)
+    :show-inheritance:
+    :members:
+
+.. autoclass:: mutagen.dsf.DSFInfo()
+    :members:
diff --git a/docs/api/id3_frames.rst b/docs/api/id3_frames.rst
index fa697f1..cf92598 100644
--- a/docs/api/id3_frames.rst
+++ b/docs/api/id3_frames.rst
@@ -50,7 +50,7 @@ ID3v2.3/4 Frames
 ----------------
 
 
-.. autoclass:: mutagen.id3.AENC(owner=u'', preview_start=0, preview_length=0)
+.. autoclass:: mutagen.id3.AENC(owner=u'', preview_start=0, preview_length=0, data='')
     :show-inheritance:
     :members:
 
@@ -105,7 +105,12 @@ ID3v2.3/4 Frames
     :members:
 
 
-.. autoclass:: mutagen.id3.GRID(owner=u'', group=128)
+.. autoclass:: mutagen.id3.GRID(owner=u'', group=128, data='')
+    :show-inheritance:
+    :members:
+
+
+.. autoclass:: mutagen.id3.GRP1(encoding=<Encoding.UTF16: 1>, text=[])
     :show-inheritance:
     :members:
 
@@ -115,7 +120,7 @@ ID3v2.3/4 Frames
     :members:
 
 
-.. autoclass:: mutagen.id3.LINK(frameid='XXXX', url=u'')
+.. autoclass:: mutagen.id3.LINK(frameid='XXXX', url=u'', data='')
     :show-inheritance:
     :members:
 
@@ -130,6 +135,16 @@ ID3v2.3/4 Frames
     :members:
 
 
+.. autoclass:: mutagen.id3.MVIN(encoding=<Encoding.UTF16: 1>, text=[])
+    :show-inheritance:
+    :members:
+
+
+.. autoclass:: mutagen.id3.MVNM(encoding=<Encoding.UTF16: 1>, text=[])
+    :show-inheritance:
+    :members:
+
+
 .. autoclass:: mutagen.id3.OWNE(encoding=<Encoding.UTF16: 1>, price=u'', date='19700101', seller=u'')
     :show-inheritance:
     :members:
diff --git a/docs/api/index.rst b/docs/api/index.rst
index c84fe30..8d8ca89 100644
--- a/docs/api/index.rst
+++ b/docs/api/index.rst
@@ -8,6 +8,7 @@ API Reference
     aiff
     ape
     asf
+    dsf
     flac
     id3
     monkeysaudio
diff --git a/docs/conf.py b/docs/conf.py
index 40faa34..4bc64da 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -13,7 +13,7 @@ extensions = [
     'sphinx.ext.autodoc',
     'sphinx.ext.napoleon',
     'sphinx.ext.intersphinx',
-    'ext',
+    'sphinx.ext.extlinks',
 ]
 intersphinx_mapping = {
     'python': ('https://docs.python.org/2.7', None),
@@ -26,9 +26,14 @@ copyright = u'2016, Joe Wreschnig, Michael Urman, Lukáš Lalinský, ' \
             u'Christoph Reiter, Ben Ockmore & others'
 html_title = project
 exclude_patterns = ['_build']
-bug_url_template = "https://github.com/quodlibet/mutagen/issues/%s"
-pr_url_template = "https://github.com/quodlibet/mutagen/pull/%s"
-bbpr_url_template = "https://bitbucket.org/lazka/mutagen/pull-requests/%s"
+
+extlinks = {
+    'bug': ('https://github.com/quodlibet/mutagen/issues/%s', '#'),
+    'pr': ('https://github.com/quodlibet/mutagen/pull/%s', '#pr'),
+    'commit': ('https://github.com/quodlibet/mutagen/commit/%s', '#'),
+    'user': ('https://github.com/%s', ''),
+}
+
 
 autodoc_member_order = "bysource"
 default_role = "obj"
@@ -38,3 +43,13 @@ html_favicon = "images/favicon.ico"
 html_theme_options = {
     "display_version": False,
 }
+
+html_context = {
+    'extra_css_files': [
+        '_static/extra.css',
+    ],
+}
+
+html_static_path = [
+    "extra.css",
+]
diff --git a/docs/ext.py b/docs/ext.py
deleted file mode 100644
index 8949d62..0000000
--- a/docs/ext.py
+++ /dev/null
@@ -1,36 +0,0 @@
-# -*- coding: utf-8 -*-
-
-from docutils import nodes
-
-
-def bug_role(name, rawtext, text, lineno, inliner, *args, **kwargs):
-    app = inliner.document.settings.env.app
-    url_tmpl = app.config.bug_url_template or "missing/%s"
-    node = nodes.reference(
-        rawtext,
-        "[%s]" % text,
-        refuri=url_tmpl % text)
-    return [node], []
-
-
-def pr_role(name, rawtext, text, lineno, inliner, *args, **kwargs):
-    app = inliner.document.settings.env.app
-    if name == "pr":
-        url_tmpl = app.config.pr_url_template
-    else:
-        url_tmpl = app.config.bbpr_url_template
-    url_tmpl = url_tmpl or "missing/%s"
-    node = nodes.reference(
-        rawtext,
-        "[%s-%s]" % (name, text),
-        refuri=url_tmpl % text)
-    return [node], []
-
-
-def setup(app):
-    app.add_role('bug', bug_role)
-    app.add_config_value('bug_url_template', None, 'env')
-    app.add_role('bb-pr', pr_role)
-    app.add_role('pr', pr_role)
-    app.add_config_value('pr_url_template', None, 'env')
-    app.add_config_value('bbpr_url_template', None, 'env')
diff --git a/docs/extra.css b/docs/extra.css
new file mode 100644
index 0000000..9cb4d76
--- /dev/null
+++ b/docs/extra.css
@@ -0,0 +1,32 @@
+.wy-side-nav-search {
+    background-color: initial;
+}
+
+.wy-nav-side, .wy-nav-top {
+    background-color: #24292E;
+}
+
+.wy-side-nav-search input[type="text"] {
+    border-color: transparent;
+}
+
+.wy-nav-content {
+    margin: initial;
+}
+
+.rst-content div[role=navigation], footer {
+   font-size: 0.85em;
+   color: #999;
+}
+
+.rst-content div[role=navigation] hr {
+    margin-top: 6px;
+}
+
+footer hr {
+    margin-bottom: 6px;
+}
+
+.rst-footer-buttons {
+    display: none;
+}
diff --git a/docs/id3_frames_gen.py b/docs/id3_frames_gen.py
index 162085f..2c26124 100755
--- a/docs/id3_frames_gen.py
+++ b/docs/id3_frames_gen.py
@@ -3,8 +3,9 @@
 # Copyright 2013 Christoph Reiter
 #
 # This program is free software; you can redistribute it and/or modify
-# it under the terms of version 2 of the GNU General Public License as
-# published by the Free Software Foundation.
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
 
 """
 ./id3_frames_gen.py > api/id3_frames.rst
diff --git a/docs/index.rst b/docs/index.rst
index 4956d1d..954b63d 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -2,6 +2,8 @@
    :align: center
    :width: 400px
 
+|
+
 .. toctree::
     :hidden:
     :titlesonly:
@@ -16,6 +18,7 @@
 .. title:: Overview
 
 .. include:: ../README.rst
+    :start-after: |
 
 ----
 
@@ -40,9 +43,10 @@ or
 Where do I get it?
 ------------------
 
-Mutagen is hosted on `GitHub <https://github.com/quodlibet/mutagen>`_. The 
-`download page <https://bitbucket.org/lazka/mutagen/downloads>`_ will have the 
-latest version or check out the git repository::
+Mutagen is hosted on `GitHub <https://github.com/quodlibet/mutagen>`_. The
+`download page <https://github.com/quodlibet/mutagen/releases>`_ or `PyPI
+<https://pypi.org/project/mutagen>`_ will have the latest version or check out
+the git repository::
 
     $ git clone https://github.com/quodlibet/mutagen.git
 
diff --git a/docs/user/examples/fileobj-gio.py b/docs/user/examples/fileobj-gio.py
index 966f483..42d6b20 100644
--- a/docs/user/examples/fileobj-gio.py
+++ b/docs/user/examples/fileobj-gio.py
@@ -3,8 +3,9 @@
 # Copyright 2016 Christoph Reiter
 #
 # This program is free software; you can redistribute it and/or modify
-# it under the terms of version 2 of the GNU General Public License as
-# published by the Free Software Foundation.
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
 
 
 import mutagen
diff --git a/docs/user/id3.rst b/docs/user/id3.rst
index ce63647..aaa5aa8 100644
--- a/docs/user/id3.rst
+++ b/docs/user/id3.rst
@@ -1,3 +1,5 @@
+.. currentmodule:: mutagen.id3
+
 ===
 ID3
 ===
@@ -17,6 +19,58 @@ If you use the ID3 module, you should familiarize yourself with how
 ID3v2 tags are stored, by reading the the details of the ID3v2
 standard at http://id3.org/id3v2.4.0-structure.
 
+ID3 Dict Interface
+^^^^^^^^^^^^^^^^^^
+
+.. code:: pycon
+
+    >>> mutagen.File("01. On The Road Again.mp3").keys()
+    [u'TXXX:replaygain_album_peak', u'RVA2:track', u'APIC:picture',
+     u'UFID:http://musicbrainz.org', 'TDRC', u'TXXX:replaygain_track_peak',
+     'TIT2', u'RVA2:album', u'TXXX:replaygain_track_gain',
+     u'TXXX:MusicBrainz Album Id', 'TRCK', 'TPE1', 'TALB',
+     u'TXXX:MusicBrainz Album Artist Id', u'TXXX:replaygain_album_gain']
+    >>>
+
+
+On the first look the key format in the ID3 dict seem a bit confusing, this is
+because they are the frame hashes of the corresponding dict values
+(:obj:`Frame.HashKey`). For example the ID3 specification states that there
+can't be two APIC frames with the same description, so the frame hash contains
+the description and adding a new frame with the same description will replace
+the old one. Only the first four letters always represent the frame type name.
+
+In many cases you don't care about the hash and just want to look up all
+frames of one type. For this use the :meth:`ID3Tags.getall` method:
+
+.. code:: pycon
+
+    >>> for frame in mutagen.File("01. On The Road Again.mp3").tags.getall("TXXX"):
+    ...     frame
+    ...
+    TXXX(encoding=<Encoding.LATIN1: 0>, desc=u'replaygain_album_peak', text=[u'1.00000000047'])
+    TXXX(encoding=<Encoding.LATIN1: 0>, desc=u'replaygain_track_peak', text=[u'1.00000000047'])
+    TXXX(encoding=<Encoding.LATIN1: 0>, desc=u'replaygain_track_gain', text=[u'-7.429688 dB'])
+    TXXX(encoding=<Encoding.LATIN1: 0>, desc=u'MusicBrainz Album Id', text=[u'be6fb9b0-5073-4633-aefa-c559554f28e5'])
+    TXXX(encoding=<Encoding.LATIN1: 0>, desc=u'MusicBrainz Album Artist Id', text=[u'815a0279-558c-4522-ac3b-6a1e259e95b5'])
+    TXXX(encoding=<Encoding.LATIN1: 0>, desc=u'replaygain_album_gain', text=[u'-7.429688 dB'])
+
+For adding new frames you can use the :meth:`ID3Tags.add` method, which will
+use the frame hash as key. For example the ID3 spec only allows one TALB
+frame, so passing a TALB frame to add() will replace the old frame:
+
+.. code:: pycon
+
+    >>> tags.getall("TALB")
+    [TALB(encoding=<Encoding.UTF8: 3>, text=[u'The Very Best of Canned Heat'])]
+    >>> tags.add(TALB(text=[u"new value"]))
+    >>> tags.getall("TALB")
+    [TALB(encoding=<Encoding.UTF16: 1>, text=[u'new value'])]
+    >>>
+
+There is also a corresponding :meth:`ID3Tags.delall` method for deleting all
+frames of one type.
+
 
 ID3 Versions
 ^^^^^^^^^^^^
diff --git a/mutagen/__init__.py b/mutagen/__init__.py
index b9c0088..ffe87e1 100644
--- a/mutagen/__init__.py
+++ b/mutagen/__init__.py
@@ -1,11 +1,10 @@
 # -*- coding: utf-8 -*-
-
 # Copyright (C) 2005  Michael Urman
 #
 # This program is free software; you can redistribute it and/or modify
-# it under the terms of version 2 of the GNU General Public License as
-# published by the Free Software Foundation.
-
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
 
 """Mutagen aims to be an all purpose multimedia tagging library.
 
@@ -24,7 +23,7 @@ from mutagen._util import MutagenError
 from mutagen._file import FileType, StreamInfo, File
 from mutagen._tags import Tags, Metadata, PaddingInfo
 
-version = (1, 36)
+version = (1, 38)
 """Version tuple."""
 
 version_string = ".".join(map(str, version))
diff --git a/mutagen/_compat.py b/mutagen/_compat.py
index 77c465f..ebb80ea 100644
--- a/mutagen/_compat.py
+++ b/mutagen/_compat.py
@@ -1,10 +1,10 @@
 # -*- coding: utf-8 -*-
-
 # Copyright (C) 2013  Christoph Reiter
 #
 # This program is free software; you can redistribute it and/or modify
-# it under the terms of version 2 of the GNU General Public License as
-# published by the Free Software Foundation.
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
 
 import sys
 
diff --git a/mutagen/_constants.py b/mutagen/_constants.py
index 62c1ce0..5c1c1a1 100644
--- a/mutagen/_constants.py
+++ b/mutagen/_constants.py
@@ -1,4 +1,9 @@
 # -*- coding: utf-8 -*-
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
 
 """Constants used by Mutagen."""
 
diff --git a/mutagen/_file.py b/mutagen/_file.py
index 6c4a1b4..1ccbf24 100644
--- a/mutagen/_file.py
+++ b/mutagen/_file.py
@@ -1,9 +1,10 @@
-# Copyright (C) 2005  Michael Urman
 # -*- coding: utf-8 -*-
+# Copyright (C) 2005  Michael Urman
 #
 # This program is free software; you can redistribute it and/or modify
-# it under the terms of version 2 of the GNU General Public License as
-# published by the Free Software Foundation.
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
 
 import warnings
 
@@ -263,10 +264,11 @@ def File(filething, options=None, easy=False):
         from mutagen.aiff import AIFF
         from mutagen.aac import AAC
         from mutagen.smf import SMF
+        from mutagen.dsf import DSF
         options = [MP3, TrueAudio, OggTheora, OggSpeex, OggVorbis, OggFLAC,
                    FLAC, AIFF, APEv2File, MP4, ID3FileType, WavPack,
                    Musepack, MonkeysAudio, OptimFROG, ASF, OggOpus, AAC,
-                   SMF]
+                   SMF, DSF]
 
     if not options:
         return None
diff --git a/mutagen/_tags.py b/mutagen/_tags.py
index fd5f093..c3f2ebf 100644
--- a/mutagen/_tags.py
+++ b/mutagen/_tags.py
@@ -2,8 +2,9 @@
 # Copyright (C) 2005  Michael Urman
 #
 # This program is free software; you can redistribute it and/or modify
-# it under the terms of version 2 of the GNU General Public License as
-# published by the Free Software Foundation.
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
 
 from ._util import loadfile
 
diff --git a/mutagen/_tools/__init__.py b/mutagen/_tools/__init__.py
index e4806d9..3e6b155 100644
--- a/mutagen/_tools/__init__.py
+++ b/mutagen/_tools/__init__.py
@@ -2,5 +2,6 @@
 # Copyright 2016 Christoph Reiter
 #
 # This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License version 2 as
-# published by the Free Software Foundation.
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
diff --git a/mutagen/_tools/_util.py b/mutagen/_tools/_util.py
index 8a390b7..4e05076 100644
--- a/mutagen/_tools/_util.py
+++ b/mutagen/_tools/_util.py
@@ -2,8 +2,9 @@
 # Copyright 2015 Christoph Reiter
 #
 # This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License version 2 as
-# published by the Free Software Foundation.
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
 
 import os
 import signal
diff --git a/mutagen/_tools/mid3cp.py b/mutagen/_tools/mid3cp.py
index 7d96f63..1339548 100644
--- a/mutagen/_tools/mid3cp.py
+++ b/mutagen/_tools/mid3cp.py
@@ -1,9 +1,10 @@
 # -*- coding: utf-8 -*-
 # Copyright 2014 Marcus Sundman
-
+#
 # This program is free software; you can redistribute it and/or modify
-# it under the terms of version 2 of the GNU General Public License as
-# published by the Free Software Foundation.
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
 
 """A program replicating the functionality of id3lib's id3cp, using mutagen for
 tag loading and saving.
diff --git a/mutagen/_tools/mid3iconv.py b/mutagen/_tools/mid3iconv.py
index b9d165c..f2d725a 100644
--- a/mutagen/_tools/mid3iconv.py
+++ b/mutagen/_tools/mid3iconv.py
@@ -1,10 +1,14 @@
 # -*- coding: utf-8 -*-
-# ID3iconv is a Java based ID3 encoding convertor, here's the Python version.
 # Copyright 2006 Emfox Zhou <EmfoxZhou at gmail.com>
 #
 # This program is free software; you can redistribute it and/or modify
-# it under the terms of version 2 of the GNU General Public License as
-# published by the Free Software Foundation.
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+
+"""
+ID3iconv is a Java based ID3 encoding convertor, here's the Python version.
+"""
 
 import sys
 import locale
diff --git a/mutagen/_tools/mid3v2.py b/mutagen/_tools/mid3v2.py
index f903e32..8d21c13 100644
--- a/mutagen/_tools/mid3v2.py
+++ b/mutagen/_tools/mid3v2.py
@@ -1,10 +1,12 @@
 # -*- coding: utf-8 -*-
-# Pretend to be /usr/bin/id3v2 from id3lib, sort of.
 # Copyright 2005 Joe Wreschnig
 #
 # This program is free software; you can redistribute it and/or modify
-# it under the terms of version 2 of the GNU General Public License as
-# published by the Free Software Foundation.
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+
+"""Pretend to be /usr/bin/id3v2 from id3lib, sort of."""
 
 import sys
 import codecs
diff --git a/mutagen/_tools/moggsplit.py b/mutagen/_tools/moggsplit.py
index cbef401..12cd252 100644
--- a/mutagen/_tools/moggsplit.py
+++ b/mutagen/_tools/moggsplit.py
@@ -1,10 +1,12 @@
 # -*- coding: utf-8 -*-
-# Split a multiplex/chained Ogg file into its component parts.
 # Copyright 2006 Joe Wreschnig
 #
 # This program is free software; you can redistribute it and/or modify
-# it under the terms of version 2 of the GNU General Public License as
-# published by the Free Software Foundation.
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+
+"""Split a multiplex/chained Ogg file into its component parts."""
 
 import os
 
diff --git a/mutagen/_tools/mutagen_inspect.py b/mutagen/_tools/mutagen_inspect.py
index fce55b6..6bd6c61 100644
--- a/mutagen/_tools/mutagen_inspect.py
+++ b/mutagen/_tools/mutagen_inspect.py
@@ -1,10 +1,12 @@
 # -*- coding: utf-8 -*-
-# Full tag list for any given file.
 # Copyright 2005 Joe Wreschnig
 #
 # This program is free software; you can redistribute it and/or modify
-# it under the terms of version 2 of the GNU General Public License as
-# published by the Free Software Foundation.
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+
+"""Full tag list for any given file."""
 
 from mutagen._senf import print_, argv
 from mutagen._compat import text_type
diff --git a/mutagen/_tools/mutagen_pony.py b/mutagen/_tools/mutagen_pony.py
index 093240e..e4a496c 100644
--- a/mutagen/_tools/mutagen_pony.py
+++ b/mutagen/_tools/mutagen_pony.py
@@ -2,8 +2,9 @@
 # Copyright 2005 Joe Wreschnig, Michael Urman
 #
 # This program is free software; you can redistribute it and/or modify
-# it under the terms of version 2 of the GNU General Public License as
-# published by the Free Software Foundation.
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
 
 import os
 import sys
diff --git a/mutagen/_util.py b/mutagen/_util.py
index 491f0a9..a178eaa 100644
--- a/mutagen/_util.py
+++ b/mutagen/_util.py
@@ -1,10 +1,10 @@
 # -*- coding: utf-8 -*-
-
 # Copyright (C) 2006  Joe Wreschnig
 #
 # This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License version 2 as
-# published by the Free Software Foundation.
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
 
 """Utility classes for Mutagen.
 
@@ -16,7 +16,13 @@ import sys
 import struct
 import codecs
 import errno
-import mmap
+
+try:
+    import mmap
+except ImportError:
+    # Google App Engine has no mmap:
+    #   https://github.com/quodlibet/mutagen/issues/286
+    mmap = None
 
 from collections import namedtuple
 from contextlib import contextmanager
@@ -527,6 +533,19 @@ def _fill_cdata(cls):
                 if s.size == 1:
                     esuffix = ""
                 bits = str(s.size * 8)
+
+                if unsigned:
+                    max_ = 2 ** (s.size * 8) - 1
+                    min_ = 0
+                else:
+                    max_ = 2 ** (s.size * 8 - 1) - 1
+                    min_ = - 2 ** (s.size * 8 - 1)
+
+                funcs["%s%s_min" % (prefix, name)] = min_
+                funcs["%s%s_max" % (prefix, name)] = max_
+                funcs["%sint%s_min" % (prefix, bits)] = min_
+                funcs["%sint%s_max" % (prefix, bits)] = max_
+
                 funcs["%s%s%s" % (prefix, name, esuffix)] = unpack
                 funcs["%sint%s%s" % (prefix, bits, esuffix)] = unpack
                 funcs["%s%s%s_from" % (prefix, name, esuffix)] = unpack_from
@@ -644,6 +663,8 @@ def mmap_move(fileobj, dest, src, count):
         ValueError: In case invalid parameters were given
     """
 
+    assert mmap is not None, "no mmap support"
+
     if dest < 0 or src < 0 or count < 0:
         raise ValueError("Invalid parameters")
 
@@ -789,9 +810,12 @@ def insert_bytes(fobj, size, offset, BUFFER_SIZE=2 ** 16):
 
     resize_file(fobj, size, BUFFER_SIZE)
 
-    try:
-        mmap_move(fobj, offset + size, offset, movesize)
-    except mmap.error:
+    if mmap is not None:
+        try:
+            mmap_move(fobj, offset + size, offset, movesize)
+        except mmap.error:
+            fallback_move(fobj, offset + size, offset, movesize, BUFFER_SIZE)
+    else:
         fallback_move(fobj, offset + size, offset, movesize, BUFFER_SIZE)
 
 
@@ -820,9 +844,12 @@ def delete_bytes(fobj, size, offset, BUFFER_SIZE=2 ** 16):
     if movesize < 0:
         raise ValueError
 
-    try:
-        mmap_move(fobj, offset, offset + size, movesize)
-    except mmap.error:
+    if mmap is not None:
+        try:
+            mmap_move(fobj, offset, offset + size, movesize)
+        except mmap.error:
+            fallback_move(fobj, offset, offset + size, movesize, BUFFER_SIZE)
+    else:
         fallback_move(fobj, offset, offset + size, movesize, BUFFER_SIZE)
 
     resize_file(fobj, -size, BUFFER_SIZE)
@@ -874,6 +901,38 @@ def dict_match(d, key, default=None):
     return default
 
 
+def encode_endian(text, encoding, errors="strict", le=True):
+    """Like text.encode(encoding) but always returns little endian/big endian
+    BOMs instead of the system one.
+
+    Args:
+        text (text)
+        encoding (str)
+        errors (str)
+        le (boolean): if little endian
+    Returns:
+        bytes
+    Raises:
+        UnicodeEncodeError
+        LookupError
+    """
+
+    encoding = codecs.lookup(encoding).name
+
+    if encoding == "utf-16":
+        if le:
+            return codecs.BOM_UTF16_LE + text.encode("utf-16-le", errors)
+        else:
+            return codecs.BOM_UTF16_BE + text.encode("utf-16-be", errors)
+    elif encoding == "utf-32":
+        if le:
+            return codecs.BOM_UTF32_LE + text.encode("utf-32-le", errors)
+        else:
+            return codecs.BOM_UTF32_BE + text.encode("utf-32-be", errors)
+    else:
+        return text.encode(encoding, errors)
+
+
 def decode_terminated(data, encoding, strict=True):
     """Returns the decoded data until the first NULL terminator
     and all data after it.
diff --git a/mutagen/_vorbis.py b/mutagen/_vorbis.py
... 2581 lines suppressed ...

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/mutagen.git



More information about the Python-modules-commits mailing list