14 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
justuser-31 74878bb6c7 Update README.md 2022-10-06 14:11:15 +00:00
justuser-31 c6c81f837c Update 2022-10-06 14:24:37 +03:00
justuser-31 3da9503a4e Update 2022-10-06 14:23:38 +03:00
justuser-31 8f888b66ee Add new atation. 2022-10-06 14:16:21 +03:00
justuser-31 e4ad207f5d Update README.md 2022-10-06 13:58:48 +03:00
justuser-31 27422e9e63 Merge run.sh and up.py. 2022-10-06 13:55:32 +03:00
justuser-31 828abf2fbe Update README.md 2022-10-06 08:13:46 +00:00
6 changed files with 117 additions and 46 deletions
+13 -7
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)
## [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)
telegram-upload README.md
#INSTALL LAME
#https://lame.sourceforge.io/links.php#Binaries
git clone https://notabug.org/Justuser/getnetradio.git
cd getnetradio
```
### 1.Usage
```
#Config your stations and audio time in run.sh
#Config upload audio file to teelegram in up.py
--to https://t.me/getnetradio_nashe0punk
#Here your link telegram channel
#ALL CONFIGS IN config.py
#Start(nohup for work in background)
nohup ./run.sh
#Start(nohup and "&" for work in background)
nohup python3 main.py &
#Stop
./stop.sh
#Or just kill main.py and wget
```
@@ -43,7 +45,11 @@ nohup ./run.sh
> 05.10.2022 - Migrate to gitlab.com
> 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"]
}
+87
View File
@@ -0,0 +1,87 @@
from os import listdir,system as ss
from time import sleep
import subprocess
#Theards
import threading
#Time&Date
from datetime import date
import time
#Config
import config
#DEV-MODE#
dev = False
##########
#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+"/")
#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 rad.get(i) == None:
pass
else:
print("SUCCESS")
tg(i,tim,prefix,rad[i][1])
'''
if i == "nashepunks.mp3":
tg(i,tim,prefix,"https://t.me/getnetradio_nashe0punk")
elif i == "nrj.mp3":
tg(i,tim,prefix,"https://t.me/getnetradio_nrj")
elif i == "retrofm.mp3":
tg(i,tim,prefix,"https://t.me/getnetradio_retrofm")
else:
pass
'''
while True:
#Download function
def rad_down(ch):
ss("wget "+ch)
#Run download
for i in rad:
th = threading.Thread(target=rad_down, args=(rad[i][0],))
th.start()
#Wait
sleep(wait)
#Stop download
ss("killall wget")
#Upload
upload()
if dev == True:
break
-13
View File
@@ -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
+2 -2
View File
@@ -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
View File
@@ -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