Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save csimpi/ddbc124c722dea366bdd99014443dee7 to your computer and use it in GitHub Desktop.
Save csimpi/ddbc124c722dea366bdd99014443dee7 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
import re
import subprocess
with open("playlists.txt", "r") as ins:
for url in ins:
print(url.strip())
cmd="./spotdl.py --playlist "+url
process=subprocess.Popen(cmd, shell=True, stderr=subprocess.STDOUT, stdout=subprocess.PIPE)
output = process.stdout.read().decode('utf-8')
#print("OUT: "+output)
matches=re.search("Writing (.*?) tracks to (.*?).txt",output);
playlist_slug=matches.group(2)
playlist_file=playlist_slug+".txt"
playlist_title=playlist_slug.replace("-", " ").strip().title()
print(playlist_title);
print(playlist_file);
cmd="./spotdl.py --list="+playlist_file+" --overwrite skip -f /home/vagrant/Music/'"+playlist_title+"'"
process=subprocess.Popen(cmd, shell=True)
print();
#break
@csimpi
Copy link
Author

csimpi commented Jun 26, 2018

This is a playlist synchronizer script for 'ritiek/spotify-downloader': https://github.com/ritiek/spotify-downloader

Create playlist.txt
Put your playlists' URLs into the playlist.txt file.
Run the script with python.

The script will download each track from each playlist from the playlist.txt and put the files into /home/vagrant/Music/{playlist title} folder

DON'T FORGET CHANGE THE DESTINATION DIRECTORY!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment