1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146
|
Metadata-Version: 1.1
Name: pytaglib
Version: 0.3.6
Summary: Python (2.6+/3.1+) bindings for the TagLib audio metadata library
Home-page: http://github.com/supermihi/pytaglib
Author: Michael Helmling
Author-email: michaelhelmling@posteo.de
License: GPLv3+
Description: pytaglib – TagLib bindings for Python 2.x/3.x
==============================================
Overview
--------
pytaglib is a package of Python_ (2.6+/3.1+) bindings for TagLib_. To my
knowledge this so far is the only full-featured audio metadata library that
supports python3.x.
Also, the package gives you complete freedom over the tag names – you are
not limited to common tags like ``ARTIST``, ``ALBUM`` etc.; instead you may use
any string as key as long as the underlying metadata format supports it (most
of them do, including mp3, ogg, and FLAC). Moreover, you can even use multiple
values of the same tag, to e.g. store two artists, several genres, and so on.
.. _Python: http://www.python.org
.. _Taglib: http://taglib.github.com
Requirements
------------
To compile the bindings you need need the Cython_ compiler for your version
of python. Note that some distributions do not yet ship Cython compiled for
python3, but you can easily get it by typing::
sudo easy_install3 cython
into a console.
pytaglib uses TagLib_ features that have been added only in version 1.8-BETA,
so you need at least that version along with development headers. The recent
releases of most linux flavours nowadays ship taglib-1.8, including:
- Ubuntu 12.10
- Debian "experimental" branch
- Linux Mint 14
- Up-To-Date Arch Linux
- Gentoo Linux (unstable)
- Fedora 17
The upcoming release 1.9 of taglib is recommended, since it fixes some bugs
that may affect pytaglib in less common circumstances.
.. _Cython: http://www.cython.org
Installation
------------
As long as pytaglib is not contained in the major distribution's package
repositories, you have to install it manually by one of the following methods.
The easiest way is to use pip or easy_install::
sudo pip pytaglib
or::
sudo easy_install pytaglib
On most systems, this will install the python2 version; use something like::
sudo easy_install3 pytaglib
to build the package for python3 (the exact command depends on your
distribution).
Alternatively, you can download the source tarball and compile manually:
::
python3 setup.py build
python3 setup.py test # optional
sudo python3 setup.py install
Replace ``3`` by whatever Python version you use.
Basic Usage
-----------
The use of the library is pretty straightforward:
#. Load the library: ``import taglib``
#. Open a file: ``f = taglib.File("/path/to/file.mp3")``
#. Read tags from the dict ``f.tags``, mapping uppercase tag names to lists
of tag values (note that even single values are stored as list in order
to be consistent).
#. Some other information about the file is available as well: ``f.length``,
``f.sampleRate``, ``f.channels``, ``f.bitrate``, and ``f.readOnly``.
#. Alter the tags by manipulating the dictionary ``f.tags``. You should always
use uppercase tag names and the values must be strings.
#. Save everything: ``retval = f.save()``.
#. If some tags could not be saved because they are not supported by the
underlying format, those will be contained in the value returned from
``f.save()``.
The following snippet should show the most relevant features. For a complete
reference confer the online help via ``help(taglib.File)``.
::
$ python
Python 3.3.0 (default, Sep 29 2012, 15:50:43)
[GCC 4.7.1 20120721 (prerelease)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import taglib
>>> f = taglib.File("x.flac")
>>> f
File('x.flac')
>>> f.tags
{'ARTIST': ['piman', 'jzig'], 'ALBUM': ['Quod Libet Test Data'], 'TITLE': ['Silence'], 'GENRE': ['Silence'], 'TRACKNUMBER': ['02/10'], 'DATE': ['2004']}
>>> f.tags["ALBUM"] = ["Always use lists even for single values"]
>>> del f.tags["GENRE"]
>>> f.tags["ARTIST"].remove("jzig")
>>> retval = f.save()
>>> retval
{}
>>>
pyprinttags
-----------
This package also installs the small script ``pyprinttags``. It takes one or more files as
command-line parameters and will display all known metadata of that files on the terminal.
If unsupported tags (a.k.a. non-textual information) are found, they can optionally be removed
from the file.
Platform: UNKNOWN
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Cython
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|