Hi again dmd
i have found a code for the watched Status on .strm files generated from Plugins. So is it possible to use this Code in Cloudstream?
In the Cloudstream Addon the watched Status and playcount work how it should but in my Library (created .strm Files from Cloudstream with Pseudolibrary) there is no watched status or playcount. So the Plugin should tell my Library the watched Status or playcount cause Kodi handles .strm Files as Playlist.
This is the Code i have found here on the Forum:
Code:
#Before executing the code below we need to know the movie original title (string variable originaltitle) and the year (string variable year). They can be obtained from the infolabels of the listitem. The code filters the database for items with the same original title and the same year, year-1 and year+1 to avoid errors identifying the media.
if xbmc.getCondVisibility('Library.HasContent(Movies)'):
print("Check if movie exists in library when marking as watched")
meta = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.GetMovies", "params": {"filter":{"or": [{"field": "year", "operator": "is", "value": "%s"}, {"field": "year", "operator": "is", "value": "%s"}, {"field": "year", "operator": "is", "value": "%s"}]}, "properties" : ["file"]}, "id": 1}' % (year, str(int(year)+1), str(int(year)-1)))
meta = unicode(meta, 'utf-8', errors='ignore')
meta = json.loads(meta)
meta = meta['result']['movies']
originaltitle = infolabels["originaltitle"]
cleaned_title= re.sub('[^-a-zA-Z0-9_.()\\\/ ]+', '', originaltitle)
meta = [i for i in meta if cleaned_title in i['file']][0]
xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.SetMovieDetails", "params": {"movieid" : %s, "playcount" : 1 }, "id": 1 }' % str(meta['movieid']))
#Before executing the code below we need to know the tvshow originaltitle (var originaltitle), the episode and season (season and episode vars - both strings). They can be obtained from the infolabels of the listitem
if xbmc.getCondVisibility('Library.HasContent(TVShows)'):
print("Check if tvshow episode exists in library when marking as watched")
cleaned_title= re.sub('[^-a-zA-Z0-9_.()\\\/ ]+', '', originaltitle)
meta = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.GetEpisodes", "params": {"filter":{"and": [{"field": "season", "operator": "is", "value": "%s"}, {"field": "episode", "operator": "is", "value": "%s"}]}, "properties": ["title", "plot", "votes", "rating", "writer", "firstaired", "playcount", "runtime", "director", "productioncode", "season", "episode", "originaltitle", "showtitle", "lastplayed", "fanart", "thumbnail", "file", "resume", "tvshowid", "dateadded", "uniqueid"]}, "id": 1}' % (season, episode))
meta = unicode(meta, 'utf-8', errors='ignore')
meta = json.loads(meta)
meta = meta['result']['episodes']
meta = [i for i in meta if cleaned_title in i['file']][0]
xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.SetEpisodeDetails", "params": {"episodeid" : %s, "playcount" : 1 }, "id": 1 }' % str(meta['episodeid']))
Is there any Chance to implement this in Cloudstream? Or if i want to implement on myself where should i look for? On Movies it´s not a Problem to set the watched Status manually but on many Episodes from Series it´s anoying.
Thanks in Advance!!!