GithubHelp home page GithubHelp logo

spot-mirror's Introduction

spot-mirror

Monitor a Spotify podcast, download episodes and host them locally

This is the repository for my spot-mirror Docker image. The image contains 3 tools:

  • spodcast - Download Spotify podcast episodes
  • podcats - Generate an RSS feed from the downloaded episodes and host it locally
  • supercronic - a crontab-compatible job runner, designed specifically to run in containers

Note: Even though spodcast has a built-in RSS feed generator, it needs an external PHP-capable webserver to generate the RSS and serve its (admittedly pretty cool) web interface. Since I only want the RSS feed it feels a bit too much, so I'd rather save the resources.

Usage

Build the image

docker build -t spot-mirror:latest .

Preface

spodcast needs your Spotify login credentials to access the Spotify API. You provide them via environment variables to the container. It is recommended to put them into an .env file

# .env
SPOTIFY_USER=<username>
SPOTIFY_PW=<password>

Docker run

$ docker run -d -v /your/data/dir:/data -p 9900:9900 -e SPOT_URL_0=https://open.spotify.com/show/SHOW_ID -e SPOT_CRON_0="0 0 5 * * WED *" --env-file .env  spot-mirror:latest

docker-compose

version: "3.9"
services:

  spot-mirror:
    image: spot-mirror:latest
    container_name: spot-mirror
    restart: unless-stopped
    ports:
      - "9900:9900"
    environment:
      - FEED_HOST=0.0.0.0
      - FEED_PORT=9900
      - FEED_TITLE=MyPodcastFeed
      - SPOT_URL_0=https://open.spotify.com/show/SHOW_ID
      - SPOT_CRON_0=0 0 5 * * WED *
    env_file:
      - .env
    volumes:
      - /your/data/dir:/data

Selecting show and schedule

The Spotify show and timeplan when to download it is selected by an pair of environment variables, see example above:

- SPOT_URL_0=https://open.spotify.com/show/SHOW_ID
- SPOT_CRON_0=0 0 5 * * WED *

This downloads the show with ID SHOW_ID every Wednesday at 5 am. Refer to the supercronic repo for format details.

Add additional shows by incrementing the number, e.g. SPOT_URL_1, SPOT_URL_2. Every SPOT_URL_N needs a corresponding SPOT_CRON_N variable.

Variables

  • FEED_HOST - hostname used by podcats
  • FEED_PORT - port used by podcats
  • FEED_TITLE - Title of the feed as hosted by podcats
  • SPOT_URL_N - See section above
  • SPOT_CRON_N= See section above

Known issues

Sometimes, spodcast times out while accessing the Spotify API. The internal script uses retries to work around that. However, the API timeout is around 2 minutes. That means the first startup of the container may take a while in some cases. If it appears to hang, just wait a short while.

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.