Use your personal Spotify data to create your own playlists for long-term liked songs rediscovery - rediscover the past.
This package uses your personal Spotify data, i.e. your past year's streaming history and your liked songs playlist, to generate a playlist of music you might like and rediscover again, but haven't listend to for more than a year. Check out this blogpost for a more detailed description and some guidance. Cheers!
In order to set up the necessary environment:
- review and uncomment what you need in
environment.yml
and create an environmentliked2play
with the help of conda:conda env create -f environment.yml
- activate the new environment with:
conda activate liked2play
NOTE: The conda environment will have liked2play installed in editable mode. Some changes, e.g. in
setup.cfg
, might require you to runpip install -e .
again.
Optional and needed only once after git clone
:
-
install several pre-commit git hooks with:
pre-commit install # You might also want to run `pre-commit autoupdate`
and checkout the configuration under
.pre-commit-config.yaml
. The-n, --no-verify
flag ofgit commit
can be used to deactivate pre-commit hooks temporarily. -
install nbstripout git hooks to remove the output cells of committed notebooks with:
nbstripout --install --attributes notebooks/.gitattributes
This is useful to avoid large diffs due to plots in your notebooks. A simple
nbstripout --uninstall
will revert these changes.
There are two steps that need to be performed before you can use this. The best thing to do is to read this blogpost that guides you through everything.
-
Request your personal usage data here. From my own experience, this took a couple of days.
-
Download your personal data once available (you will be notified by email) and extract it to your machine.
-
Create your Spotify API credentials here by adding a new app. Also add yourself as user to the app. Save
client_id
client_secret
user_id
to your machine.
-
Adapt the config template
config.json
according to your own paths and preferences.
With the package installed the command liked2play
becomes available on your system.
There are two required arguments:
-c
stands for config and expects the filepath of yourconfig.json
-m
stands for mode and expects one of the steps you want to perform:analyze
: analyzes your liked songs and streaming history and generates a small summary statisticspreprocess
: fetches music features and joins information with streaming information and liked songs required for determining your music taste profilegenerate
: uses your music taste profile to determine the top-k songs to resemble your "Rediscover Past" playlistupload
: upload the generated playlist to your Spotify accountend2end
: performspreprocess
,generate
, andupload
in a single pass
During some runs you will be redirected to a website that starts with the URL you specified in the config.json
.
Copy the full URL and enter it in your shell when asked for. This is for authentification.
Example Usage:
liked2play -c configs/config.json -m analyze -v
- Always keep your abstract (unpinned) dependencies updated in
environment.yml
and eventually insetup.cfg
if you want to ship and install your package viapip
later on. - Create concrete dependencies as
environment.lock.yml
for the exact reproduction of your environment with:For multi-OS development, consider usingconda env export -n liked2play -f environment.lock.yml
--no-builds
during the export. - Update your current environment with respect to a new
environment.lock.yml
using:conda env update -f environment.lock.yml --prune
├── LICENSE.txt <- License as chosen on the command-line.
├── README.md <- The top-level README for developers.
├── data
│ ├── external <- Data from third party sources.
│ ├── interim <- Intermediate data that has been transformed.
│ ├── processed <- The final, canonical data sets for modeling.
│ └── raw <- The original, immutable data dump.
├── environment.yml <- The conda environment file for reproducibility.
├── notebooks <- Jupyter notebooks. Naming convention is a number (for
│ ordering), the creator's initials and a description,
│ e.g. `1.0-fw-initial-data-exploration`.
├── pyproject.toml <- Build system configuration. Do not change!
├── setup.cfg <- Declarative configuration of your project.
├── setup.py <- Use `pip install -e .` to install for development or
| or create a distribution with `tox -e build`.
├── src
│ └── liked2play <- Actual Python package where the main functionality goes.
├── tests <- Unit tests which can be run with `py.test`.
├── .coveragerc <- Configuration for coverage reports of unit tests.
├── .isort.cfg <- Configuration for git hook that sorts imports.
└── .pre-commit-config.yaml <- Configuration of pre-commit git hooks.
This project has been set up using PyScaffold 4.1.1 and the dsproject extension 0.6.1.