Skip to main content

Spotijjjy

A python script to generate Spotify playlists from rest services. Currently works for Any ABC (Australian Broadcasting Corporation) with a /r/listentothis playlist generator in progress

Originally designed for Triple J - thus the name.

Inputs

ABC

Any ABC (Australian Broadcasting Corporation) radio station
Known ABC stations are: jazz,dig,doublej,unearthed,country,triplej,classic
You can choose what timeframe to create a playlist from, it defaults to the previous aired standard morning and afternoon sessions

Setup

From source

# Clone the repo
git clone git@github.com:maxtara/Spotijjjy.git
cd Spotijjjy

# Create a [virtualenv](https://virtualenv.pypa.io/en/stable/)
virtualenv env
source env/bin/activate

# install requirements
pip install -r requirements.txt

From pip

TODO

Run

Spotify Intructions

To get a Spotify client id, client secret and refresh token, follow instructions at Spotify Web API Tutorial

Oauth token store

The oauth token needs to be stored to be refreshed, there are currently two storage options, DynamoDB or a file, specified in the STORE option below.
If storing the oauth token in DynamoDB, the key to store it is 'spotijjjy_token'.

If using the DynamoDB store, boto3 is required - pip install boto3

CLI Usage

usage: python -m spotijjjy.main config.json station_id playlist_id <STORE>

e.g.: python -m spotijjjy.main config.json doublej 2jhfs98s3finafzgfse9u3 file:foo.txt [ranges]
e.g.: python -m spotijjjy.main config.json triplej sfiujh38f9hs983fjs3fj9 dydb:tablename [ranges]

Optional argument ranges in the format - comma seperated list of from%to in iso format.
e.g. 2020-01-01T12:00:00%2020-01-01T13:00:00,2020-02-01T12:00:00%2020-02-01T13:00:00
turns into 
    from - 2020-01-01T12:00:00
    to   - 2020-01-01T13:00:00 
and from - 2020-02-01T12:00:00
    to   - 2020-02-01T13:00:00

Deploy on Serverless (AWS Lambda) Setup

Requires serverless (sls) to be installed, and aws credentials setup. More help here: https://www.serverless.com/framework/docs/getting-started/

sls plugin install --name serverless-python-requirements
sls deploy

Arguments are passed in a env variables, which you can put in the serverless.yml, or a secrets.json like the yaml provided.

Notes

Spotify searching

I do my best to find the correct song via the spotify search api, using a variety of methods. I use Multiple API options (searching with the artist, or artists, or full text search), and from the returned search results, I try to find the exact song using fuzzy string matching. YMMV

Deploying

pytest -vs
python3 setup.py sdist bdist_wheel
python3 -m twine upload dist/*

Metadata

Release files for spotijjjy 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for spotijjjy 1.0.0
File Size Uploaded
spotijjjy-1.0.0.tar.gz 8.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for spotijjjy 1.0.0
File Interpreter ABI Platform
spotijjjy-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 18.3 kB

Release files / spotijjjy-1.0.0.tar.gz

Download URL spotijjjy-1.0.0.tar.gz
Size 8.8 kB
Tags Source
SHA-256 checksum
How to use checksums
02bf49b732feeb19b5716427491db9dc840bbde4771f46f9d0ff36cd4befaeac
BLAKE2b-256 checksum
How to use checksums
1cbec94ea1bda326ba26931a532bad66c0beaa81ba4388dc8598a74d9d9b7c30
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.2

Release files / spotijjjy-1.0.0-py3-none-any.whl

Download URL spotijjjy-1.0.0-py3-none-any.whl
Size 9.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7e19dd0a979c099e0a2eff8b444d0d52413f423e17655822b68d216209e1bc2c
BLAKE2b-256 checksum
How to use checksums
1a48d34458ff2a0a6b9de014d775fcb33a4c59b6a4728bcae9f25752717b69c3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.2

Release history Release notifications | RSS feed

1.1.0

2 release files

This release

1.0.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page