[AMC] --def exec not working anymore with FileBot 4.9.2

Support for Windows 10 users and the Microsoft Store package
Post Reply
ZeroByDivide
402
Posts: 157
Joined: 16 Dec 2014, 01:39

[AMC] --def exec not working anymore with FileBot 4.9.2

Post by ZeroByDivide »

did something change on how execute works? Was working perfectly fine for a very long time until the past couple days.

I noticed in the past 2-3 days now that any exec commands I produce through filebot never run, even though when looking in the filebot logs it said it executes it and no errors are produced at all. So I went in digging today running my script a different way (running through cmd with output going to a text file so I can grab the error) to get the full output of my whole command to see what could be the issue, and noticed that when it hits the execute part it throws an error and just continues on with the rest of the normal filebot command.

The error that it is outputting:

Code: Select all

& : The term 'filebot -script 
C:\Users\JourneyOver\Dropbox/Public/Filebot/Update_Sonarr_Radarr.groovy --def type=Episode 
id=75978' is not recognized as the name of a cmdlet, function, script file, or operable program. 
Check the spelling of the name, or if a path was included, verify that the path is correct and try 
again.
At line:1 char:3
+ & @'
+   ~~
    + CategoryInfo          : ObjectNotFound: (filebot -script...pisode id=75978:String) [], Comma 
   ndNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

As you notice it for some reason is not calling the exec command correctly and it's throwing an error that the term is not recognized which is weird as normal filebot commands run just perfectly and even running the command that I'm trying to have filebot execute as well manually it works just fine. It just doesn't run when the execute command is run through filebot through the exec stuff.

I am posting below my script, the Update_Sonarr_Radarr.groovy, the normal filebot log, and the log that I had gotten from outputting the full command into a text file with the error message.

Script (I had to post it on pastebin because everytime I tried to post it, the forums always threw an error message...):
https://pastebin.com/3RfLfvPn

Update_Sonarr_Radarr.groovy:

Code: Select all

// TVDB/TMDB ID
def id = id as int

// Video Type
def type = type

// Sonarr API Configuration
if (type =~ /Episode/) {
    def url = new URL('http://localhost:8989')
    def header = ['X-Api-Key': '']

    def sonarrSeriesId = new JsonSlurper()
        .parseText(new URL(url, '/sonarr/api/series')
            .get(header)
            .text)
        .find {
            it.tvdbId == id
        }.id

    println new URL(url, '/sonarr/api/command').post(
        JsonOutput.toJson(
            [name: 'rescanSeries', seriesId: sonarrSeriesId]
        ).getBytes('UTF-8'),
        'application/json',
        header
    ).text
}

