cp2077_extractor.track

Track metadata.

Classes:

Track(artist, title, wem_name[, writer, ...])

Represents an audio track played on the radio etc.

Functions:

set_tag(tag, value, tags)

Set the tag if the value in the existing tags differs.

namedtuple Track(artist, title, wem_name, writer='', real_artist='', other_uses=mappingproxy({}))[source]

Bases: NamedTuple

Represents an audio track played on the radio etc.

Fields
  1.  artist (str) – Alias for field number 0

  2.  title (str) – Alias for field number 1

  3.  wem_name (int) – Alias for field number 2

  4.  writer (str) – Alias for field number 3

  5.  real_artist (str) – Alias for field number 4

  6.  other_uses (Mapping[int, str]) – Mapping of WEM file names to usage.

__repr__()

Return a nicely formatted representation string

property filename_stub

Track filename (without suffix), comprising the artist and track title and made filename safe.

Return type

str

set_id3_metadata(mp3_filename, station, album_art=None)[source]

Set ID3 tags on the file (artist, title, performer, writer/composer, album/station, etc.).

Parameters
  • mp3_filename (Union[str, Path, PathLike]) – The file to set metadata on.

  • station (str) – The name of the radio station, used as the album name.

  • album_art (Union[str, Path, PathLike[str], bytes, None]) – Either the path to the album art file or the raw bytes of the album art, in PNG format. Optional. Default None.

set_tag(tag, value, tags)[source]

Set the tag if the value in the existing tags differs.

Parameters
Return type

bool

Returns

Whether the value in the tags has been changed, to inform whether to write tags to file.