You are not logged in.

#1 2012-05-14 12:55:35

Thme
Member
From: Raleigh NC
Registered: 2012-01-22
Posts: 105

[Solved]Can sox use thunar's synatax to add wavs from within a folder?

Sorry I renamed this topic to be more specific to the issue(re-edit: oops that was a terrible subject title earlier I must've rushed when editing.)

NOTE:A workable solution is in my last post...

Ok I'm trying to configure Thunar to run a simple script(basically an executable text file with a string using sox to concatenate a series of wavs within the working directory and referenced within .bashrc with a simpler alias.)
the alias works after  few trials and errors I had to write the string with its arguements in a text file make it executable.

The alias looks like this

alias makegapless='~/.gaplessscript'

and the command string used in ".gaplessscript" is

sox --combine concatenate (ls|grep .wav) gapless.wav

this just tells sox to combine a series of .wav's into one continuous track and output it into the same working directory with the genaric name "gapless.wav" which is a lot faster than using audacity or something similar to get the same results.

My goal is to pass this command to thunar with a custom action and tell it to point inside a selected directory with .wav's so all i have to do is right click the folder and run the command without opening a terminal into the directory

Any suggestions on how to write this in thunar's custom actions. I tried several using the the parameters suggested in thunars custom actions window but none seem to work. what would be the syntax or lines tp include in the string so that this can be done? I have a few custom actions already configured but can't seem to figure this one out...

Last edited by Thme (2012-05-27 20:10:47)


"Hidden are the ways for those who pass by, for light is perished and darkness comes into being." Nephthys:
Ancient Egyptian Coffin Texts

Offline

#2 2012-05-14 13:39:49

swanson
Member
From: Sweden
Registered: 2011-02-05
Posts: 759

Re: [Solved]Can sox use thunar's synatax to add wavs from within a folder?

I would use this in a script;

find -type f \( -iname '*.wav' -o -iname '*.WAV' \) | 'your command here' 

And send the dir-name from thunar with %d

Offline

#3 2012-05-14 15:53:30

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,557
Website

Re: [Solved]Can sox use thunar's synatax to add wavs from within a folder?

I'm not sure if it's relevant - it may be because thunar probably doesn't have access to aliases as they are not set until your bashrc is read.  But I'm curious why you alias a script that you wrote.  Why not just change the name of the script to what you want it to be, and put it somewhere in your path?


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#4 2012-05-14 15:58:21

Thme
Member
From: Raleigh NC
Registered: 2012-01-22
Posts: 105

Re: [Solved]Can sox use thunar's synatax to add wavs from within a folder?

I was wondering about trying that trilby. So I could just have thunar point to the directory then execute the script execute the script? Is that what you mean. I'm pretty new to creating scripts but love learning it.

Ps: I Aliased it to simplify the command so a friend of mine could easily
remember it.

Last edited by Thme (2012-05-14 16:01:05)


"Hidden are the ways for those who pass by, for light is perished and darkness comes into being." Nephthys:
Ancient Egyptian Coffin Texts

Offline

#5 2012-05-14 16:05:16

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,557
Website

Re: [Solved]Can sox use thunar's synatax to add wavs from within a folder?

I'm not clear on exactly what you need to do, but you seem to be adding many unnecessary layers of complexity.  As per swanson's suggestion, you may not even need a script at all if thunar can execute shell commands.  I'm not master of find syntax, so my first run would have been different, but something like

sox --combine concatenate `find %d -type f -name '*.wav'` gapless.wav

might do the trick without scripts or aliases.

Having a script with only a single line, with a alias to the script, then something else to run the alias to launch the script to run the one command seems exceedingly wasteful.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#6 2012-05-14 16:17:27

Thme
Member
From: Raleigh NC
Registered: 2012-01-22
Posts: 105

Re: [Solved]Can sox use thunar's synatax to add wavs from within a folder?

That actually was my original intent before ever creating the script but ran into synax errors. And thunar didn't seam to know how to use the command. I had added %d into it a few places when testing but I'll try changing the command as you suggested to see if it works.

My goal is to have it so my friend can do this to a lot of his live music. I have little use for it but if I could have it setup to do this to his folders with a right click it would save me time as hes has a lot(as in 500gb) of live music and doing it this way I can get him to do it himself without making it to complex for him to remember. He's not to literate. I appreciate the suggestions I'll mark this solved when I get it working.

Last edited by Thme (2012-05-14 16:49:33)


"Hidden are the ways for those who pass by, for light is perished and darkness comes into being." Nephthys:
Ancient Egyptian Coffin Texts

Offline

#7 2012-05-14 18:17:58

swanson
Member
From: Sweden
Registered: 2011-02-05
Posts: 759

Re: [Solved]Can sox use thunar's synatax to add wavs from within a folder?

The key for you might be to tell thunar to show the custom action when right clicking a wav file. Then have thunar send the dir name in %d to your script. I find that it is often easier to send this to a script than to have the actual command in thunar. For one thing; backticks and/or other special chars migth be confusing, either for thunar or for the user (me).

Here's an example script i use for creating -m3u files from wav files in a dir;

#/bin/bash

touch "${PWD##*/}WAV.m3u"
find -type f \( -iname '*.wav' -o -iname '*.WAV' \) | sort >> "${PWD##*/}WAV.m3u"
exit 0

It is rather similar to what you want. It finds the wav files, sort them, then write them to a file. You could just alter the part after the | . Here's the UCA;

createm3ulist %d

Last edited by swanson (2012-05-14 18:19:16)

Offline

#8 2012-05-15 13:03:27

Thme
Member
From: Raleigh NC
Registered: 2012-01-22
Posts: 105

Re: [Solved]Can sox use thunar's synatax to add wavs from within a folder?

Ok so apparently This is an issue with sox only taking certain syntax. and the paths sent to it by thunar aren't recognized when deling with folders? I was able to get results with both my posted command and the one suggested by trilby when testing it in the cli. but when trying to intoduce those paths to be specified with thunar when running sox as an action strangely this sting works in the custom actions with out a script but has a disadvantage.

sox --combine concatenate %F gapless.wav

Doing it this way I have to highlight the audio files specifically(will take other supported formats like ogg, mp3 and flac etc. and convert them as well). If any unsupported type is highlighted it won't run. I tried the different options %d %D etc just to see if anything worked but as i already thought it didn't. arranging the ls|grep or find strings into this got nothing. I went through about as many possible strings i could think of  even ones i was sure wouldn't work. I'm marking this as solved as i did get at least a working menu action just not exactly what i wanted. but any further insight would be appreciated. maybe i'm just missing something really simple.


"Hidden are the ways for those who pass by, for light is perished and darkness comes into being." Nephthys:
Ancient Egyptian Coffin Texts

Offline

#9 2012-05-15 13:24:55

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,557
Website

Re: [Solved]Can sox use thunar's synatax to add wavs from within a folder?

If I were you I'd play with some variations of commands to figure out what thunar actually passes.  You may have to prepend something or escape something to pass the directory name properly.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

Board footer

Powered by FluxBB