]> gitweb.fluxo.info Git - playlister.git/commitdiff
Adds playlist-mpv and playlist-mplayer
authorSilvio Rhatto <rhatto@riseup.net>
Wed, 4 Oct 2017 23:58:34 +0000 (20:58 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Wed, 4 Oct 2017 23:58:34 +0000 (20:58 -0300)
playlist-mplayer [new symlink]
playlist-mpv [new symlink]
playlist-wget

diff --git a/playlist-mplayer b/playlist-mplayer
new file mode 120000 (symlink)
index 0000000..a0e124b
--- /dev/null
@@ -0,0 +1 @@
+playlist-wget
\ No newline at end of file
diff --git a/playlist-mpv b/playlist-mpv
new file mode 120000 (symlink)
index 0000000..a0e124b
--- /dev/null
@@ -0,0 +1 @@
+playlist-wget
\ No newline at end of file
index b02fd60079f580de9b358ba7e939cd67f1f5ee8f..63422b9a0873e9a54de8808e9d7dc8b17e5af518 100755 (executable)
@@ -27,10 +27,25 @@ PLAYLIST_BASE="$(dirname $(dirname $PLAYLIST))"
 # 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