phrydy package

Module contents

Submodules

phrydy.doc_generator module

phrydy.doc_generator.format_field_as_rst_table(field_name: str, field_doc: phrydy.field_docs.FieldDoc) → str[source]
phrydy.doc_generator.format_field_as_txt(field_name: str, field_doc: phrydy.field_docs.FieldDoc, second_column: int, field_prefix: str = '') → str[source]
phrydy.doc_generator.format_fields_as_rst_table(additional_fields: Optional[Dict[str, phrydy.field_docs.FieldDoc]] = None) → str[source]
phrydy.doc_generator.format_fields_as_txt(additional_fields: Optional[Dict[str, phrydy.field_docs.FieldDoc]] = None, field_prefix: str = '', color: bool = False) → str[source]

Return a formated string containing the documentation about the audio fields.

phrydy.doc_generator.get_max_field_length(fields: Dict[str, Any]) → int[source]

Get the length of the longest field in the dictionary fields.

Parameters:fields (dict) – A dictionary to search for the longest field.
phrydy.doc_generator.get_type_name(t: Any) → str[source]
phrydy.doc_generator.merge_fields(*fields) → Dict[str, phrydy.field_docs.FieldDoc][source]

Used in audiorename/args.py

phrydy.doc_generator.print_debug(file_path: str, MediaClass: Callable[[str], phrydy.mediafile_extended.MediaFileExtended], field_generator: Callable[[], Generator[str, None, None]], color: bool = False) → None[source]
phrydy.doc_generator.print_dict_sorted(dictionary: Dict[str, Any], color: bool, align: Literal[left, right] = 'right') → None[source]
phrydy.doc_generator.print_section(text: str, color: bool = False) → None[source]
phrydy.doc_generator.remove_color(text: str) → str[source]

https://stackoverflow.com/a/14693789/10193818

phrydy.field_docs module

class phrydy.field_docs.FieldDoc[source]

Bases: dict

