MythTV  master
Public Member Functions | Public Attributes | Private Member Functions | List of all members
nv_python_libs.youtube.youtube_api.Videos Class Reference
Inheritance diagram for nv_python_libs.youtube.youtube_api.Videos:
Inheritance graph
[legend]
Collaboration diagram for nv_python_libs.youtube.youtube_api.Videos:
Collaboration graph
[legend]

Public Member Functions

def __init__ (self, apikey, mythtv=True, interactive=False, select_first=False, debug=False, custom_ui=None, language=None, search_all_languages=False)
 
def getUserPreferences (self, userPreferenceFilePath)
 
def detectUserLocationByIP (self)
 Start - Utility functions. More...
 
def massageDescription (self, text)
 
def setTreeViewIcon (self, dir_icon=None)
 
def searchTitle (self, title, pagenumber, pagelen)
 End of Utility functions. More...
 
def getSearchResults (self, title, pagenumber, pagelen)
 
def getVideoDetails (self, ids)
 
def parseDetails (self, entry)
 
def searchForVideos (self, title, pagenumber)
 
def translateItem (self, item)
 
def displayTreeView (self)
 
def getVideoCategories (self)
 
def getVideosForCategory (self, categoryId, dictionaries)
 
def getVideosForURL (self, url, dictionaries)
 

Public Attributes

 config
 
 common
 
 mythxml
 
 log_name
 
 log
 
 error_messages
 
 key_translation
 
 apikey
 
 feed_icons
 
 treeview
 
 channel_icon
 
 userPrefs
 
 tree_dir_icon
 
 channel
 
 tree_key
 

Private Member Functions

def _initLogger (self)
 

Detailed Description

Main interface to http://www.youtube.com/
This is done to support a common naming framework for all python Netvision plugins no matter their site
target.

Supports search methods

Definition at line 71 of file youtube_api.py.

Constructor & Destructor Documentation

◆ __init__()

def nv_python_libs.youtube.youtube_api.Videos.__init__ (   self,
  apikey,
  mythtv = True,
  interactive = False,
  select_first = False,
  debug = False,
  custom_ui = None,
  language = None,
  search_all_languages = False 
)
apikey (str/unicode):
    Specify the target site API key. Applications need their own key in some cases

mythtv (True/False):
    When True, the returned meta data is being returned has the key and values massaged to match MythTV
    When False, the returned meta data  is being returned matches what target site returned

interactive (True/False): (This option is not supported by all target site apis)
    When True, uses built-in console UI is used to select the correct show.
    When False, the first search result is used.

select_first (True/False): (This option is not supported currently implemented in any grabbers)
    Automatically selects the first series search result (rather
    than showing the user a list of more than one series).
    Is overridden by interactive = False, or specifying a custom_ui

debug (True/False):
     shows verbose debugging information

custom_ui (xx_ui.BaseUI subclass): (This option is not supported currently implemented in any grabbers)
    A callable subclass of interactive class (overrides interactive option)

language (2 character language abbreviation): (This option is not supported by all target site apis)
    The language of the returned data. Is also the language search
    uses. Default is "en" (English). For full list, run..

search_all_languages (True/False): (This option is not supported by all target site apis)
    By default, a Netvision grabber will only search in the language specified using
    the language option. When this is True, it will search for the
    show in any language

Definition at line 78 of file youtube_api.py.

Member Function Documentation

◆ getUserPreferences()

def nv_python_libs.youtube.youtube_api.Videos.getUserPreferences (   self,
  userPreferenceFilePath 
)

Definition at line 208 of file youtube_api.py.

◆ detectUserLocationByIP()

def nv_python_libs.youtube.youtube_api.Videos.detectUserLocationByIP (   self)

Start - Utility functions.

Get longitude and latitiude to find videos relative to your location. Up to three different
servers will be tried before giving up.
return a dictionary e.g.
{'Latitude': '43.6667', 'Country': 'Canada', 'Longitude': '-79.4167', 'City': 'Toronto'}
return an empty dictionary if there were any errors
Code found at: http://blog.suinova.com/2009/04/from-ip-to-geolocation-country-city.html

Definition at line 239 of file youtube_api.py.

◆ massageDescription()

def nv_python_libs.youtube.youtube_api.Videos.massageDescription (   self,
  text 
)
Removes HTML markup from a text string.
@param text The HTML source.
@return The plain text.  If the HTML source contains non-ASCII
entities or character references, this is a Unicode string.

Definition at line 299 of file youtube_api.py.

