I've updated to 18.4 and jsonrpc method I used to save .nfo files aside each movie/tv seems to ignore options passed to it. In fact, the behavior is like it has all three options "enabled"! :(
The request I make:
{
"jsonrpc":"2.0",
"method":"VideoLibrary.Export",
"params":{
"options": {
"overwrite": false,
"actorthumbs": false,
"images": false
}
},
"id":1
}
It's based on documentation from:
This worked as expected with the previous version I had installed (17.x)
Now it does exactly the opposite of what I want:
.nfo files -> it overwrites all .nfo filesSteps to reproduce the behavior:
Used Operating system:
As by documentation, all the options are false by default, having them not specified matches my expected behavior (just export .nfo) files:
{
"jsonrpc":"2.0",
"method":"VideoLibrary.Export",
"id":1
}
I see that the json-rpc call constructs cmd and sends it at:
https://github.com/xbmc/xbmc/blob/Leia/xbmc/interfaces/json-rpc/VideoLibrary.cpp#L897
looking at git blame, this rpc function's code is 2-9 years old. so looks like this has been outstanding for a bit.. the logic doesnt check to see if the options param values are true or false but if the options 'image' is present.
if (parameterObject["options"].isMember("images"))
so as the OP is noting, being explicit on saying false for the option has the reverse intention due to the implemented logic.
I can confirm this issue. I tried following requests:
http://localhost:8152/jsonrpc?request={"jsonrpc":"2.0","method":"VideoLibrary.Export","params":{"options":{"actorthumbs":false,"images":false,"overwrite":false}},"id":9}
http://localhost:8152/jsonrpc?request={"jsonrpc":"2.0","method":"VideoLibrary.Export","params":{"options":{"actorthumbs":false,"images":true,"overwrite":false}},"id":11}
Logfile for the first request: http://paste.ubuntu.com/p/7M7GcVPwKD/
@glensc could you manage to also provide a logfile please. As that's always mandatory in those cases.
Thanks in advance
@DaVukovic I don't think the log is needed, as @thezoggy identified the faulty code that it doesn't check the values, but only key existence, which is wrong by documentation. And it's confirmed by at least one user as well (You!)
Also, there wasn't anything useful in the logs, and I don't have log anymore (restarted Kodi, which truncates the log) and I don't want to trash the filesystem again to reproduce on the original situation (modify timestamps are important to me). and I'm very reluctant to post the whole log, as it may contain sensitive information and if I post partial one, someone thinks that's not sufficient...
The fix is very trivial, has anyone started to work on this? if not i'll submit the PR myself.
Seems .isMember should be just replaced with .asBoolean:
Most of the team are away on our annual Devcon, so I can almost guarantee nobody has started working on it.
Please go ahead and submit the PR.
Enjoy the devcon, here's the patch: https://github.com/xbmc/xbmc/pull/16777
Most helpful comment
Most of the team are away on our annual Devcon, so I can almost guarantee nobody has started working on it.
Please go ahead and submit the PR.