diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2017-10-05 07:35:35 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2017-10-05 07:35:35 -0300 |
commit | a4333e7689fe8980ac5ca161c4c29dd0c1a81ecf (patch) | |
tree | 8523cc9c8c3106ee03646c5ac42d094f35712255 | |
parent | efecff8c26aeca41c62ad9ba88dbec98166360e1 (diff) | |
download | playlister-a4333e7689fe8980ac5ca161c4c29dd0c1a81ecf.tar.gz playlister-a4333e7689fe8980ac5ca161c4c29dd0c1a81ecf.tar.bz2 |
Reimplement playlist-mpv playlist-mplayer
-rwxr-xr-x | playlist-wget | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/playlist-wget b/playlist-wget index 63422b9..0f33887 100755 --- a/playlist-wget +++ b/playlist-wget @@ -28,24 +28,19 @@ PLAYLIST_BASE="$(dirname $(dirname $PLAYLIST))" wget -c $PLAYLIST # Process each file -cat `basename $PLAYLIST` | while read file; do - dirname="`dirname "$file"`" +if [ "$BASENAME" == "playlist-wget" ]; then + cat `basename $PLAYLIST` | while read file; do + dirname="`dirname "$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 + done +elif [ "$BASENAME" == "playlist-mpv" ]; then + # Play using mpv + # We could call mpv directly with the playlist URL, but then the file locations would be wrong + curl -s $PLAYLIST | sed -e "s|^|\"$PLAYLIST_BASE/|" -e 's|$|"|' -e 's|\n|\x0|' | xargs mpv +elif [ "$BASENAME" == "playlist-mplayer" ]; then + # Play using mplayer + curl -s $PLAYLIST | sed -e "s|^|\"$PLAYLIST_BASE/|" -e 's|$|"|' -e 's|\n|\x0|' | xargs mplayer +fi |