0.24 Python bindings/Connection Handlers

From MythTV Official Wiki
Revision as of 20:43, 15 August 2010 by Wagnerrp (talk | contribs) (Frontend)

Jump to: navigation, search

Database Connections

MythDB

Command Inputs Returns Description
getStorageGroup
cursor
searchRecorded
searchOldRecorded
searchJobs
searchGuide
searchRecord
searchInternetContent
getFrontends
getFrontend
getRecorded
getChannels

MythVideo

Command Inputs Returns Description
getStorageGroup
cursor
scanStorageGroups
searchVideo
getVideo

MythMusic

MythVideo

Command Inputs Returns Description
getStorageGroup
cursor
searchMusic

MythProto Connections

MythBE

Command Inputs Returns Description
backendCommand command string result string This method sends a low level string to the backend, and returns the response.
getRecording chanid
starttime
None or Program object Returns information for a single recording
deleteRecording Program object
force=False (optional)
Informs the backend to delete the recording using whatever mechanism was selected
forgetRecording Program object Informs the backend to mark a recording as re-recordable
deleteFile relative path to file
storage group name
Delete a single managed file on the backend
getHash relative path to file
storage group name
hash string Calculate the hash value for a managed file
reschedule recordid=-1 (optional)
wait=False (optional)
Issue a scheduler run on all rules, or on one specific rule if other than '-1'. Will optionally wait for the scheduler to finish before returning.
fileExists relative path to file
sgroup='Default' (optional)
None or full path to file Searches storage groups on the backend for given file
download url DownloadFileTransfer object Starts a managed download on the backend to the Temp storage group, and returns a file object. The downloaded file will be automatically deleted when the file is closed.
downloadTo url
storage group
relative path to file
openfile=False (optional)
None or DownloadFileTransfer object (if openfile is True) Starts a managed download on the backend to the specified location. Optionally opens the new file for reading.
allocateEventLock regular expression EventLock object Opens a lock object that cannot be acquired until an event matching the regular expression has been received.
getPendingRecordings list of Program objects Returns a list of programs scheduled to be recorded
getScheduledRecordings list of Program objects Returns a list of programs scheduled to be recorded
getUpcomingRecordings list of Program objects Returns a list of programs scheduled to be recorded, filtered for only those that will be recorded
getConflictedRecordings list of Program objects Returns a list of programs scheduled to be recorded, filtered for only those with scheduling conflicts
getRecorderList list of integers Returns a list of defined card IDs
getFreeRecorderList list of integers Returns a list of available card IDs
lockTuner id=None (optional) (ID, video node, audio node, VBI node) or integer error Returns the information about the locked tuner, -1 if no tuners are available, or -2 if the optionally requested tuner is already locked.
freeTuner id=None (optional) Free all tuners currently locked by this connection, or one specific tuner. This is automatically run when the connection is closed.
getCurrentRecording recorder Program object Returns the program currently being recorded by the given ID.
isRecording recorder boolean Returns True or False whether the recorder is actively being used.
isActiveBackend hostname boolean Returns True or False whether the provided host is connected as a backend.
getRecordings list of Program objects Returns a list of existing recordings.
getExpiring list of Program objects Returns a list of existing recordings nearing expiration.
getCheckfile Program object path string Returns the path to the recording on the backend.
getFreeSpace all=False (optional) list of FreeSpace objects Returns information about the recording directories on the local or all backends.
getFreeSpaceSummary total and used space (in integer KB) Returns information about disk usage.
getLoad 1, 5, and 15 minute load averages
getUptime uptime in seconds
walkSG
getSGList
getSGFile
getLastGuideData string date of last guide data

BEEventMonitor

MythSystemEvent

Other Connections

MythXML

Command Inputs Returns Description
_queryObject
_query
_queryTree
getConnectionInfo
getServDesc
getHosts
getKeys
getSetting
getProgramGuide
getProgramDetails
getChannelIcon
getRecorded
getExpiring
getInternetSources

Frontend

Command Inputs Returns Description
getQuery list of 2-tuples, [(location string, description)] returns all available data queries from the backend
sendQuery query (string) response (string) sends a query to the backend, returning the unprocessed result
getPlay list of 2-tuples, [(playback command, description)] returns all available playback commands from the backend
sendPlay command (string) boolean sends a command to the backend, returning success or failure
play media (any object with _playOnFe method) boolean plays the given media object on the frontend, currently works with Recorded, Program, or Video
getLoad tuple returns the 1/5/15 load averages
getUptime timedelta returns the system uptime
getTime datetime returns the current system time
getMemory dict returns a dictionary of memory and swap usage in megabytes

jump

Frontend.jump is populated with an object intended for use sending jumppoints to the frontend. The '.list()' and '.dict()' methods return the available jumppoints, and jumps can be sent by accessing a jumppoint as an attribute or item. Returns True on successful jump.

>>> fe = Frontend.fromUPNP().next()
>>> fe.sendQuery('location')
'mainmenu'
>>> fe.jump.mythvideo
True
>>> fe.sendQuery('location')
'mythvideo'
>>> fe.jump['playbackrecordings']
True
>>> fe.sendQuery('location')
'playbackbox'

key

Frontend.key is populated with an object intended for use sending keypresses to the frontend. The '.list()' method returns a list of special keys allowed, in addition to any alphanumeric keys. Keypresses can be sent as an attribute or item, and accept both literal strings and ordinal scancodes. Returns True on success.

>>> fe = Frontend.fromUPNP().next()
>>> fe.key
['#', '$', '%', '&', '(', ')', ..... ,'tab', 'underscore', 'up', '|']
>>> fe.key.escape
True
>>> fe.key['enter']
True
>>> fe.key[68]
True