Windows - Trouble with script using gui app
Posted: March 21st, 2013, 8:20 pm
I have a post-processing script I put together for flac files. I am trying to use foobar2000's command line capabilities to convert all the files I download since it is the easiest way to end up with files the way I want. The script works fine when I run it from the command line, but when I use it with sabnzbd it starts foobar, but the gui never shows and the commands don't seem to work because of this. The script will hang in a running state until I kill the foobar process in task manager. I assume this has to be something to do with the way sabnzbd runs post-processing scripts or the fact that I'm running it as a service. Is there an option I have missed somewhere where I can make this work?
Here is my batch file:
I am running sabnzbd as a windows service on 2008 Server (WHS 2011). I set up the service with srvany.exe. I have tried enabling the service to interact with the desktop, and also changed the user account that the service runs under to the logged in user. Any help or ideas would be appreciated!
Here is my batch file:
Code: Select all
:: remove embedded artwork
for /R %1 %%f in (*.flac) do (metaflac.exe --remove --block-type=PICTURE "%%f")
:: remove replaygain if there because it will be added during conversion
for /R %1 %%f in (*.flac) do (metaflac.exe --remove-replay-gain "%%f")
:: remove these tags I do not want (there is probably a better way to do this)
for /R %1 %%f in (*.flac) do (metaflac --remove-tag=COMMENT --remove-tag=TRACKTOTAL --remove-tag="TOTAL DISCS" --remove-tag="TOTAL TRACKS" --remove-tag="TOTALDISCS" --remove-tag="TOTALTRACKS" --remove-tag=COMPILATION --remove-tag=COMPOSER --remove-tag=ORIGINALARTIST --remove-tag=COPYRIGHT --remove-tag=URL --remove-tag=ENCODEDBY --remove-tag=BPM --remove-tag=LYRICS --remove-tag=VERSION --remove-tag=GROUPING --remove-tag=SUBTITLE --remove-tag=RELESETIME --remove-tag=ORIGARTIST --remove-tag=RATING --remove-tag=MOOD --remove-tag=DISCNUMBER --remove-tag=DISC --remove-tag=CONDUCTOR --remove-tag=LYRICIST --remove-tag=ORIGINALLYRICIST --remove-tag=RELEASETIME --remove-tag=AUDIOFILEURL --remove-tag=AUTHORURL --remove-tag=AUDIOSOURCEURL --remove-tag=RADIOSTATIONNAME --remove-tag=RADIOSTATIONURL --remove-tag=BUYCDURL --remove-tag=ISRC --remove-tag=ORGANIZATION --remove-tag=LABELNO --remove-tag=LANGUAGE --remove-tag="RIP DATE" --remove-tag="Retail Date" --remove-tag=MEDIA --remove-tag=ENCODER --remove-tag="ENCODED BY" --remove-tag="ENCODER SETTINGS" --remove-tag="PROFILE" --remove-tag="SOURCE" --remove-tag="Ripping Tool" --remove-tag="Release Type" --remove-tag=ENSEMBLE --remove-tag=OST --remove-tag="ACCURATERIPDISCID" --remove-tag="ACCURATERIPRESULT" --remove-tag="CATALOG #" --remove-tag="CDDB DISC ID" --remove-tag="CDTOC" --remove-tag="CRC" --remove-tag="STYLE" --remove-tag="UPC" "%%f")
:: start a foobar and make a new playlist
start "" %foobar%\foobar2000.exe /runcmd="New Playlist"
:: add the directory passed to this batch file to the new playlist
%foobar%\foobar2000.exe /add %1
:: wait 2 seconds
timeout 2
:: convert files with a preset called flac
%foobar%\foobar2000.exe /runcmd-playlist="Convert/flac"
:: remove the playlist
%foobar%\foobar2000.exe /runcmd="remove Playlist"