Ticket #6678 (closed enhancement: fixed)
Opened 3 years ago
Last modified 3 years ago
Additional functions for Python bindings
| Reported by: | Raymond Wagner <raymond@…> | Owned by: | awithers |
|---|---|---|---|
| Priority: | minor | Milestone: | 0.22 |
| Component: | Bindings - Python | Version: | head |
| Severity: | medium | Keywords: | |
| Cc: | Ticket locked: | no |
Description
MythDB.setSetting(value, data, hostname=None):
Counter function to the existing MythDB.getSetting(). Will create new entry if setting does not already exist.
MythDB.getCast(chanid, starttime, roles=None):
Takes channel id and start time as integers, with an optional 'roles' to search for. With no 'roles', will return a dictionary of tuples indexed by role. When given a single string or tuple of strings, will return a tuple of all cast members matching those roles.
MythTV.getRecording(chanid, starttime):
Takes channel id and start time as integers, and implements 'QUERY_RECORDING TIMESLOT'. Will return a Program object.
MythTV.getRecordings():
Implements 'QUERY_RECORDINGS' and returns a list of Program objects.
MythTV.getCheckfile(program):
Takes a Program object and implements 'QUERY_CHECKFILE', returning the location of a recording in the file system. This currently includes a bugfix where the command requires an additional two separators.
Program.toString():
Implements a 'toString' function to revert a Program object back to a string format usable by MythProto? command calls.
Attachments
Change History
comment:1 Changed 3 years ago by Raymond Wagner <raymond@…>
Added Job class to MythTV.MythDB for dealing with user jobs written in python
Job() takes two input options Job(jobid) or Job(chanid,starttime)
Job.setComment(comment) Job.setStatus(status)
comment:2 Changed 3 years ago by Raymond Wagner <raymond@…>
Ignore pyth.update2.patch
Also adds MythTV.Program.filesize as a processed long of fs_low and fs_high Properly fixes issue with getCheckfile and Program string
comment:3 Changed 3 years ago by Raymond Wagner <raymond@…>
pyth.update4.patch is a small fix for an improper call of QUERY_RECORDINGS
comment:4 Changed 3 years ago by Raymond Wagner <raymond@…>
MythTV.getRecordings() is now properly fixed, rather than functioning through chance.
Frontend socket access is now part of MythTV
MythTV.getFrontends():
Returns a list of Frontend objects for accessible frontends
MythTV.getFrontend(hostname):
Returns a Frontend object for the specified host
Frontend(hostname, port):
Returns a Frontend object, throws an exception if cannot connect to frontend
Frontend.getJump():
Returns a tuple containing available jumppoints
Frontend.sendJump(jumppoint):
Sends jumppoint to frontend
Frontend.getKey():
Returns a tuple containing available special keys
Frontend.sendKey():
Sends keycode to connected frontend
Frontend.getQuery():
Returns a tuple containing available queries
Frontend.sendQuery():
Returns query from connected frontend
Frontend.getPlay():
Returns a tuple containing available playback commands
Frontend.sendPlay():
Send playback command to connected frontend
comment:5 Changed 3 years ago by Raymond Wagner <raymond@…>
Patch 6 may return proper UTF-8 text from mythproto calls, or it may just return unicode strings full of garbled ASCII.
comment:6 Changed 3 years ago by Raymond Wagner <raymond@…>
Patch 7 adds a minor tweek to the UTF-8 support from R.D.Vaughan. It also adds the FileTransfer? class.
MythTV.FileTransfer?(file[,parent]):
'file' can take the form of a Program object, or a tuple containing (backend, filename, storagegroup)
filename is a relative path from the storagegroup base, starting with a '/'
'parent' is an optional command object (MythTV.MythTV()). If none is given, it will open a new one internally to use
The class uses the standard file i/o functions:
FileTransfer?.close()
FileTransfer?.tell()
FileTransfer?.read(byte count)
This currently pulls up to 64KB at a time, but will buffer an unlimited amount of bytes before returning the data. Don't go overboard here, because python will be buffering this in memory.
FileTransfer?.rewind()
FileTransfer?.seek(byte offset[,whence])
'whence' is an optional integer where 0 seeks absolute from file start, and 1 seeks relative from the current position. Default behavior is 0 (absolute).
comment:7 Changed 3 years ago by Raymond Wagner <raymond@…>
Patch 8 updates MythDB to pull database information from config.xml instead of the old mysql.txt. The correct way to do this would be to include failover to UPnP auto-detection of the backend, however there are no bare UPnP libraries available for python. I'll probably end up porting auto-discovery code from the Perl Net::UPNP::ControlPoint? module.
comment:8 Changed 3 years ago by Raymond Wagner <raymond@…>
Patch 9 updates the MythDB.py changes to changeset [21052].
Also adds the following functions to MythTV.py MythTV.deleteRecording(program,force=False)
deletes recording defined by program instance force will force mythtv to delete metadata even if recording file is not found
MythTV.forgetRecording(program)
allows recording defined by program instance to be re-recorded
MythTV.getFreeSpace(all=False)
returns a tuple of information about storage devices on the local system all returns information about all systems, and a summary line
MythTV.getFreeSpaceSummary()
returns summary information of all available storage devices
MythTV.getLoad()
returns standard 1/5/15 load averages
comment:10 Changed 3 years ago by Raymond Wagner <raymond@…>
Patches 10 and 11 illustrate that I need to start reviewing code before uploading it.
Patch 12 updates the FileTransfer? class. The class now requires two inputs, file and mode. The 'file' input still takes the existing Program or Tuple inputs, however can now understand the standard 'myth://group@host:port/path/to/file.ext' format, with group and port optional. The 'mode' input takes 'r' or 'w'.
Also added is the MythTV.deleteFile(file,group) routine.
comment:11 Changed 3 years ago by kormoc
- Status changed from new to closed
- Resolution set to fixed
