Add check bitrate and convert.
This commit is contained in:
parent
74878bb6c7
commit
0c47043168
48
main.py
48
main.py
@ -1,28 +1,48 @@
|
|||||||
from os import listdir,system as ss
|
from os import listdir,system as ss
|
||||||
from time import sleep
|
from time import sleep
|
||||||
|
import subprocess
|
||||||
#Theards
|
#Theards
|
||||||
import threading
|
import threading
|
||||||
#Time&Date
|
#Time&Date
|
||||||
from datetime import date
|
from datetime import date
|
||||||
import time
|
import time
|
||||||
|
|
||||||
|
#DEV-MODE#
|
||||||
|
dev = False
|
||||||
|
##########
|
||||||
|
|
||||||
#RADIO STATIONS
|
#RADIO STATIONS
|
||||||
|
#SET TELEGRAM IN upload()
|
||||||
rad = [
|
rad = [
|
||||||
"https://nashe1.hostingradio.ru:18000/nashepunks.mp3",
|
"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"
|
"https://emgregion.hostingradio.ru:8064/moscow.retrofm.mp3 -O retrofm.mp3"
|
||||||
]
|
]
|
||||||
###
|
|
||||||
|
|
||||||
#TIME(IN MINUTES)
|
#TIME(IN MINUTES)
|
||||||
tw = 3
|
tw = 30
|
||||||
|
if dev == False:
|
||||||
|
wait = tw*60
|
||||||
|
else:
|
||||||
wait = tw
|
wait = tw
|
||||||
###
|
|
||||||
|
|
||||||
#Save location
|
#Save location
|
||||||
prefix = "~/ARCHIVE/"
|
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
|
#Upload in telegram
|
||||||
def upload():
|
def upload():
|
||||||
today = date.today()
|
today = date.today()
|
||||||
@ -31,18 +51,15 @@ def upload():
|
|||||||
tim = today.strftime("%d.%m.%Y_"+time.strftime("%H:%M", time.localtime()))
|
tim = today.strftime("%d.%m.%Y_"+time.strftime("%H:%M", time.localtime()))
|
||||||
|
|
||||||
for i in files:
|
for i in files:
|
||||||
|
#HERE SET YOUR TELEGRAM AND MP3
|
||||||
if i == "nashepunks.mp3":
|
if i == "nashepunks.mp3":
|
||||||
ss("telegram-upload "+i+" --to https://t.me/getnetradio_nashe0punk --caption "+tim)
|
tg(i,tim,prefix,"https://t.me/getnetradio_nashe0punk")
|
||||||
ss("mkdir "+prefix+tim)
|
|
||||||
ss("mv "+i+" "+prefix+tim+"/")
|
|
||||||
elif i == "nrj.mp3":
|
elif i == "nrj.mp3":
|
||||||
ss("telegram-upload "+i+" --to https://t.me/getnetradio_nrj --caption "+tim)
|
tg(i,tim,prefix,"https://t.me/getnetradio_nrj")
|
||||||
ss("mkdir "+prefix+tim)
|
|
||||||
ss("mv "+i+" "+prefix+tim+"/")
|
|
||||||
elif i == "retrofm.mp3":
|
elif i == "retrofm.mp3":
|
||||||
ss("telegram-upload "+i+" --to https://t.me/getnetradio_retrofm --caption "+tim)
|
tg(i,tim,prefix,"https://t.me/getnetradio_retrofm")
|
||||||
ss("mkdir "+prefix+tim)
|
|
||||||
ss("mv "+i+" "+prefix+tim+"/")
|
|
||||||
else:
|
else:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@ -65,4 +82,5 @@ while True:
|
|||||||
#Upload
|
#Upload
|
||||||
upload()
|
upload()
|
||||||
|
|
||||||
|
if dev == True:
|
||||||
break
|
break
|
||||||
|
Loading…
Reference in New Issue
Block a user