Skip to content

paulodder/bandcamp_suggestor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

51 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

README

intro

Code to play a radio based on a Bandcamp user’s wishlist and https://bc-explorer.app.

setting up

  1. Create a virtualenv (I used Python 3.9) and activate it
    virtualenv <env_name>
    source <env_name>/bin/activate
        
  2. Install the requirements
    pip install -r requirements.txt
        

    and then:

    pip install -e .
        
  3. Create a .env file
    A .env file is used to keep track of machine-specific variables. Create a .env in the root of this project with the following values set:
    PROJECT_DIR=/path/to/bandcamp_suggestor/ # the path to this directory
    BANDCAMP_USER=username # your bandcamp username
    RASPBERRY_PI_USER=username # your raspberry pi username (optional)
        

    To access these variables in python code run:

    from decouple import config
    config("PROJECT_DIR")
        

usage

from src.bandcamp_suggestor import BandcampSuggestor
bc_suggestor = BandcampSuggestor('<bandcamp_username>')
bc_suggestor.generate_suggestions()

will scrape the collection and wishlist items from bandcamp, use a randomly picked one to feed to bc-explorer, and then returns suggestions from bc-explorer.

To play the radio based on your bandcamp wishlist locally run the following:

python scripts/play_infinite_radio.py

To run the radio on raspberry pi startup do the following:

  1. Install `RPi.GPIO` on the pi
    pip install RPi.GPIO==0.7.1
        
  2. Give this file execute permissions
    chmod +x path/to/raspberry_pi_on_startup.sh
        
  3. Run the following on startup of raspberry pi (https://unix.stackexchange.com/questions/166473/debian-how-to-run-a-script-on-startup-as-soon-as-there-is-an-internet-connecti):
    export $(cat /path/to/.env | xargs) # to get $PROJECT_DIR and $RASPBERRY_PI_USER
    bash -c "${PROJECT_DIR}scripts/raspberry_pi_on_startup.sh > /path/to/run.log 2>&1" # Start the radio and log
        

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •