You are not logged in.
Pages: 1
Hi,
I have been using a bash script I found a while back to create a playlist via custom action.
This works well for creating a recursive playlist, but I am trying to modify it to only create a playlist from the selected items only. It seemed to me I should only have to change the %D to %F and use the same script, but it will only create a playlist from the first item selected.
I'm hoping I'm just overlooking something simple, but I'm stumped.
Here are the custom actions:
<action>
<icon>playlist</icon>
<name>Create Playlist Recursive</name>
<unique-id>1438391983211903-5</unique-id>
<command>xfce4-terminal -H -x ~/bin/m3u_maker_TA.sh %D</command>
<description>m3u playlist of all playable media - edit script to shuffle</description>
<patterns>*</patterns>
<directories/>
<audio-files/>
<image-files/>
<other-files/>
<video-files/>
</action>
<action>
<icon>audio-x-mp3-playlist</icon>
<name>Create Playlist Selected</name>
<unique-id>1438971384287455-8</unique-id>
<command>xfce4-terminal -H -x ~/bin/m3u_maker_TA.sh %F</command>
<description></description>
<patterns>*</patterns>
<audio-files/>
<image-files/>
<other-files/>
<video-files/>
</action>
..and the bash script.
#!/bin/bash
# Creates M3U from all media files recursively as a thunar action.
set -x
touch "${PWD##*/}.m3u"
export IFS=$'\n'
# flac, ape, wv, wav, mp3, aac, ogg, oga, wma, mpc, m4a, mp4,
# mkv, mpg, avi, mpeg, webm, flv, wmv, m4v, 3gp, rm, rmvb, ifo
# mov, vob, asf, ogm, m2v, avc, dv, pg, jpeg, bmp, png, gif
for i in $(find $1 -name "*" -type f|egrep *.'[fF][lL][aA][cC]|[aA][pP][eE]|/
[wW][vV]|[wW][aA][vV]|[mM][pP][3]|[aA][aA][cC]|[oO][gG][gG]|[oO][gG][aA]|/
[wW][mM][aA]|[mM][pP][cC]|[mM][4][aA]|[mM][pP][4]|[mM][kK][vV]|[mM][pP][gG]|/
[aA][vV][iI]|[mM][pP][eE][gG]|[wW][eE][bB][mM]|[fF][lL][vV]|[wW][mM][vV]|/
[mM][4][vV]|[3][gG][pP]|[rR][mM]|[rR][mM][vV][bB]|[iI][fF][oO]|[mM][oO][vV]|/
[dD][iI][vV][xX]|[vV][oO][bB]|[aA][sS][fF]|[oO][gG][mM]|[mM][2][vV]|/
[aA]vV][cC]|[dD][vV]|[jJ][pP][gG]|[jJ][pP][eE][gG]|[pP][nN][gG]|[bB][mM][pP]|/
[gG][iI][fF]' )
do
echo "$i"|sed 's/^.*\.m3u//' >> "${PWD##*/}.m3u"
done
# Uncomment next 3 lines to shuffle playlist
#shuf "${PWD##*/}.m3u" > "${PWD##*/}2.m3u"
#shuf "${PWD##*/}2.m3u" > "${PWD##*/}.m3u"
#rm "${PWD##*/}2.m3u"
any help is most appreciated.
Arch Linux
Offline
for i in $(find $1 -name.....
When a thunar custom action sends over a number of parameters (more that one file), each file gets a different positional parameter (e.g. $1, $2, $3, etc). All of the parameters can be retrieved via $@.
The script that you are using is only searching for the first parameter ($1) and will never see or process the other sent parameters. This works fine in a situation where there is only one parameter (the name of a directory), but fails when more than one parameter is sent.
A quick fix is to change the "$1" to read "$@" so that all parameters are processed.
Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki | Community | Contribute ---
Offline
Wow!
I can't believed I missed that.
I really appreciate the quick reply. That was driving me insane.
Cheers
Arch Linux
Offline
Pages: 1
[ Generated in 0.011 seconds, 8 queries executed - Memory usage: 541.53 KiB (Peak: 542.81 KiB) ]