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
85c98016
Commit
85c98016
authored
Apr 19, 2019
by
Andrey Shatokhin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added checkmpd
parent
2ce6a996
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
0 deletions
+38
-0
checkmpd
checkmpd
+38
-0
No files found.
checkmpd
0 → 100755
View file @
85c98016
#!/bin/bash
ROOT_DIRECTORY
=
/home/icecastradio/radio_mpd/
URL
=
http://radio.azbyka.ru/json.xsl
STREAMS
=
`
ls
-l
$ROOT_DIRECTORY
|
grep
"^d"
|
awk
'{print $9}'
`
CONTENT
=
$(
curl
$URL
)
ACTIVE_STREAMS
=
`
grep
-oP
'(?<=/).*?(?=")'
<<<
$CONTENT
`
# List information
echo
-e
"
\n
All MPD-STREAMS:"
for
ELEM
in
$STREAMS
;
do
echo
$ELEM
done
echo
echo
"Active MPD-STREAMS:"
for
ELEM
in
$ACTIVE_STREAMS
;
do
echo
$ELEM
done
echo
OFFLINE_STREAMS
=()
# 2) Compare "$ACTIVE_STREAMS" and variable "STREAMS".
# If "$ELEM" not in "$ACTIVE_STREAMS" , add "$ELEM" in $OFFLINE_STREAMS.
for
ELEM
in
$STREAMS
;
do
if
[[
!
$ACTIVE_STREAMS
=
~
$ELEM
]]
;
then
OFFLINE_STREAMS+
=(
$ELEM
)
fi
done
echo
"Restarting following MPD-STREAMS:"
for
ELEM
in
${
OFFLINE_STREAMS
[@]
}
;
do
ELEM_PORT
=
`
cat
$ROOT_DIRECTORY
/
$ELEM
.mpd.conf |
grep
port |
awk
'{ print $2 ; exit; }'
' | tr -d \"`
# Start stream
mpc -q -p $ELEM_PORT play
echo $ELEM
done
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