from os import listdir,system as ss from time import sleep #Theards import threading #Time&Date from datetime import date import time #RADIO STATIONS rad = [ "https://nashe1.hostingradio.ru:18000/nashepunks.mp3", "https://ic7.101.ru:8000/v1_1 -O nrj.mp3" ] ### #TIME(IN MINUTES) tw = 3 wait = tw ### #Save location prefix = "~/ARCHIVE/" ### #Upload in telegram def upload(): today = date.today() files = listdir() #Set date&time tim = today.strftime("%d.%m.%Y_"+time.strftime("%H:%M", time.localtime())) for i in files: if i == "nashepunks.mp3": ss("telegram-upload "+i+" --to https://t.me/getnetradio_nashe0punk --caption "+tim) ss("mkdir "+prefix+tim) ss("mv "+i+" "+prefix+tim+"/") elif i == "nrj.mp3": ss("telegram-upload "+i+" --to https://t.me/getnetradio_nrj --caption "+tim) ss("mkdir "+prefix+tim) ss("mv "+i+" "+prefix+tim+"/") else: pass while True: #Download function def rad_down(ch): ss("wget "+i) #Run download for i in rad: th = threading.Thread(target=rad_down, args=(i,)) th.start() #Wait sleep(wait) #Stop download ss("killall wget") #Upload upload() break