Coder Social home page Coder Social logo

moritzgrede / beets-playlistconverter Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 243 KB

beets plugin to convert playlists between four file formats. Supports posix, ntfs and their uri counterparts.

License: MIT License

Python 100.00%
python beets-plugin

beets-playlistconverter's Introduction

beets-PlaylistConverter

You often switch between filesystems? Your favourite music player does not support a specific path type in .m3u files?

With this beets plugin you can convert playlists to three other formats. It supports the posix-style path format of /foo/bar, the ntfs-style of C:\foo\bar and their uri counterparts, so file:///foo/bar and file:///C:/foo/bar.

Getting Started

You will need Python <= 3.9.0 and the bleeding edge version of beets.

$ python3.9 -m pip install --upgrade https://github.com/repos/beetbox/beets/tarball/master beets-playlistconverter

Then, enable the plugin. You may use the beet config --edit command to add the playlistconverter plugin to the configuration.

plugins: … playlistconverter

Now, you can further configure the plugin or start using it.

Configuration

The following sample configuration snippet shows the available options. Where to place this snippet in the config.yaml is shown here

playlistconverter:
  auto: no
  source_dir: posix
  types: ntfs uriposix urintfs
  playlist_posix: /foo/bar
  playlist_ntfs: /foo/barNTFS
  playlist_uriposix: /foo/barURIPOSIX
  playlist_urintfs: /foo/barURINTFS
  • auto

    Can be either yes or no (True or False). It configures the automated call of the plugin after an import of any kind. This way, if any of the playlists in the source directory have changed due to database changes, the playlists will be converted again.

  • source_dir

    Configures the source directory type of your playlists. This does not define the actual path, only the type. Can be either posix or ntfs depending on your OS. Default is to get the current OS and set the type accordingly (it would be wise to set this by hand).

  • types

    Will define a default set of type to convert to. This is a space seperated list of the following values: posix ntfs uriposix urintfs. The order does actually matter, the type named first will be also be converted first (Although this doesn't really make a siginificant difference). By default all available types except for the one defined in source_dir are included.

  • playlist_*

    Next the different options for playlist paths. These start with playlist_ and end in one of the possible formats. All of these are paths. By default the playlist_ path with the source_dir type is the path defined in the playlist plugin configuration. Then all other types will get the same path with their respective type appended.

It is recommended to also enable the playlist plugin and configure both to the same directory. This way the playlist plugin will keep your source playlists up to date and the playlistconverter will convert the files.

Usage

$ beet plcv -h

Shows help for all available commands -h / --help.

$ beet plcv -c -s [OPTIONS]

Show changes made between different format conversions -c / --show-changes. To show no output except for errors use -q / --quiet.

Importing

$ beet plcv -i -f FILENAME -p FILEPATH -a

Import a file or directory -p / --path to one or multiple files in the source directory -f / --file. If importing to an existing source file (or importing a folder), specify -a / --append to append to the existing file instead of overwriting.
Multiple values for FILEPATH and FILENAME are also possible, use , as a seperator.

Exporting

$ beet plcv -e

Defining no other options will read the Configuration and export all formats (except the sources format) to the specified directorys, overwriting existing files.

$ beet plcv -e -f FILENAME -p FILEPATH -t TYPES

Export a source file -f / --filename to one or multiple folders or files -p / --path. Specify formats to export with -t / --types (see Configuration - Types for possible values).
Multiple values for FILENAME and FILEPATH are also possible, use , as a seperator. When multiple FILEPATHs are defined, then each will be associated with a type.

Feature Requests / Bug reports

If you have an idea or a use case this plugin is missing or even found a bug, feel free to open an issue.

Planned additions

The following is a list of possible additions to the plugin.

  • Checking for write times in the source directory. Ignore files that haven't changed and add commandline switch to force reading / writing
  • Support relative paths in .m3u files
  • Add extended m3u support
  • m3u8 support / saving instead of m3u?

License

The MIT License

Copyright (c) 2020 Moritz Grede

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

beets-playlistconverter's People

Contributors

moritzgrede avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.