From 8b372a4ed49fba14a465c77216d8e48a9b199519 Mon Sep 17 00:00:00 2001 From: justuser31 Date: Thu, 6 Oct 2022 22:28:51 +0300 Subject: [PATCH] New config! More easier. --- config.py | 15 +++++++++++++++ main.py | 33 +++++++++++++++++---------------- 2 files changed, 32 insertions(+), 16 deletions(-) create mode 100644 config.py diff --git a/config.py b/config.py new file mode 100644 index 0000000..54b6d74 --- /dev/null +++ b/config.py @@ -0,0 +1,15 @@ +#Time in minutes +time = "10" +#Prefix for file save location( $prefix/your.mp3 ) +prefix= "~/ARCHIVE/" +#Your radio +radio = { + +#name_of_file.mp3 : ["https://link_to_radio.mp3","https://link_to_telegram"] +#"-O name.mp3" after link to change name(look for example \/ ) + +"nashepunks.mp3" : ["https://nashe1.hostingradio.ru:18000/nashepunks.mp3","https://t.me/getnetradio_nashe0punk"], +"nrj.mp3" : ["https://ic7.101.ru:8000/v1_1 -O nrj.mp3","https://t.me/getnetradio_nrj"], +"retrofm.mp3" : ["https://emgregion.hostingradio.ru:8064/moscow.retrofm.mp3 -O retrofm.mp3","https://t.me/getnetradio_retrofm"] + +} diff --git a/main.py b/main.py index 98f679f..5eaca67 100644 --- a/main.py +++ b/main.py @@ -6,27 +6,23 @@ import threading #Time&Date from datetime import date import time +#Config +import config + #DEV-MODE# dev = False ########## -#RADIO STATIONS -#SET TELEGRAM IN upload() -rad = [ -"https://nashe1.hostingradio.ru:18000/nashepunks.mp3", -"https://ic7.101.ru:8000/v1_1 -O nrj.mp3", -"https://emgregion.hostingradio.ru:8064/moscow.retrofm.mp3 -O retrofm.mp3" -] -#TIME(IN MINUTES) -tw = 30 +#Import config +tw = int(config.time) +prefix = config.prefix +rad = config.radio + if dev == False: wait = tw*60 else: wait = tw -#Save location -prefix = "~/ARCHIVE/" -### #Check bitrate and upload def tg(i,tim,prefix,group): @@ -51,7 +47,12 @@ def upload(): tim = today.strftime("%d.%m.%Y_"+time.strftime("%H:%M", time.localtime())) for i in files: - #HERE SET YOUR TELEGRAM AND MP3 + if rad.get(i) == None: + pass + else: + print("SUCCESS") + tg(i,tim,prefix,rad[i][1]) +''' if i == "nashepunks.mp3": tg(i,tim,prefix,"https://t.me/getnetradio_nashe0punk") @@ -62,15 +63,15 @@ def upload(): tg(i,tim,prefix,"https://t.me/getnetradio_retrofm") else: pass - +''' while True: #Download function def rad_down(ch): - ss("wget "+i) + ss("wget "+ch) #Run download for i in rad: - th = threading.Thread(target=rad_down, args=(i,)) + th = threading.Thread(target=rad_down, args=(rad[i][0],)) th.start() #Wait