itvx-for-kodi
itvx-for-kodi copied to clipboard
Wrong episode playing via Player.Open
I am trying to play a particular episode via Player.Open and the first episode of the series is playing, rather than the episode in the link. Please can you advise?
For example, https://www.itv.com/watch/jane-the-virgin/10a3384/10a3384a0040 is series 2, episode 18. However, if I run Player.open with the url plugin://plugin.video.viwx/resources/lib/main/play_title/?url=%2Fwatch%2Fjane-the-virgin%2F10a3384%2F10a3384a0040
, as you described in #84, season 1 episode 1 plays.
Since this html page contains data of all episodes it could well be that the first playlist found is that of the first episode of the first series. For episodes of series viwX obtains the playlist url directly and doesn't use this function.
If you want to play an episode you'll have to find the url to the episode's payllist and make a JSON-RPC call to lib/resources/main/play_stream_catchup
and pass that to parameter url
.
Alternatively, you could enable debug logging, play the episode and check the log to find the url Kodi used to run the addon. You can also add the episode to Kodi's favourites and check favourites.xml in the folder userdata to find the url Kodi uses to play the episode.
Hi, thanks for the quick response.
I have just been looking at the get_playlist_url_from_episode_page
function which is called from the play_title
function and noticed that it first attempts to return data['seriesList'][0]['titles'][0]['playlistUrl']
, falling back to data['episode']['playlistUrl']
. However, the latter results in it playing the correct episode based on the episode page url provided. Is there a reason this isn't used as the default? If not, I'd be happy to make a PR. Or if there's a good metric to determine when the former should be used we could perhaps use that instead.
https://github.com/dimkroon/itvx-for-kodi/blob/main/plugin.video.viwx/resources/lib/itvx.py#L445-L449
As I mentioned earlier, this function is not used to play episodes from a series. I've no clue why you are doing these JSON-RPC calls. There is in general no lack of support for remote control in Kodi, so it not clear to me why you need extended functionality in viwX. Can you explain why this is a good idea in general and for viwX in particular?
I use json-rpc quite extensively for a number of scripts. In general, they allow me to watch videos I've found in a browser, or an app on my tv. Basically find the video I want and send it to kodi to watch on the big screen. I use similar scripts in home assistant to send videos to my tv to watch. A key point is the home assistant scripts can't make their own requests to itvx to determine the playlist url. For youtube and for films on itvx, it does some find and replace / url encoding to turn the url into the appropriate json-rpc request to kodi.
The reason is mainly that i find it much easier to search for things in a desktop browser. If I find an episode I want to watch, click "send to kodi", and it appears on the big screen.
Apologies for the late response. I was under the impression that I had posted a reply long ago, but somehow I must have done something wrong.
As mentioned before, you're not using the right function to play episodes. I get what you're trying to do, but it's too specific to your particular use case to change the way viwx plays episodes. I suggest you resolve the playlist url in your own scripts and then call the appropriate function by JSON-RPC.
The fact that you can use JSON-RPC to run a plugin with any query string you like doesn't mean that functions you execute that way are a stable or even a public API. Be aware there's no guaranty that anything you do that way will continue to work.