Difference between revisions of "0.23 Python bindings/Data Objects"

From MythTV Official Wiki
Jump to: navigation, search
m
m (Add category (Python))
Line 45: Line 45:
 
<span id="OldRecorded"></span>
 
<span id="OldRecorded"></span>
 
==OldRecorded(data=None, db=None, raw=None)==
 
==OldRecorded(data=None, db=None, raw=None)==
 +
 +
 +
 +
[[Category:Python]]

Revision as of 20:54, 1 February 2010

The basic data object supplied by the Python bindings is designed to operate as a dictionary or as a class with attributes.

>>> prog = be.getRecordings()[0]
>>> prog.keys()
['title', 'subtitle', 'description', 'category', 'chanid', 'channum', 'callsign', 'channame', 'filename', 'fs_high', 'fs_low', 'starttime', 'endtime', 'duplicate', 'shareable', 'findid', 'hostname', 'sourceid', 'cardid', 'inputid', 'recpriority', 'recstatus', 'recordid', 'rectype', 'dupin', 'dupmethod', 'recstartts', 'recendts', 'repeat', 'programflags', 'recgroup', 'commfree', 'outputfilters', 'seriesid', 'programid', 'lastmodified', 'stars', 'airdate', 'hasairdate', 'playgroup', 'recpriority2', 'parentid', 'storagegroup', 'audio_props', 'video_props', 'subtitle_type', 'year']
>>> prog.title
u'Psych'
>>> prog['channame']
u'USA Network'
>>> a = prog.iteritems()
>>> a.next()
('title', u'Psych')

Data Only objects

These objects are read only, and populated by data from the backend.

Program(raw)

This class is the standard Program Info structure used by the backend protocol. It provides the following fields: title, subtitle, description, category, chanid, channum, callsign, channame, filename, fs_high, fs_low, starttime, endtime, duplicate, shareable, findid, hostname, sourceid, cardid, inputid, recpriority, recstatus, recordid, rectype, dupin, dupmethod, recstartts, recendts, repeat, programflags, recgroup, commfree, outputfilters, seriesid, programid, lastmodified, stars, airdate, hasairdate, playgroup, recpriority2, parentid, storagegroup, audio_props, video_props, subtitle_type, year. Additionally, the 'filesize' attribute is is calculated from 'fs_high' and 'fs_low'.

toString()

Produces a string representation of the data, for use with backend protocol commands.

delete(force=False, rerecord=False)

Issues a protocol command to tell the backend to delete the recording. 'force' will force the delete even if the backend could not find the file. 'rerecord' informs the scheduler to allow the show to be recorded again.

getRecorded()

Returns a matching Recorded object.

open(type='r')

Returns a file object, defaults to read access.

FreeSpace(raw)

Read Only Database objects

StorageGroup(id=None, db=None, raw=None)

Guide(data=None, db=None, raw=None)

Read-Write Database objects

Job(id=None, chanid=None, starttime=None, db=None, raw=None)

Channel(chanid=None, db=None, raw=None)

Video(id=None, db=None, raw=None)

Recorded(data=None, db=None, raw=None)

RecordedProgram(data=None, db=None, raw=None)

OldRecorded(data=None, db=None, raw=None)