phrydy.field_docs.fields = {'acoustid_fingerprint': {'category': 'music_brainz', 'data_type': 'str', 'description': 'Acoustic ID fingerprint'}, 'acoustid_id': {'category': 'music_brainz', 'data_type': 'str', 'description': 'Acoustic ID', 'examples': ['86e217b7-d3ad-4493-a9f2-cf71256ace07']}, 'album': {'category': 'common', 'data_type': 'str', 'description': 'album', 'examples': ['Help!']}, 'albumartist': {'category': 'common', 'data_type': 'str', 'description': 'The artist for the entire album, which may be different from the artists for the individual tracks', 'examples': ['The Beatles']}, 'albumartist_credit': {'category': 'common', 'data_type': 'str', 'description': 'albumartist_credit'}, 'albumartist_sort': {'category': 'common', 'data_type': 'str', 'description': 'albumartist_sort', 'examples': ['Beatles, The']}, 'albumartists': {'category': 'common', 'data_type': 'list', 'description': 'albumartists'}, 'albumdisambig': {'category': 'common', 'description': 'The disambiguation album field helps to distinguish between identically named albums. The album “Weezer” for example has the disambiguation comments “Red Album” and “Green Album”.'}, 'albumstatus': {'category': 'common', 'data_type': 'str', 'description': 'The status describes how "official" a release is.', 'examples': ['official', 'promotional', 'bootleg', 'pseudo-release']}, 'albumtype': {'category': 'common', 'data_type': 'str', 'description': 'The MusicBrainz album type; the MusicBrainz wiki has a list of type names', 'examples': ['album/soundtrack']}, 'arranger': {'category': 'common', 'data_type': 'str', 'description': 'A musician who creates arrangements.'}, 'art': {'category': 'common', 'description': 'Legacy album art field.', 'examples': [b'\xff\xd8\xff\xe0\x00']}, 'artist': {'category': 'common', 'data_type': 'str', 'description': 'artist', 'examples': ['The Beatles']}, 'artist_credit': {'category': 'common', 'data_type': 'str', 'description': 'The track-specific artist credit name, which may be a variation of the artist’s “canonical” name'}, 'artist_sort': {'category': 'common', 'data_type': 'str', 'description': 'The “sort name” of the track artist.', 'examples': ['Beatles, The', 'White, Jack']}, 'artists': {'category': 'common', 'description': 'artists', 'examples': [['a-ha'], ['Anouk', 'Remon Stotijn']]}, 'asin': {'category': 'common', 'description': 'Amazon Standard Identification Number', 'examples': ['B000002UAL']}, 'barcode': {'category': 'common', 'data_type': 'str', 'description': 'There are many different types of barcode, but the ones usually found on music releases are two: 1. Universal Product Code (UPC), which is the original barcode used in North America. 2. European Article Number (EAN)', 'examples': ['5028421931838', '036000291452']}, 'bitdepth': {'category': 'audio', 'description': 'only available for some formats', 'examples': [16]}, 'bitrate': {'category': 'audio', 'description': 'in kilobits per second, with units: e.g., “192kbps”', 'examples': [436523, 256000]}, 'bitrate_mode': {'category': 'common', 'description': 'bitrate_mode', 'examples': ['CBR']}, 'bpm': {'category': 'common', 'description': 'Beats per Minute'}, 'catalognum': {'category': 'common', 'description': 'This is a number assigned to the release by the label which can often be found on the spine or near the barcode. There may be more than one, especially when multiple labels are involved. This is not the ASIN — there is a relationship for that — nor the label code.', 'examples': ['CDP 7 46439 2']}, 'channels': {'category': 'audio', 'data_type': 'int', 'description': 'channels', 'examples': [1, 2]}, 'comments': {'category': 'common', 'description': 'comments'}, 'comp': {'category': 'common', 'data_type': 'bool', 'description': 'Compilation flag', 'examples': [True, False]}, 'composer': {'category': 'common', 'data_type': 'str', 'description': 'The name of the composer.', 'examples': ['Ludwig van Beethoven']}, 'composer_sort': {'category': 'common', 'data_type': 'str', 'description': 'The composer name for sorting.', 'examples': ['Beethoven, Ludwig van']}, 'copyright': {'category': 'common', 'description': 'copyright'}, 'country': {'category': 'common', 'description': 'The country the release was issued in.', 'examples': ['NL']}, 'date': {'category': 'date', 'description': 'The release data of the specific release.', 'examples': ['1996-01-01']}, 'day': {'category': 'date', 'description': 'The release day of the specific release.'}, 'disc': {'category': 'common', 'description': 'disc', 'examples': [1]}, 'disctitle': {'category': 'common', 'description': 'disctitle'}, 'disctotal': {'category': 'common', 'description': 'disctotal', 'examples': [1]}, 'encoder': {'category': 'common', 'description': 'the name of the person or organisation that encoded the audio file. This field may contain a copyright message, if the audio file also is copyrighted by the encoder.', 'examples': ['iTunes v7.6.2']}, 'encoder_info': {'category': 'common', 'description': 'encoder_info', 'examples': ['LAME 3.92.0+']}, 'encoder_settings': {'category': 'common', 'description': 'encoder_settings', 'examples': ['-b 255+']}, 'format': {'category': 'audio', 'description': 'e.g., “MP3” or “FLAC”', 'examples': ['MP3', 'FLAC']}, 'genre': {'category': 'common', 'description': 'genre', 'examples': ['Rock']}, 'genres': {'category': 'common', 'description': 'genres', 'examples': [['Rock']]}, 'grouping': {'category': 'common', 'description': 'A content group, which is a collection of media items such as a CD boxed set.'}, 'images': {'category': 'common', 'description': 'images', 'examples': [['<mediafile.Image object>']]}, 'initial_key': {'category': 'common', 'description': 'The Initial key frame contains the musical key in which the sound starts. It is represented as a string with a maximum length of three characters. The ground keys are represented with "A","B","C","D","E", "F" and "G" and halfkeys represented with "b" and "#". Minor is represented as "m".', 'examples': ['Dbm']}, 'isrc': {'category': 'common', 'description': 'The International Standard Recording Code, abbreviated to ISRC, is a system of codes that identify audio and music video recordings.', 'examples': ['CAC118989003', 'ITO101117740']}, 'label': {'category': 'common', 'description': 'The label which issued the release. There may be more than one.', 'examples': ['Brilliant Classics', 'wea']}, 'language': {'category': 'common', 'description': 'The language a release’s track list is written in. The possible values are taken from the ISO 639-3 standard.', 'examples': ['zxx', 'eng']}, 'length': {'category': 'audio', 'description': 'The length of a recording in seconds.', 'examples': [674.4666666666667]}, 'lyricist': {'category': 'common', 'data_type': 'str', 'description': 'The writer of the text or lyrics in the recording.'}, 'lyrics': {'category': 'common', 'data_type': 'str', 'description': 'The lyrics of the song or a text transcription of other vocal activities.'}, 'mb_albumartistid': {'category': 'music_brainz', 'data_type': 'str', 'description': 'MusicBrainz album artist ID.', 'examples': ['1f9df192-a621-4f54-8850-2c5373b7eac9', 'b972f589-fb0e-474e-b64a-803b0364fa75']}, 'mb_albumartistids': {'category': 'music_brainz', 'data_type': 'list', 'description': 'MusicBrainz album artist IDs as a list.', 'examples': [['b972f589-fb0e-474e-b64a-803b0364fa75', 'dea28aa9-1086-4ffa-8739-0ccc759de1ce', 'd2ced2f1-6b58-47cf-ae87-5943e2ab6d99']]}, 'mb_albumid': {'category': 'music_brainz', 'data_type': 'str', 'description': 'MusicBrainz album ID.', 'examples': ['fd6adc77-1489-4a13-9aa0-32951061d92b']}, 'mb_artistid': {'category': 'music_brainz', 'data_type': 'str', 'description': 'MusicBrainz artist ID.', 'examples': ['1f9df192-a621-4f54-8850-2c5373b7eac9']}, 'mb_artistids': {'category': 'music_brainz', 'data_type': 'list', 'description': 'MusicBrainz artist IDs as a list.', 'examples': [['1f9df192-a621-4f54-8850-2c5373b7eac9']]}, 'mb_releasegroupid': {'category': 'music_brainz', 'data_type': 'str', 'description': 'MusicBrainz releasegroup ID.', 'examples': ['f714fd70-aaca-4863-9d0d-2768a53acaeb']}, 'mb_releasetrackid': {'category': 'music_brainz', 'data_type': 'str', 'description': 'MusicBrainz release track ID.', 'examples': ['38c8c114-5e3b-484f-8af0-79c47ef9c169']}, 'mb_trackid': {'category': 'music_brainz', 'data_type': 'str', 'description': 'MusicBrainz track ID.', 'examples': ['c390b132-4a44-4e16-bec3-bffbbcaa19aa']}, 'mb_workhierarchy_ids': {'category': 'music_brainz', 'data_type': 'str', 'description': 'All IDs in the work hierarchy. This field corresponds to the field `work_hierarchy`. The top level work ID appears first. A slash (/) is used as separator.', 'examples': ['e208c5f5-5d37-3dfc-ac0b-999f207c9e46 / 5adc213f-700a-4435-9e95-831ed720f348 / eafec51f-47c5-3c66-8c36-a524246c85f8']}, 'mb_workid': {'category': 'music_brainz', 'data_type': 'str', 'description': 'MusicBrainz work ID.', 'examples': ['508ec4b1-9549-38cd-a61e-1f0d120a6118']}, 'media': {'category': 'common', 'data_type': 'str', 'description': 'A prototypical medium is one of the physical, separate things you would get when you buy something in a record store.', 'examples': ['CD']}, 'month': {'category': 'date', 'data_type': 'int', 'description': 'The release month of the specific release.', 'examples': [11]}, 'original_date': {'category': 'date', 'data_type': 'str', 'description': 'The release date of the original version of the album.', 'examples': ['1991-11-04']}, 'original_day': {'category': 'date', 'data_type': 'int', 'description': 'The release day of the original version of the album.', 'examples': [4]}, 'original_month': {'category': 'date', 'data_type': 'int', 'description': 'The release month of the original version of the album.', 'examples': [11]}, 'original_year': {'category': 'date', 'data_type': 'int', 'description': 'The release year of the original version of the album.', 'examples': [1991]}, 'r128_album_gain': {'category': 'r128', 'description': 'An optional gain for album normalization. EBU R 128 is a recommendation for loudness normalisation and maximum level of audio signals.'}, 'r128_track_gain': {'category': 'r128', 'description': 'An optional gain for track normalization. EBU R 128 is a recommendation for loudness normalisation and maximum level of audio signals.'}, 'releasegroup_types': {'category': 'music_brainz', 'description': 'This field collects all items in the MusicBrainz’ API related to type: `type`, `primary-type and `secondary-type-list`. Main usage of this field is to determine in a secure manner if the release is a soundtrack.'}, 'rg_album_gain': {'category': 'rg', 'description': 'ReplayGain Album Gain, see https://en.wikipedia.org/wiki/ReplayGain.'}, 'rg_album_peak': {'category': 'rg', 'description': 'ReplayGain Album Peak, see https://en.wikipedia.org/wiki/ReplayGain.'}, 'rg_track_gain': {'category': 'rg', 'description': 'ReplayGain Track Gain, see https://en.wikipedia.org/wiki/ReplayGain.', 'examples': [0.0]}, 'rg_track_peak': {'category': 'rg', 'description': 'ReplayGain Track Peak, see https://en.wikipedia.org/wiki/ReplayGain.', 'examples': [0.000244]}, 'samplerate': {'category': 'audio', 'data_type': 'int', 'description': 'The sample rate as an integer number.', 'examples': [44100]}, 'script': {'category': 'common', 'data_type': 'str', 'description': 'The script used to write the release’s track list. The possible values are taken from the ISO 15924 standard.', 'examples': ['Latn']}, 'title': {'category': 'common', 'data_type': 'str', 'description': 'The title of a audio file.', 'examples': ['32 Variations for Piano in C minor on an Original Theme, WoO 80']}, 'track': {'category': 'common', 'data_type': 'int', 'description': 'The track number.', 'examples': [1]}, 'tracktotal': {'category': 'common', 'data_type': 'int', 'description': 'The total track number.', 'examples': [12]}, 'url': {'category': 'common', 'data_type': 'str', 'description': 'Uniform Resource Locator.'}, 'work': {'category': 'common', 'data_type': 'str', 'description': 'The Musicbrainzs’ work entity.', 'examples': ['32 Variations for Piano in C minor on an Original Theme, WoO 80']}, 'work_hierarchy': {'category': 'music_brainz', 'data_type': 'str', 'description': 'The hierarchy of works: The top level work appears first. As separator is this string used: -->.', 'examples': ['Die Zauberflöte, K. 620 --> Die Zauberflöte, K. 620: Akt I --> Die Zauberflöte, K. 620: Act I, Scene II. No. 2 Aria "Was hör ...']}, 'year': {'category': 'date', 'data_type': 'int', 'description': 'The release year of the specific release.', 'examples': [2001]}}

