Skip to content

raiden-e/autofy

Repository files navigation

Autofy

Tests Daily Run

Scripts that automatically backup, update Spotify playlists etc.

Licensing 🔑

Pillow pyGithub pytz spotipy telethon

Links 📎

Daily Song Discord Daily Song Dubstep Radar LoFi Playlist Track des Tages Trappin in Japan

Lofi ☕

A script to pick around 250 Lo-Fi songs and drop them into a chilled weekly automated playlist.

Lo-Fi Hip-Hop is some of the chilliest beats you will ever hear, and it helps me study, code, play games, and relax.

Backup 📚

Spotify has some good playlists. However, they update them sometimes, such that they remove good songs from them. This script goes through several playlists and archives their tracks.

Check out the Night Rider Playlist and the Night Rider Backup.

Requirements for Backup

You need to go to gist.github.com and create a gist with a file called autofy.json. In this gist, create a file called autofy.json and paste the following basic structure

{
  "backup": {
  }
}

Adding single playlist automatically with Image.py: Image

Adding a playlist manually:

{
  "backup": {
    "My Playlist No. 1": {
      "get": [
        "spotify:playlist:RanDoMstuff12312312312"
      ],
      "set": "spotify:playlist:uriToMyPlaylistNo1backup"
    }
  }
}

you can also have multiple plyalist be merged into one backup list, like my lofi backup:

{
  "backup": {
    "zzLofi": {
      "get": [
        "spotify:playlist:0vvXsWCC9xrXsKd4FyS8kM",
        "spotify:playlist:74sUjcvpGfdOvCHvgzNEDO",
        "spotify:playlist:37i9dQZF1DXc8kgYqQLMfH",
        "spotify:playlist:37i9dQZF1DX8Uebhn9wzrS",
        "spotify:playlist:37i9dQZF1DX9RwfGbeGQwP",
        "spotify:playlist:37i9dQZF1DWZZbwlv3Vmtr",
        "spotify:playlist:37i9dQZF1DX0SM0LYsmbMT"
      ],
      "set": "spotify:playlist:0wd5N98lZyiNpOm4nQJqc5"
    }
  }
}

Image

Automatically adds a playlist to the gist containing Backup.py 's list of URI's.

.\venv\Scripts\activate.ps1
python .\Image.py --plid <link to playlist> --file <path to >

parser.add_argument("plid", nargs='?', help='The id of the playlist you want to backup', type=str) parser.add_argument("--noplaylist", help='switch to only get picture', action="store_true") parser.add_argument('-f', '--file')

DailySong 🎶

Send's a random song from a Spotify playlist to Track des Tages, Daily Track, and my Discord at noon CEST.

Dubstep 🚑

So I like this genre, but Spotify's algorithms are kind of poor when it comes to recommendations. The personal radar changes whenever you listen to something new. Especially when you recently listened to songs by popular artists. So I summed up some decent dubstep artists in a gist. This script pulls the latest releases from those artists and loads them into a playlist every week. If the latest release was an album, it picks the 2-5 most popular tracks.

Now Playing ▶

Show the currently playing song on Spotify and get the artist, song name, album name, and cover. This script continuously saves the name of the song, artist, and album in a text file in the user's home folder.

.\venv\Scripts\activate.ps1
python .\NowPlayling.py

FixReport 🔧

Since my playlist Hard DNB 🔥 is being reported like crazy and I always have to reset the title, description and reupload the playlist's cover image, i built a script, that would to it automa for me. Screw Spotify's support...

update: my playlist got deleted along with my account. I love spotify :)

Examples

Example Lofi

python LoFi.py

Example Image

python Image.py spotify:playlist:5h9LqGUUE4FKQfVwgAu1OA

Example DailySong

python DailySong.py

Example Dubstep

python Dubstep.py

Example Backup

# requires a gist with a file called "autofy.json" see above
python Backup.py

Setup

Requirements

  • python
    • discord.py
    • Pillow
    • pyGithub
    • pytz
    • spotipy
    • telethon

Create a Telegram application

Create a Spotify application

Create a Discord bot

Get your gist token

Rename config_template.py to config.py. Save your api hashes and id's to config.py

Install Python

Open Powershell/CMD/bash and run the following commands:

# if you are unfamiliar with virtual environments, you can read up on them here:
# https://docs.python.org/3/tutorial/venv.html

pip install -U virtualenv, pip

python -m virtualenv venv

./venv/Scripts/activate.ps1

pip install -r requirements.txt

Now you can run a script manually like so:

# 'xxxxxxxxxx' is the playlist id
python Image.py spotify:playlist:xxxxxxxxxx