Opened 10 years ago

Closed 10 years ago

#7264 closed task (fixed)

Rewrite of Python Bindings

Reported by: Raymond Wagner <raymond@…> Owned by: Raymond Wagner
Priority: minor Milestone: 0.23
Component: Bindings - Python Version: head
Severity: low Keywords:
Cc: Ticket locked: no

Description

This is a rewrite of the python bindings scheduled for 0.23 in an attempt to clean up the interface, from the existing motley assortment of functions.

Attachments (14)

rewrite.demo.tar.bz2 (57.5 KB) - added by Raymond Wagner <raymond@…> 10 years ago.
rewrite.demo2.tar.bz2 (51.2 KB) - added by Raymond Wagner <raymond@…> 10 years ago.
rewrite.tar.bz2 (16.1 KB) - added by Raymond Wagner <raymond@…> 10 years ago.
rewrite2.tar.bz2 (16.2 KB) - added by Raymond Wagner <raymond@…> 10 years ago.
rewrite3.tar.bz2 (16.1 KB) - added by anonymous 10 years ago.
rewrite4.tar.bz2 (18.7 KB) - added by Raymond Wagner <raymond@…> 10 years ago.
rewrite5.tar.bz2 (19.9 KB) - added by Raymond Wagner <raymond@…> 10 years ago.
rewrite6.tar.bz2 (21.3 KB) - added by Raymond Wagner <raymond@…> 10 years ago.
rewrite7.tar.bz2 (21.7 KB) - added by Raymond Wagner <raymond@…> 10 years ago.
rewrite8.tar.bz2 (22.6 KB) - added by Raymond Wagner <raymond@…> 10 years ago.
rewrite9.tar.bz2 (22.9 KB) - added by Raymond Wagner <raymond@…> 10 years ago.
rewrite10.tar.bz2 (23.5 KB) - added by Raymond Wagner 10 years ago.
rewrite11.tar.bz2 (25.2 KB) - added by Raymond Wagner 10 years ago.
jamu_mirobridge_mnv_grabber_patches.tar.gz (133.0 KB) - added by r.d.vaughan@… 10 years ago.
Jamu, Mirobridge and MythNetvision?-grabber python bindings patches

Download all attachments as: .zip

Change History (26)

Changed 10 years ago by Raymond Wagner <raymond@…>

Attachment: rewrite.demo.tar.bz2 added

Changed 10 years ago by Raymond Wagner <raymond@…>

Attachment: rewrite.demo2.tar.bz2 added

comment:1 Changed 10 years ago by Raymond Wagner <raymond@…>

Above is an example of the direction I intend the rewrite to take. The new bindings will make extensive use of subclassing, starting with the 'ListData?' class. The class is intended to take a list of data, and store it against a pre-defined list of field names. The resulting object can be used as a regular object with variables, or as a dictionary or list, depending on which the user feels makes most sense.

Building off of these are DBData, and DBDataWrite, which are intended to make an easily accessible object for reading data from the database, and to allow writing data back and creating new entries, respectively.

The Video object is the first major rewrite using this, moving most of the functionality out of the old MythVideo? class, leaving only search functions and general management.

It should be understood that 0.23 is expected to include a internal rewrite, and partial merging of recordings and videos. As such, the posted demo should be taken as the direction I intend to go with the rewrite, rather than any indication of what the final product will look like.

Changed 10 years ago by Raymond Wagner <raymond@…>

Attachment: rewrite.tar.bz2 added

Changed 10 years ago by Raymond Wagner <raymond@…>

Attachment: rewrite2.tar.bz2 added

Changed 10 years ago by anonymous

Attachment: rewrite3.tar.bz2 added

Changed 10 years ago by Raymond Wagner <raymond@…>

Attachment: rewrite4.tar.bz2 added

Changed 10 years ago by Raymond Wagner <raymond@…>

Attachment: rewrite5.tar.bz2 added

comment:2 Changed 10 years ago by Raymond Wagner <raymond@…>

Quick note for whenever this gets committed, update mythtv/libs/libmythdb/mythversion.h to reference mythtv/bindings/python/MythTV/MythStatic.py as the only file that needs updating for proto/schema bumps.

Changed 10 years ago by Raymond Wagner <raymond@…>

Attachment: rewrite6.tar.bz2 added

comment:3 Changed 10 years ago by Raymond Wagner <raymond@…>

