Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: foo_run 0.3.8 (Read 505386 times) previous topic - next topic
0 Members and 2 Guests 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

Re: foo_run 0.3.8

Reply #678
does anyone know how to configure for CUETools?

so that the check on the accuraterip database starts and the file is automatically saved

Re: foo_run 0.3.8

Reply #679
"c:\Portable App\CUETools\CUETools.exe" "%_path%"
did you figure out how to run the check automatically?

Re: foo_run 0.3.8

Reply #680
Hi guys,
i know the last post was a long time ago, but i think it's still the best place to ask.

1) Would anyone know the code for a search in allmusic.com combining artist + album,
2) same question for discogs, combining the codes below ?

Code: [Select]
Discogs artist
https://www.discogs.com/es/search/?q=$replace(%artist%, ,+)&type=artist

Discogs album
https://www.discogs.com/es/search/?q=$replace(%album%, ,+)&type=master

Cheers

Nico


Re: foo_run 0.3.8

Reply #681
I found the solution for discogs, on this forum:

Code: [Select]
https://www.discogs.com/search?q=$replace(%artist%+%album%, ,+)&ie=utf-8

But i'm still looking for allmusic.com. So far i tried:

Quote
http://www.allmusic.com/search?q=$replace(%artist%+%album%, ,+)
http://www.allmusic.com/search/artist/$replace(%artist%, ,+)/search/album/$replace(%album%, ,+)

But none are working.

Any help would be appreciated.

Re: foo_run 0.3.8

Reply #682
@mrnike
The spaces need to be replaced with:
Code: [Select]
%20

You may find that other characters need replacing like ( and ) etc. 

When you search in your browser you'll see these when you search via your browser.

Re: foo_run 0.3.8

Reply #683
I'm not sure i understood you.

You mean i should add %20 wherever there is a space in my code ? I doubt this is the problem, as the code for discogs works perfectly wihtout the %20.

What i'm trying to archive is to combine those 2 codes

Code: [Select]
http://www.allmusic.com/search/album/$replace(%album%, ,+)
http://www.allmusic.com/search/artist/$replace(%artist%, ,+)

as per the discogs code, in order to get a more precise search results.

Re: foo_run 0.3.8

Reply #684
mrnike I don't know if this will help you:
Code: [Select]
http://www.allmusic.com/search/album/$replace(%artist%+ %album%, ,+)
YouTube Music

Re: foo_run 0.3.8

Reply #685
Brillant !
Thanks SergPuh.68.

Re: foo_run 0.3.8

Reply #686
You mean i should add %20 wherever there is a space in my code ? I doubt this is the problem, as the code for discogs works perfectly wihtout the %20.

What i'm trying to archive is to combine those 2 codes

Code: [Select]
http://www.allmusic.com/search/album/$replace(%album%, ,+)
http://www.allmusic.com/search/artist/$replace(%artist%, ,+)

as per the discogs code, in order to get a more precise search results.

When you search on the site itself it replaces whitespace with the %20. Like this: https://www.allmusic.com/search/all/one%20two

Which is URL Encoding using ASCII Encoding Reference, see here:
https://www.w3schools.com/tags/ref_urlencode.ASP

So both these work exactly the same:
Code: [Select]
http://www.allmusic.com/search/album/$replace(%artist%+%album%, ,+)
http://www.allmusic.com/search/album/$replace(%artist%+%album%, ,'%20')


Re: foo_run 0.3.8

Reply #687
MTP file transfers to my Android phone are impossibly slow so I've had to rely on pushing files through command line with Android Debug Bridge. For example: cmd adb push "folder" "phone/sd_card/folder".
I was wondering if there was a way, maybe through using foo_run, to conveniently copy files to my phone instead? (I'm a code noob!) In the same way that it's convenient to use the "File Operations" in foobar2000 to transfer files.

Re: foo_run 0.3.8

Reply #688
Nevermind, I found my answer. (Sorry I'm a novice; feel free to delete these two messages.)

Code: [Select]
adb.exe push "%path%" "sd_card"

Re: foo_run 0.3.8

Reply #689
Does anyone know how to get rid of the trailing whitespace when using?

Code: [Select]
cmd /c echo $trim(%album artist% %album%)|CLIP

This results in a carriage return on the CLIP.

Re: foo_run 0.3.8

Reply #690
Use echo|set to remove trailing newline...

Titleformat output to clipboard:
Code: [Select]
cmd /c echo|set /p=$trim(%album artist% - %album%)|CLIP


Re: foo_run 0.3.8

Reply #692
Hi could tell me how implement code in foobar ?


Re: foo_run 0.3.8

Reply #694
thank you very much.

I don't know why I don't see Run services in Tools



Re: foo_run 0.3.8

Reply #696
ok, got this, thank you!!

Re: foo_run 0.3.8

Reply #697
Is it possible to pipe the results of a Run Service into a playlist column? I'm trying to get the file checksum into a playlist column so that I can manually review for duplicates (I can't just use foo_audiomd5 for this because they're midi files and ffmpeg doesn't know how to take the audio md5 of those)

Re: foo_run 0.3.8

Reply #698
Since I didn’t find a useful CUE sheet editor, I set a AutoHotkey script that creates or appends to a file. But when I pass the current playing position (%playback_time% or %time_elapsed%), foobar2000 only sends a “?”.
Any ideas on how to send the current playing position automatically to the script?

 
SimplePortal 1.0.0 RC1 © 2008-2021