Skip to content

CLI tool to convert BBC radio station playlists into spotify playists

License

Notifications You must be signed in to change notification settings

stefpiatek/bbc_meet_spotify

Repository files navigation

bbc_meet_spotify

Simple tool to convert BBC radio station playlists into spotify playists

Why

BBC used to be friendly for spotify users and create spotify playlists of their A-, B- and C-list songs for that week. It looks like when they moved everything to BBC Sounds, that they wanted to make people use it, so stopped putting their playlists on Spotify. This is a low effort way to get those playlists back on spotify.

Other options that didn't work for me:

  • rdfaudio (Javascripy chrome plugin) never populated a playlist for me.
  • spotify_bb6 (python) relied on spotify links existing on the bbc page, the weekly playlist doesn't have this anymore so additional work scraping the track info and then searching spotify was needed
  • beebify (python) scraped the information from a different format of bbc playlist which didn't work for the weekly playlists sadly.
  • bbcr1-spotify (Crystal) seemed like it would only populate playlist with bbc radio 1 now playing

Installation & setup

  1. Clone repository and enter the repository directory

    git clone https://github.com/stefpiatek/bbc_meet_spotify.git
    cd bbc_meet_spotify
  2. Install poetry if you don't already have it installed

  3. From the repository directory, initialise poetry

    poetry init
  4. Follow the instructions for authorisation of spotify apps (which involves registering your app). The name of the application can be whatever you'd like.

  5. Copy the config_example.toml to a new file config.toml.

    • Fill in the config client_id and client_secret from the application you registered with spotify.
    • Fill in your spotify username field.

Usage

The simplest usage is to use the default values poetry run bbc-meet-spotify six_music

The first time you use this, your internet browser will open a page following the url pattern: http://localhost:8888/?code=<code>. Copy the the entire url into the command line prompt and hit enter.

Overview of actions taken

  • The command above will get all songs from the BBC 6 Music playlist page
  • If this playlist has been run before, and the date prefix cli argument wasn't used, check the history (playlist_history/BBC 6 Music.toml) and only get the new songs. This also saves the full history back to the toml file for the next time it's run.
  • Create a public playlist e.g. BBC 6 Music. If a playlist by this name already exists, it will just use this playlist.
  • Add all songs that it can find on spotify to the playlist if they aren't already in the playlist.
    • If any songs can't be found, the song will be logged and you can add these manually.

2020-01-11 21:51:06.133 | ERROR | __main__:_get_song_id:193 - Could not find a song: <Juniore: Ah Bah D Accord>

Command line options

Command line options are generated by typer, see their documentation if you need help using the command line options.

You can view the command line options by poetry run bbc-meet-spotify --help poetry add --dev coverage[toml] pytest-cov

Usage: bbc-meet-spotify [OPTIONS] 
                        [six_music|radio1|dance_party_2021|dance_anthems]

Options:
  --date-prefix / --no-date-prefix
                                  Add a date prefix to be added to your
                                  spotify playlist?  [default: False]

  --public-playlist / --private-playlist
                                  Spotify playlist settings  [default: True]
  -n, --custom-playlist-name TEXT
                                  Set a custom name for playlist
  --version
  --help                          Show this message and exit.

The default command line options with the six_music are equivalent to calling:

poetry run bbc-meet-spotify --no-date-prefix --public-playlist six_music

About

CLI tool to convert BBC radio station playlists into spotify playists

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages