Find mp3 save to playlist.lst and reload playlist without interrupt current playing stream for SHOUTcast

搜索 MP3 更新playlist.lst 不需打扰目前的播放。

touch make_playlist
chmod +x make_playlist

[------ START COPY ------]

#!/bin/bash

LANG=”zh_CN.GB2312″

PATH=$PATH:/usr/local/bin

BASEDIR=/home/justin/shoutcast

PLAYLIST=”$BASEDIR”/playlist.lst

TMPFILE=/tmp/playlist.$$.tmp

trap “rm -f \”$TMPFILE\”" EXIT

LANG=”zh_CN.GB2312″
echo ” > “$TMPFILE”
find /home/admin/domains/pelayan.com/public_html/qboy/  -type f -name “*.mp3″ >> “$TMPFILE”
find /home/admin/domains/pelayan.com/public_html/john/  -type f -name “*.mp3″ >> “$TMPFILE”
find /home/admin/domains/pelayan.com/public_html/aien/  -type f -name “*.mp3″ >> “$TMPFILE”
find /home/justin/domains/perak.org/public_html/justin/mp3  -type f -name “*.mp3″ >> “$TMPFILE”

if [ -r “$TMPFILE” ]; then
(rl “$TMPFILE”) >”$PLAYLIST”
else
echo “$0: error creating playlist” >&2
exit 1
fi

killall -USR1 sc_trans_linux >/dev/null && echo “Playlist reload!”

[------ END COPY ------]

怎样用 Flash Media Player 收听 SHOUTcast ?

I’ve choose JW FLV MEDIA PLAYER 3.14

Download 下载
http://www.jeroenwijering.com/upload/mediaplayer-3-14.zip

修改如下:
Modify like below:

Shoutcast.html
<html>
<head>
<title>Perak FM Flash Media Player</title>
<script type=”text/javascript” src=”swfobject.js”>
</script>
</head>
<body>
<div id=”player”>
<a href=”http://www.macromedia.com/go/getflashplayer”>Get the Flash Player</a>
to see this player.
</div>
<script type=”text/javascript”>
var so = new SWFObject(’mediaplayer.swf’, ’streambaby’, ‘200′, ‘40′, ‘0′);
so.addVariable(’backcolor’,'0xFFFFFF’);
so.addVariable(’file’, ‘playlist.xml’);
so.addVariable(’displayheight’, ‘0′);
so.write(’player’);
</script>
</body>
</html>

playlist.xml
<?xml version=”1.0″ encoding=”UTF-8″?>
<playlist version=”1″ xmlns=”http://xspf.org/ns/0/”>
<trackList>
<track> <!– Shoutcast Stream –>
<title>Perak FM</title>
<creator>Perak FM</creator>
<location>http://radio.perak.org:8000/;stream.nsv</location>
<identifier></identifier>
<meta rel=”type”>mp3</meta>
<info>http://radio.perak.org</info>
</track>
</trackList>
</playlist>

How to make SHOUTcast support Chinese UTF8 or GBK or GB 2312

怎样让SHOUTcast支持中文

如果出现乱码,可以用这个 convmv 转换
http://www.j3e.de/linux/convmv/

LANG=”zh_CN.GB2312″
convmv-1.10/convmv -f  utf8 -t gbk /home/justin/domains/perak.org/public_html/justin/mp3/chi/ -r –notest –nosmart
或者

LANG=”zh_CN.UTF-8″
convmv-1.10/convmv -f   gbk -t utf8 /home/justin/domains/perak.org/public_html/justin/mp3/chi/ -r –notest –nosmart
Find 可以用到了。

find /home/justin/domains/perak.org/public_html/justin/mp3/chi/ -type f -name “*.mp3″ > playlist.lst

启动

LANG=”zh_CN.GB2312″

nohup /home/justin/shoutcast/sc_serv /home/justin/shoutcast/sc_serv.conf > /dev/null &

nohup /home/justin/shoutcast/sc_trans_linux /home/justin/shoutcast/sc_trans.conf > /dev/null &

sc_trans startup script

01月 18th, 2008

#!/bin/sh
#
# Startup script for ShoutCast sc_trans Server
#
# chkconfig: 345 81 81
# description: ShoutCast sc_trans Server
#
# processname: sc_trans
# pidfile: /var/run/sc_trans.pid
# config: /home/justin/shoutcast/sc_trans.conf
#
# 1. vi sc_trans
# 2. paste this file
# 3. edit line 35
# 4. mv sc_trans /etc/init.d/
# 5. chkconfig -add sc_trans
#
# Start
# /etc/init.d/sc_trans start
#
# Stop
# /etc/init.d/sc_trans stop
#
# Source function library.

. /etc/rc.d/init.d/functions

PID_FILE=/var/run/sc_trans.pid
PID=`ps -A | grep sc_trans | awk ‘{print $1;}’`
RETVAL=0

start() {
echo -n $”Starting $DESCR: ”

exec sudo -u justin /home/justin/shoutcast/sc_trans_linux /home/justin/shoutcast/sc_trans.conf > /dev/null 2>&1 & RETVAL=$?
[ $RETVAL = 0 ] && touch /var/lock/subsys/sc_trans && echo $!>$PID_FILE && echo_success
echo
return $RETVAL
}
stop() {
echo -n $”Stopping $DESCR: ”
#killproc $PID_FILE
[[ $PID != “” ]] && success && kill $PID || failure
RETVAL=$?
echo
[ $RETVAL = 0 ] && rm -f /var/lock/subsys/sc_trans $PID_FILE
}

# See how we were called.
case “$1″ in
start)
start
;;
stop)
stop
;;
restart)
stop
sleep 3
start
;;
*)
echo $”Usage: $DESCR {start|stop|restart}”
exit 1
esac

exit $RETVAL

#!/bin/sh
#
# Startup script for ShoutCast Server
#
# chkconfig: 345 81 81
# description: ShoutCast Server
#
# processname: sc_serv
# pidfile: /var/run/sc_serv.pid
# config: /home/justin/shoutcast/sc_serv.conf
#
## vi shoutcast
# paste this file
# mv shoutcast /etc/init.d/
#
# chkconfig –add shoutcast
#
# /etc/init.d/shoutcast start
#
# /etc/init.d/shoutcast stop
# Source function library.

. /etc/rc.d/init.d/functions

PID_FILE=/var/run/sc_serv.pid
PID=`ps -A | grep sc_serv | awk ‘{print $1;}’`
RETVAL=0

start() {
echo -n $”Starting $DESCR: ”
# daemon java $OPTIONS > /dev/null 2>&1 &

exec sudo -u justin /home/justin/shoutcast/sc_serv /home/justin/shoutcast/sc_serv.conf > /dev/null 2>&1 & RETVAL=$?

[ $RETVAL = 0 ] && touch /var/lock/subsys/sc_serv && echo $!>$PID_FILE && echo_success
echo
return $RETVAL
}
stop() {
echo -n $”Stopping $DESCR: ”
#killproc $PID_FILE
[[ $PID != “” ]] && success && kill $PID || failure
RETVAL=$?
echo
[ $RETVAL = 0 ] && rm -f /var/lock/subsys/sc_serv $PID_FILE
}

# See how we were called.
case “$1″ in
start)
start
;;
stop)
stop
;;
restart)
stop
sleep 3
start
;;
*)
echo $”Usage: $DESCR {start|stop|restart}”
exit 1
esac
exit $RETVAL