eyed3.id3 package
Submodules
eyed3.id3.apple module
Here lies Apple frames, all of which are non-standard. All of these would have been standard user text frames by anyone not being a bastard, on purpose.
- class eyed3.id3.apple.PCST(_=None)[source]
Bases:
FrameIndicates a podcast. The 4 bytes of data is undefined, and is typically all 0.
- class eyed3.id3.apple.TDES(_=None, **kwargs)[source]
Bases:
TextFramePodcast description. One encoding byte followed by text per encoding.
- class eyed3.id3.apple.TGID(_=None, **kwargs)[source]
Bases:
TextFramePodcast URL of the audio file. This should be a W frame!
- class eyed3.id3.apple.WFED(_=None, url='')[source]
Bases:
TextFrameAnother podcast URL, the feed URL it is said.
- class eyed3.id3.apple.GRP1(_=None, **kwargs)[source]
Bases:
TextFrameApple grouping, could be a TIT1 conversion.
eyed3.id3.frames module
- class eyed3.id3.frames.Frame(**kwargs)[source]
Bases:
object- property header
- parse(**kwargs)
- property text_delim
- property encoding
- property strict_rendering
- property unknown
- class eyed3.id3.frames.TextFrame(**kwargs)[source]
Bases:
FrameText frames. Data string format: encoding (one byte) + text
- property text
- class eyed3.id3.frames.UserTextFrame(**kwargs)[source]
Bases:
TextFrame- property description
- class eyed3.id3.frames.UserUrlFrame(**kwargs)[source]
Bases:
UrlFrameData string format: encoding (one byte) + description + b”" + url (iso-8859-1)
- property description
- class eyed3.id3.frames.ImageFrame(**kwargs)[source]
Bases:
Frame- OTHER = 0
- ICON = 1
- OTHER_ICON = 2
- FRONT_COVER = 3
- BACK_COVER = 4
- LEAFLET = 5
- MEDIA = 6
- LEAD_ARTIST = 7
- ARTIST = 8
- CONDUCTOR = 9
- BAND = 10
- COMPOSER = 11
- LYRICIST = 12
- RECORDING_LOCATION = 13
- DURING_RECORDING = 14
- DURING_PERFORMANCE = 15
- VIDEO = 16
- BRIGHT_COLORED_FISH = 17
- ILLUSTRATION = 18
- BAND_LOGO = 19
- PUBLISHER_LOGO = 20
- MIN_TYPE = 0
- MAX_TYPE = 20
- URL_MIME_TYPE = b'-->'
- URL_MIME_TYPE_STR = '-->'
- URL_MIME_TYPE_VALUES = (b'-->', '-->')
- property description
- property mime_type
- property picture_type
- class eyed3.id3.frames.ObjectFrame(**kwargs)[source]
Bases:
Frame- property description
- property mime_type
- property filename
- parse(data, frame_header)[source]
Parse the frame from
databytes using details fromframe_header.Data string format: <Header for ‘General encapsulated object’, ID: “GEOB”> Text encoding $xx MIME type <text string> $00 Filename <text string according to encoding> $00 (00) Content description <text string according to encoding> $00 (00) Encapsulated object <binary data>
- class eyed3.id3.frames.PrivateFrame(id=b'PRIV', owner_id=b'', owner_data=b'')[source]
Bases:
FramePRIV
- class eyed3.id3.frames.PopularityFrame(id=b'POPM', email=b'', rating=0, count=0)[source]
Bases:
FrameFrame type for ‘POPM’ frames; popularity. Frame format: <Header for ‘Popularimeter’, ID: “POPM”> Email to user <text string> $00 Rating $xx Counter $xx xx xx xx (xx …)
- property rating
- property email
- property count
- class eyed3.id3.frames.UniqueFileIDFrame(id=b'UFID', owner_id=b'', uniq_id=b'')[source]
Bases:
Frame- property owner_id
- property uniq_id
- class eyed3.id3.frames.DescriptionLangTextFrame(**kwargs)[source]
Bases:
Frame,LanguageCodeMixin- property description
- property text
- class eyed3.id3.frames.CommentFrame(id=b'COMM', description='', lang=b'eng', text='')[source]
Bases:
DescriptionLangTextFrame
- class eyed3.id3.frames.LyricsFrame(id=b'USLT', description='', lang=b'eng', text='')[source]
Bases:
DescriptionLangTextFrame
- class eyed3.id3.frames.TermsOfUseFrame(**kwargs)[source]
Bases:
Frame,LanguageCodeMixin- property text
- class eyed3.id3.frames.TocFrame(**kwargs)[source]
Bases:
FrameTable of content frame. There may be more than one, but only one may have the top-level flag set.
Data format: Element ID: <string>TOC flags: %000000ab Entry count: %xx Child elem IDs: <string>(… num entry count) Description: TIT2 frame (optional)
- TOP_LEVEL_FLAG_BIT = 6
- ORDERED_FLAG_BIT = 7
- class eyed3.id3.frames.RelVolAdjFrameV24(fid=b'RVA2', identifier=None, channel_type=None, adjustment=None, peak=None)[source]
Bases:
Frame- CHANNEL_TYPE_OTHER = 0
- CHANNEL_TYPE_MASTER = 1
- CHANNEL_TYPE_FRONT_RIGHT = 2
- CHANNEL_TYPE_FRONT_LEFT = 3
- CHANNEL_TYPE_BACK_RIGHT = 4
- CHANNEL_TYPE_BACK_LEFT = 5
- CHANNEL_TYPE_FRONT_CENTER = 6
- CHANNEL_TYPE_BACK_CENTER = 7
- CHANNEL_TYPE_BASS = 8
- property identifier
- property channel_type
- property adjustment
- property peak
- class eyed3.id3.frames.RelVolAdjFrameV23(fid=b'RVAD')[source]
Bases:
Frame- FRONT_CHANNEL_RIGHT_BIT = 0
- FRONT_CHANNEL_LEFT_BIT = 1
- BACK_CHANNEL_RIGHT_BIT = 2
- BACK_CHANNEL_LEFT_BIT = 3
- FRONT_CENTER_CHANNEL_BIT = 4
- BASS_CHANNEL_BIT = 5
- CHANNEL_DEFN = [('front_right', 0), ('front_left', 1), ('front_right_peak', None), ('front_left_peak', None), ('back_right', 2), ('back_left', 3), ('back_right_peak', None), ('back_left_peak', None), ('front_center', 4), ('front_center_peak', None), ('bass', 5), ('bass_peak', None)]
- class VolumeAdjustments(master: int = 0, master_peak: int = 0, front_right: int = 0, front_left: int = 0, front_right_peak: int = 0, front_left_peak: int = 0, back_right: int = 0, back_left: int = 0, back_right_peak: int = 0, back_left_peak: int = 0, front_center: int = 0, front_center_peak: int = 0, back_center: int = 0, back_center_peak: int = 0, bass: int = 0, bass_peak: int = 0, other: int = 0, other_peak: int = 0)[source]
Bases:
object
- class eyed3.id3.frames.StartEndTuple(start, end)
Bases:
tupleA 2-tuple, with names ‘start’ and ‘end’.
- end
Alias for field number 1
- start
Alias for field number 0
- class eyed3.id3.frames.ChapterFrame(id=b'CHAP', element_id=None, times=None, offsets=None, sub_frames=None)[source]
Bases:
FrameFrame type for chapter/section of the audio file. <ID3v2.3 or ID3v2.4 frame header, ID: “CHAP”> (10 bytes) Element ID <text string> $00 Start time $xx xx xx xx End time $xx xx xx xx Start offset $xx xx xx xx End offset $xx xx xx xx <Optional embedded sub-frames>
- NO_OFFSET = 4294967295
No offset value, aka ‘0xff0xff0xff0xff’
- property title
- property subtitle
- property user_url
- class eyed3.id3.frames.FrameSet[source]
Bases:
dict- parse(f, tag_header, extended_header)[source]
Read frames starting from the current read position of the file object. Returns the amount of padding which occurs after the tag, but before the audio content. A return value of 0 does not mean error.
- property unknown_frame_ids
- getAllFrames()[source]
Return all the frames in the set as a list. The list is sorted in an arbitrary but consistent order.
- setTextFrame(**kwargs)
eyed3.id3.headers module
- class eyed3.id3.headers.TagHeader(version=(2, 4, 0))[source]
Bases:
object- SIZE = 10
- property version
- property major_version
- property minor_version
- property rev_version
- class eyed3.id3.headers.ExtendedTagHeader[source]
Bases:
object- RESTRICT_TAG_SZ_LARGE = 0
- RESTRICT_TAG_SZ_MED = 1
- RESTRICT_TAG_SZ_SMALL = 2
- RESTRICT_TAG_SZ_TINY = 3
- RESTRICT_TEXT_ENC_NONE = 0
- RESTRICT_TEXT_ENC_UTF8 = 1
- RESTRICT_TEXT_LEN_NONE = 0
- RESTRICT_TEXT_LEN_1024 = 1
- RESTRICT_TEXT_LEN_128 = 2
- RESTRICT_TEXT_LEN_30 = 3
- RESTRICT_IMG_ENC_NONE = 0
- RESTRICT_IMG_ENC_PNG_JPG = 1
- RESTRICT_IMG_SZ_NONE = 0
- RESTRICT_IMG_SZ_256 = 1
- RESTRICT_IMG_SZ_64 = 2
- RESTRICT_IMG_SZ_64_EXACT = 3
- property update_bit
- property crc_bit
- property crc
- property restrictions_bit
- property tag_size_restriction
- property tag_size_restriction_description
- property text_enc_restriction
- property text_enc_restriction_description
- property text_length_restriction
- property text_length_restriction_description
- property image_enc_restriction
- property image_enc_restriction_description
- property image_size_restriction
- property image_size_restriction_description
- parse(fp, version)[source]
Parse an ID3 v2 extended header starting at the current position of
fpand per the format defined byversion. This method should only be called when the presence of an extended header is known since it moves the file position. If a header is found but malformed aneyed3.id3.tag.TagExceptionis thrown. The return value isNone.
- class eyed3.id3.headers.FrameHeader(**kwargs)[source]
Bases:
objectA header for each and every ID3 frame in a tag.
- TAG_ALTER = None
- FILE_ALTER = None
- READ_ONLY = None
- COMPRESSED = None
- ENCRYPTED = None
- GROUPED = None
- UNSYNC = None
- DATA_LEN = None
- property major_version
- property minor_version
- property version
- property tag_alter
- property file_alter
- property read_only
- property compressed
- property encrypted
- property grouped
- property unsync
- property data_length_indicator
eyed3.id3.tag module
- class eyed3.id3.tag.Tag(version=(2, 4, 0), **kwargs)[source]
Bases:
Tag- property version
- setTextFrame(**kwargs)
- property composer
- property comments
- property bpm
- property play_count
- property publisher
- property cd_id
- property images
- property encoding_date
- property best_release_date
This method tries its best to return a date of some sort, amongst all the possible date frames. The order of preference for a release date is 1) date of original release 2) date of this versions release 3) the recording date. Or None is returned.
- getBestDate(prefer_recording_date=False)[source]
This method returns a date of some sort, amongst all the possible date frames. The order of preference is:
date of original release
date of this versions release
the recording date.
Unless
prefer_recording_dateisTruein which case the order is 3, 1, 2.Nonewill be returned if no dates are available.
- property release_date
The date the audio was released. This is NOT the original date the work was released, instead it is more like the pressing or version of the release. Original release date is usually what is intended but many programs use this frame and/or don’t distinguish between the two.
NOTE: ID3v2.3 only has original release date, so setting release_date is the same as original_release_value; they both set TORY.
- property original_release_date
The date the work was originally released.
NOTE: ID3v2.3 only stores year. If the Date object is more precise it is store in XDOR, and XDOR is preferred when acessing. The year-only date is stored in the standard TORY frame as well.
- property recording_date
The date of the recording. Many applications use this for release date regardless of the fact that this value is rarely known, and release dates are more correct.
- property tagging_date
- property lyrics
- property disc_num
- property objects
- property privates
- property popularities
- property genre
- property non_std_genre
- property user_text_frames
- property commercial_url
- property copyright_url
- property audio_file_url
- property audio_source_url
- property artist_url
- property internet_radio_url
- property payment_url
- property publisher_url
- property user_url_frames
- property unique_file_ids
- property terms_of_use
- property copyright
- property encoded_by
- save(filename=None, version=None, encoding=None, backup=False, preserve_file_time=False, max_padding=None)[source]
Save the tag. If
filenameis not give the value from thefile_infomember is used, or aTagExceptionis raised. Theversionargument can be used to select an ID3 version other than the version read.Select text encoding with ``encodingor use the existing (or default) encoding. Ifbackupis True the original file is preserved; likewise ifpreserve_file_timeis True the file´s modification/access times are not updated.
- property chapters
- property table_of_contents
- property album_type
- property artist_origin
Returns None or a ArtistOrigin dataclass: (city, state, country) Any may be
None.
- frameiter(fids=None)[source]
A iterator for tag frames. If
fidsis passed it must be a list of frame IDs to filter and return.
- property original_artist
- class eyed3.id3.tag.FileInfo(file_name, tagsz=0, tpadd=0)[source]
Bases:
objectThis class is for storing information about a parsed file. It contains info such as the filename, original tag size, and amount of padding; all of which can make rewriting faster.
- class eyed3.id3.tag.DltAccessor(FrameClass, fid, fs)[source]
Bases:
AccessorBaseAccess matching tag frames by “description” and/or “lang” values.
- set(**kwargs)
- remove(**kwargs)
Returns the removed item or
Noneif not found.
- get(**kwargs)
- class eyed3.id3.tag.CommentsAccessor(fs)[source]
Bases:
DltAccessor
- class eyed3.id3.tag.LyricsAccessor(fs)[source]
Bases:
DltAccessor
- class eyed3.id3.tag.ImagesAccessor(fs)[source]
Bases:
AccessorBase- set(**kwargs)
- remove(**kwargs)
Returns the removed item or
Noneif not found.
- get(**kwargs)
- class eyed3.id3.tag.ObjectsAccessor(fs)[source]
Bases:
AccessorBase- set(**kwargs)
- remove(**kwargs)
Returns the removed item or
Noneif not found.
- get(**kwargs)
- class eyed3.id3.tag.PrivatesAccessor(fs)[source]
Bases:
AccessorBase
- class eyed3.id3.tag.UserTextsAccessor(fs)[source]
Bases:
AccessorBase- set(**kwargs)
- remove(**kwargs)
Returns the removed item or
Noneif not found.
- get(**kwargs)
- class eyed3.id3.tag.UniqueFileIdAccessor(fs)[source]
Bases:
AccessorBase
- class eyed3.id3.tag.UserUrlsAccessor(fs)[source]
Bases:
AccessorBase- set(**kwargs)
- remove(**kwargs)
Returns the removed item or
Noneif not found.
- get(**kwargs)
- class eyed3.id3.tag.PopularitiesAccessor(fs)[source]
Bases:
AccessorBase
- class eyed3.id3.tag.ChaptersAccessor(fs)[source]
Bases:
AccessorBase
- class eyed3.id3.tag.TocAccessor(fs)[source]
Bases:
AccessorBase- set(**kwargs)
- class eyed3.id3.tag.TagTemplate(pattern, path_friendly='-', dotted_dates=False)[source]
Bases:
Template- pattern = re.compile('\n \\$(?:\n (?P<escaped>\\$) | # Escape sequence of two delimiters\n (?P<named>[_a-z][_a-z0-9:]*) | # delimiter and a Python identifier\n , re.IGNORECASE|re.VERBOSE)
- idpattern = '[_a-z][_a-z0-9:]*'
- safe_substitute(tag, zeropad=True)
Module contents
- eyed3.id3.isValidVersion(v, fully_qualified=False)[source]
Check the tuple
vagainst the list of valid ID3 version constants. Iffully_qualifiedisTrueit is enforced that there are 3 components to the version inv. ReturnsTruewhen valid andFalseotherwise.
- eyed3.id3.normalizeVersion(v)[source]
If version tuple
vis of the non-specific type (v1 or v2, any, etc.) a fully qualified version is returned.
- exception eyed3.id3.GenreException(*args)[source]
Bases:
ErrorExcpetion type for exceptions related to genres.
- class eyed3.id3.Genre(name=None, id: int = None, genre_map=None)[source]
Bases:
objectA genre in terms of a
nameand andid. Only whennameis a “standard” genre (as defined by ID3 v1) willidbe a value other thanNone.Constructor takes an optional name and ID. If id is provided the name, regardless of value, is set to the string the id maps to. Likewise, if name is passed and is a standard genre the id is set to the correct value. Any invalid id values cause a ValueError to be raised. Genre names that are not in the standard list are still accepted but the id value is set to None.
- property id
The Genre’s id property. When setting the value is strictly enforced and if the value is not a valid genre code a
ValueErroris raised. Otherwise the id is set and thenameproperty is updated to the code’s string name.
- property name
The Genre’s name property. When setting the value the name is looked up in the standard genre map and if found the
idppropery is set to the numeric valud and the name is normalized to the sting found in the map. Non standard genres are set (with a warning log) and theidis set toNone. It is valid to set the value toNone.
- class eyed3.id3.GenreMap(*args)[source]
Bases:
dictClassic genres defined around ID3 v1 but suitable anywhere. This class is used primarily as a way to map numeric genre values to a string name. Genre strings on the other hand are not required to exist in this list.
The optional
*argsare passed directly to thedictconstructor.- GENRE_MIN = 0
- GENRE_MAX = 191
- ID3_GENRE_MIN = 0
- ID3_GENRE_MAX = 79
- WINAMP_GENRE_MIN = 80
- WINAMP_GENRE_MAX = 191
- GENRE_ID3V1_MAX = 255
- property ids