- youtube-dl
- detox
- ffmpeg
- rsync
- davfs
- icecast2
- ices2
- haproxy
- davfs
#!/bin/bash
## parameters: 1 = playlist end, 2 = playlist start
YTDL_BIN="~/apps/youtube-dl"
DETOX_BIN="/usr/bin/detox"
DETOX_RC="/etc/detoxrc"
YTDL_DIR="./"
CSV="YTDL.csv"
YTPLAYLIST="$1"
YTDL_DIR="~/AUDIO/YTDL-$(date '+%Y%m%d%H%M')_X"
PLAYLIST_START=""
if [ ! -z "$2" ]; then
$PLAYLIST_START="--playlist-start $2"
fi
mkdir $YTDL_DIR
cd $YTDL_DIR
$YTDL_BIN --update
$YTDL_BIN -4 -i -c --no-part --socket-timeout 20 -R 5 --no-mtime --youtube-skip-dash-manifest -w --no-check-certificate --prefer-insecure --no-overwrites -o "%(display_id)s-%(title)s.%(ext)s" -x --audio-format vorbis --audio-quality 3 --write-description ${YTPLAYLIST}
$DETOX_BIN ./*.ogg
rm ./*.description
rsync --archive -hh --partial --verbose --modify-window=1 --recursive YTDL-* /mnt/webdav/strato/users/drive-XXX/pub/audio/tracks.yt/
i run debian, so i just installed all software
apt-get install -y icecast2 ices2 haproxy davfs2
## optional ...
apt-get install -y vorbis-tools youtube-dl vorbisgain sshfs lftp oggz-tools ogmtools ffmpeg sox
apt-get clean
<?xml version="1.0"?>
<ices>
<background>1</background>
<logpath>/tmp</logpath>
<logfile>ices.log</logfile>
<logsize>2048</logsize>
<loglevel>2</loglevel>
<consolelog>0</consolelog>
<stream>
<metadata>
<name>bdngrdo</name>
<genre>music</genre>
<description>stream</description>
<url>https://is.gd/bdngrdo</url>
</metadata>
<input>
<module>playlist</module>
<param name="type">basic</param>
<param name="file">ices_playlist.txt</param>
<param name="random">1</param>
<param name="restart-after-reread">0</param>
<param name="once">0</param>
</input>
<instance>
<hostname>127.0.0.1</hostname>
<port>8000</port>
<password>sourceme</password>
<mount>/stream</mount>
<yp>0</yp>
<reconnectdelay>5</reconnectdelay>
<reconnectattempts>50</reconnectattempts>
<maxqueuelength>80</maxqueuelength>
<encode>
<nominal-bitrate>128000</nominal-bitrate>
<samplerate>44100</samplerate>
<channels>2</channels>
</encode>
</instance>
</stream>
</ices>
create playlist file from mouted webdav:
ls -1 /mnt/webdav/users/drive-XXX/pub/audio/tracks.yt/YTDL-202*/*.ogg > ices_playlist.txt
<icecast>
<location>Earth</location>
<admin>icw@localhost</admin>
<limits>
<clients>40</clients>
<sources>1</sources>
<queue-size>524288</queue-size>
<client-timeout>30</client-timeout>
<header-timeout>15</header-timeout>
<source-timeout>50</source-timeout>
<burst-on-connect>1</burst-on-connect>
<burst-size>65535</burst-size>
</limits>
<authentication>
<source-password>sourceme</source-password>
<relay-password>relayme</relay-password>
<admin-user>admin</admin-user>
<admin-password>hackme</admin-password>
</authentication>
<hostname>localhost</hostname>
<listen-socket>
<port>8000</port>
<bind-address>127.0.0.1</bind-address>
<shoutcast-mount>/stream</shoutcast-mount>
</listen-socket>
<http-headers>
<header name="Access-Control-Allow-Origin" value="*" />
</http-headers>
<fileserve>1</fileserve>
<paths>
<x-forwarded-for>127.0.0.1</x-forwarded-for>
<basedir>/usr/share/icecast2</basedir>
<logdir>/var/log/icecast2</logdir>
<webroot>/usr/share/icecast2/web</webroot>
<adminroot>/dev/null</adminroot>
<alias source="/" destination="/status.xsl"/>
</paths>
<logging>
<accesslog>access.log</accesslog>
<errorlog>error.log</errorlog>
<loglevel>1</loglevel>
<logsize>10000</logsize>
</logging>
<security>
<chroot>0</chroot>
</security>
</icecast>
global
log /dev/log local0
log /dev/log local1 info
chroot /var/lib/haproxy
user haproxy
group haproxy
daemon
defaults
log global
mode http
option httplog
option dontlognull
timeout connect 5000
timeout client 50000
timeout server 50000
frontend icecast
bind 0.0.0.0:10080
mode http
option forwardfor
default_backend icecast
backend icecast
server icecast01 127.0.0.1:8000 check
systemctl start icecast2
systemctl start haproxy
ices2 ices-playlist.xml