# Download the playlist
wget -c $PLAYLIST
-# Download playlist and all it's files preseving the folder structure
+# Process each file
cat `basename $PLAYLIST` | while read file; do
dirname="`dirname "$file"`"
- mkdir -p "$dirname"
- wget -c "$PLAYLIST_BASE/$file" -O "$file"
+ if [ "$BASENAME" == "playlist-wget" ]; then
+ # Download playlist and all it's files preseving the folder structure
+ mkdir -p "$dirname"
+ wget -c "$PLAYLIST_BASE/$file" -O "$file"
+ elif [ "$BASENAME" == "playlist-mpv" ]; then
+ # Play using mpv
+ mpv "$PLAYLIST_BASE/$file"
+ elif [ "$BASENAME" == "playlist-mplayer" ]; then
+ # Play using mplayer
+ mplayer "$PLAYLIST_BASE/$file"
+ fi
done
+
+# Remove playlist if on stream mode
+# This should be implemented as a shell trap
+#if [ "$BASENAME" == "playlist-mpv" ] || [ "$BASENAME" == "playlist-mplayer" ]; then
+# rm `basename $PLAYLIST`
+#fi