Referenced by nv_python_libs.youtube.youtube_api.Videos.getVideosForURL(), and nv_python_libs.youtube.youtube_api.Videos.parseDetails().

◆ _initLogger()

def nv_python_libs.youtube.youtube_api.Videos._initLogger (   self)
private
Setups a logger using the logging module, returns a log object

Definition at line 332 of file youtube_api.py.

◆ setTreeViewIcon()

def nv_python_libs.youtube.youtube_api.Videos.setTreeViewIcon (   self,
  dir_icon = None 
)
Check if there is a specific generic tree view icon. If not default to the channel icon.
return self.tree_dir_icon

Definition at line 350 of file youtube_api.py.

Referenced by nv_python_libs.youtube.youtube_api.Videos.getVideosForURL().

◆ searchTitle()

def nv_python_libs.youtube.youtube_api.Videos.searchTitle (   self,
  title,
  pagenumber,
  pagelen 
)

End of Utility functions.

Key word video search of the YouTube web site
return an array of matching item dictionaries
return

Definition at line 372 of file youtube_api.py.

◆ getSearchResults()

def nv_python_libs.youtube.youtube_api.Videos.getSearchResults (   self,
  title,
  pagenumber,
  pagelen 
)

◆ getVideoDetails()

def nv_python_libs.youtube.youtube_api.Videos.getVideoDetails (   self,
  ids 
)

◆ parseDetails()

def nv_python_libs.youtube.youtube_api.Videos.parseDetails (   self,
  entry 
)

◆ searchForVideos()

def nv_python_libs.youtube.youtube_api.Videos.searchForVideos (   self,
  title,
  pagenumber 
)
Common name for a video search. Used to interface with MythTV plugin NetVision

Definition at line 468 of file youtube_api.py.

◆ translateItem()

def nv_python_libs.youtube.youtube_api.Videos.translateItem (   self,
  item 
)

◆ displayTreeView()

def nv_python_libs.youtube.youtube_api.Videos.displayTreeView (   self)
Gather the Youtube categories/feeds/...etc then get a max page of videos meta data in each of them
return array of directories and their video metadata

Definition at line 525 of file youtube_api.py.

◆ getVideoCategories()

def nv_python_libs.youtube.youtube_api.Videos.getVideoCategories (   self)

◆ getVideosForCategory()

def nv_python_libs.youtube.youtube_api.Videos.getVideosForCategory (   self,
  categoryId,
  dictionaries 
)
Parse a list made of category lists and retrieve video meta data
return a dictionary of directory names and categories video metadata

Definition at line 567 of file youtube_api.py.

◆ getVideosForURL()

def nv_python_libs.youtube.youtube_api.Videos.getVideosForURL (   self,
  url,
  dictionaries 
)
Get the video metadata for url search
return the video dictionary of directories and their video mata data

Definition at line 581 of file youtube_api.py.

Referenced by nv_python_libs.youtube.youtube_api.Videos.getVideosForCategory().

Member Data Documentation

◆ config

nv_python_libs.youtube.youtube_api.Videos.config

◆ common

nv_python_libs.youtube.youtube_api.Videos.common

◆ mythxml

nv_python_libs.youtube.youtube_api.Videos.mythxml

◆ log_name

nv_python_libs.youtube.youtube_api.Videos.log_name

◆ log

nv_python_libs.youtube.youtube_api.Videos.log

Definition at line 118 of file youtube_api.py.

◆ error_messages

nv_python_libs.youtube.youtube_api.Videos.error_messages

◆ key_translation

nv_python_libs.youtube.youtube_api.Videos.key_translation

◆ apikey

nv_python_libs.youtube.youtube_api.Videos.apikey

◆ feed_icons

nv_python_libs.youtube.youtube_api.Videos.feed_icons

Definition at line 177 of file youtube_api.py.

◆ treeview

nv_python_libs.youtube.youtube_api.Videos.treeview

Definition at line 195 of file youtube_api.py.

◆ channel_icon

nv_python_libs.youtube.youtube_api.Videos.channel_icon

Definition at line 196 of file youtube_api.py.

◆ userPrefs

nv_python_libs.youtube.youtube_api.Videos.userPrefs

Definition at line 229 of file youtube_api.py.

◆ tree_dir_icon

nv_python_libs.youtube.youtube_api.Videos.tree_dir_icon

Definition at line 354 of file youtube_api.py.

◆ channel

nv_python_libs.youtube.youtube_api.Videos.channel

◆ tree_key

nv_python_libs.youtube.youtube_api.Videos.tree_key

The documentation for this class was generated from the following file: