Last active
April 21, 2016 23:25
-
-
Save jayktaylor/a7ec96f7495a2676bf98aef37872e5f5 to your computer and use it in GitHub Desktop.
Dumps urls from audio_cache folder into playlist.txt and optionally moves to config/autoplaylist.txt - similar to Borked's pldump
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from os import listdir | |
from os.path import isfile, join | |
import shutil | |
files = [f for f in listdir("audio_cache") if isfile(join("audio_cache", f))] | |
url = "https://www.youtube.com/watch?v=" | |
print("\n" * 100) | |
with open('playlist.txt', 'w+') as f: | |
for i in files: | |
i = i.replace('youtube-', '').split('-')[0] | |
link = url + i | |
f.write(link + '\n') | |
print("Saved to file: " + link) | |
print("Done writing to file.\n") | |
input = input("Would you like to replace autoplaylist.txt with this file? [y/n] ") | |
if input == "y": | |
shutil.move('playlist.txt', 'config/autoplaylist.txt') | |
print("Replaced autoplaylist.txt.") | |
else: | |
print("Okay, we haven't replaced autoplaylist.txt.") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment