PlayMedia not working for widget
#1
Hi, I've made a Next Episode episode widget that doesn't rely on addons for when people don't have/want Embuary Helper installed on their system, but I'm running into a problem with playing the selected episode. I did this by effectively two lists like so:

xml:

<include name="Widget_NextUp">
        <include condition="System.AddonIsEnabled(script.embuary.helper)" content="Widget_Template">
            <param name="widget_position" value="$PARAM[widget_position]"/>
            <param name="widget_header" value="$LOCALIZE[31227]"/>
            <param name="id" value="$PARAM[id]"/>
            <param name="content" value="plugin://script.embuary.helper/?info=getnextup"/>
        </include>
        <include condition="!System.AddonIsEnabled(script.embuary.helper)" content="Widget_Template">
            <param name="widget_position" value="$PARAM[widget_position]"/>
            <param name="widget_header" value="$LOCALIZE[31227]"/>
            <param name="id" value="$PARAM[id]"/>
            <param name="target" value="videos"/>
            <param name="content" value="special://skin/extras/playlists/inprogress_tvshows.xsp"/>
            <param name="use_custom_click" value="true"/>
            <param name="click_action" value="Next_Up"/>
            <control type="list" id="92200">
                <visible>Control.HasFocus($PARAM[id])</visible>
                <itemlayout/>
                <focusedlayout/>
                <content target="videos" sortby="playcount" sortorder="ascending" limit="1">videodb://inprogresstvshows/$INFO[Container($PARAM[id]).ListItem.DBID]/-2/?xsp=%7B%22rules%22%3A%7B%22and%22%3A%5B%7B%22field%22%3A%22playcount%22%2C%22operator%22%3A%22is%22%2C%22value%22%3A%5B%220%22%5D%7D%5D%7D%2C%22type%22%3A%22episodes%22%7D</content>
            </control>
        </include>
    </include>

So if Embuary Helper is enabled, the widget will use the plugin as content source, but if it isn't, it will use an inprogress smart playlist for tv shows. In this second instance, a secondary list then provides details of the next unplayed episode for the tvshow selected in the primary list. So far, so good.

But for my <onclick> in my primary list, I want to play the episode that is selected in the secondary list (id = 92200). And this is not working.

I thought it would be a simple case of this:

xml:

<onclick>PlayMedia($INFO[Container(92200).ListItem.Filenameandpath])</onclick>

But that gives me the following error:

json:

2022-10-11 12:02:25.059 T:4552    ERROR <general>: Keymapping error: no such action 'playmedia()' defined
2022-10-11 12:02:25.059 T:4552    DEBUG <general>: CApplication::ExecuteXBMCAction: Tried translating, but failed to understand PlayMedia($INFO[Container(92200).ListItem.FileNameAndPath])

I think the $INFO should be translated in the log, which seems to indicate that for some reason the <onclick> of a list cannot parse the request. Is it because it's an external list? Any ideas?

I've tried sending a click to 92200 also, but that doesn't work. The only way I can get the functionality to work is by passing focus to 92200 but this means you need an extra click with no perceptible result by the user to pass focus. And also it gives me issues with the way my widget visibility conditions work and I don't really want to redo them all if I can help it. 

Anyone got any ideas?
Reply
#2
Cant't whats causing it and if it's a bug.
but noticed the same on other intentions. (no ref via container id)

i suggest,

- extend the visibility condition for your container with another property , to keep its behaviour "alive", then use the default action to setfocus(hiddenbuttonid)...

- move the default ( the one which need reference to a container id ) onclick actions to a hidden button + set property to keep tje bisibility alive

- on the hidden button, use onfocus action,
like 'playmedia' + send focus (back to prev container ) + lastly clear the property again.
Skins |  Titan M O D   •   S W A N (WIP)
Reply
#3
Thanks @mardukL, will try out your suggestions and report back!
Reply
#4
This sounds wrong to me. The $info should always resolve before the command. At worst it should resolve empty ie just be playmedia()

If youre on Nexus nightly -maybe double check on Matrix because I think this might be a bug that needs to be reported. $info shouldn't behave like that.
Arctic Fuse - Alpha now available. Support me on Ko-fi.
Reply
#5
Also you should remove target="videos" from your content tags in the smartplaylist because you're overriding the onclick.

The target tag should only be used if you want kodi to control the onclick for the list (it tells kodi which mynav window a folder should open in).
Arctic Fuse - Alpha now available. Support me on Ko-fi.
Reply
#6
Thanks @jurialmunkey - I'll amend and try on Matrix to see if it's a Nexus bug or an error on my side!
Reply

Logout Mark Read Team Forum Stats Members Help
PlayMedia not working for widget0