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