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

From MythTV Official Wiki
Jump to: navigation, search
m (add some cleaner tags)
m
Line 14: Line 14:
 
=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" />
+
<span id="Program"></span>
 
==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 25: 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" />
+
<span id="FreeSpace"></span>
 
==FreeSpace(raw)==
 
==FreeSpace(raw)==
 
=Read Only Database objects=
 
=Read Only Database objects=
<span id="StorageGroup" />
+
<span id="StorageGroup"></span>
 
==StorageGroup(id=None, db=None, raw=None)==
 
==StorageGroup(id=None, db=None, raw=None)==
<span id="Guide" />
+
<span id="Guide"></span>
 
==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" />
+
<span id="Job"></span>
 
==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" />
+
<span id="Channel"></span>
 
==Channel(chanid=None, db=None, raw=None)==
 
==Channel(chanid=None, db=None, raw=None)==
<span id="Video" />
+
<span id="Video"></span>
 
==Video(id=None, db=None, raw=None)==
 
==Video(id=None, db=None, raw=None)==
<span id="Recorded" />
+
<span id="Recorded"></span>
 
==Recorded(data=None, db=None, raw=None)==
 
==Recorded(data=None, db=None, raw=None)==
<span id="RecordedProgram" />
+
<span id="RecordedProgram"></span>
 
==RecordedProgram(data=None, db=None, raw=None)==
 
==RecordedProgram(data=None, db=None, raw=None)==
<span id="OldRecorded" />
+
<span id="OldRecorded"></span>
 
==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.

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)