0.24 Python bindings/Data Handlers

From MythTV Official Wiki
Revision as of 04:50, 3 October 2010 by Wagnerrp (talk | contribs) (Program)

Jump to: navigation, search

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 Outputs Description
Recorded object
Program object
Returns a Program object from an existing Recorded object

toString

Inputs Outputs Description
n/a
serialized data <string>
Outputs a string with values separated by '[]:[]', for use over Myth Protocol

open

Inputs Outputs Description
type='r'
file object
Opens Program for read/write, will automatically decide between local filesystem, Myth Protocol, or MythXML for how to access file

delete

Inputs Outputs Description
force=False
rerecord=False
n/a
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

Inputs Outputs Description
path
replace=None
n/a
Returns a formatted file path using the syntax of mythlink.pl. Replace is an optional character to use in place of certain characters that cause problems in Windows.

formatJob

Inputs Outputs Description
command
n/a
Returns a formatted command string using the jobqueue syntax.

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)