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

From MythTV Official Wiki
Jump to: navigation, search
(Created page with 'The basic data object supplied by the Python bindings is designed to operate as a dictionary or as a class with attributes. <pre> >>> prog = be.getRecordings()[0] >>> prog.keys()…')
 
m (add some cleaner tags)
Line 13: Line 13:
 
</pre>
 
</pre>
 
=Data Only objects=
 
=Data Only objects=
These objects are read only, and populated by data from the backend.  
+
These objects are read only, and populated by data from the backend.
 +
<span id="Program" />
 
==Program(raw)==
 
==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'.
 
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'.
Line 24: Line 25:
 
===open(type='r')===
 
===open(type='r')===
 
Returns a file object, defaults to read access.
 
Returns a file object, defaults to read access.
 +
<span id="FreeSpace" />
 
==FreeSpace(raw)==
 
==FreeSpace(raw)==
 
=Read Only Database objects=
 
=Read Only Database objects=
 +
<span id="StorageGroup" />
 
==StorageGroup(id=None, db=None, raw=None)==
 
==StorageGroup(id=None, db=None, raw=None)==
 +
<span id="Guide" />
 
==Guide(data=None, db=None, raw=None)==
 
==Guide(data=None, db=None, raw=None)==
 
=Read-Write Database objects=
 
=Read-Write Database objects=
 +
<span id="Job" />
 
==Job(id=None, chanid=None, starttime=None, db=None, raw=None)==
 
==Job(id=None, chanid=None, starttime=None, db=None, raw=None)==
 +
<span id="Channel" />
 
==Channel(chanid=None, db=None, raw=None)==
 
==Channel(chanid=None, db=None, raw=None)==
 +
<span id="Video" />
 
==Video(id=None, db=None, raw=None)==
 
==Video(id=None, db=None, raw=None)==
 +
<span id="Recorded" />
 
==Recorded(data=None, db=None, raw=None)==
 
==Recorded(data=None, db=None, raw=None)==
 +
<span id="RecordedProgram" />
 
==RecordedProgram(data=None, db=None, raw=None)==
 
==RecordedProgram(data=None, db=None, raw=None)==
 +
<span id="OldRecorded" />
 
==OldRecorded(data=None, db=None, raw=None)==
 
==OldRecorded(data=None, db=None, raw=None)==

Revision as of 19:08, 30 January 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. <span id="Program" />

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. <span id="FreeSpace" />

FreeSpace(raw)

Read Only Database objects

<span id="StorageGroup" />

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

<span id="Guide" />

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

Read-Write Database objects

<span id="Job" />

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

<span id="Channel" />

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

<span id="Video" />

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

<span id="Recorded" />

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

<span id="RecordedProgram" />

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

<span id="OldRecorded" />

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