Usage¶
To use this module, simply import import it:
import mpd_pydb
and read your MPD database into an Database
object:
db = mpd_pydb.Database.read_file("/path/to/the/database.db")
Song objects¶
A song object is a namedtuple()
object with each tag type
defined in the MPD database available as a field. In addition to the tag types
you can configure in MPDs configuration file, 3 additional fields are available:
- Time
- The length of the song as a
float
. - mtime
- The time at which the file was last modified, in Unix time as an
int
. - path
- The path to the file inside of MPDs music directory as an
Path
object - music_dir_
- The absolute path to the music directory on the local hard drive. This is
used to implement support for PEP 519’s
os.PathLike.__fspath__()
method on the song objects.