kodi refresh library command not working with recent kodi testbuilds

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
samuel
Posts: 4
Joined: 04 Nov 2017, 13:47

kodi refresh library command not working with recent kodi testbuilds

Post by samuel »

hello everyone,
i ran into a following problem with kodi "refresh video library command" not working with recent kodi testbuilds.

i am using filebot (4.7.9) intalled on synology + filebot node (0.2.4) and i run the filebot command as a scheduled task. i've been using filebot with ease and these kodi builds handled everything properly, until recently - i found out my video library refresh stopped working after i updated my kodi testbuild to some version from June 2017.

after some digging, here is what i've found: long story short: kodi doesnt accept most of the rpc calls via GET request, they should be done via POST.
here is what it looks like in filebot output:

Code: Select all

filebot -script 'dev:amc' /volume1/download/ --output /volume1/video/ --action move -non-strict --conflict auto --lang en --def 'subtitles=ces' 'clean=y' 'deleteAfterExtract=y' 'kodi=192.168.0.100:80' --log all --log-file '/volume1/@appstore/filebot-node/data/filebot.log'

------------------------------------------

<lines removed>

Notify Kodi: [host:192.168.0.100, port:80]
GET: http://192.168.0.100:80/jsonrpc?request={"jsonrpc":"2.0","method":"GUI.ShowNotification","params":{"title":"FileBot+finished+processing+1+files","message":"\u2022+Mesage","image":"https://app.filebot.net/icon.png"},"id":1}
GET: http://192.168.0.100:80/jsonrpc?request={"jsonrpc":"2.0","method":"VideoLibrary.Scan","id":1}
Clean clutter files and empty folders
Done ヾ(@⌒ー⌒@)ノ
------------------------------------------

[Process completed]
as you can see, the GET calls (GUI.ShowNotification and VideoLibrary.Scan) seems to pass OK, because kodi returns OK 200, with this body:

Code: Select all

{
  "jsonrpc": "2.0",
  "error": {
    "code": -32099,
    "message": "Bad client permission."
  },
  "id": 1
}
when i send the command manually via POST request to kodi like this:
url: http://192.168.0.100/jsonrpc?VideoLibrary.Scan
body (content-type application/json):

Code: Select all

[{"jsonrpc":"2.0","method":"VideoLibrary.Scan","id":7}]
the kodi library updates just fine.
User avatar
rednoah
The Source
Posts: 22976
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: kodi refresh library command not working with recent kodi testbuilds

Post by rednoah »

Maybe fixed.

Please try the latest script revision:

Code: Select all

filebot -script dev:amc ...
:idea: Please read the FAQ and How to Request Help.
samuel
Posts: 4
Joined: 04 Nov 2017, 13:47

Re: kodi refresh library command not working with recent kodi testbuilds

Post by samuel »

i am running it with -script dev:amc, but nothing has changed (the GET request in the log looks the same and kodi doesn't refresh library), do i need to somehow (force) update the amc script or something?

just a side note, my kodi runs more recent build now (not June, but late October), but i suppose it has nothing to do with it.
User avatar
rednoah
The Source
Posts: 22976
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: kodi refresh library command not working with recent kodi testbuilds

Post by rednoah »

If you've been using dev:amc all along, then you might need to call -clear-cache once to make sure it's using the latest script. The log should say POST: <URL> now.
:idea: Please read the FAQ and How to Request Help.
samuel
Posts: 4
Joined: 04 Nov 2017, 13:47

Re: kodi refresh library command not working with recent kodi testbuilds

Post by samuel »

yup, thanks for the tip. unfortunately there are some problems, see the output:

Code: Select all

filebot -script 'dev:amc' /volume1/download/ --output /volume1/video/ --action move -non-strict --conflict auto --lang en --def 'subtitles=ces' 'clean=y' 'deleteAfterExtract=y' 'kodi=192.168.0.100:80' --log all --log-file '/volume1/@appstore/filebot-node/data/filebot.log'

------------------------------------------
Locking /volume1/@appstore/filebot-node/data/filebot.log
Run script [dev:amc] at [Sun Nov 05 08:47:08 CET 2017]
Parameter: subtitles = ces
Parameter: clean = y
Parameter: deleteAfterExtract = y
Parameter: kodi = *****
Parameter: seriesFormat = TV shows/{n}/Season {s}/{n} - {s00e00} - {t}{'\''.'\''+source}{'\''.'\''+vf}{'\''.'\''+vc}{'\''.'\''+group}
Parameter: movieFormat = movies/{n} ({y})/{n}.{y}{'\''.'\''+source}{'\''.'\''+vf}{'\''.'\''+vc}{'\''.'\''+group}
Argument[0]: /volume1/download
MultipleCompilationErrorsException: startup failed:
Script2.groovy: 16: expecting '}', found ')' @ line 16, column 40.
   	def url = "http://$host:$port/jsonrpc")
                                          ^
1 error
 at net.filebot.cli.ScriptShell.evaluate(ScriptShell.java:64)
Ignore system path: /volume1/download/@eaDir
<lines removed>
Processed 1 files
Notify Kodi: [host:192.168.0.100, port:80]
MissingMethodException: No signature of method: org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.showNotification() is applicable for argument types: (java.lang.String, java.lang.Integer, org.codehaus.groovy.runtime.GStringImpl, java.lang.String, java.lang.String) values: [192.168.0.100, 80, FileBot finished processing 1 files, • ...]
Clean clutter files and empty folders
Done ヾ(@⌒ー⌒@)ノ
------------------------------------------
don't know if this helps at all, but i made a PR for this typo (just by guess, dont be mad;) https://github.com/filebot/scripts/pull/48
User avatar
rednoah
The Source
Posts: 22976
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: kodi refresh library command not working with recent kodi testbuilds

Post by rednoah »

Ups. My bad. Should be working now.
:idea: Please read the FAQ and How to Request Help.
samuel
Posts: 4
Joined: 04 Nov 2017, 13:47

Re: kodi refresh library command not working with recent kodi testbuilds

Post by samuel »

good job! i confirm it is woking now. i hope it doesnt break something for users using older kodi builds.

i humbly suggest you log/print the json string as well, for the debug purposes. because now (as you mentioned before) it prints just the POST: <URL> (the same for GUI.ShowNotification and VideoLibrary.Scan)
User avatar
rednoah
The Source
Posts: 22976
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: kodi refresh library command not working with recent kodi testbuilds

Post by rednoah »

Sure. More logging makes sense.
:idea: Please read the FAQ and How to Request Help.
Post Reply