|
|
|
@ -1,11 +1,21 @@
|
|
|
|
|
#!/usr/bin/env python3 |
|
|
|
|
import pathlib, os, sys, traceback |
|
|
|
|
import pathlib, os, sys, traceback, configparser |
|
|
|
|
from yt_dlp import YoutubeDL |
|
|
|
|
from shout import Shout |
|
|
|
|
|
|
|
|
|
class IceDJ: |
|
|
|
|
# TODO: use a config file |
|
|
|
|
def __init__(self): |
|
|
|
|
config = configparser.ConfigParser() |
|
|
|
|
config.read('config.txt') |
|
|
|
|
cfgShout = config['IceDJ-shout'] |
|
|
|
|
|
|
|
|
|
self.shout = Shout() |
|
|
|
|
self.shout.host = cfgShout['host'] |
|
|
|
|
self.shout.port = int(cfgShout['port']) |
|
|
|
|
self.shout.user = cfgShout['user'] |
|
|
|
|
self.shout.password = cfgShout['password'] |
|
|
|
|
self.shout.mount = cfgShout['mount'] |
|
|
|
|
|
|
|
|
|
self.ydl_opts = { |
|
|
|
|
'format': 'bestaudio', |
|
|
|
|
'postprocessors': [{ |
|
|
|
@ -18,13 +28,6 @@ class IceDJ:
|
|
|
|
|
pathlib.Path(self.directory).mkdir(parents=True, exist_ok=True) |
|
|
|
|
os.chdir(self.directory) |
|
|
|
|
|
|
|
|
|
self.shout = Shout() |
|
|
|
|
self.shout.host = '127.0.0.1' |
|
|
|
|
self.shout.port = 8000 |
|
|
|
|
self.shout.user = 'source' |
|
|
|
|
self.shout.password = 'hackme' |
|
|
|
|
self.shout.mount = '/icedj' |
|
|
|
|
|
|
|
|
|
# TODO: check if url is valid |
|
|
|
|
# downloads a url to a file and returns it's filename |
|
|
|
|
def download(self, url): |
|
|
|
|