Merge run.sh and up.py.

master
justuser 2 years ago
parent 828abf2fbe
commit 27422e9e63

@ -0,0 +1,63 @@
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

@ -1,13 +0,0 @@
while :
do
wget https://nashe1.hostingradio.ru:18000/nashepunks.mp3 &
th1=$!
wget https://ic7.101.ru:8000/v1_1 -O nrj.mp3 &
th2=$!
sleep 30m
kill -9 $th1
kill -9 $th2
python3 up.py
done

@ -1,5 +1,5 @@
kl=$(ps aux | grep run.sh | grep bin | awk -F " " '{print $2}')
kl=$(ps aux | grep main.py | grep python3 | awk -F " " '{print $2}')
kill $kl
killall wget
rm *.mp3
rm nohup.out
#rm nohup.out

24
up.py

@ -1,24 +0,0 @@
from os import listdir,system as ss
from datetime import date
import time
today = date.today()
files = listdir()
prefix = "~/ARCHIVE/"
for i in files:
tim = today.strftime("%d.%m.%Y_"+time.strftime("%H:%M", time.localtime()))
#Check type,no need for this
#tp = i[i.find('.') + 1:]
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
Loading…
Cancel
Save