MPD PyDB

class mpd_pydb.db.Database(format_version, mpd_version, supported_tags, songs=None)[source]

Bases: object

Parameters:
  • format_version (int) –
  • mpd_version (str) –
  • supported_tags (iterable) –
  • songs ([namedtuple]) – A list of songs in the database
Raises:
  • ValueError – If the format_version is not supported or mpd_version is None
  • TypeError – If supported_tags is not iterable
add_song(song)[source]

Add song to this DB.

Parameters:song (namedtuple) –
format_version = None

The database format version

mpd_version = None

The version of MPD that created this database

classmethod read_file(filename, music_dir=None)[source]

Read the database in filename.

Parameters:
  • filename (str) – The path to the database file
  • music_dir (str) – The path to MPDs music directory
songs = None

A list of songs in this database

supported_tags = None

A list containing the names of all supported tags

to_dataframe()[source]

Convert this database to a pandas DataFrame. In addition to the tags already loaded, the two columns TotalDiscs and TotalTracks will be populated with the values from Disc and Track tags (ID3 only). The Disc and Track tags will no longer contain information about the total amount of discs and tracks after the conversion.

Return type:DataFrame