From: Oleg Broytman Date: Mon, 9 Nov 2020 14:43:56 +0000 (+0300) Subject: .mc: Load songs from a playlist one by one X-Git-Url: https://git.phdru.name/?a=commitdiff_plain;h=1dd7ac76fb5d0fdc4506c1a29f5ffa3f5184b9a1;p=dotfiles.git .mc: Load songs from a playlist one by one Work around problems with filesystem encodings. --- diff --git a/.mc/mc.ext b/.mc/mc.ext index 7f3b9cd..d2444d3 100644 --- a/.mc/mc.ext +++ b/.mc/mc.ext @@ -93,7 +93,7 @@ type/^XML *(1\.0 *)?document # View=%view{ascii} unzip -v %f # include/audio - Open=[ "`audtool --get-volume`" -eq 0 ] && (audacious & sleep 3); audtool --playlist-clear --playlist-addurl %f --playback-play + Open=[ "`audtool --get-volume`" -eq 0 ] && (audacious & sleep 3); audtool --playlist-clear; case %f in *.m3u) while read song; do audtool --playlist-addurl "$song"; done < %f ;; *) audtool --playlist-addurl %f ;; esac; audtool --playback-play #Open=mplayer %f & #Open=deadbeef %f & View=%view{ascii} %f diff --git a/.mc/menu b/.mc/menu index e0a3bd5..acb6b51 100644 --- a/.mc/menu +++ b/.mc/menu @@ -124,7 +124,12 @@ I View icon, JPEG-2000, TIFF, WebP image a Add the audiofile(s) or playlist(s) if [ "`audtool --get-volume`" -eq 0 ]; then audacious & sleep 3; fi for f in %s; do - audtool --playlist-addurl "$f" + case "$f" in + *.m3u) while read song; do + audtool --playlist-addurl "$song" + done < "$f" ;; + *) audtool --playlist-addurl "$f" ;; + esac done #deadbeef --queue %s & @@ -134,7 +139,12 @@ p Load the audiofile(s) or playlist(s) if [ "`audtool --get-volume`" -eq 0 ]; then audacious & sleep 3; fi audtool --playlist-clear for f in %s; do - audtool --playlist-addurl "$f" + case "$f" in + *.m3u) while read song; do + audtool --playlist-addurl "$song" + done < "$f" ;; + *) audtool --playlist-addurl "$f" ;; + esac done #deadbeef --queue %s & @@ -143,7 +153,12 @@ P Play the audiofile(s) or playlist(s) if [ "`audtool --get-volume`" -eq 0 ]; then audacious & sleep 3; fi audtool --playlist-clear for f in %s; do - audtool --playlist-addurl "$f" + case "$f" in + *.m3u) while read song; do + audtool --playlist-addurl "$song" + done < "$f" ;; + *) audtool --playlist-addurl "$f" ;; + esac done exec audtool --playback-play #mplayer -playlist %f & @@ -154,7 +169,9 @@ R Play the playlist in random order "$HOME"/admin/prog/audio-cdr-video/audio/shuffle-playlist.py %f random-playlist-tmp.m3u if [ "`audtool --get-volume`" -eq 0 ]; then audacious & sleep 3; fi audtool --playlist-clear - audtool --playlist-addurl random-playlist-tmp.m3u + while read song; do + audtool --playlist-addurl "$song" + done < random-playlist-tmp.m3u audtool --playback-play #mplayer -playlist random-playlist-tmp.m3u & #deadbeef --queue random-playlist-tmp.m3u & deadbeef --play