7 Commits

Author SHA1 Message Date
justuser-31 26f9c15cfd Update README.md 2022-10-06 19:32:09 +00:00
justuser-31 44e1960a5e Update README.md 2022-10-06 19:30:30 +00:00
justuser-31 00d7d0c582 Update README.md 2022-10-06 19:29:49 +00:00
justuser-31 8b372a4ed4 New config! More easier. 2022-10-06 22:28:51 +03:00
justuser-31 883307b9d4 Merge branch 'master' of https://gitlab.com/justuser31/getnetradio 2022-10-06 20:03:58 +03:00
justuser-31 0c47043168 Add check bitrate and convert. 2022-10-06 20:03:49 +03:00
justuser-31 b40b367280 Update README.md 2022-10-06 17:01:38 +00:00
3 changed files with 71 additions and 32 deletions
+10 -5
View File
@@ -1,4 +1,4 @@
## [Install](https://gitlab.com/justuser31/getnetradio/-/blob/master/README.md#0install) | [Usage](https://gitlab.com/justuser31/getnetradio/-/blob/master/README.md#1usage) | [Telegram](https://t.me/getnetradio) | [Updates](https://gitlab.com/justuser31/getnetradio/-/blob/master/README.md#contact-updates) | [Realeses](https://gitlab.com/justuser31/getnetradio/-/releases) ## [Install](https://gitlab.com/justuser31/getnetradio#0install) | [Usage](https://gitlab.com/justuser31/getnetradio#1usage) | [Telegram](https://t.me/getnetradio) | [Updates](https://gitlab.com/justuser31/getnetradio#contact-updates) | [Realeses](https://gitlab.com/justuser31/getnetradio/-/releases)
----- -----
@@ -11,20 +11,22 @@ sudo pip3 install -U telegram-upload
#Check if all works(If not,READ MESSAGE) #Check if all works(If not,READ MESSAGE)
telegram-upload README.md telegram-upload README.md
#INSTALL LAME
#https://lame.sourceforge.io/links.php#Binaries
git clone https://notabug.org/Justuser/getnetradio.git git clone https://notabug.org/Justuser/getnetradio.git
cd getnetradio cd getnetradio
``` ```
### 1.Usage ### 1.Usage
``` ```
#Config your stations and audio time in run.sh #ALL CONFIGS IN config.py
#Config upload audio file to teelegram in up.py
--to https://t.me/getnetradio_nashe0punk
#Here your link telegram channel
#Start(nohup and "&" for work in background) #Start(nohup and "&" for work in background)
nohup python3 main.py & nohup python3 main.py &
#Stop #Stop
./stop.sh ./stop.sh
#Or just kill main.py and wget
``` ```
@@ -45,6 +47,9 @@ nohup python3 main.py &
> 06.10.2022 - Merge st.sh and up.py, new release. > 06.10.2022 - Merge st.sh and up.py, new release.
> 06.10.2022 - Add check bitrate and convert with "lame".
> 06.10.2022 - New config,more easier.
----- -----
+15
View File
@@ -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"]
}
+45 -26
View File
@@ -1,27 +1,43 @@
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
#Config
import config
#RADIO STATIONS
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) #DEV-MODE#
tw = 3 dev = False
wait = tw ##########
###
#Import config
tw = int(config.time)
prefix = config.prefix
rad = config.radio
if dev == False:
wait = tw*60
else:
wait = tw
#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+"/")
#Save location
prefix = "~/ARCHIVE/"
###
#Upload in telegram #Upload in telegram
def upload(): def upload():
@@ -31,29 +47,31 @@ 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:
if rad.get(i) == None:
pass
else:
print("SUCCESS")
tg(i,tim,prefix,rad[i][1])
'''
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
'''
while True: while True:
#Download function #Download function
def rad_down(ch): def rad_down(ch):
ss("wget "+i) ss("wget "+ch)
#Run download #Run download
for i in rad: for i in rad:
th = threading.Thread(target=rad_down, args=(i,)) th = threading.Thread(target=rad_down, args=(rad[i][0],))
th.start() th.start()
#Wait #Wait
@@ -65,4 +83,5 @@ while True:
#Upload #Upload
upload() upload()
if dev == True:
break break