[mythtv-users] python bindings

Raymond Wagner raymond at wagnerrp.com
Thu Jan 30 03:02:25 UTC 2014


On 1/29/2014 9:42 PM, Jeremy Jones wrote:
>
> On Thu, Jan 23, 2014 at 12:57 PM, Jeremy Jones
> <jeremy.dwain.jones at gmail.com <mailto:jeremy.dwain.jones at gmail.com>> wrote:
>
>
>     On Jan 23, 2014 12:18 PM, "Raymond Wagner" <raymond at wagnerrp.com
>     <mailto:raymond at wagnerrp.com>> wrote:
>      >
>      > On Jan 23, 2014, at 8:10, Jeremy Jones
>     <jeremy.dwain.jones at gmail.com <mailto:jeremy.dwain.jones at gmail.com>>
>     wrote:
>      >
>      >>
>      >> On Wed, Jan 22, 2014 at 10:51 PM, Raymond Wagner
>     <raymond at wagnerrp.com <mailto:raymond at wagnerrp.com>> wrote:
>      >>>
>      >>>
>      >>>> 4) And this is really what I need: Is there a place that I can
>     look that
>      >>>> will tell me about accessing the following database tables
>     using the
>      >>>> python bindings?
>      >>>>    a) music_playlists
>      >>>>    b) music_songs
>      >>>>    c) music_directories
>      >>>
>      >>>
>      >>> The relevant pages list objects for those, but it seems I never
>     filled them in.
>      >>>
>      >>>
>     http://www.mythtv.org/wiki/0.26_Python_bindings/Data_Handlers#MusicPlaylist
>      >>>
>      >>> Also see...
>      >>>
>      >>>
>     http://code.mythtv.org/cgit/mythtv/tree/mythtv/bindings/python/MythTV/dataheap.py#n1229
>      >>>
>      >>> In any case, they follow the same behavior of all other
>     database-derived objects.  They can be accessed by the class
>     constructor by using the table's primary keys, and all columns are
>     accessible as attributes.  You can alter the attributes and run
>     .update() to push the changes, or you can feed those changes into
>     .update({}) with a dict argument.  You can create a new, empty
>     object, populate it, and then push it with .create().  You can
>     delete an existing object with .delete().
>      >>>
>      >>
>      >> That's exactly what I needed.  Thank you Raymond.
>      >>
>      >> Jeremy
>      >
>      >
>      > Be aware that there is no data protection on those classes.  It's
>     up to you to add data in the manner mythmusic is happy with.
>
>     Thanks for the warning, but I only plan to read from the database.
>
>
> What would cause this:
>
> Python Database Connection MythMusic schema mismatch: we speak 1018 but
> database speaks 1020

http://code.mythtv.org/cgit/mythtv/tree/mythtv/bindings/python/MythTV/static.py#n10
http://code.mythtv.org/cgit/mythtv/tree/mythtv/bindings/python/MythTV/static.py#n253
http://code.mythtv.org/cgit/mythtv/tree/mythtv/bindings/python/MythTV/dataheap.py#n1229

It's a mechanism built into the DBData class that allows the bindings to 
check the plugin schema version against a stored value, and ensure that 
it cannot be used unless the versions match, and the class has been 
updated to properly handle the new version.


More information about the mythtv-users mailing list