Giter VIP home page Giter VIP logo

spotify-random-saved-album's Introduction

๐Ÿƒ Spotify โ€“ get the URL of a random saved album

Usage

spotify-random-saved-album --h
usage: spotify-random-saved-album [-h] [--no-cache] [--update-cache] [--output-name] [--output-artist] [--uri]

options:
  -h, --help       show this help message and exit
  --no-cache       .cache.json won't be created
  --update-cache   force update cache file
  --output-name    append album's name to output
  --output-artist  append artist's name to output
  --uri            return URI instead of URL. You can pass URI to spotify.start_playback(context_uri=URI) to play the album instantly
                   (premium required)

Install - 7 steps:

  1. Install dependencies and install the script:

    sudo apt update
    sudo apt install git python3 python3-pip
    
    pip install spotify-random-saved-album
    
  2. login and create a new Spotify Developer app at https://developer.spotify.com/dashboard/applications

  3. Open the created app on the Dashboard and click Edit settings

  4. Go to Redirect URIs -> add redirect URL http://127.0.0.1:9090

  5. Copy Client ID and Client Secret from the app's main page

  6. Create a new file /path/to/.env which will contain the Client ID and Client Secret:

    The /path/to/.env file should look like this:

    export SPOTIFY_ID=YOUR_CLIENT_ID
    export SPOTIFY_SECRET=YOUR_CLIENT_SEC
    

    (optional): create and populate /path/to/.env with the following commands:

    touch .env # creates .env file
    echo "export SPOTIFY_ID=<YOUR_CLIENT_ID>" >> .env
    echo "export SPOTIFY_SECRET=<YOUR_CLIENT_SEC>" >> .env
    cat .env
  7. Get the URL of a random saved album:

    (Option A) source the /path/to/.env (sets $SPOTIFY_ID and $SPOTIFY_SECRET) and run the spotify-random-saved-album command

    source /path/to/.env && spotify-random-saved-album

    (Option B) the variables explicitly and run the script:

    SPOTIFY_ID=<YOUR_CLIENT_ID> SPOTIFY_SECRET=<YOUR_CLIENT_SEC> spotify-random-saved-album
    

Notes

You have to pass the OAuth via browser once on the last step.

Personal usecase of this script is to pipe the output (external link) to a browser shortcut which will open a random album.

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.