g++ libmp3lame-dev libshout3-dev icecast2 libperl-dev libmp3-info-perl
Music is stored in the / home / ftp directory, and ID3 tags were pulled out of them using the Perl module taken from here (for this we collected ices with the --with-perl key). Config /usr/local/etc/ices.conf:wget http://downloads.us.xiph.org/releases/ices/ices-0.4.tar.gz tar -zxvf ices-0.4.tar.gz cd ices-0.4 ./configure --with-perl make make install
<? xml version = "1.0"?> <ices: Configuration xmlns: ices = "http://www.icecast.org/projects/ices"> <Playlist> <Randomize> 1 </ randomize> <Type> perl </ type> <Module> ices </ Module> <Crossfade> 5 </ Crossfade> </ Playlist> <Execution> <Background> 0 </ Background> <Verbose> 0 </ Verbose> <BaseDirectory> / tmp </ BaseDirectory> </ Execution> <Stream> <Server> <Hostname> air1.appleinsider.ru </ Hostname> <Port> 1976 </ Port> <Password> SOURCEPASSWORD </ Password> <Protocol> http </ protocol> </ Server> <Mountpoint> / nonstop </ Mountpoint> <Name> AppleInsider.ru Radio </ Name> <Genre> not specified </ Genre> <Description> Music from our listeners </ Description> <URL> http://www.appleinsider.ru/ipodcast/ </ URL> <Public> 1 </ Public> <Bitrate> 128 </ Bitrate> <Reencode> 1 </ Reencode> <Samplerate> 44100 </ Samplerate> <Channels> 2 </ Channels> </ Stream> </ ices: Configuration>
<icecast> <limits> <clients> 1000 </ clients> <sources> 6 </ sources> <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> SOURCEPASSWORD </ source-password> <relay-password> RELAYPASSWORD </ relay-password> <admin-user> admin </ admin-user> <admin-password> ADMINPASSWORD </ admin-password> </ authentication> <hostname> air1.appleinsider.ru </ hostname> <listen-socket> <port> 1976 </ port> </ listen-socket> <mount> <mount-name> / nonstop </ mount-name> <charset> UTF8 </ charset> </ mount> <mount> <mount-name> / air </ mount-name> <max listeners> 600 </ max listeners> <charset> UTF8 </ charset> <fallback-mount> / nonstop </ fallback-mount> <fallback-override> 1 </ fallback-override> </ mount> . . . </ icecast>
<icecast> <limits> <clients> 1000 </ clients> <sources> 6 </ sources> <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> <relay-password> RELAYPASSWORD </ relay-password> <admin-user> admin </ admin-user> <admin-password> ADMINPASSWORD </ admin-password> </ authentication> <hostname> air2.appleinsider.ru </ hostname> <listen-socket> <port> 1976 </ port> </ listen-socket> <relay> <server> air1.appleinsider.ru </ server> <port> 1976 </ port> <mount> / air </ mount> <local-mount> / air </ local-mount> <username> relay </ username> <password> RELAYPASSWORD </ password> <on-demand> 0 </ on-demand> </ relay> <mount> <mount-name> / air </ mount-name> <max listeners> 600 </ max listeners> <charset> UTF8 </ charset> </ mount> . . . </ icecast>
http://air1.appleinsider.ru:1976/air
#! / bin / sh TOTAL = 0 IMIN = 1 MIN = 100 # We collect the load (ie the number of listeners) of each server # To do this, we query the service page and parsim it. for NUM in `seq 1 5`; do DATA = `curl --silent http: //air$NUM.appleinsider.ru: 1976 / status2.xsl` AIR = `echo $ DATA | sed 's /.*\/ air //' | cut -d "," -f4` NONSTOP = `echo $ DATA | sed 's /.*\/ nonstop //' | cut -d "," -f4` if ["x $ {AIR}" = "xCurrent Listeners"]; then AIR = 0 fi if ["x $ {NONSTOP}" = "xCurrent Listeners"]; then NONSTOP = 0 echo "air $ NUM: $ AIR" else if ["x $ {NONSTOP}" = "x0"]; then echo "air $ NUM: $ AIR" else echo "air $ NUM: $ AIR / $ NONSTOP" fi fi # NOW - server load num NOW = `expr $ AIR + $ NONSTOP` # TOTAL - total load TOTAL = `expr $ TOTAL + $ NOW` # Determine the number of the least loaded server if [$ NOW -lt $ MIN]; then MIN = $ NOW IMIN = $ NUM fi done echo "-------------------" echo "Total: $ TOTAL" # Update statistics on the webpage broadcast echo $ TOTAL> stat.txt scp stat.txt podcast: / var / www # Update M3U file echo air.m3u - \> http: //air$IMIN.appleinsider.ru: 1976 / air ssh air1 ln -sf /usr/share/icecast2/web/air.m3u_$IMIN /usr/share/icecast2/web/air.m3u echo "Server $ IMIN is on duty."
Source: https://habr.com/ru/post/134246/
All Articles