def __init__(self, plugin, sortmethods=None): Film.__init__(self) self.plugin = plugin self.handle = plugin.addon_handle self.settings = Settings() self.sortmethods = sortmethods if sortmethods is not None else [ xbmcplugin.SORT_METHOD_TITLE, xbmcplugin.SORT_METHOD_DATE, xbmcplugin.SORT_METHOD_DURATION, xbmcplugin.SORT_METHOD_SIZE ] self.showshows = False self.showchannels = False
def retrieve_film_info(self, filmid): """ Retrieves the spcified film information from the database Args: filmid(id): database id of the requested film """ if self.conn is None: return None try: condition = '( film.id={} )'.format(filmid) self.logger.info('SQLite Query: {}', self.sql_query_films + ' WHERE ' + condition) cursor = self.conn.cursor() cursor.execute(self.sql_query_films + ' WHERE ' + condition) film = Film() for (film.filmid, film.title, film.show, film.channel, film.description, film.seconds, film.size, film.aired, film.url_sub, film.url_video, film.url_video_sd, film.url_video_hd) in cursor: cursor.close() return film cursor.close() except sqlite3.Error as err: self.logger.error('Database error: {}', err) self.notifier.show_database_error(err) return None
def RetrieveFilmInfo( self, filmid ): if self.conn is None: return None try: condition = '( film.id={} )'.format( filmid ) self.logger.info( 'MySQL Query: {}', self.sql_query_films + ' WHERE ' + condition ) cursor = self.conn.cursor() cursor.execute( self.sql_query_films + ' WHERE ' + condition ) film = Film() for ( film.id, film.title, film.show, film.channel, film.description, film.seconds, film.size, film.aired, film.url_sub, film.url_video, film.url_video_sd, film.url_video_hd ) in cursor: cursor.close() return film cursor.close() except mysql.connector.Error as err: self.logger.error( 'Database error: {}', err ) self.notifier.ShowDatabaseError( err ) return None
def __init__(self, plugin, sortmethods=None): Film.__init__(self) self.plugin = plugin self.handle = plugin.addon_handle self.settings = Settings() # define sortmethod for films # all av. sort method and put the default sortmethod on first place to be used by UI allSortMethods = [ xbmcplugin.SORT_METHOD_TITLE, xbmcplugin.SORT_METHOD_DATE, xbmcplugin.SORT_METHOD_DATEADDED, xbmcplugin.SORT_METHOD_SIZE, xbmcplugin.SORT_METHOD_DURATION ] if sortmethods is not None: self.sortmethods = sortmethods else: method = allSortMethods[0] allSortMethods[0] = allSortMethods[self.settings.filmSortMethod] allSortMethods[self.settings.filmSortMethod] = method self.sortmethods = allSortMethods self.showshows = False self.showchannels = False