Git Product home page Git Product logo

bandcamp_suggestor's Introduction

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
        

bandcamp_suggestor's People

Contributors

lucweytingh avatar paulodder avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.