"Mark as (un)watched" for setResolvedUrl-based streams
#1
Recently in one of my add-ons, I switched from setting a video stream's URL directly on the ListItem to doing it indirectly via setResolvedUrl. However, I noticed that when I made the change, I can no longer manually mark a video as watched or unwatched from the context menu. I suppose I could implement this myself, but I'm not sure how. Has anyone done something similar?

For reference, here's the relevant code I'm using to create the ListItem:

Code:
# Initially...
url = <some URL back to my plugin>
li = xbmcgui.ListItem(name, iconImage='DefaultVideo.png',
                      thumbnailImage=thumb)
li.setProperty('IsPlayable', 'true')
xbmcplugin.addDirectoryItem(handle=addon_id, url=url,
                            listitem=li)


# Later...
video_url = <fetch the real URL>
li = xbmcgui.ListItem(path=video_url)
xbmcplugin.setResolvedUrl(addon_id, True, li)
Reply
#2
Code:
li.addContextMenuItems([('Toggle watched', 'Action(ToggleWatched)')])

Mind the braces: it's a tuple inside a list inside a method call Smile
Reply
#3
Cool, thanks! I don't suppose there's a way to figure out whether "li" will have a checkmark added beside it so that I can say "Mark as watched" or "Mark as unwatched"? I guess I could keep track of that myself, but that's probably more work than it's worth...
Reply
#4
Oops, I've said 'mind the braces' and didn't check them myself.Confused The corrected code is above.
Reply

Logout Mark Read Team Forum Stats Members Help
"Mark as (un)watched" for setResolvedUrl-based streams0