MP3

Inheritance diagram of musify.libraries.local.track.mp3

The MP3 implementation of a LocalTrack.

Classes:

MP3TagReader(file, tag_map[, remote_wrangler])

MP3TagWriter(file, tag_map[, remote_wrangler])

MP3(file[, remote_wrangler])

class musify.libraries.local.track.mp3.MP3TagReader(file, tag_map, remote_wrangler=None)

Bases: TagReader[MP3]

Methods:

read_tag(tag_ids)

Extract all tag values from file for a given list of tag IDs

read_genres()

Extract metadata from file for genre

read_images()

Extract image from file

read_tag(tag_ids)

Extract all tag values from file for a given list of tag IDs

Return type:

list[Any] | None

read_genres()

Extract metadata from file for genre

Return type:

list[str] | None

read_images()

Extract image from file

class musify.libraries.local.track.mp3.MP3TagWriter(file, tag_map, remote_wrangler=None)

Bases: TagWriter[MP3]

Methods:

delete_tag(tag_name[, dry_run])

Remove a tag by its tag name.

write_tag(tag_id, tag_value[, dry_run])

Generic method for updating a tag value in the file.

delete_tag(tag_name, dry_run=True)

Remove a tag by its tag name.

Parameters:
  • tag_name (str) – Tag name as found in TagMap to remove.

  • dry_run (bool (default: True)) – Run function, but do not modify the file on the disk.

Returns:

bool – True if tag has been remove, False otherwise.

write_tag(tag_id, tag_value, dry_run=True)

Generic method for updating a tag value in the file.

Parameters:
  • tag_id (str | None) – ID of the tag for this file type.

  • tag_value (Any) – New value to assign.

  • dry_run (bool (default: True)) – Run function, but do not modify the file on the disk.

Returns:

bool – The index number of the conditional that was met to warrant updating the file’s tags. None if none of the conditions were met.

class musify.libraries.local.track.mp3.MP3(file, remote_wrangler=None)

Bases: LocalTrack[MP3, MP3TagReader, MP3TagWriter]

Attributes:

valid_extensions

Extensions of files that can be loaded by this class.

tag_map

Map of human-friendly tag name to ID3 tag ids for a given file type

valid_extensions: frozenset[str] = frozenset({'.mp3'})

Extensions of files that can be loaded by this class.

tag_map = TagMap(title=['TIT2'], artist=['TPE1'], album=['TALB'], album_artist=['TPE2'], track_number=['TRCK'], track_total=['TRCK'], genres=['TCON'], date=['TDRC', 'TDAT', 'TDOR'], year=['TYER', 'TORY'], month=(), day=(), bpm=['TBPM'], key=['TKEY'], disc_number=['TPOS'], disc_total=['TPOS'], compilation=['TCMP'], comments=['COMM'], images=['APIC'])

Map of human-friendly tag name to ID3 tag ids for a given file type