def get_episode_db_info(self, season, episode, info='dbid'): if not self.dbid: return return rpc.KodiLibrary(dbtype='episode', tvshowid=self.dbid, logging=False).get_info(info=info, season=season, episode=episode)
def set_watched(self): if not self.playerstring or not self.playerstring.get('tmdb_id'): return if not self.current_time or not self.total_time: return if '{}'.format(self.playerstring.get('tmdb_id')) != '{}'.format( self.details.get('unique_ids', {}).get('tmdb')): return # Item in the player doesn't match so don't mark as watched # Only update if progress is 75% or more progress = ((self.current_time / self.total_time) * 100) if progress < 75: return if self.playerstring.get('tmdb_type') == 'episode': tvshowid = rpc.KodiLibrary('tvshow').get_info( info='dbid', imdb_id=self.playerstring.get('imdb_id'), tmdb_id=self.playerstring.get('tmdb_id'), tvdb_id=self.playerstring.get('tvdb_id')) if not tvshowid: return dbid = rpc.KodiLibrary('episode', tvshowid).get_info( info='dbid', season=self.playerstring.get('season'), episode=self.playerstring.get('episode')) if not dbid: return rpc.set_watched(dbid=dbid, dbtype='episode') elif self.playerstring.get('tmdb_type') == 'movie': dbid = rpc.KodiLibrary('movie').get_info( info='dbid', imdb_id=self.playerstring.get('imdb_id'), tmdb_id=self.playerstring.get('tmdb_id'), tvdb_id=self.playerstring.get('tvdb_id')) if not dbid: return rpc.set_watched(dbid=dbid, dbtype='movie')