parameters: (self, title, pagenumber)
docstring: Common name for a video search. Used to interface with MythTV plugin NetVision
docstring_summary: Common name for a video search. Used to interface with MythTV plugin NetVision
docstring_tokens: Common name for a video search . Used to interface with MythTV plugin NetVision
function: def searchForVideos(self, title, pagenumber):
          """Common name for a video search. Used to interface with MythTV plugin NetVision
          """
          # Get tedtalks_config.xml
          self.getUserPreferences()
  
          if self.config['debug_enabled']:
              print("self.tedtalks_config:")
              sys.stdout.write(etree.tostring(self.tedtalks_config, encoding='UTF-8', pretty_print=True))
              print()
  
          # Easier for debugging
  #        print self.searchTitle(title, pagenumber, self.page_limit)
  #        print
  #        sys.exit()
  
          try:
              data = self.searchTitle(title, pagenumber, self.page_limit)
          except TedTalksVideoNotFound as msg:
              sys.stderr.write("%s\n" % msg)
              sys.exit(0)
          except TedTalksUrlError as msg:
              sys.stderr.write('%s\n' % msg)
              sys.exit(1)
          except TedTalksHttpError as msg:
              sys.stderr.write(self.error_messages['TedTalksHttpError'] % msg)
              sys.exit(1)
          except TedTalksRssError as msg:
              sys.stderr.write(self.error_messages['TedTalksRssError'] % msg)
              sys.exit(1)
          except Exception as e:
              sys.stderr.write("! Error: Unknown error during a Video search (%s)\nError(%s)\n" % (title, e))
              sys.exit(1)
  
          # Create RSS element tree
          rssTree = etree.XML(self.common.mnvRSS+'</rss>')
  
          # Set the paging values
          if len(data) == self.page_limit:
              self.channel['channel_returned'] = len(data)
              self.channel['channel_startindex'] = len(data)+(self.page_limit*(int(pagenumber)-1))
              self.channel['channel_numresults'] = len(data)+(self.page_limit*(int(pagenumber)-1)+1)
          else:
              self.channel['channel_returned'] = len(data)+(self.page_limit*(int(pagenumber)-1))
              self.channel['channel_startindex'] = len(data)
              self.channel['channel_numresults'] = len(data)
  
          # Add the Channel element tree
          channelTree = self.common.mnvChannelElement(self.channel)
          rssTree.append(channelTree)
  
          for item in data:
              channelTree.append(item)
  
          # Output the MNV search results
          sys.stdout.write('<?xml version="1.0" encoding="UTF-8"?>\n')
          sys.stdout.write(etree.tostring(rssTree, encoding='UTF-8', pretty_print=True))
          sys.exit(0)
function_tokens: def searchForVideos ( self , title , pagenumber ) : # Get tedtalks_config.xml self . getUserPreferences ( ) if self . config [ 'debug_enabled' ] : print ( "self.tedtalks_config:" ) sys . stdout . write ( etree . tostring ( self . tedtalks_config , encoding = 'UTF-8' , pretty_print = True ) ) print ( ) # Easier for debugging #        print self.searchTitle(title, pagenumber, self.page_limit) #        print #        sys.exit() try : data = self . searchTitle ( title , pagenumber , self . page_limit ) except TedTalksVideoNotFound as msg : sys . stderr . write ( "%s\n" % msg ) sys . exit ( 0 ) except TedTalksUrlError as msg : sys . stderr . write ( '%s\n' % msg ) sys . exit ( 1 ) except TedTalksHttpError as msg : sys . stderr . write ( self . error_messages [ 'TedTalksHttpError' ] % msg ) sys . exit ( 1 ) except TedTalksRssError as msg : sys . stderr . write ( self . error_messages [ 'TedTalksRssError' ] % msg ) sys . exit ( 1 ) except Exception as e : sys . stderr . write ( "! Error: Unknown error during a Video search (%s)\nError(%s)\n" % ( title , e ) ) sys . exit ( 1 ) # Create RSS element tree rssTree = etree . XML ( self . common . mnvRSS + '</rss>' ) # Set the paging values if len ( data ) == self . page_limit : self . channel [ 'channel_returned' ] = len ( data ) self . channel [ 'channel_startindex' ] = len ( data ) + ( self . page_limit * ( int ( pagenumber ) - 1 ) ) self . channel [ 'channel_numresults' ] = len ( data ) + ( self . page_limit * ( int ( pagenumber ) - 1 ) + 1 ) else : self . channel [ 'channel_returned' ] = len ( data ) + ( self . page_limit * ( int ( pagenumber ) - 1 ) ) self . channel [ 'channel_startindex' ] = len ( data ) self . channel [ 'channel_numresults' ] = len ( data ) # Add the Channel element tree channelTree = self . common . mnvChannelElement ( self . channel ) rssTree . append ( channelTree ) for item in data : channelTree . append ( item ) # Output the MNV search results sys . stdout . write ( '<?xml version="1.0" encoding="UTF-8"?>\n' ) sys . stdout . write ( etree . tostring ( rssTree , encoding = 'UTF-8' , pretty_print = True ) ) sys . exit ( 0 )