In some plugins, the search URI does not accept a search query param. When the search URI is parsed through Files.GetDirectory JSON-RPC method, the user is prompted to input the query manually thereby making potential players not user friendly.
Solution is to allow automated filling of keyboard dialog as input step.
Latest commit will allow for a "keyboard" step which will essentially auto-fill the keyboard dialog and press enter before moving on to the next step.
"play_movie" : [
"plugin://plugin.video.foobar/search/",
{"keyboard": "{title}"},
{"title": "{title}"}
]
@drinfernoo - Can you test and see if this will work with the plugins that you were trying to make players for? I've tested with a few different plugins and it definitely works with some, but others don't like it and will just dump you out at the search dir.
I'm not sure it's working for me... My player file is as follows, for Disney+:
{
"name": "Disney+",
"plugin": "slyguy.disney.plus",
"priority": 500,
"play_movie": [
"plugin://slyguy.disney.plus/?_=search",
{"keyboard": "{title}"},
{"title": "{title}", "year": "{year}"}
],
"play_episode": [
"plugin://slyguy.disney.plus/?_=search",
{"keyboard": "{showname}"},
{"title": "{showname}"},
{"season": "{season}"},
{"season": "{season}", "episode": "{episode}"}
],
"search_movie": [
"plugin://slyguy.disney.plus/?_=search",
{"keyboard": "{title}"}
],
"search_episode": [
"plugin://slyguy.disney.plus/?_=search",
{"keyboard": "{showname}"},
{"title": "{showname}"},
{"season": "{season}"}
]
}
But whenever the keyboard pops up, no text is put in, nor is the keyboard confirmed. It does appear that the Disney+ add-on remembers what I searched for last, and fills in the dialog with that query... would the keyboard already begin filled goof this up?
Hmm that's strange. It should definitely complete the keyboard and close it. I've never had any issues with that -- the only problem I've encountered is afterwards some plugins don't return anything via GetDirectory (I think because they do a container refresh before showing search results).
Is the addon using the native keyboard or something else? Also, are you testing from a widget or the library?
I'm testing it by trying to play an item I can confirm is on Disney+ (like Lion King or Aladdin), from a menu inside TMDbHelper. I haven't looked at the source, but it does appear to be using the native keyboard dialog.
What about if you use Youtube.
{
"name" : "Tester",
"plugin" : "plugin.video.youtube",
"priority" : 500,
"play_movie" : [
"plugin://plugin.video.youtube/kodion/search/input/",
{"keyboard": "{title}"},
{"title": "{title}", "year": "{year}"}
]
}
This should autofill the keyboard dialog and close it. It will fail to play anything because of the way Youtube search works, but it definitely autofills and closes for me.
Also, are you testing on Android by any chance? I wonder if this is the same reason autocomplete doesn't work properly on Android.
Also one that definitely works for me is IMDb Trailers (available on official repo)
{
"name" : "Tester",
"plugin" : "plugin.video.imdb.trailers",
"priority" : 500,
"play_movie" : [
"plugin://plugin.video.imdb.trailers/?action=search",
{"keyboard": "{title}"},
{"title": "{title}"}
]
}
I tested with Joker and this played the trailer for it.
I actually was able to get it working with the Disney+ add-on! In my test instance, I had forgotten to update TMDbHelper before testing ๐
I need to tweak the player still for episodes (getting an error from TMDbHelper), but the keyboard magic is working for me, and movies are playing flawlessly!
So I've now tweaked my player and can get most episodes to play, but there are still some shows that give me the error I linked above. My current player looks like this:
{
"name": "Disney+",
"plugin": "slyguy.disney.plus",
"priority": 500,
"play_movie": [
"plugin://slyguy.disney.plus/?_=search",
{"keyboard": "{title}"},
{"title": "{title}", "year": "{year}"}
],
"play_episode": [
"plugin://slyguy.disney.plus/?_=search",
{"keyboard": "{showname}"},
{"title": "{showname}"},
{"position": "{season}"},
{"position": "{episode}"}
],
"search_movie": [
"plugin://slyguy.disney.plus/?_=search",
{"keyboard": "{title}"}
],
"search_episode": [
"plugin://slyguy.disney.plus/?_=search",
{"keyboard": "{showname}"},
{"title": "{showname}"},
{"position": "{season}"}
]
}
In particular, Gravity Falls and Disney Gallery: The Mandalorian give me the error, but I'm sure there are others. I was able to successfully play episodes from So Weird, Gargoyles, Agent Carter, and Doc McStuffins in my testing. I presume this is more of an issue with the Disney+ add-on, but wondered if there's a better way to handle whatever is being sent back to TMDbHelper, that would result in success, or at least a more graceful failure.
I generated a fresh debug log (attempting Disney Gallery: The Mandalorian S01E04) here: https://pastebin.com/p9igmQPq
@drinfernoo - Ah that error was something unrelated. Basically, when I did a clean-up of the player code, I forgot to break the for loop iterating through the player steps if one of them failed. Should now be fixed and will return back to the player select dialog properly if it fails.
The actual failure is just this step failing to find a title that matches showname
{"title": "{showname}"}
If you want to output what Files.GetDirectory is returning, un-comment these log commands: https://github.com/jurialmunkey/plugin.video.themoviedb.helper/commit/81e8657ece85ee5a10d802dbe585f44c0170758d
That should give a clearer indication of what is being returned and why {showname} isn't finding a matching title field in the GetDirectory results.
As a separate comment, why are you using "position" to match season / episode? Does the Disney+ addon not provide "season" or "episode" number fields? You'll get more consistent results if you can match against those fields instead of position.
I was still fiddling with the player, and using position seemed to work for some shows that were erroring when using season ๐คท๐ผโโ๏ธ
If the error is "unrelated", then I'll switch back to season and see how we do.
I was still fiddling with the player, and using
positionseemed to work for some shows that were erroring when usingseason๐คท๐ผโโ๏ธIf the error is "unrelated", then I'll switch back to
seasonand see how we do.
By "unrelated" I mean that the exception error was due to a bug in my code.
If it failed to match before, it's still going to fail - it just won't error now. So if you were getting fails on the season step then it's possible that the Disney+ addon doesn't provide a season number at the seasons level.
@jurialmunkey I'm playing with fallback players as well, so is it possible it was failing on the first player before fallback?
I think the issue is that the error prevented it from moving on to the next player.
@drinfernoo Yeah, that would probably be it. If the player failed to find a match before the last step of the player then it would have thrown an exception -- but a fail on the last step would work properly because there's no more steps to iterate so it is essentially the same as breaking the loop.
All my test cases were fails on the last step of the player, so that's why I didn't pick-up on the bug.
Yep, it's working now ๐ So... I need to do a bit of testing before reporting something though ๐
In any case, the keyboard thing is doing exactly as it should, from what I can tell, so I think this one can be closed ๐