6 includes:

Main schema bump
Lots of database, socket, and network logging
Addition of MythVideo? wrapper functions from -dev list
Alterations to repr values (purely superficial)

Changed 10 years ago by Raymond Wagner <raymond@…>

Attachment: rewrite7.tar.bz2 added

comment:4 Changed 10 years ago by Raymond Wagner <raymond@…>

7 includes:

Assorted fixes.
'logfile' argument to MythLog? class. After this is used, all existing and subsequent instances will log to this file.
'from MythTV import *' now behaves properly, returning all usable objects, rather than the four base files.
Calling 'init.py' from the terminal now opens an interactive session, expanding on the previous behavior of 'MythTV.py.'

Changed 10 years ago by Raymond Wagner <raymond@…>

Attachment: rewrite8.tar.bz2 added

Changed 10 years ago by Raymond Wagner <raymond@…>

Attachment: rewrite9.tar.bz2 added

comment:5 Changed 10 years ago by Raymond Wagner <raymond@…>

*added MythTV subclass for MythBE (for backwards compatibility)
*added MythDB.searchJobs and MythDB.searchGuide
*other assorted fixes

comment:6 Changed 10 years ago by robertm

Owner: changed from Anduin Withers to Raymond Wagner
Status: newassigned

Changed 10 years ago by Raymond Wagner

Attachment: rewrite10.tar.bz2 added

comment:7 Changed 10 years ago by Raymond Wagner

  • fixes issues with MythBE() functions and UTF-8 characters in Progam() data.
  • fixes MythLog?() for Python 0.25.
  • adds MythBE.walkSG to behave similarly to os.walk, providing a tuple of (path, directories, files)

Changed 10 years ago by Raymond Wagner

Attachment: rewrite11.tar.bz2 added

comment:8 Changed 10 years ago by Raymond Wagner

  • MythError? fixed to print proper error string on traceback
  • MythError? tweaked to provide error codes, and additional information
  • MythBE subclassed to FileOps?, and now includes the functions of the latter
  • MythVideo?.pruneMetadata rewritten to MythVideo?.scanStorageGroups. Now optionally returns a tuple of new files in the form (hostname, path, hash), and a tuple of no longer available Video objects.

comment:9 Changed 10 years ago by anonymous

Please change python.pro such that you follow the --prefix directive of the primary configure. You force the bindings into /usr/local

Changed 10 years ago by r.d.vaughan@…

Jamu, Mirobridge and MythNetvision?-grabber python bindings patches

comment:10 Changed 10 years ago by r.d.vaughan@…

Jamu, Miro Bridge and Myth Netvision-grabber patches implementing the new python bindings.

Please do not apply them until wagnerrp approves as the patches were developed/tested with a later version of the python bindings then are currently posted on this ticket (later than rewrite11.tar.bz2).

comment:11 Changed 10 years ago by Raymond Wagner

(In [23287]) Initial commit of updated Python bindings. refs #7264

The rewrite was based around object mapping of several data structures and database tables into a structure more readily usable in Python. Also included are:

Rewrite of database access:

Credentials can now be more easily specified while opening the connection. Additionally, these credentials can easily be carried through to all functions and classes that may use the database, allowing proper use of alternate credentials from those found in the config.xml. A basic UPNP implementation now allows the bindings to search for available backends on the network, defaulting to a PIN of 0000, and creating a config.xml upon receipt of credentials. The database object now implements connection caching, so one set of credentials will only open one connection to the database.

Rewrite of backend access:

The backend socket now also implements caching, reusing connections wherever possible.

Logging rewrite:

The previous logging interface is replaced with one using bitwise filtering similar to that found in the MythTV binaries. Verbosity level follows the same rules, and defaults to 'important,general'.

Exceptions rewrite:

Errors continue to function as before, however several attributes have been added to allow for additional filtering and handling.

Grabber interface:

A basic class for retrieving data from external commands is now available, with customized forms for the MythVideo? and MythNetVision? grabber formats.

Canned searches:

Several keyword-based searches are now available for recordings, oldrecordings, jobs, guide data, and videos.

comment:12 Changed 10 years ago by Raymond Wagner

Resolution: fixed
Status: assignedclosed

A month after commit with no activity, I'm going to close this. Any future bugs can open new tickets.

Note: See TracTickets for help on using tickets.