Ticket #7264 (closed task: fixed)
Opened 2 years ago
Last modified 2 years ago
Rewrite of Python Bindings
| Reported by: | Raymond Wagner <raymond@…> | Owned by: | wagnerrp |
|---|---|---|---|
| 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
Change History
comment:1 Changed 2 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.
comment:2 Changed 2 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.
comment:3 Changed 2 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)
comment:4 Changed 2 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.'
comment:5 Changed 2 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 2 years ago by robertm
- Owner changed from awithers to wagnerrp
- Status changed from new to assigned
comment:7 Changed 2 years ago by wagnerrp
- 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)
comment:8 Changed 2 years ago by wagnerrp
- 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 2 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 2 years ago by r.d.vaughan@…
-
attachment
jamu_mirobridge_mnv_grabber_patches.tar.gz
added
Jamu, Mirobridge and MythNetvision?-grabber python bindings patches
comment:10 Changed 2 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 2 years ago by wagnerrp
(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 2 years ago by wagnerrp
- Status changed from assigned to closed
- Resolution set to fixed
A month after commit with no activity, I'm going to close this. Any future bugs can open new tickets.
