Author: wagnerrp
Date: 2010-07-06 16:20:19 +0000 (Tue, 06 Jul 2010)
New Revision: 25274
Changeset: http://svn.mythtv.org/trac/changeset/25274
Modified:
trunk/mythtv/bindings/python/MythTV/__init__.py
trunk/mythtv/bindings/python/MythTV/altdict.py
trunk/mythtv/bindings/python/MythTV/connections.py
trunk/mythtv/bindings/python/MythTV/database.py
trunk/mythtv/bindings/python/MythTV/dataheap.py
trunk/mythtv/bindings/python/MythTV/exceptions.py
trunk/mythtv/bindings/python/MythTV/methodheap.py
trunk/mythtv/bindings/python/MythTV/msearch.py
trunk/mythtv/bindings/python/MythTV/static.py
Log:
This commit tweaks the DBData[Write] classes, and adds several classes
for working with MythMusic database tables.
DBData classes now accept a '_key' parameter. This parameter is a list
providing the database fields to be used to link an object to an
entry in the database. This replaces the previous '_where' and
'_setwheredat' fields.
The '_key' parameter will set the other two values as:
_where = ' AND '.join(_key)
_setwheredat = ','.join(_key)+','
If more control is needed, these values can still be set manually.
DBDataWrite.create() now returns a fully usable object, rather than the
last rowid. This method now only works properly if the unique
identifier defined by the '_where' parameter is defined by the user.
The old behavior of 'create()' is now found in the '_create()' method,
if more control is needed than the new behavior provides.
DBDataWriteAI is a new class is a modified DBDataWrite specifically for
use with tables that use an Auto-Incrementing id field as the unique
identifier.
DBData._evalwheredat() is now the only thing that should be setting the
'_wheredat' parameter, and so must be run to tie an object to an entry
in the database. That means this method can be overridden to provide
any code that must be run after an object is fully mapped, replacing
'_postinit()'. '_evalwheredat()' now accepts an optional tuple, to
allow '_wheredat' to be set directly, rather than pulling from data
in the object.
Basic support for access to MythMusic data has been added, with the
following classes:
Song
Album
Artist
MusicPlaylist
MusicDirectory
These classes all have several classmethods, allowing them to be
initialized off of each other.
Also added is a MythMusic class offering a 'searchMusic' method.
Refs #8577