From 643ebb925b655155ce5d6420f5f6ac8a35f07116 Mon Sep 17 00:00:00 2001
From: rcrdnalor <rcrernst@gmail.com>
Date: Mon, 2 Jul 2018 20:50:26 +0200
Subject: [PATCH 2/2] Python Bindings - Add recordedfile table and its usage
---
mythtv/bindings/python/MythTV/__init__.py | 3 +-
mythtv/bindings/python/MythTV/dataheap.py | 35 ++++++++++++++++++++++-
2 files changed, 36 insertions(+), 2 deletions(-)
diff --git a/mythtv/bindings/python/MythTV/__init__.py b/mythtv/bindings/python/MythTV/__init__.py
index 81fda6a881..2f92d96830 100644
a
|
b
|
__all_data__ = ['Record', 'Recorded', 'RecordedProgram', 'OldRecorded', \ |
15 | 15 | 'Job', 'Channel', 'Guide', 'Video', 'VideoGrabber', \ |
16 | 16 | 'InternetContent', 'InternetContentArticles', \ |
17 | 17 | 'InternetSource', 'Song', 'Album', 'Artist', \ |
18 | | 'MusicPlaylist', 'MusicDirectory', 'RecordedArtwork'] |
| 18 | 'MusicPlaylist', 'MusicDirectory', 'RecordedArtwork', \ |
| 19 | 'RecordedFile'] |
19 | 20 | |
20 | 21 | __all_method__ = ['MythBE', 'BEEventMonitor', 'MythSystemEvent', \ |
21 | 22 | 'Frontend', 'MythDB', 'MythXML', 'MythMusic', \ |
diff --git a/mythtv/bindings/python/MythTV/dataheap.py b/mythtv/bindings/python/MythTV/dataheap.py
index 946015c412..4bf13970c8 100644
a
|
b
|
class Recorded( CMPRecord, DBDataWrite ): |
386 | 386 | """Recorded.getProgram() -> Program object""" |
387 | 387 | return Program.fromRecorded(self) |
388 | 388 | |
| 389 | def getRecordedFile(self): |
| 390 | """Recorded.getRecordedFile() -> RecordedFile object""" |
| 391 | return RecordedFile.fromRecorded(self) |
| 392 | |
389 | 393 | def getRecordedProgram(self): |
390 | 394 | """Recorded.getRecordedProgram() -> RecordedProgram object""" |
391 | 395 | return RecordedProgram.fromRecorded(self) |
… |
… |
class Recorded( CMPRecord, DBDataWrite ): |
548 | 552 | return fe.send('play','program %d %s' % \ |
549 | 553 | (self.chanid, self.starttime.isoformat())) |
550 | 554 | |
551 | | class RecordedProgram( CMPRecord, DBDataWrite ): |
| 555 | class RecordedFile( CMPRecord, DBDataWrite ): |
| 556 | """ |
| 557 | RecordedFile(data=None, db=None) -> RecordedFile object |
| 558 | 'data' is a recordedid |
| 559 | """ |
| 560 | _key = ['recordedid'] |
| 561 | _defaults = {'filesize':0, 'width':0, 'height':0, |
| 562 | 'fps':0.0, 'aspect':0.0, 'audio_sample_rate':0, |
| 563 | 'audio_channels':0, 'audio_codec':'', 'video_codec':'', |
| 564 | 'comment':u'', 'hostname':'', 'storagegroup':'', |
| 565 | 'container':'', 'total_bitrate':0, |
| 566 | 'video_avg_bitrate':0, 'video_max_bitrate':0, |
| 567 | 'audio_avg_bitrate':0, 'audio_max_bitrate':0} |
552 | 568 | |
| 569 | def __str__(self): |
| 570 | if self._wheredat is None: |
| 571 | return u"<Uninitialized RecordedFile at %s>" % hex(id(self)) |
| 572 | return u"<RecordedFile '%s','%d' at %s>" % (self.basename, |
| 573 | self.recordedid, hex(id(self))) |
| 574 | |
| 575 | def __repr__(self): |
| 576 | return str(self).encode('utf-8') |
| 577 | |
| 578 | def __init__(self, data=None, db=None): |
| 579 | DBDataWrite.__init__(self, data, db) |
| 580 | |
| 581 | @classmethod |
| 582 | def fromRecorded(cls, recorded): |
| 583 | return cls((recorded.recordedid), recorded._db) |
| 584 | |
| 585 | class RecordedProgram( CMPRecord, DBDataWrite ): |
553 | 586 | """ |
554 | 587 | RecordedProgram(data=None, db=None) -> RecordedProgram object |
555 | 588 | 'data' is a tuple containing (chanid, storagegroup) |