Add check bitrate and convert.

master
justuser31 2 years ago
parent 74878bb6c7
commit 0c47043168

@ -1,28 +1,48 @@
from os import listdir,system as ss
from time import sleep
import subprocess
#Theards
import threading
#Time&Date
from datetime import date
import time
#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://ic7.101.ru:8000/v1_1 -O nrj.mp3",
"https://emgregion.hostingradio.ru:8064/moscow.retrofm.mp3 -O retrofm.mp3"
]
###
#TIME(IN MINUTES)
tw = 3
wait = tw
###
tw = 30
if dev == False:
wait = tw*60
else:
wait = tw
#Save location
prefix = "~/ARCHIVE/"
###
#Check bitrate and upload
def tg(i,tim,prefix,group):
ss("rm t")
ss("ffprobe "+i+" 2> t")
bit = int(subprocess.check_output("cat t | grep bitrate | grep Duration | awk -F \" \" '{print $6}'", shell=True))
if bit != 128:
ss("lame --mp3input -b 128 "+i+" tt")
ss("mv tt "+i)
ss("telegram-upload "+i+" --to "+group+" --caption "+tim)
ss("mkdir "+prefix+tim)
ss("mv "+i+" "+prefix+tim+"/")
#Upload in telegram
def upload():
today = date.today()
@ -31,18 +51,15 @@ 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 i == "nashepunks.mp3":
ss("telegram-upload "+i+" --to https://t.me/getnetradio_nashe0punk --caption "+tim)
ss("mkdir "+prefix+tim)
ss("mv "+i+" "+prefix+tim+"/")
tg(i,tim,prefix,"https://t.me/getnetradio_nashe0punk")
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+"/")
tg(i,tim,prefix,"https://t.me/getnetradio_nrj")
elif i == "retrofm.mp3":
ss("telegram-upload "+i+" --to https://t.me/getnetradio_retrofm --caption "+tim)
ss("mkdir "+prefix+tim)
ss("mv "+i+" "+prefix+tim+"/")
tg(i,tim,prefix,"https://t.me/getnetradio_retrofm")
else:
pass
@ -65,4 +82,5 @@ while True:
#Upload
upload()
break
if dev == True:
break

Loading…
Cancel
Save