This page is for classes intended for use calling external functions and programs.
System
This class is the base handler for external calls. The class is designed to take function paths from an entry in the settings table, but direct paths can be provided instead.
__init__
Inputs
|
Outputs
|
Description
|
path=None setting=None db=None
|
self
|
Must be provided either the name of a setting, or the absolute path to an executable. If both are given, the database setting will take precedence if defined.
|
Example:
>>> s = System(path='echo')
>>> s.path
'echo'
|
append
Inputs
|
Outputs
|
Description
|
*args
|
n/a
|
Append one or more strings to the command permanently. Useful if a command is to be used repeatedly.
|
Example:
>>> s.append('some appended','"string"')
>>> s.path
'echo some appended "string"'
|
command
Inputs
|
Outputs
|
Description
|
*args
|
result
|
Apply additional string arguments to command, and return the terminal output as a string. If the command exits with a code not equal to zero, this will raise an exception, with returncode and stderr attributes populated for inspection.
|
Example:
>>> s.command('some string')
'some appended string some string\n'
>>> s.command('another','string')
'some appended string another string\n'
|
Grabber
This class is a modified System class, following the MythTV Universal Metadata Format. This class cannot be called directly, but must be subclassed, with a 'cls' attribute defined as a result handler.
search
Inputs
|
Outputs
|
Description
|
phrase subtitle=None tolerance=None func=None
|
iterable of Metadata
|
Performs a phrase or title/subtitle search. Accepts a tolerance for filtering based off the difference between the result and the search. Accepts a func to calculate the distance for filtering.
|
|
sortedSearch
Inputs
|
Outputs
|
Description
|
phrase subtitle=None tolerance=None
|
list of Metadata
|
Operates as search, but sorts based off search distance.
|
|
grabInetref
Inputs
|
Outputs
|
Description
|
inetref season=None episode=None
|
Metadata object
|
Returns a single metadata object matching the inetref and optional season and episode.
|
|
VideoGrabber
This class is a modified Grabber class, with pre-defined setting names for use with MythVideo.
__init__
Inputs
|
Outputs
|
Description
|
mode lang='en' db=None
|
self
|
mode can be either TV or Movie, using the grabbers defined by MythVideo.
|
Example:
>>> grab = VideoGrabber('TV')
>>> grab.search('Better Off Ted', 'Heroes')
<generator object search at 0x804f1e1e0>
>>> grab.search('Better Off Ted', 'Heroes').next()
{'subtitle': 'Heroes', 'revenue': None, ... 'trailer': None}
>>> grab.grabInetref(84021, 1, 2).next()
{'subtitle': 'Heroes', 'revenue': None, ... 'trailer': None}
|
InternetSource
The class does not call external executables directly, but accesses data from them being run on the backend over MythXML. This class should not be run directly, but instead retrieved through MythXML.getInternetSources().
searchContent
Inputs
|
Outputs
|
Description
|
query page=1
|
iterable of Metadata
|
Performs a search, returning an iterable of InternetMetadata objects.
|
Example:
>>> igrab = xml.getInternetSources().next()
>>> igrab.searchContent('Top Gear')
<generator object searchContent at 0x804f1e410>
>>> igrab.searchContent('Top Gear').next()
{'description': "Jeremy Clarkson asks why there aren't more three-wheeled cars in the world. (R)", ... 'length': None}
|
SystemEvent
This class is a modified System class for handling system events received from the backend. This class is only to be called automatically by MythSystemEvent, in order to run the executable defined in the database, and should not be called directly.