A multidimensional dictionary documenting all metadata fields.

fields = {
    'field': {
        'description': 'Title',
        'category': 'Category',
    },
}
phrydy.field_docs.fields = metadata description

A multidimensional dictionary documenting all metadata fields.

fields = {
    'field': {
        'description': 'Title',
        'category': 'Category',
    },
}

phrydy.mediafile_extended module

class phrydy.mediafile_extended.MediaFileExtended(filething, id3v23=False)[source]

Bases: mediafile.MediaFile

albumartist_sort

Changed field. Uses TSO2

composer_sort

Changed field. Uses MP3 description storage style composersortorder.

classmethod fields() → Generator[str, None, None][source]

Get the names of all writable properties that reflect metadata tags (i.e., those that are instances of MediaField).

mb_workhierarchy_ids

All IDs in the work hierarchy. This field corresponds to the field work_hierarchy. The top level work ID appears first. As separator a slash (/) is used.

Example:

e208c5f5-5d37-3dfc-ac0b-999f207c9e46 / 5adc213f-700a-4435-9e95-831ed720f348 / eafec51f-47c5-3c66-8c36-a524246c85f8

mb_workid

Changed Field: The MusicBrainz’ Work ID

classmethod readable_fields() → Generator[str, None, None][source]

Get all metadata fields: the writable ones from fields() and also other audio properties.

releasegroup_types

This field collects all items in the MusicBrainz’ API related to type: type, primary-type and``secondary-type-list``. Main usage of this field is to determine in a secure manner if the release is a soundtrack.

"release-group": {
  "first-release-date": "1994-09-27",
  "secondary-type-list": [
    "Compilation",
    "Soundtrack"
  ],
  "primary-type": "Album",
  "title": "Pulp Fiction: Music From the Motion Picture",
  "type": "Soundtrack",
  "id": "1703cd63-9401-33c0-87c6-50c4ba2e0ba8"
}
work

The last work in the work hierarchy.

work_hierarchy

The hierarchy of works: The top level work appears first. As separator is this string used: -->

Example:

Die Zauberflöte, K. 620 --> Die Zauberflöte, K. 620: Akt I --> Die Zauberflöte, K. 620: Act I, Scene II. No. 2 Aria "Was hör' ...

class phrydy.mediafile_extended.MgFile[source]

Bases: dict

TIPL = None

4.2.2 TIPL Involved people list

TMCL = None

4.2.2 TMCL Musician credits list

TPE3 = None

4.2.2 TPE3 Conductor/ar_performer refinement