Support for ID3 tags. A cs.binary based parser/transcriber for ID3 tags and a convenience wrapper for Doug Zongker's pyid3lib: http://pyid3lib.sourceforge.net/
Project description
Support for ID3 tags. A cs.binary based parser/transcriber for ID3 tags and a convenience wrapper for Doug Zongker's pyid3lib: http://pyid3lib.sourceforge.net/
Latest release 20260531: Provide value_type for the BinarySingleValue subclasses.
Short summary:
EnhancedTagFrame: An Enhanced Tag.ID3: Wrapper for pyid3lib.tag.ID3V1Frame: An ID3V1 or ID3v1.1 data frame as described in wikipedia: https://en.wikipedia.org/wiki/ID3.ID3V22TagDataFrame: An ID3 v2.2.0 tag data frame.ID3V23TagDataFrame: An ID3 v2.3.0 tag data frame.ID3V2Frame: An ID3v2 frame, based on the document at: https://web.archive.org/web/20120527211939/http://www.unixgods.org/~tilo/ID3/docs/id3v2-00.html.ID3V2Size: An ID3v2 size field, a big endian 4 byte field of 7-bit values, high bit 0.ID3V2Tags: AnID3V2Tagsmaps ID3V2 tag information as aSimpleNamespace.ISO8859_1NULString: A NUL terminated string encoded with ISO8859-1.padded_text: Encodetextusingencoding, crop to a maximum oflengthbytes, pad with NULs tolengthif necessary.parse_padded_text: Fetchlengthbytes frombfr, strip trailing NULs, decode usingencoding(default'ascii'), strip trailling whitepsace.TextEncodingClass: A trite class to parse the single byte text encoding field.TextInformationFrameBody: A text information frame.UCS2NULString: A NUL terminated string encoded with UCS-2.
Module contents:
EnhancedTagFrame.parse(bfr):
Parse an enhanced tag.
EnhancedTagFrame.transcribe(self):
Transcribe the enhanced tag.
-
class ID3(types.SimpleNamespace): Wrapper for pyid3lib.tag.OBSOLETE. Going away when I'm sure the other classes cover all this stuff off.
ID3.__getitem__(self, key):
Fetch the text of the specified frame.
ID3.__setitem__(self, key, value):
Set a frame text to value.
ID3.clean(self, attr):
Strip NULs and leading and trailing whitespace.
ID3.flush(self):
Update the ID3 tags in the file if modified, otherwise no-op.
Clears the modified flag.
ID3.get_frame(self, frameid):
Return the frame with the specified frameid, or None.
ID3.tag:
The tag mapping from self.pathname.
-
class ID3V1Frame(cs.binary.SimpleBinary): An ID3V1 or ID3v1.1 data frame as described in wikipedia: https://en.wikipedia.org/wiki/ID3The following fields are defined:
title: up to 30 ASCII charactersartist: up to 30 ASCII charactersalbum: up to 30 ASCII charactersyear: 4 digit ASCII yearcomment: up to 30 ASCII bytes, NUL or whitespace padded, up to 28 ASCII bytes iftrackis nonzerotrack: 0 for no track, a number from 1 through 255 otherwise; if nonzero then the comment field may only be up to 28 bytes longgenre_id: a number value from 0 to 255
ID3V1Frame.parse(bfr):
Parse a 128 byte ID3V1 or ID3v1.1 record.
ID3V1Frame.tagset(self):
Return a TagSet with the ID3 tag information.
ID3V1Frame.transcribe(self):
Transcribe the ID3V1 frame.
-
class ID3V22TagDataFrame(cs.binary.SimpleBinary): An ID3 v2.2.0 tag data frame.Reference doc: https://id3.org/id3v2-00
ID3V22TagDataFrame.tag_id_class(tag_id):
Return the AbstractBinary subclass to decode the a tag body from its tag id.
Return None for unrecognised ids.
-
class ID3V23TagDataFrame(cs.binary.SimpleBinary): An ID3 v2.3.0 tag data frame.Reference doc: https://id3.org/id3v2.3.0
ID3V23TagDataFrame.tag_id_class(tag_id):
Return the AbstractBinary subclass to decode the a tag body from its tag id.
Return None for unrecognised ids.
class ID3V2Frame(cs.binary.SimpleBinary): An ID3v2 frame, based on the document at: https://web.archive.org/web/20120527211939/http://www.unixgods.org/~tilo/ID3/docs/id3v2-00.html
ID3V2Frame.parse(bfr):
Return an ID3v2 frame as described here:
ID3V2Frame.tagset(self):
Return a TagSet with the ID3 tag information.
ID3V2Frame.transcribe(self):
Transcribe the ID3v2 frame.
class ID3V2Size(cs.binary.BinarySingleValue): An ID3v2 size field, a big endian 4 byte field of 7-bit values, high bit 0.
ID3V2Size.VALUE_TYPE
ID3V2Size.parse_value(bfr):
Read an ID3V2 size field from bfr, return the size.
ID3V2Size.transcribe_value(size):
Transcribe a size in ID3v2 format.
class ID3V2Tags(types.SimpleNamespace): AnID3V2Tagsmaps ID3V2 tag information as aSimpleNamespace.
ID3V2Tags.__getattr__(self, attr):
Catch frame id attrs and their wordier versions.
ID3V2Tags.__setattr__(self, attr, value):
Map attributes to frame ids, set the corresponding __dict__ entry.
class ISO8859_1NULString(cs.binary.BinarySingleValue): A NUL terminated string encoded with ISO8859-1.
ISO8859_1NULString.VALUE_TYPE
ISO8859_1NULString.transcribe_value(s):
pylint: disable=arguments-differ
padded_text(text, length, encoding='ascii'): Encodetextusingencoding, crop to a maximum oflengthbytes, pad with NULs tolengthif necessary.parse_padded_text(bfr, length, encoding='ascii'): Fetchlengthbytes frombfr, strip trailing NULs, decode usingencoding(default'ascii'), strip trailling whitepsace.class TextEncodingClass(cs.binary.BinarySingleValue): A trite class to parse the single byte text encoding field.
TextEncodingClass.VALUE_TYPE
TextInformationFrameBody.parse(bfr):
Parse the text from the frame.
TextInformationFrameBody.transcribe(self):
Transcribe the frame.
-
class UCS2NULString(cs.binary.BinarySingleValue): A NUL terminated string encoded with UCS-2.We're cheating and using UTF16 for this.
UCS2NULString.VALUE_TYPE
UCS2NULString.transcribe_value(s):
Transcribe text as UTF-16-LE with leading BOM and trailing NUL.
Release Log
Release 20260531: Provide value_type for the BinarySingleValue subclasses.
Release 20211208:
- ID3V1 and ID3V2 support.
- ID3V1Frame,ID3V2Frame: new .tagset() method to return a TagSet.
- ID3V1Frame.parse: trim trailing NULs from the comment field.
- Assorted other small changes.
Release 20160828: Use "install_requires" instead of "requires" in DISTINFO.
Release 20150116.2: pyid3lib not on PyPI, remove from requirements and mention in README
Release 20150116: Initial PyPI release.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cs_id3-20260531.tar.gz.
File metadata
- Download URL: cs_id3-20260531.tar.gz
- Upload date:
- Size: 13.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ec03b5358f9f9d9c64a1de86230d3bab3b0fbbb2683b8ad74bc2ac29fe47862c
|
|
| MD5 |
38762c3cf528288baa9300e5700e4413
|
|
| BLAKE2b-256 |
ee2054c91cedea70750e59955ffd39043f40477e75e226440f49e2cbaaa735a0
|
File details
Details for the file cs_id3-20260531-py2.py3-none-any.whl.
File metadata
- Download URL: cs_id3-20260531-py2.py3-none-any.whl
- Upload date:
- Size: 12.9 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
22c7875172196881b1c6246120dcf2296db82e6eeee4479de56a9f0523d1d90b
|
|
| MD5 |
b2f161a864267e46d388e85caa89f55c
|
|
| BLAKE2b-256 |
95d2589f4903e06bd1a7216f2d8eb88cafd4b2849a61baf2cbacaeb90c5a2116
|