2014-07-24, 17:41
Hi, I would like to add a "resume watching" of movies/episodes functionality to the home screen of my skin.
The service.library.data.provider script provides great functionality for this, with one small exception:
The recommendedmovies tag retrieves only the resumable movies, which is the desired result.
But the recommendedepisodes tag retrieves what xbmc calls "tv shows in progress"...these are not only episodes you have started watching
and haven't finished, but all tv shows with remaining unwatched episodes (this is great for general recommendation purposes but not resume purposes).
So in order to accomplish what I want, I tried editing the library.py file and changing the _fetch_recommended_episodes function to this
(basically a copy of the recommendedmovies function with changed details):
Needless to say, this didn't work. I am not at all experienced in python development, I just tried changing what appeared logical to me
Any assistance would be appreciated..
The service.library.data.provider script provides great functionality for this, with one small exception:
The recommendedmovies tag retrieves only the resumable movies, which is the desired result.
But the recommendedepisodes tag retrieves what xbmc calls "tv shows in progress"...these are not only episodes you have started watching
and haven't finished, but all tv shows with remaining unwatched episodes (this is great for general recommendation purposes but not resume purposes).
So in order to accomplish what I want, I tried editing the library.py file and changing the _fetch_recommended_episodes function to this
(basically a copy of the recommendedmovies function with changed details):
PHP Code:
def _fetch_recommended_episodes( self, useCache = False ):
data = self._get_data( "recommendedepisodes", useCache )
if data is not None:
return data
# Set that we're getting updated data
self.WINDOW.setProperty( "recommendedepisodes-data", "LOADING" )
json_string = '{"jsonrpc": "2.0", "id": 1, "method": "VideoLibrary.GetEpisodes", "params": {"properties": ["title", "playcount", "season", "episode", "showtitle", "plot", "file", "rating", "resume", "tvshowid", "art", "streamdetails", "firstaired", "runtime", "writer", "cast", "dateadded", "lastplayed"], "limits": {"end": %d},' % self.LIMIT
json_query = xbmc.executeJSONRPC('%s "sort": {"order": "descending", "method": "lastplayed"}, "filter": {"field": "inprogress", "operator": "true", "value": ""}}}' %json_string)
json_query = unicode(json_query, 'utf-8', errors='ignore')
self.WINDOW.setProperty( "recommendedepisodes-data", json_query )
self.WINDOW.setProperty( "recommendedepisodes",strftime( "%Y%m%d%H%M%S",gmtime() ) )
return json_query
Needless to say, this didn't work. I am not at all experienced in python development, I just tried changing what appeared logical to me
Any assistance would be appreciated..