Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
radio_mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
azbyka
radio_mpd
Commits
c44b544b
Commit
c44b544b
authored
Mar 18, 2024
by
Иван Мажукин
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
moved to common db, music_directory, corrected delete function in radio.sh
parent
3d93be34
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
17 deletions
+21
-17
.port
.port
+1
-1
checkmpd
checkmpd
+1
-1
radio.sh
radio.sh
+17
-13
template.mpd.conf
template.mpd.conf
+2
-2
No files found.
.port
View file @
c44b544b
PORT=67
55
PORT=67
83
checkmpd
View file @
c44b544b
#!/bin/bash
ROOT_DIRECTORY
=
/home/icecastradio/radio_mpd/
URL
=
http://radio.azbyka.ru/json.xsl
cd
$ROOT_DIRECTORY
||
exit
URL
=
http://radio2.azbyka.ru/json.xsl
STREAMS
=
`
ls
-l
$ROOT_DIRECTORY
|
grep
"^d"
|
awk
'{print $9}'
`
CONTENT
=
$(
curl
$URL
2>/dev/null
)
ACTIVE_STREAMS
=
`
grep
-oP
'(?<=/).*?(?=")'
<<<
$CONTENT
`
...
...
radio.sh
View file @
c44b544b
...
...
@@ -43,9 +43,9 @@ elem_control()
function
create_stream
()
{
local
STREAM_NAME
=
$1
local
STREAM_DIRECTORY
=
$ROOT_DIRECTORY
/
$1
local
ABS_PATH_TO_CFG
=
$
STREAM
_DIRECTORY
/
$1
.mpd.conf
local
ABS_PATH_TO_CFG
=
$
ROOT
_DIRECTORY
/
$1
.mpd.conf
if
[[
!
-f
$ABS_PATH_TO_CFG
]]
;
then
...
...
@@ -65,21 +65,21 @@ function create_stream() {
chmod
+x
$STREAM_DIRECTORY
/playlists
# Systemd configuration
cp
template.service /etc/systemd/system/
$1
.service
sed
-i
's?#1?'
$ABS_PATH_TO_CFG
'?'
/etc/systemd/system/
$1
.service
sudo
cp
template.service /etc/systemd/system/
$1
.service
s
udo s
ed
-i
's?#1?'
$ABS_PATH_TO_CFG
'?'
/etc/systemd/system/
$1
.service
echo
PORT
=
$((
PORT+1
))
>
./.port
serv daemon-reload
serv
$1
on
sudo
serv daemon-reload
sudo
serv
$1
on
# Enable playlist repeat
mpc
-q
$(
elem_control
$STREAM_NAME
)
repeat on
sleep
1
mpc
$(
elem_control
$STREAM_NAME
)
repeat on
echo
"Файлы конфигураций cозданы успешно !"
echo
"Запущен mpd-поток под названием :
$1
по адресу : radio.azbyka.ru:80/
$1
"
#echo "Для начала работы требуется обновить базу данных mpd"
echo
"Для работы с потоком : ./radio -m
$1
"
echo
"Для работы с потоком : ./radio
.sh
-m
$1
"
else
echo
-e
"Поток
\"
$1
\"
уже создан.
\n
Для работы с ним : ./radio -m
$1
"
echo
-e
"Поток
\"
$1
\"
уже создан.
\n
Для работы с ним : ./radio
.sh
-m
$1
"
fi
}
...
...
@@ -87,6 +87,9 @@ function create_stream() {
function
manage_stream
()
{
local
STREAM_NAME
=
$1
echo
"mpc
$(
elem_control
$STREAM_NAME
)
update"
mpc
$(
elem_control
$STREAM_NAME
)
update
echo
"ncmpc
$(
elem_control
$STREAM_NAME
)
"
ncmpc
$(
elem_control
$STREAM_NAME
)
...
...
@@ -94,9 +97,10 @@ function manage_stream() {
function
delete_stream
(){
serv stop
$1
serv off
$1
rm
-rvf
./
$1
*
sudo rm
-f
/etc/systemd/system/
$1
.service
sudo rm
-f
v
/etc/systemd/system/
$1
.service
sudo
systemctl daemon-reload
}
...
...
template.mpd.conf
View file @
c44b544b
...
...
@@ -2,7 +2,7 @@
music_directory
"/var/local/media/audio"
playlist_directory
"#1/playlists"
log_file
"#1/mpd.log"
db_file
"
#1
/mpd.db"
db_file
"
/home/icecastradio/radio_mpd
/mpd.db"
#######################################################################
######################## OPTIONAL PATHS ###############################
...
...
@@ -14,7 +14,7 @@ sticker_file "#1/sticker.sql"
######################## DAEMON OPTIONS ###############################
user
"icecastradio"
#bind_to_address "
127.0.0.1
"
#bind_to_address "
#1/socket
"
bind_to_address
"#1/mpd.socket"
#bind_to_address "any"
#port "#2"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment