From 2ce9e0fdf1617b7287fe81a3c5eb55c15c0a79b8 Mon Sep 17 00:00:00 2001 From: Evgeny Zinoviev Date: Wed, 21 Apr 2021 01:51:29 +0300 Subject: add readme --- README.md | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..d1a5c54 --- /dev/null +++ b/README.md @@ -0,0 +1,41 @@ +# deadbeef-playlist + +This is a Python library for reading and writing playlists in the "DBPL" binary +format, created by my absolute favorite desktop audio player +[DeaDBeeF](https://github.com/DeaDBeeF-Player/deadbeef). + +I created it to be able to edit paths to audio files in the playlist, although +it's possible to change any tracks properties. + +## Example + +Let's imagine you have a large `.dbpl` playlist with hundreds of items, and you want +to change tracks paths from `/data/music` to `/Volumes/music`. Write a script +named `script.py`: + +```python +from dbpl import Playlist +from argparse import ArgumentParser + +if __name__ == '__main__': + parser = ArgumentParser() + parser.add_argument('--input', required=True, help='input file') + parser.add_argument('--output', required=True, help='output file') + args = parser.parse_args() + + playlist = Playlist(args.input) + for t in playlist.tracks: + uri = t.get_uri() + uri = uri.replace('/data/music', '/Volumes/music') + t.set_uri(uri) + playlist.save(args.output) +``` + +Then use it: +``` +python3 ./script.py --input old.dbpl --output new.dbpl +``` + +## License + +BSD-2c \ No newline at end of file -- cgit v1.2.3