def setXBMCEpisodePlaycount(tvdb_id, seasonid, episodeid, playcount): # httpapi till jsonrpc supports playcount update RawXbmcDb.execute( "UPDATE files" + " SET playcount=%(playcount)s" % {'playcount': xcp(playcount)} + " WHERE idFile IN (" + " SELECT idFile" + " FROM episode" + " INNER JOIN tvshowlinkepisode ON episode.idEpisode = tvshowlinkepisode.idEpisode" + " INNER JOIN tvshow ON tvshowlinkepisode.idShow = tvshow.idShow" + " WHERE tvshow.c12='%(tvdb_id)s'" % {'tvdb_id': xcp(tvdb_id)} + " AND episode.c12='%(seasonid)s'" % {'seasonid': xcp(seasonid)} + " AND episode.c13='%(episodeid)s'" % {'episodeid': xcp(episodeid)} + " )")
def setXBMCEpisodePlaycount(tvdb_id, seasonid, episodeid, playcount): # httpapi till jsonrpc supports playcount update RawXbmcDb.execute( "UPDATE files"+ " SET playcount=%(playcount)s" % {'playcount':xcp(playcount)}+ " WHERE idFile IN ("+ " SELECT idFile"+ " FROM episode"+ " INNER JOIN tvshow ON episode.idShow = tvshow.idShow"+ " WHERE tvshow.c12='%(tvdb_id)s'" % {'tvdb_id':xcp(tvdb_id)}+ " AND episode.c12='%(seasonid)s'" % {'seasonid':xcp(seasonid)}+ " AND episode.c13='%(episodeid)s'" % {'episodeid':xcp(episodeid)}+ " )")
def setXBMCMoviePlaycount(imdb_id, playcount): # httpapi till jsonrpc supports playcount update # c09 => IMDB ID match = RawXbmcDb.query( "SELECT movie.idFile FROM movie"+ " WHERE movie.c09='%(imdb_id)s'" % {'imdb_id':xcp(imdb_id)}) if not match: #add error message here return try: match[0][0] except KeyError: return RawXbmcDb.execute( "UPDATE files"+ " SET playcount=%(playcount)d" % {'playcount':int(playcount)}+ " WHERE idFile=%(idFile)s" % {'idFile':xcp(match[0][0])})
def setXBMCMoviePlaycount(imdb_id, playcount): # httpapi till jsonrpc supports playcount update # c09 => IMDB ID match = RawXbmcDb.query("SELECT movie.idFile FROM movie" + " WHERE movie.c09='%(imdb_id)s'" % {'imdb_id': xcp(imdb_id)}) if not match: #add error message here return try: match[0][0] except KeyError: return RawXbmcDb.execute( "UPDATE files" + " SET playcount=%(playcount)d" % {'playcount': int(playcount)} + " WHERE idFile=%(idFile)s" % {'idFile': xcp(match[0][0])})