Skip to main content
Topic: foo_run 0.3.8 (Read 491860 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Re: foo_run 0.3.8

Reply #675
I'm hoping someone can help as my windows scripting skills are poor and I'm struggling to get this to work.

From foobar2000 windows I'm trying to call a bash script (using WSL) passing the path of the music file that's selected in the interface, but I'm struggling to deal with & in directory names.

Current approach

[Run services] I'm using a .bat file as I can't get foo_run to start a 64 bit cmd window in order to start bash so I have some necessary redirection here
Code: [Select]
cmd.exe /k "d:\test.bat "$substr(%_path%,0,$strrchr(%_path%,'\'))""

[test.bat]
Code: [Select]
"%WINDIR%\sysnative\cmd.exe" /k bash /mnt/d/test.sh '%~1'

[test.sh] (Obviously I'll do something more useful here when it's working)
Code: [Select]
#!/bin/bash

targetDir=`wslpath -a "$1"`
cd "$targetDir"
pwd
ls -al


If the path doesn't have an ampersand in it, it works, otherwise it throws:

C:\Program Files (x86)\_personalInstalls\foobar2000>"C:\Windows\sysnative\cmd.exe" /k bash /mnt/d/test.sh 'G:\Tagged  & Cleaned\flac\Adams, Bryan\2012 - Cuts Like A Knife\'
/bin/bash: -c: line 0: unexpected EOF while looking for matching `''
/bin/bash: -c: line 1: syntax error: unexpected end of file

Notice the folder is actually 'Tagged&Cleaned', I'm guessing the step that passes it to bash is evaluating it somehow, but I don't know why, and I've tried lots of quoting variations but I just can't get it to work.

Hopefully it's a simple fix....

Re: foo_run 0.3.8

Reply #676
As discussed with Wolfbane, here is a short and very basic step-by-step explanation on how to download videos from youtube using foobar and youtube-dl.

Now youtube-dl should download the video.
Enjoy  :)

Worked, both mono and the group downloads. THX

 

Re: foo_run 0.3.8

Reply #677

...

If the path doesn't have an ampersand in it, it works, otherwise it throws:

C:\Program Files (x86)\_personalInstalls\foobar2000>"C:\Windows\sysnative\cmd.exe" /k bash /mnt/d/test.sh 'G:\Tagged  & Cleaned\flac\Adams, Bryan\2012 - Cuts Like A Knife\'
/bin/bash: -c: line 0: unexpected EOF while looking for matching `''
/bin/bash: -c: line 1: syntax error: unexpected end of file

Notice the folder is actually 'Tagged&Cleaned', I'm guessing the step that passes it to bash is evaluating it somehow, but I don't know why, and I've tried lots of quoting variations but I just can't get it to work.

Hopefully it's a simple fix....

Turns out I was spiralling, uncontrollably in the wrong direction, and all that was ultimately needed was:

[Run services]
Code: [Select]
"C:\Windows\sysnative\cmd.exe" /k "bash /mnt/d/test.sh "$directory_path(%_path%)""

[test.bat]
Code: [Select]
#!/bin/bash

targetDir=`wslpath -u "$1"`
cd "$targetDir"
pwd
ls -al

 
SimplePortal 1.0.0 RC1 © 2008-2020