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

From MythTV Official Wiki
Jump to: navigation, search
m
 
(21 intermediate revisions by 3 users not shown)
Line 16: Line 16:
 
<span id="Program"></span>
 
<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 [[ProgramInfo_(Myth_Protocol)|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()===
 
===toString()===
 
Produces a string representation of the data, for use with backend protocol commands.
 
Produces a string representation of the data, for use with backend protocol commands.
Line 22: Line 22:
 
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.
 
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()===
 
===getRecorded()===
Returns a matching Recorded object.
+
Returns a matching [[Python_bindings/Data_Objects#Recorded.28data.3DNone.2C_db.3DNone.2C_raw.3DNone.29|Recorded]] object.
 
===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>
 
<span id="FreeSpace"></span>
 +
 +
===created by===
 +
This type of object is returned by the following methods:
 +
* [[Python_bindings#getPendingRecordings.28.29|MythBE.getPendingRecordings]]
 +
* [[Python_bindings#getScheduledRecordings.28.29|MythBE.getScheduledRecordings]]
 +
* [[Python_bindings#getUpcomingRecordings.28.29|MythBE.getUpcomingRecordings]]
 +
* [[Python_bindings#getCurrentRecording.28recorder.29|MythBE.getCurrentRecording]]
 +
* [[Python_bindings#getRecording.28chanid.2C_starttime.29|MythBE.getRecording]]
 +
* [[Python_bindings#getRecordings.28.29|MythBE.getRecordings]]
 +
* [[Python_bindings#getProgramDetails.28chanid.2C_starttime.29|MythXML.getProgramDetails]]
 +
* [[Python_bindings#getRecorded.28descending.3DTrue.29|MythXML.getRecorded]]
 +
* [[Python_bindings#getExpiring.28.29_2|MythXML.getExpiring]]
 +
* [[Python_bindings/Data_Objects#Recorded.28data.3DNone.2C_db.3DNone.2C_raw.3DNone.29|Recorded.getProgram]]
 +
 
==FreeSpace(raw)==
 
==FreeSpace(raw)==
 +
This class provides basic statistics for a storage group folder.  It provides the following fields: host, path, islocal, disknumber, sgroupid, blocksize, ts_high, ts_low, us_high, us_low.  Additionally, the following attributes are calculated: totalspace, freespace, usedspace
 +
<pre>
 +
>>> be.getFreeSpace()
 +
>>> fs = be.getFreeSpace()
 +
>>> fs
 +
[<FreeSpace '/mnt/mythtv/fserve_1/video@mythbe' at 0x803952e50>, <FreeSpace '/mnt/mythtv/fserve_2/video@mythbe' at 0x803952c50>, <FreeSpace '/mnt/mythtv/fserve_3/video@mythbe' at 0x803952ed0>]
 +
>>> fs[0].items()
 +
[('host', u'mythbe'), ('path', u'/mnt/mythtv/fserve_1/video'), ('islocal', True), ('disknumber', -1), ('sgroupid', 35), ('blocksize', 32768), ('ts_high', 0), ('ts_low', 286948096), ('us_high', 0), ('us_low', 203925376)]
 +
>>> fs[0].totalspace
 +
286948096
 +
>>> fs[0].freespace
 +
83022720
 +
</pre>
 +
===created by===
 +
* [[Python_bindings#getFreeSpace.28all.3DFalse.29|MythBE.getFreeSpace]]
 
=Read Only Database objects=
 
=Read Only Database objects=
 +
These classes correspond to one entry in a specific database table. The provided data fields will match those in the database. These classes provide a 'getAllEntries()' method which returns a list of all such objects in the database.
 +
<pre>
 +
>>> StorageGroup().getAllEntries()
 +
[<StorageGroup 'myth://Default@fserve/mnt/mythtv/fserve_1/video/' at 0x803c8fe90>, <StorageGroup 'myth://Default@fserve/mnt/mythtv/fserve_3/video/' at 0x803c94090>]
 +
</pre>
 
<span id="StorageGroup"></span>
 
<span id="StorageGroup"></span>
 
==StorageGroup(id=None, db=None, raw=None)==
 
==StorageGroup(id=None, db=None, raw=None)==
 +
This class provides information from the storagegroup database table. In addition to the database information, a boolean 'local' attribute specifies whether a storage group folder is accessible on the local machine.
 +
<pre>
 +
>>> db = MythDB()
 +
>>> sg = db.getStorageGroup()[0]
 +
>>> sg
 +
<StorageGroup 'myth://Videos@mythbe.wagnerrp.com/mnt/mythtv/store/media/video/' at 0x803dad810>
 +
>>> sg.id
 +
5L
 +
>>> sg.local
 +
False
 +
</pre>
 +
===created by===
 +
* [[Python_bindings#getStorageGroup.28groupname.3DNone.2C_hostname.3DNone.29|MythDB.getStorageGroup]]
 
<span id="Guide"></span>
 
<span id="Guide"></span>
 
==Guide(data=None, db=None, raw=None)==
 
==Guide(data=None, db=None, raw=None)==
 +
This class provides information for a show listing in the program guide.
 +
 +
<pre>
 +
>>> shows = db.searchGuide(title='24')
 +
>>> for x in shows[0].items():
 +
...  print x
 +
...
 +
(u'chanid', 1702L)
 +
(u'starttime', datetime.datetime(2010, 3, 29, 21, 0))
 +
(u'endtime', datetime.datetime(2010, 3, 29, 22, 0))
 +
(u'title', u'24')
 +
(u'subtitle', u'Day 8: 5:00AM- 6:00AM')
 +
(u'description', u'As the threat of mass destruction clarifies, President Taylor tasks Jack with a crucial mission.')
 +
(u'category', u'Crime drama')
 +
(u'category_type', u'series')
 +
(u'airdate', 0)
 +
(u'stars', 0.0)
 +
(u'previouslyshown', 0)
 +
(u'title_pronounce', None)
 +
(u'stereo', 1)
 +
(u'subtitled', 0)
 +
(u'hdtv', 1)
 +
(u'closecaptioned', 1)
 +
(u'partnumber', 0L)
 +
(u'parttotal', 0L)
 +
(u'seriesid', u'EP00446604')
 +
(u'originalairdate', datetime.date(2010, 3, 29))
 +
(u'showtype', u'Series')
 +
(u'colorcode', None)
 +
(u'syndicatedepisodenumber', u'814')
 +
(u'programid', u'EP004466040201')
 +
(u'manualid', 0L)
 +
(u'generic', 0)
 +
(u'listingsource', 2L)
 +
(u'first', 1)
 +
(u'last', 1)
 +
(u'audioprop', u'STEREO,DOLBY')
 +
(u'subtitletypes', u'HARDHEAR')
 +
(u'videoprop', u'HDTV')
 +
</pre>
 +
 +
 +
===record(type=kAllRecord)===
 +
Return a new Record object for a recording rule, using the optional record type.
 +
 +
Other types include:
 +
 +
<pre>
 +
    Record.kNotRecording
 +
    Record.kSingleRecord
 +
    Record.kTimeslotRecord
 +
    Record.kChannelRecord
 +
    Record.kAllRecord
 +
    Record.kWeekslotRecord
 +
    Record.kFindOneRecord
 +
    Record.kOverrideRecord
 +
    Record.kDontRecord
 +
    Record.kFindDailyRecord
 +
    Record.kFindWeeklyRecord
 +
</pre>
 +
 +
===created by===
 +
* [[Python_bindings#searchGuide.28.2A.2Akwargs.29|MythDB.searchGuide]]
 +
* [[Python_bindings#getProgramGuide.28starttime.2C_enddime.2C_startchan.3DNone.2C_numchan.3DNone.29|MythXML.getProgramGuide]]
 +
 
=Read-Write Database objects=
 
=Read-Write Database objects=
 +
These classes provide write capacity to certain database tables. Included beyond the read-only types are methods 'create()', 'update()', and 'delete()'. Create only works on an object with no 'wheredat' attribute set, while update and delete only work with the attribute set. Create takes an optional dictionary for additional information, returning the new row id. Update follows standard dict.update() syntax. All updates to the database will be sanitized, preventing certain fields from being written, and providing default values for others.
 
<span id="Job"></span>
 
<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)==
 +
This class provides an two ways to initialize an object; either define the jobid, or define both chanid and starttime.
 +
<pre>
 +
>>> Job(3780)
 +
<Job '3780' at 0x803da9cd0>
 +
>>> Job(chanid=2069, starttime=20100309220000)
 +
<Job '3780' at 0x803dd5450>
 +
>>> Job(None, 2069, 20100309220000)
 +
<Job '3780' at 0x803da9cd0>
 +
</pre>
 +
 +
===setComment(comment)===
 +
Shortcut to updating the comment string for an existing job. Allows in-progress messages and persistent exit messages to be set.
 +
 +
===setStatus(status)===
 +
Shortcut to updating the status value.
 +
 +
===created by===
 +
* [[Python_bindings#searchJobs.28.2A.2Akwargs.29|MythDB.searchJobs]]
 
<span id="Channel"></span>
 
<span id="Channel"></span>
 +
 
==Channel(chanid=None, db=None, raw=None)==
 
==Channel(chanid=None, db=None, raw=None)==
 +
Channel takes a single chanid as an argument.
 +
<pre>
 +
>>> Channel(4091)
 +
<Channel '4091','WCPO-DT' at 0x803e44110>
 +
 +
>>> for x in Channel('1702').items():
 +
...  print x
 +
...
 +
(u'chanid', 1702L)
 +
(u'channum', u'702')
 +
(u'freqid', u'702')
 +
(u'sourceid', 1L)
 +
(u'callsign', u'KTVUDT')
 +
(u'name', u'KTVUDT (KTVU-DT)')
 +
(u'icon', u'/home/dougt/.mythtv/channels/ktvu_fox2_oakland.jpg')
 +
(u'finetune', None)
 +
(u'videofilters', None)
 +
(u'xmltvid', u'19571')
 +
(u'recpriority', 0L)
 +
(u'contrast', 32768L)
 +
(u'brightness', 32768L)
 +
(u'colour', 32768L)
 +
(u'hue', 32768L)
 +
(u'tvformat', u'Default')
 +
(u'visible', 1)
 +
(u'outputfilters', None)
 +
(u'useonairguide', 0)
 +
(u'mplexid', 32767)
 +
(u'serviceid', 0)
 +
(u'tmoffset', 0L)
 +
(u'atsc_major_chan', 702L)
 +
(u'atsc_minor_chan', 0L)
 +
(u'last_record', datetime.datetime(2010, 3, 28, 21, 10, 9))
 +
(u'default_authority', None)
 +
(u'commmethod', -1L)
 +
 +
</pre>
 +
===created by===
 +
* [[Python_bindings#getChannels.28.29|MythDB.getChannels]]
 
<span id="Video"></span>
 
<span id="Video"></span>
 +
 
==Video(id=None, db=None, raw=None)==
 
==Video(id=None, db=None, raw=None)==
 +
Video takes a single intid as an input. The 'category' is handled specially, and the user is provided only the string value. Translation between the integer value in the database, and referencing to the 'videocategory' table is handled in the background. A value of 0 is mapped to 'None'.
 +
<pre>
 +
>>> Video(684)
 +
<Video 'The 'Burbs' at 0x803e44110>
 +
</pre>
 +
 +
===cast, genre, and country===
 +
These attributes are handlers for their respective lookup tables, and are handled in the background for the user. Provided for each are 'add', 'delete', and 'clean' methods.
 +
<pre>
 +
>>> vid = Video(684)
 +
>>> vid.cast
 +
Tom Hanks, Bruce Dern, Carrie Fisher, Cory Danziger
 +
>>> vid.genre
 +
Comedy
 +
>>> vid.country
 +
United States of America
 +
>>> vid.cast.delete('Tom Hanks')
 +
>>> vid.cast
 +
Bruce Dern, Carrie Fisher, Cory Danziger
 +
>>> vid.cast.add('Tom Hanks')
 +
>>> vid.cast
 +
Bruce Dern, Carrie Fisher, Cory Danziger, Tom Hanks
 +
</pre>
 +
 +
===open(mode='r')===
 +
===openBanner(mode='r')===
 +
===openCoverart(mode='r')===
 +
===openFanart(mode='r')===
 +
===openScreenshot(mode='r')===
 +
===openTrailer(mode='r')===
 +
Opens file socket to content. Tries to find locally, and failing to do so, opens a remote FileTransfer socket. This will only work for Storage Group content.
 +
 +
===getHash()===
 +
Returns the file hash computed by the backend.
 +
 +
===fromFilename(filename)===
 +
Pulls any possible information from the given information, and returns copy of self. Behaves as [[MythVideo_File_Parsing]].
 +
 +
===created by===
 +
* [[Python_bindings#searchVideos.28.2A.2Akwargs.29|MythVideo.searchVideos]]
 +
* [[Python_bindings#getVideo.28.2A.2Akwargs.29|MythVideo.getVideo]]
 +
<span id="Record"></span>
 +
 +
==Record(id=None, db=None, raw=None)==
 +
Record handles creating and modification of new recording rules.
 +
===created by===
 +
* [[Python_bindings#searchRecord.28.2A.2Akwargs.29|MythDB.searchRecord]]
 
<span id="Recorded"></span>
 
<span id="Recorded"></span>
 +
 
==Recorded(data=None, db=None, raw=None)==
 
==Recorded(data=None, db=None, raw=None)==
 +
Recorded handles a single recorded program, and takes a tuple of (chanid, starttime) for initialization.
 +
<pre>
 +
>>> Recorded((4121,20100112200000))
 +
<Recorded 'NCIS','2010-01-12 20:00:00' at 0x803e4ee50>
 +
</pre>
 +
===cast===
 +
The 'cast' attribute is a special handler for the people lookup table.
 +
<pre>
 +
>>> rec = Recorded((4121,20100112200000))
 +
>>> rec.cast
 +
David McCallum, Michael Weatherly, Rocky Carroll, Donald P. Bellisario, Frank Cardea, George Schenck, John O'Brien, Mark Harmon, Pauley Perrette, Robert Wagner, Brian Dietzen, Cote De Pablo, Mark Ankeny, Sean Murray, Arvin Brown, Joe Lando, Amir Arison, Penny Johnson Jerald, Mido Hamada, Adam Conger, Alon Aboutboul, Lauren Shiohama, Samantha Sergeant, Yan Feldman
 +
>>> rec.cast[0].name
 +
'David McCallum'
 +
>>> rec.cast[0].role
 +
u'actor'
 +
</pre>
 +
===seek, markup===
 +
The 'seek' and 'markup' attributes are special handlers for video timebase information.
 +
===getProgram()===
 +
Returns a Program object.
 +
===getRecordedProgram===
 +
Returns a RecordedProgram object.
 +
===formatPath(path, replace=None)===
 +
Returns a formatted path, as described by the 'path' string. Follows 'mythlink.pl' formatting.
 +
<pre>
 +
>>> rec.formatPath('%T/(%oY%-%om%-%od) %S')
 +
u'NCIS/(2010-01-12) Flesh and Blood.mpg'
 +
</pre>
 +
===created by===
 +
* [[Python_bindings#searchRecorded.28.2A.2Akwargs.29|MythDB.searchRecorded]]
 +
* [[Python_bindings/Data_Objects#getRecorded.28.29|Program.getRecorded]]
 
<span id="RecordedProgram"></span>
 
<span id="RecordedProgram"></span>
 +
 
==RecordedProgram(data=None, db=None, raw=None)==
 
==RecordedProgram(data=None, db=None, raw=None)==
 +
Holds auxiliary data not contained with in the Recorded object.
 +
===created by===
 +
* [[Python_bindings/Data_Objects#Recorded.28data.3DNone.2C_db.3DNone.2C_raw.3DNone.29|Recorded.getRecordedProgram]]]]
 
<span id="OldRecorded"></span>
 
<span id="OldRecorded"></span>
 
==OldRecorded(data=None, db=None, raw=None)==
 
==OldRecorded(data=None, db=None, raw=None)==
 +
Manages entries in the oldrecorded table. New entries can be created, but 'update()' and 'delete()' are disabled. The only value the user has control over after creation is the duplicate bit, through 'setDuplicate(record=False)'.
 +
===created by===
 +
* [[Python_bindings#searchOldRecorded.28.2A.2Akwargs.29|MythDB.searchOldRecorded]]
 +
 +
[[Category:0.23 Python Bindings]]

Latest revision as of 13:15, 20 July 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.

created by

This type of object is returned by the following methods:

FreeSpace(raw)

This class provides basic statistics for a storage group folder. It provides the following fields: host, path, islocal, disknumber, sgroupid, blocksize, ts_high, ts_low, us_high, us_low. Additionally, the following attributes are calculated: totalspace, freespace, usedspace

>>> be.getFreeSpace()
>>> fs = be.getFreeSpace()
>>> fs
[<FreeSpace '/mnt/mythtv/fserve_1/video@mythbe' at 0x803952e50>, <FreeSpace '/mnt/mythtv/fserve_2/video@mythbe' at 0x803952c50>, <FreeSpace '/mnt/mythtv/fserve_3/video@mythbe' at 0x803952ed0>]
>>> fs[0].items()
[('host', u'mythbe'), ('path', u'/mnt/mythtv/fserve_1/video'), ('islocal', True), ('disknumber', -1), ('sgroupid', 35), ('blocksize', 32768), ('ts_high', 0), ('ts_low', 286948096), ('us_high', 0), ('us_low', 203925376)]
>>> fs[0].totalspace
286948096
>>> fs[0].freespace
83022720

created by

Read Only Database objects

These classes correspond to one entry in a specific database table. The provided data fields will match those in the database. These classes provide a 'getAllEntries()' method which returns a list of all such objects in the database.

>>> StorageGroup().getAllEntries()
[<StorageGroup 'myth://Default@fserve/mnt/mythtv/fserve_1/video/' at 0x803c8fe90>, <StorageGroup 'myth://Default@fserve/mnt/mythtv/fserve_3/video/' at 0x803c94090>]

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

This class provides information from the storagegroup database table. In addition to the database information, a boolean 'local' attribute specifies whether a storage group folder is accessible on the local machine.

>>> db = MythDB()
>>> sg = db.getStorageGroup()[0]
>>> sg
<StorageGroup 'myth://Videos@mythbe.wagnerrp.com/mnt/mythtv/store/media/video/' at 0x803dad810>
>>> sg.id
5L
>>> sg.local
False

created by

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

This class provides information for a show listing in the program guide.

>>> shows = db.searchGuide(title='24')
>>> for x in shows[0].items():
...   print x
... 
(u'chanid', 1702L)
(u'starttime', datetime.datetime(2010, 3, 29, 21, 0))
(u'endtime', datetime.datetime(2010, 3, 29, 22, 0))
(u'title', u'24')
(u'subtitle', u'Day 8: 5:00AM- 6:00AM')
(u'description', u'As the threat of mass destruction clarifies, President Taylor tasks Jack with a crucial mission.')
(u'category', u'Crime drama')
(u'category_type', u'series')
(u'airdate', 0)
(u'stars', 0.0)
(u'previouslyshown', 0)
(u'title_pronounce', None)
(u'stereo', 1)
(u'subtitled', 0)
(u'hdtv', 1)
(u'closecaptioned', 1)
(u'partnumber', 0L)
(u'parttotal', 0L)
(u'seriesid', u'EP00446604')
(u'originalairdate', datetime.date(2010, 3, 29))
(u'showtype', u'Series')
(u'colorcode', None)
(u'syndicatedepisodenumber', u'814')
(u'programid', u'EP004466040201')
(u'manualid', 0L)
(u'generic', 0)
(u'listingsource', 2L)
(u'first', 1)
(u'last', 1)
(u'audioprop', u'STEREO,DOLBY')
(u'subtitletypes', u'HARDHEAR')
(u'videoprop', u'HDTV')


record(type=kAllRecord)

Return a new Record object for a recording rule, using the optional record type.

Other types include:

    Record.kNotRecording
    Record.kSingleRecord
    Record.kTimeslotRecord
    Record.kChannelRecord
    Record.kAllRecord
    Record.kWeekslotRecord
    Record.kFindOneRecord
    Record.kOverrideRecord
    Record.kDontRecord
    Record.kFindDailyRecord
    Record.kFindWeeklyRecord

created by

Read-Write Database objects

These classes provide write capacity to certain database tables. Included beyond the read-only types are methods 'create()', 'update()', and 'delete()'. Create only works on an object with no 'wheredat' attribute set, while update and delete only work with the attribute set. Create takes an optional dictionary for additional information, returning the new row id. Update follows standard dict.update() syntax. All updates to the database will be sanitized, preventing certain fields from being written, and providing default values for others.

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

This class provides an two ways to initialize an object; either define the jobid, or define both chanid and starttime.

>>> Job(3780)
<Job '3780' at 0x803da9cd0>
>>> Job(chanid=2069, starttime=20100309220000)
<Job '3780' at 0x803dd5450>
>>> Job(None, 2069, 20100309220000)
<Job '3780' at 0x803da9cd0>

setComment(comment)

Shortcut to updating the comment string for an existing job. Allows in-progress messages and persistent exit messages to be set.

setStatus(status)

Shortcut to updating the status value.

created by

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

Channel takes a single chanid as an argument.

>>> Channel(4091)
<Channel '4091','WCPO-DT' at 0x803e44110>

>>> for x in Channel('1702').items():
...   print x
... 
(u'chanid', 1702L)
(u'channum', u'702')
(u'freqid', u'702')
(u'sourceid', 1L)
(u'callsign', u'KTVUDT')
(u'name', u'KTVUDT (KTVU-DT)')
(u'icon', u'/home/dougt/.mythtv/channels/ktvu_fox2_oakland.jpg')
(u'finetune', None)
(u'videofilters', None)
(u'xmltvid', u'19571')
(u'recpriority', 0L)
(u'contrast', 32768L)
(u'brightness', 32768L)
(u'colour', 32768L)
(u'hue', 32768L)
(u'tvformat', u'Default')
(u'visible', 1)
(u'outputfilters', None)
(u'useonairguide', 0)
(u'mplexid', 32767)
(u'serviceid', 0)
(u'tmoffset', 0L)
(u'atsc_major_chan', 702L)
(u'atsc_minor_chan', 0L)
(u'last_record', datetime.datetime(2010, 3, 28, 21, 10, 9))
(u'default_authority', None)
(u'commmethod', -1L)

created by

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

Video takes a single intid as an input. The 'category' is handled specially, and the user is provided only the string value. Translation between the integer value in the database, and referencing to the 'videocategory' table is handled in the background. A value of 0 is mapped to 'None'.

>>> Video(684)
<Video 'The 'Burbs' at 0x803e44110>

cast, genre, and country

These attributes are handlers for their respective lookup tables, and are handled in the background for the user. Provided for each are 'add', 'delete', and 'clean' methods.

>>> vid = Video(684)
>>> vid.cast
Tom Hanks, Bruce Dern, Carrie Fisher, Cory Danziger
>>> vid.genre
Comedy
>>> vid.country
United States of America
>>> vid.cast.delete('Tom Hanks')
>>> vid.cast
Bruce Dern, Carrie Fisher, Cory Danziger
>>> vid.cast.add('Tom Hanks')
>>> vid.cast
Bruce Dern, Carrie Fisher, Cory Danziger, Tom Hanks

open(mode='r')

openBanner(mode='r')

openCoverart(mode='r')

openFanart(mode='r')

openScreenshot(mode='r')

openTrailer(mode='r')

Opens file socket to content. Tries to find locally, and failing to do so, opens a remote FileTransfer socket. This will only work for Storage Group content.

getHash()

Returns the file hash computed by the backend.

fromFilename(filename)

Pulls any possible information from the given information, and returns copy of self. Behaves as MythVideo_File_Parsing.

created by

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

Record handles creating and modification of new recording rules.

created by

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

Recorded handles a single recorded program, and takes a tuple of (chanid, starttime) for initialization.

>>> Recorded((4121,20100112200000))
<Recorded 'NCIS','2010-01-12 20:00:00' at 0x803e4ee50>

cast

The 'cast' attribute is a special handler for the people lookup table.

>>> rec = Recorded((4121,20100112200000))
>>> rec.cast
David McCallum, Michael Weatherly, Rocky Carroll, Donald P. Bellisario, Frank Cardea, George Schenck, John O'Brien, Mark Harmon, Pauley Perrette, Robert Wagner, Brian Dietzen, Cote De Pablo, Mark Ankeny, Sean Murray, Arvin Brown, Joe Lando, Amir Arison, Penny Johnson Jerald, Mido Hamada, Adam Conger, Alon Aboutboul, Lauren Shiohama, Samantha Sergeant, Yan Feldman
>>> rec.cast[0].name
'David McCallum'
>>> rec.cast[0].role
u'actor'

seek, markup

The 'seek' and 'markup' attributes are special handlers for video timebase information.

getProgram()

Returns a Program object.

getRecordedProgram

Returns a RecordedProgram object.

formatPath(path, replace=None)

Returns a formatted path, as described by the 'path' string. Follows 'mythlink.pl' formatting.

>>> rec.formatPath('%T/(%oY%-%om%-%od) %S')
u'NCIS/(2010-01-12) Flesh and Blood.mpg'

created by

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

Holds auxiliary data not contained with in the Recorded object.

created by

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

Manages entries in the oldrecorded table. New entries can be created, but 'update()' and 'delete()' are disabled. The only value the user has control over after creation is the duplicate bit, through 'setDuplicate(record=False)'.

created by