Opened 10 years ago

Closed 10 years ago

#6885 closed enhancement (fixed)

Python updates

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

Description

MythLog?.py is rewritten. It now uses the MythTV severity levels, and will log to the stdout and/or database logs.

MythLog?(priority=WARNING, module='pythonbindings', mode=3) takes three optional arguments. Priority sets the minimum severity that will be logged. Module sets an identifier used in the log. Mode sets where things are logged (1=to stdout, 2=to database, 3=to both). All instances of old logging format in the bindings have been replaced.

MythLog?.setPriority(priority) changes priority on an initialized logging class.

MythLog?.all|debug|info|...(message,detail=) logs a message, with an optional argument for additional information.





Adds cleaning of videometadata(genres, country, cast) tables in MythVideo?.rmMetadata from [21427]. Also updates MythVideo?.pruneMetadata to use above function.





Reimplements GetStorageDirs? from #5546.
MythDB.getStorageGroup(group=None, host=None) takes optional groupname and hostname for filtering, and returns a tuple of dictionaries with the fields 'id','group','host', and 'dirname'.





Also merges in non-overlapping updates from #4985
New functions MythDB.getChannels(), MythDB.getChannel(chanid), and MythDB.getGuideData(chanid,date) return new Channel and Guide classes.
New functions MythTV.getExpiring(), MythTV.getUptime(), and MythTV.getLastGuideData()

Attachments (10)

pyth.updates.patch (20.6 KB) - added by Raymond Wagner <raymond@…> 10 years ago.
pyth.updates2.patch (27.8 KB) - added by Raymond Wagner <raymond@…> 10 years ago.
pyth.updates3.patch (20.0 KB) - added by Raymond Wagner <raymond@…> 10 years ago.
pyth.updates4.patch (24.1 KB) - added by Raymond Wagner <raymond@…> 10 years ago.
pyth.updates5.patch (25.7 KB) - added by Raymond Wagner <raymond@…> 10 years ago.
pyth.updates6.patch (29.5 KB) - added by Raymond Wagner <raymond@…> 10 years ago.
pyth.updates7.patch (664 bytes) - added by andycarr@… 10 years ago.
MythDB.py $MYTHCONFDIR fix
pyth.updates8.patch (31.1 KB) - added by Raymond Wagner <raymond@…> 10 years ago.
pyth.updates9.patch (34.8 KB) - added by Raymond Wagner <raymond@…> 10 years ago.
pyth.updates10.patch (34.8 KB) - added by Raymond Wagner <raymond@…> 10 years ago.

Download all attachments as: .zip

Change History (23)

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

Attachment: pyth.updates.patch added

comment:1 Changed 10 years ago by raymond@…

Changes in MythVideo?.py have been taken care of by [21461].

comment:2 in reply to:  1 Changed 10 years ago by anonymous

The logger does not parse out single quotes. Thus if you are passing in something with single quotes, the SQL fails. You should reg exp each input parameter to remove single quotes (or adjust you sql to accomodate them)

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

Attachment: pyth.updates2.patch added

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

Fixes aforementioned bug, and cleans up SQL syntax throughout MythDB.py.

Rewrites MythVideo?.rtnVideoStorageGroup() to use MythDB.getStorageGroup().

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

Attachment: pyth.updates3.patch added

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

Removes MythLog? rewrite. This patch is now new functions and bugfixes only. MythLog? rewrite will be added back to a separate patch.

Also added are three new functions to the Program class. setBasename(filename), setHostname(host), and setSG(storagegroup) can now be used to update the database entry for the corresponding Program.

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

Attachment: pyth.updates4.patch added

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

Reconfigures the JOB class. Class now contains 'inserttime', 'type', 'cmds', 'flags', and 'args' fields. Also are 'getComment()' and 'getStatus()' functions for monitoring jobs, as well as the ability to create new jobs, by initializing the object using a dictionary.

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

Attachment: pyth.updates5.patch added

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

Patch 5 fixes various bugs added into MythTV.py by patch 4, including the one fixed by #7081. Also includes additional sanity checking for functions dealing with database manipulation of recorded and jobqueue.

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

Attachment: pyth.updates6.patch added

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

Patch 6 brings ticket up to dat with 21938. Also adds requested MythTV.lockTuner() and MythTV.freeTuner(). lockTuner() takes an optional recorder ID as an argument, and if successful, will add the tuner to a list of those currently locked by the instance. freeTuner() also takes an optional ID, and if not given one, will free all tuners in the aforementioned list. This is called automatically in the class destructor.

To facilitate those two commands, the MythTV() constructor now takes an optional host argument as an IP or hostname, to allow connection to a slave backend.

Changed 10 years ago by andycarr@…

Attachment: pyth.updates7.patch added

MythDB.py $MYTHCONFDIR fix

comment:8 Changed 10 years ago by Andrew Carr <andycarr@…>

Patch corrects the variable name used to pull in the $MYTHCONFDIR environment variable in MythDB.py

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

Attachment: pyth.updates8.patch added

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

Adds patch for issue discovered above by andycarr. Also includes checking for proper SCHEMA_VERSION (mythtv schema) and MVSCHEMA_VERSION (mythvideo schema).

comment:10 Changed 10 years ago by anonymous

line 213 of MythDB.py should read (chanid,starttime)) == 0:

not

(chanid,starttim)) == 0:

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

Attachment: pyth.updates9.patch added

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

Attachment: pyth.updates10.patch added

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

Patch 10 should be the last for this line of updates. The Frontend() object has been rewritten, and should no longer have login problems, or truncated strings. The rest of the patch is just additional functions that should have no effect on existing scripts.

This should close out the existing python bindings in trunk, in preparation for release of 0.22. I will be rewriting the bindings for 0.23.

comment:12 Changed 10 years ago by Rob Smith

Owner: changed from Anduin Withers to Rob Smith
Status: newaccepted

comment:13 Changed 10 years ago by Rob Smith

Resolution: fixed
Status: acceptedclosed

(In [22385]) Fixes #6885, this updates the python bindings with a pile of fixes and improvements

Note: See TracTickets for help on using tickets.