Opened 15 months ago

Last modified 4 weeks ago

#13300 infoneeded_new Patch - Feature

Python Bindings enhancemts according to latest MythTV protocol (91)

Reported by: rcrdnalor Owned by: Raymond Wagner
Priority: minor Milestone: 31.0
Component: Bindings - Python Version: v29-fixes
Severity: medium Keywords:
Cc: Ticket locked: no


Mythtv v29: Python Bindings enhancements according to latest MythTV protocol:

1) Allow db.seacrchRecorded method to search by given recordedid:

Patch: 0001-Add-recordedid-to-db.seacrchRecorded-method.patch

This patch implements a search inside the recorded table by given recordedid by modifing the already implemented searchRecorded method.

2) Add the recordedfile table to python bindings and make use of it:

Patch: 0002-Python-Bindings-Add-recordedfile-table-and-its-usage.patch

This patch adds the recordedfile table to the python bindings and allows the Recorded instance to use (and update) it.

These patches are compatible with current master and fixes/v29. Once accepted, please backport to fixes/v29.

Example usage:

$ python2
Python 2.7.15rc1 (default, Apr 15 2018, 21:51:34) 
[GCC 7.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from MythTV import MythDB, MythError, MythDBError, Recorded, RecordedFile
>>> db = MythDB()
>>> reciter = db.searchRecorded(recordedid = 44)
>>> rec =
>>> rec
b'<Recorded 'Servatius Wetter','2018-06-30 11:10:00+02:00' at 0x7efe3fc482a0>'
>>> recfile = rec.getRecordedFile()
>>> recfile
b'<RecordedFile '2105_20180630091000.ts','44' at 0x7efe3fc554f0>'
>>> recfile.keys()
[u'basename', u'filesize', u'width', u'height', u'fps', u'aspect', u'audio_sample_rate', u'audio_channels', u'audio_codec', u'video_codec', u'comment', u'hostname', u'storagegroup', u'id', u'recordedid', u'container', u'total_bitrate', u'video_avg_bitrate', u'video_max_bitrate', u'audio_avg_bitrate', u'audio_max_bitrate']
>>> recfile.values()
[u'2105_20180630091000.ts', 563401220L, 1920, 1088, 25.0, 1.777778, 0, 0, u'AC3', u'H264', u'', u'bionic', u'Default', 51L, 44L, u'MPEG2-TS', 0, 0, 0, 0, 0]

Attachments (2)

0001-Add-recordedid-to-db.seacrchRecorded-method.patch (2.1 KB) - added by rcrdnalor 15 months ago.
Add recordedid to Python Bindings
0002-Python-Bindings-Add-recordedfile-table-and-its-usage.patch (3.6 KB) - added by rcrdnalor 15 months ago.
Add recordedfile to Python Bindings

Download all attachments as: .zip

Change History (7)

Changed 15 months ago by rcrdnalor

Add recordedid to Python Bindings

Changed 15 months ago by rcrdnalor

Add recordedfile to Python Bindings

comment:1 Changed 15 months ago by ijc

FWIW (I'm not a maintainer) these like sane to me.

Was the omission of basename and id from the RecordedId._defaults table deliberate?

comment:2 Changed 15 months ago by rcrdnalor

@ijc Thank you for reviewing my patches.

I am not sure if I understood your question correctly. If you meant theRecordedfile._defaults object, then the answer is yes. If you look into the mysql description of the recordedfile table (mysql describe recrodedfile), the fields id and basename are key-fields: id is autoincrement, it will be handled by mysql itself, and basename has a key as well, that means, the user needs to provide a valid value. Therefore, no default values are foreseen for those fields.

Could you please review #13299 as well? This is a tricky one and hard to decribe.

Thx, dnalor

comment:3 Changed 15 months ago by ijc

Thanks for the explanation, I did mean Recordedfile._defaults and had missed that basename was also a key field.

Will see if I can understand #13299 next...

comment:4 Changed 4 weeks ago by Bill Meek

Milestone: needs_triage31.0
Status: newinfoneeded_new

Roland, are any changes required for Python 3? E.g. in the 2nd patch here: 'comment':u'', 'hostname':'', 'storagegroup':''

comment:5 Changed 4 weeks ago by rcrdnalor

I will add testcases to my repo and include the patches in pull request 182 as a single commit.

This means, one can easily revert it, if necessary.

Note: See TracTickets for help on using tickets.