sudo apt-get install icecast2
sudo apt-get install mpd
<icecast> <limits> <clients>50</clients> <sources>2</sources> <threadpool>5</threadpool> <queue-size>524288</queue-size> <client-timeout>30</client-timeout> <header-timeout>15</header-timeout> <source-timeout>10</source-timeout> <burst-on-connect>1</burst-on-connect> <burst-size>65535</burst-size> </limits> <authentication> <source-password>#2</source-password> <relay-password>#2_relay</relay-password> <admin-user>admin</admin-user> <admin-password>admin_#2</admin-password> </authentication> <hostname>127.0.0.1</hostname> <listen-socket> <port>#3</port> </listen-socket> <mount> <mount-name>/#1</mount-name> </mount> <paths> <basedir>#0/#1/icecast2</basedir> <logdir>#0/#1/icecast2/log</logdir> <webroot>#0/#1/icecast2/web</webroot> <adminroot>#0/#1/icecast2/admin</adminroot> <pidfile>#0/#1/icecast2/icecast.pid</pidfile> <alias source="/" dest="/status.xsl"/> </paths> <logging> <accesslog>access.log</accesslog> <errorlog>error.log</errorlog> <loglevel>4</loglevel> <logsize>10000</logsize> </logging> <security> <chroot>0</chroot> <changeowner> <user>icecast</user> <group>icecast</group> </changeowner> </security> </icecast>
music_directory "#1/#2/music" playlist_directory "#1/#2/playlists" db_file "#1/#2/lib/tag_cache" log_file "#1/#2/log/mpd.log" pid_file "#1/#2/pid" state_file "#1/#2/state" user "mpd" bind_to_address "127.0.0.1" port "#5" auto_update "yes" audio_output { type "shout" name "#2 radio" encoding "mp3" host "localhost" port "#4" mount "/#2" password "#3" bitrate "192" format "44100:16:2" } audio_output { type "alsa" name "fake out" driver "null" } volume_normalization "yes" filesystem_charset "UTF-8" id3v1_encoding "UTF-8" metadata_to_use "artist,album,title,track,name,genre,date,composer,performer,disc"
#!/bin/bash MAIN_DIR=/userAlias FROM=/radio if [ $# -lt 4 ]; then echo "==== ====" echo " ./script.sh 'userName' 'userPassword' 'port' 'mpdPort'" exit 1 fi echo "<===> <===>" if [ ! -d "$MAIN_DIR" ]; then mkdir $MAIN_DIR echo " " fi mkdir $MAIN_DIR'/'$1 echo " " $1 echo "" echo "<===> icecast <===>" cp $FROM/icecast.xml.default $MAIN_DIR'/'$1'/'icecast.xml replace '#0' $MAIN_DIR -- $MAIN_DIR'/'$1'/'icecast.xml replace '#1' $1 -- $MAIN_DIR'/'$1'/'icecast.xml replace '#2' $2 -- $MAIN_DIR'/'$1'/'icecast.xml replace '#3' $3 -- $MAIN_DIR'/'$1'/'icecast.xml mkdir $MAIN_DIR'/'$1'/icecast2' mkdir $MAIN_DIR'/'$1'/icecast2/log' mkdir $MAIN_DIR'/'$1'/icecast2/web' mkdir $MAIN_DIR'/'$1'/icecast2/admin' cp $FROM/icecastDirs/admin/* $MAIN_DIR'/'$1'/icecast2/admin' cp $FROM/icecastDirs/web/* $MAIN_DIR'/'$1'/icecast2/web' touch $MAIN_DIR/$1/icecast2/log/error.log touch $MAIN_DIR/$1/icecast2/log/access.log chown icecast:icecast $MAIN_DIR/$1/icecast.xml chown icecast:icecast $MAIN_DIR/$1/icecast2/log/* echo "<===> icecast <===>" echo "" echo "<===> mpd <===>" cp $FROM/mpd.conf.default $MAIN_DIR'/'$1'/'mpd.conf replace '#1' $MAIN_DIR -- $MAIN_DIR'/'$1'/'mpd.conf replace '#2' $1 -- $MAIN_DIR'/'$1'/'mpd.conf replace '#3' $2 -- $MAIN_DIR'/'$1'/'mpd.conf replace '#4' $3 -- $MAIN_DIR'/'$1'/'mpd.conf replace '#5' $4 -- $MAIN_DIR'/'$1'/'mpd.conf mkdir $MAIN_DIR'/'$1'/music' mkdir $MAIN_DIR'/'$1'/playlists' mkdir $MAIN_DIR'/'$1'/lib' mkdir $MAIN_DIR'/'$1'/log' touch $MAIN_DIR/$1/lib/tag_cache chmod 777 $MAIN_DIR/$1/lib/tag_cache touch $MAIN_DIR/$1/pid chmod 777 $MAIN_DIR/$1/pid echo "<===> mpd <===>" echo "<===> icecast <===>" icecast2 -b -c $MAIN_DIR'/'$1'/'icecast.xml sleep 1s echo "<===> mpd <===>" mpd $MAIN_DIR'/'$1'/'mpd.conf
chmod 777 script.sh
./script.sh radio1 password1 9001 19001
:9001/radio1
... mpd ( ) .
: /userAlias/radio1/music/
- mpd:
sudo apt-get install ncmpc
mpd.
:
ncmpc -p 19001
music Ctrl + U
'3' - .
/ .
'2' - . Enter - .
, :9001/radio1 .
, .
:9001/radio1
... mpd ( ) .
: /userAlias/radio1/music/
- mpd:
sudo apt-get install ncmpc
mpd.
:
ncmpc -p 19001
music Ctrl + U
'3' - .
/ .
'2' - . Enter - .
, :9001/radio1 .
, .
Source: https://habr.com/ru/post/170235/
All Articles