// Radarr API Configuration
if (type =~ /Movie/) {
    def url = new URL('http://localhost:7878')
    def header = ['X-Api-Key': '']

    def radarrMovieId = new JsonSlurper()
        .parseText(new URL(url, '/radarr/api/v3/movie')
            .get(header)
            .text)
        .find {
            it.tmdbId == id
        }.id

    println new URL(url, '/radarr/api/v3/command').post(
        JsonOutput.toJson(
            [name: 'rescanMovie', movieId: radarrMovieId]
        ).getBytes('UTF-8'),
        'application/json',
        header
    ).text
}
normal log (again had to pastebin because of forum errors, plus it's super long..):
https://pastebin.com/qakcFtdF

log with error message in it (and again had to pastebin because of forum errors, plus it's super long..):
https://pastebin.com/6NxAib3x


out of everything though the only relevant part of it all is just the error message which I posted above and I will post again below with the execute part included:

Code: Select all

Execute: filebot -script C:\Users\JourneyOver\Dropbox/Public/Filebot/Update_Sonarr_Radarr.groovy --def type=Episode id=75978
& : The term 'filebot -script 
C:\Users\JourneyOver\Dropbox/Public/Filebot/Update_Sonarr_Radarr.groovy --def type=Episode 
id=75978' is not recognized as the name of a cmdlet, function, script file, or operable program. 
Check the spelling of the name, or if a path was included, verify that the path is correct and try 
again.
At line:1 char:3
+ & @'
+   ~~
    + CategoryInfo          : ObjectNotFound: (filebot -script...pisode id=75978:String) [], Comma 
   ndNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException
 


and here is the relevant sysinfo:

Code: Select all

FileBot 4.9.2 (r8060)
JNA Native: 6.1.0
MediaInfo: 20.08
7-Zip-JBinding: 16.02
Chromaprint: 1.5.0
Extended Attributes: OK
Unicode Filesystem: OK
Script Bundle: 2020-10-11 (r675)
Groovy: 3.0.6
JRE: OpenJDK Runtime Environment 15
JVM: 64-bit OpenJDK 64-Bit Server VM
CPU/MEM: 16 Core / 4.3 GB Max Memory / 84 MB Used Memory
OS: Windows 10 (amd64)
HW: MSYS_NT-10.0-19041 DESKTOP-CAR0BHN 3.1.6-340.x86_64 2020-07-09 14:33 UTC x86_64 Msys
STORAGE: NTFS [Alpha] @ 626 GB | NTFS [Beta] @ 691 GB | NTFS [Gamma] @ 398 GB | NTFS [Delta] @ 908 GB | NTFS [Epsilon] @ 130 GB | FAT32 [KINGSTON] @ 7 GB | NTFS [Zeta] @ 1.3 TB
Package: APPX
License: Microsoft Store License
Done ?(?????)?

Edit: So it seems like if I just put in filebot to execute without the

Code: Select all

-script blahblahblah
stuff it will call filebot up and it will open the program. Same thing with things like notepad.exe and such.. it seems to be an issue with

Code: Select all

filebot -script
that it is having an issue with and it's only when filebot is calling an exec on it..

Edit2: also should mention that I have already tried uninstalling and reinstalling filebot.

Edit3: seems like even having something like

Code: Select all

exec=powershell C:/Users/JourneyOver/Dropbox/Public/Filebot/test.ps1 type={type} id={id}
or even

Code: Select all

exec=C:/Users/JourneyOver/Dropbox/Public/Filebot/test.ps1 type={type} id={id}
will cause the same issue as I mentioned above.

which explains why things like

Code: Select all

filebot -script fn:amc --output "D:/Media" --log-file "C:\Users\JourneyOver\Dropbox\Public\Filebot\logs\filebot-amc.log" --action move --conflict override -non-strict C:/Users/JourneyOver/Desktop/QBT --def  "seriesFormat=/TV Shows/{N}/Season {S.pad(2)}/{N.replaceTrailingBrackets()} - {episode.special ? 'S00E'+special.pad(2) : S00E00} - {T.replacePart(', Part $1')}" "exec=echo type={type} id={id}"
throw the same type of error.

Edit4: so it looks to be an issue with exec trying to call something that has a space in the command.. if it's something like

Code: Select all

"exec=path/to/whatever.extension"
or something like just

Code: Select all

filebot
it'll work no problem, but add in a space and something else like

Code: Select all

"exec=path/to/whatever.extension type={type}"
or even

Code: Select all

filebot -script fn:sysinfo
and it throws the error.
User avatar
rednoah
The Source
Posts: 19127
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: [AMC] --def exec not working anymore with FileBot 4.9.2

Post by rednoah »

Yep, there seems to be a regression issue on Windows that breaks --def exec for some typical use cases.


Since --def exec is broken, try the newer more general -exec option instead:

Code: Select all

-exec filebot -script C:\Users\JourneyOver\Dropbox/Public/Filebot/Update_Sonarr_Radarr.groovy --def type={type} id={id}


EDIT: Fixed with FileBot r8101.
:idea: Please read the FAQ and How to Request Help.
ZeroByDivide
402
Posts: 157
Joined: 16 Dec 2014, 01:39

Re: [AMC] --def exec not working anymore with FileBot 4.9.2

Post by ZeroByDivide »

rednoah wrote: 24 Oct 2020, 04:17 Yep, there seems to be a regression issue on Windows that breaks --def exec for some typical use cases.


Since --def exec is broken, try the newer more general -exec option instead:

Code: Select all

-exec filebot -script C:\Users\JourneyOver\Dropbox/Public/Filebot/Update_Sonarr_Radarr.groovy --def type={type} id={id}


EDIT: Fixed with FileBot r8101.
yea now I wish I could just figure out how to make it work in my script without any issues :/ .. hard coding it to be above the --def doesn't seem to work, and you already know how the other method was going before you jumped off discord..

I wish I could get ahold of r8101 so I could just continue using the old method, but stupid microsoft store :(

Edit: issue has been solved. Thanks again @rednoah
Post Reply