Difference between revisions of "0.24 Python bindings/Data Handlers"

From MythTV Official Wiki
Jump to: navigation, search
(Database Read-Only)
(Database Read-Write)
Line 65: Line 65:
  
 
== Database Read-Write ==
 
== Database Read-Write ==
 +
These classes map to a single entry in a database table, and allow creation, alteration, and deletion in addition to just read access.
 +
=== generic ===
 +
These are several methods shared by all classes of this type.
 +
==== create ====
 +
;inputs
 +
:data=None <dict>
 +
;outputs
 +
:self
 +
;description
 +
:Creates a new entry in the database, pulling from the existing data in the object, and supplementing with an optional dictionary. This method will only work if the object has not yet been initialized against an existing database entry.
 +
==== update ====
 +
;inputs
 +
:follows standard dict.update() syntax
 +
;description
 +
:Updates the local object with any given changes, and then pushes the data contained in the object onto the database. This method will only work if the object has a matching database entry.
 +
==== delete ====
 +
;description
 +
:Deletes database entry matched to object.
 
=== Record ===
 
=== Record ===
 +
==== getUpcoming ====
 +
==== fromGuide ====
 +
(classmethod)
 +
==== fromProgram ====
 +
(classmethod)
 
=== Recorded ===
 
=== Recorded ===
 +
==== cast ====
 +
==== seek ====
 +
==== markup ====
 +
==== open ====
 +
==== formatPath ====
 +
==== importMetadata ====
 +
==== fromProgram ====
 +
(classmethod)
 
=== RecordedProgram ===
 
=== RecordedProgram ===
 +
==== fromRecorded ====
 +
(classmethod)
 
=== OldRecorded ===
 
=== OldRecorded ===
 +
==== setDuplicate ====
 
=== Job ===
 
=== Job ===
 +
==== setComment ====
 +
==== setStatus ====
 
=== Channel ===
 
=== Channel ===
 
=== Video ===
 
=== Video ===
 +
==== cast ====
 +
==== genre ====
 +
==== country ====
 +
==== markup ====
 +
==== open ====
 +
==== openBanner ====
 +
==== openCoverart ====
 +
==== openFanart ====
 +
==== openScreenshot ====
 +
==== openTrailer ====
 +
==== getHash ====
 +
==== parseFilename ====
 +
==== importMetadata ====
 +
==== fromFilename ====
 +
(classmethod)
 
=== Song ===
 
=== Song ===
 +
==== fromAlbum ====
 +
(classmethod)
 +
==== fromArtist ====
 +
(classmethod)
 +
==== fromPlaylist ====
 +
(classmethod)
 
=== Album ===
 
=== Album ===
 +
==== fromArtist ====
 +
(classmethod)
 +
==== fromSong ====
 +
(classmethod)
 
=== Artist ===
 
=== Artist ===
 +
==== fromName ====
 +
(classmethod)
 +
==== fromSong ====
 +
(classmethod)
 +
==== fromAlbum ====
 +
(classmethod)
 
=== MusicPlaylist ===
 
=== MusicPlaylist ===
 +
==== fromSong ====
 +
(classmethod)
 
=== MusicDirectory ===
 
=== MusicDirectory ===
 +
==== fromPath ====
 +
(classmethod)
  
 
[[Category:Trunk_Python_Bindings]]
 
[[Category:Trunk_Python_Bindings]]

Revision as of 01:04, 17 August 2010

Backend Data

These classes are not intended to be called directly, but only returned from methods in MythBE and MythXML. The classes are similar to dictionaries, whose data can also be accessed as class attributes.

FreeSpace

Refers to one disk defined in the backend for storage group use. Computes several additional values from the original data.

>>> fs = be.getFreeSpace().next()
>>> fs
<FreeSpace '/mnt/mythtv/recordings@mythtrunk' at 0x804e7f0e0>
>>> fs.items()
[('host', u'mythtrunk'), ('path', u'/mnt/mythtv/recordings'), ... , ('us_low', 19550336)]
>>> fs.totalspace, fs.usedspace, fs.freespace
(119116800, 19550336, 99566464)

Program

Refers to a single upcoming or existing recording.

fromRecorded

inputs
Recorded object
outputs
Program object
description
returns a Program object from an existing Recorded object

toString

outputs
serialized data <string>
description
outputs as string with values separated by '[]:[]', for use over mythprotocol

open

inputs
type='r' <string>
outputs
file object
description
opens program for read or write, will automatically decide between filesystem, mythproto, or mythxml for how to access file

delete

inputs
force=False <boolean>
rerecord=False <boolean>
description
Deletes a recording, and optionally marks it for re-record. If force is False, the call will fail if mythbackend cannot find a file to delete matching the program. Setting force to True will cause it to be deleted anyway, possibly resulting in an orphaned file.

formatPath

Outputs a formatted file path using the syntax of mythlink.pl.

formatJob

Outputs a formatted command string using the syntax of MythJobqueue and MythSystemEvents.

Database Read-Only

These classes provide mapped access to a single entry in a database table. The table columns are accessible as the same name as attributes or keys. The class otherwise behaves as a dictionary.

Guide

This class maps to guide data in the `program` table. This class can be populated from the database directly, or from MythXML.

getRecStatus

outputs
recstatus <int>
description
This method queries the pending recordings from the backend, and determines if the guide object has a special record status, otherwise returning 0.

InternetContent

This class maps to an installed grabber in the `internetcontent` table.

InternetContentArticles

This class maps to a grabbed internet video in the `internetcontentarticles` table.

Database Read-Write

These classes map to a single entry in a database table, and allow creation, alteration, and deletion in addition to just read access.

generic

These are several methods shared by all classes of this type.

create

inputs
data=None <dict>
outputs
self
description
Creates a new entry in the database, pulling from the existing data in the object, and supplementing with an optional dictionary. This method will only work if the object has not yet been initialized against an existing database entry.

update

inputs
follows standard dict.update() syntax
description
Updates the local object with any given changes, and then pushes the data contained in the object onto the database. This method will only work if the object has a matching database entry.

delete

description
Deletes database entry matched to object.

Record

getUpcoming

fromGuide

(classmethod)

fromProgram

(classmethod)

Recorded

cast

seek

markup

open

formatPath

importMetadata

fromProgram

(classmethod)

RecordedProgram

fromRecorded

(classmethod)

OldRecorded

setDuplicate

Job

setComment

setStatus

Channel

Video

cast

genre

country

markup

open

openBanner

openCoverart

openFanart

openScreenshot

openTrailer

getHash

parseFilename

importMetadata

fromFilename

(classmethod)

Song

fromAlbum

(classmethod)

fromArtist

(classmethod)

fromPlaylist

(classmethod)

Album

fromArtist

(classmethod)

fromSong

(classmethod)

Artist

fromName

(classmethod)

fromSong

(classmethod)

fromAlbum

(classmethod)

MusicPlaylist

fromSong

(classmethod)

MusicDirectory

fromPath

(classmethod)