--- /dev/null
+<h2 align="center">m - p - 3 <> d - a - t - a - b - a - s - e</h2>
+
+<!-- are you allowed to connect? -->
+
+<!--#exec cmd="
+
+allowed=0
+if [ ! -f /etc/mp3db.conf ]; then
+ echo \"error: no /etc/mp3db.conf file found, aborting.\"
+ exit 1
+else
+ mp3_server_name=`grep MP3_SERVER_NAME /etc/mp3db.conf | awk '{ print $2 }'`
+ mp3_srcdir=`grep MP3_SRCDIR /etc/mp3db.conf | awk '{ print $2 }'`
+ http_root=`grep HTTP_ROOT /etc/mp3db.conf | awk '{ print $2 }'`
+ http_offset=`grep HTTP_OFFSET /etc/mp3db.conf | awk '{ print $2 }'`
+ local_net=`grep LOCAL_NET /etc/mp3db.conf | awk '{ print $2 }'`
+ mp3_http_loc=`grep MP3_HTTP_LOC /etc/mp3db.conf | awk '{ print $2 }'`
+ local_player_ip=`grep LOCAL_PLAYER_IP /etc/mp3db.conf | awk '{ print $2 }'`
+ playerfile_dir=`grep PLAYFILE_DIR /etc/mp3db.conf | awk '{ print $2 }'`
+ my_user_name=`grep USR_NAME /etc/mp3db.conf | awk '{ print $2 }'`
+ user_passwd=`grep USER_PASSWD /etc/mp3db.conf | awk '{ print $2 }'`
+fi
+
+if [ ! -f /etc/mp3user ]; then
+ echo \"error: no /etc/mp3user file found, aborting.\"
+ exit 1
+fi
+for allowed_ip in `cat /etc/mp3user | awk '{ print $2 }'`; do
+ [ \"$allowed_ip\" = \"$REMOTE_ADDR\" ] && allowed=1
+done
+
+if [ \"$allowed\" = \"1\" ]; then
+if [ ! -z \"`echo $REMOTE_ADDR | grep ^$local_net`\" ]; then
+ computer_name=`grep $REMOTE_ADDR /etc/hosts | awk '{ print $3 }'`
+else
+ computer_name=`host $REMOTE_ADDR | awk '{ print $5 }'`
+fi
+echo \"hi `grep $REMOTE_ADDR /etc/mp3user | awk '{ print $1 }'`!<br><br>your connection from $computer_name is authorized. have fun!<br>\"
+
+#mp3 parsing
+
+#call myself and see what songs to present
+echo \"
+<form action=\"$http_offset/index.shtml\" method=\"get\">
+<p>artist(s):
+<br>
+<input name=\"artist\" type=\"text\" size=\"30\" maxlength=\"30\">
+</p>
+<input type=\"radio\" name=\"und_oder\" value=\"und\">and
+<input type=\"radio\" name=\"und_oder\" value=\"oder\" checked>or
+<br>
+<p>song:
+<br>
+<input name=\"song\" type=\"text\" size=\"30\" maxlength=\"30\">
+</p>
+<input type=\"submit\" value=\"search\">
+</form>
+\"
+
+if [ ! -z \"$QUERY_STRING\" ]; then
+
+ echo \"<h4>results:</h4>\";
+
+ artist=`echo '$QUERY_STRING' | awk -F\& '{ gsub(\"artist=\",\"\"); print $1 }'`;
+ if [ \"`echo '$QUERY_STRING' | awk -F\& '{ gsub(\"und_oder=\",\"\"); print $2 }'`\" = \"oder\" ]; then
+ und_oder=\"-o\";
+ else
+ und_oder=\"-a\";
+ fi;
+ song=`echo '$QUERY_STRING' | awk -F\& '{ gsub(\"song=\",\"\"); print $3 }'`;
+ echo \"searching for: $artist $song (mode: $und_oder)<br><br>\";
+
+ if [ \"$und_oder\" != \"-a\" ]; then
+ echo \"-> artists found:<br>\";
+ if [ ! -z \"$artist\" ]; then
+ for found_artists in `ls -A $mp3_srcdir/ | grep $artist`; do
+ echo \"<br>`echo $found_artists | sed 's/_/\ /g'`:<br>\";
+ echo \"<table border=1 cellpadding=5 cellspacing=0>\";
+ for dir_song in $mp3_srcdir/$found_artists/*; do
+ mp3=`basename $dir_song`;
+ echo \"<tr><td><a href=\"$mp3_http_loc/$found_artists/$mp3\">$mp3</a></td><td><a href=\"http://${local_player_ip}${playerfile_dir}/playsong.shtml\?url=http://${mp3_server_name}${mp3_http_loc}/$found_artists/$mp3\&user=$my_user_name\&passwd=$user_passwd\">play ($local_player_ip)</a></td></tr>\";
+ done;
+ echo \"</table>\";
+ done;
+ fi;
+ if [ ! -z \"$song\" ]; then
+ echo \"<br>-> songs found:<br>\";
+ echo \"<table border=1 cellpadding=5 cellspacing=0>\";
+ for single_song in $mp3_srcdir/*/*; do
+ if [ ! -z \"`echo $single_song | grep $song`\" ]; then
+ dir=`echo $single_song | awk -F/ '{ print $(NF-1) }'`
+ s_name=`echo $single_song | awk -F/ '{ print $(NF) }'`
+ echo \"<tr><td><a href=\"$mp3_http_loc/$dir/$s_name\">$s_name</a></td><td><a href=\"http://${local_player_ip}${playerfile_dir}/playsong.shtml\?url=http://${mp3_server_name}${mp3_http_loc}/$dir/$s_name\&user=$my_user_name\&passwd=$user_passwd\">play ($local_player_ip)</a></td></tr>\";
+ fi;
+ done;
+ echo \"</table>\";
+ fi;
+
+ else
+
+ search_paths=`ls -A $mp3_srcdir | grep $artist`;
+ for search_path in $search_paths; do
+ echo \"-> artist: $search_path:<br>\";
+ echo \"<table border=1 cellpadding=5 cellspacing=0>\";
+ for dir_song in $mp3_srcdir/$search_path/*; do
+ mp3=`basename $dir_song`;
+ if [ ! -z \"`echo $mp3 | grep $song`\" ]; then
+ echo \"<tr><td><a href=\"$mp3_http_loc/$search_path/$mp3\">$mp3</a></td><td><a href=\"http://${local_player_ip}${playerfile_dir}/playsong.shtml\?url=http://${mp3_server_name}${mp3_http_loc}/$search_path/$mp3\&user=$my_user_name\&passwd=$user_passwd\">play ($local_player_ip)</a></td></tr>\";
+ fi ;
+ done;
+ done;
+
+ fi;
+
+fi
+
+else
+
+echo \"sorry,<br><br>you, `echo $REMOTE_ADDR` are not authorized. you probably never will! :)<br>please don't mail asking for access. i am willing to share all my knowledge *) and code, but not mp3's as this might be illegal.<br><br>regards, hackbard<br><br><h5>*) i don't know nothig!</h5>\"
+
+fi
+" -->
+
--- /dev/null
+#!/bin/sh
+
+for i in *; do
+ if [ -d $i ]; then
+ echo "renaming content of $i ..."
+ cd $i
+ for j in *; do
+ if [ -f "$j" ]; then
+ dst_file="`echo $j | sed 's/\ /\\ /g' | sed 's/(/\\(/g' | sed s'/)/\\)/g' | sed 's/&/\\&/g' | sed 's/!/\\!/g'`"
+ trg_file="`echo $j | sed 's/\ /_/g' | sed 's/&/_/g'| sed 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ()-,!/abcdefghijklmnopqrstuvwxyz_____/'`"
+ if [ "$dst_file" != "$trg_file" ]; then
+ mv "$dst_file" $trg_file
+ chmod 644 $trg_file
+ fi
+ fi
+ # assume albums
+ if [ -d "$j" ]; then
+ cd $j
+ album="`echo $j | sed 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ()-,/abcdefghijklmnopqrstuvwxyz____/'`"
+ for song in *; do
+ dst_file="`echo $song | sed 's/\ /\\ /g' | sed 's/(/\\(/g' | sed s'/)/\\)/g' | sed 's/&/\\&/g' | sed 's/!/\\!/g'`"
+ trg_file="`echo $song | sed 's/\ /_/g' | sed 's/&/_/g'| sed 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ()-,!/abcdefghijklmnopqrstuvwxyz_____/'`"
+ if [ ! -f ../${album}__${trg_file} ]; then
+ mv "$dst_file" ../${album}__${trg_file}
+ chmod 644 ../${album}__${trg_file}
+ fi
+ done
+ cd ..
+ rm -rf $j
+ fi
+
+ done
+ cd ..
+ fi
+done
+
--- /dev/null
+<!-- play music on hackstation ... -->
+
+<!--#exec cmd="
+
+if [ ! -z \"`echo $REMOTE_ADDR | grep '^192.168.10'`\" ]; then
+ echo \"connection from $REMOTE_ADDR allowed.<br><br>\";
+ if [ ! -z \"$QUERY_STRING\" ]; then
+ url=`echo '$QUERY_STRING' | awk -F\& '{ gsub(\"url=\",\"\"); print $1 }'`;
+ user=`echo '$QUERY_STRING' | awk -F\& '{ gsub(\"user=\",\"\"); print $2 }'`;
+ passwd=`echo '$QUERY_STRING' | awk -F\& '{ gsub(\"passwd=\",\"\"); print $3 }'`;
+ if [ -z \"`ps -ef | grep [m]player | grep -v 'bin\/sh'`\" ]; then
+ play_cmd=\"/usr/bin/mplayer -user $user -passwd $passwd $url\";
+ echo \"trying: $play_cmd<br><br>\";
+ /usr/bin/mplayer -user $user -passwd $passwd $url > /dev/null 2>&1;
+ else
+ echo \"mplayer allready running ...\";
+ fi;
+ fi;
+else
+ echo \"sorry, connection from $REMOTE_ADDR not authorized! go away.<br><br>\";
+fi
+
+" -->