This is a Python project made to import the 'Weekly Jams' playlist from ListenBrainz into Plex.
Make sure you have Python 3.11
installed:
Get the latest version using your favorite git client or by downloading the latest release from here:
https://github.com/Mjsciarabba/Listenbrainz-Playlist-Sync/releases
In the project directory rename config.yml.example
to config.yml
, open config.yml
with your text editor and edit where needed.
The method for obtaining a Plex token is described here: https://support.plex.tv/articles/204059436-finding-an-authentication-token-x-plex-token/
In the config file, enter your Plex library/section name containing your music, like so:
music_section: 'Music'
The poster_file_path
field is optional. This is for if you want to upload a custom playlist cover instead of using the
auto-generated one from Plex. This upload only happens during initial creation of the playlist
filter_genre
is also optional. This field is used to filter out unwanted tracks by genre. A use case could be removing pesky Christmas songs infiltrating your playlist in the off-season.
A completed Plex section looks like this:
# Plex Info
baseurl: '192.168.1.70:32400'
token: 'abcdef123456789'
music_section: 'Music'
poster_file_path: 'path\to\poster.png'
filter_genre: 'Christmas'
Information on how to obtain the ListenBrainz token for your user can be found here: https://listenbrainz.readthedocs.io/en/latest/users/api/index.html#get-the-user-token
The playlist_username
should be your ListenBrainz username
api_email
is needed for the Musicbrainz API to make queries. You do not need to have a Musicbrainz account, and you
can use any email address
A completed ListenBrainz section looks like this:
# ListenBrainz Info
user_token: 'abcdef123456789'
playlist_username: 'listenbrainz'
api_email: 'mail@example.com'
Install the additional requirements using the Python package installer (pip) from within the project folder:
pip install -r requirements.txt
Now that configuration is finished and requirements have been installed, we can finally start the script:
python main.py
Using the Windows Task Scheduler, you can have this script run on a weekly basis automatically. Here's how to set it up:
- Create a
Runner.cmd
file by opening the text editor (i.e. Notepad, TextEdit) and pasting the following code:
cd C:\Users\USERNAMEHERE\Listenbrainz Playlist Sync
python main.py
- Open Task Scheduler by searching for it in the Start Menu or by opening the Run window (Windows + R) and typing taskschd.msc before hitting OK. ** Ensure that Task Scheduler is opened and not Task Manager **
- Select "Create a basic task" on the right-hand column
- Give the task a name, such as
Listenbrainz Sync
and then select "Next" - Choose the frequency that this should run,
Weekly
is suggested. - Choose the action "Start a program" and select "Next".
- Click "Browse", Navigate to the directory and choose
Runner.cmd
, which was created in Step 1, then select "Open". - Copy the directory everything up to but not including
Runner.cmd
from the "Program/Script" field, and paste it into the "Start in" field. - Click "Finish".
- Click "Task Schedule Library" on the left. The "Listenbrainz Sync" task should be visible.
This project is licensed under the MIT License - see the LICENSE file for details.