2017-08-06, 10:51
Hello,
I'm having problem with Kodi desyncing watch mark (because of Cache? or other magical problem).
Im using this simple code while drawing ListItem to determinate if video should be marked as watched or not:
And use that info this way:
When I play video or use MINE context menu (mark episode as watched) I simply push "view++" to server and refresh Container:
So I would assume that Kodi once again parse new list from server, and draw it once again but now with proper watch mark. It does most of the times, but sometimes it wont mark video as watched (with overlay=5) but playcount=1 so mine context menu assume that this video is watched and replace context menu with "Mark this episode as unwatched", also server also got the information that this episode is watched, but Kodi ignore this.
From this point on the mark flag wont get change anyother way than using build in ToogleWatch which overwrite anything else - I can Mark Watch/Unwatch by my context menu, but icon wont change (server is updated but ListView in Kodi isn't).
EDIT: It looks like when file is marked as watched by kodi (using toggle) it save it somewhere (db) and no matter what I programicaly want to draw (flag) it is overwritten with saved status - which ain't cool. Solution/Bug/Workaround ?
I'm having problem with Kodi desyncing watch mark (because of Cache? or other magical problem).
Im using this simple code while drawing ListItem to determinate if video should be marked as watched or not:
Code:
if int(video.get("view", '0')) > 0:
details['playcount'] = 1
details['overlay'] = 5
details['lastplayed'] = '2010-10-10 11:00:00' # I even put this because i was thinking kodi want to know when it was watched
else:
details['playcount'] = 0
details['overlay'] = 4
And use that info this way:
Code:
liz = xbmcgui.ListItem(details.get('title', 'Unknown'))
liz.setInfo(type=tp, infoLabels=details)
liz.setProperty('IsPlayable', 'true')
...
liz.addContextMenuItems(context)
return xbmcplugin.addDirectoryItem(handle, gui_url, listitem=liz, isFolder=False)
When I play video or use MINE context menu (mark episode as watched) I simply push "view++" to server and refresh Container:
Code:
xbmc.executebuiltin('Container.Refresh')
xbmc.sleep(int(__addon__.getSetting('refresh_wait')))
So I would assume that Kodi once again parse new list from server, and draw it once again but now with proper watch mark. It does most of the times, but sometimes it wont mark video as watched (with overlay=5) but playcount=1 so mine context menu assume that this video is watched and replace context menu with "Mark this episode as unwatched", also server also got the information that this episode is watched, but Kodi ignore this.
From this point on the mark flag wont get change anyother way than using build in ToogleWatch which overwrite anything else - I can Mark Watch/Unwatch by my context menu, but icon wont change (server is updated but ListView in Kodi isn't).
EDIT: It looks like when file is marked as watched by kodi (using toggle) it save it somewhere (db) and no matter what I programicaly want to draw (flag) it is overwritten with saved status - which ain't cool. Solution/Bug/Workaround ?