[mythtv-commits] Ticket #13299: Python Bindings fail to calculate date-time object
MythTV
noreply at mythtv.org
Wed Jul 11 20:22:59 UTC 2018
#13299: Python Bindings fail to calculate date-time object
-------------------------------+--------------------------------
Reporter: rcrdnalor | Owner: Raymond Wagner
Type: Patch - Bug Fix | Status: new
Priority: minor | Milestone: needs_triage
Component: Bindings - Python | Version: Unspecified
Severity: medium | Resolution:
Keywords: | Ticket locked: 0
-------------------------------+--------------------------------
Comment (by rcrdnalor):
I'd like to attract more attention to this issue.
This bug causes every meaningful call to the `Recorded` class to fail
(using chanid and starttime), but with this patch installed, I can use all
these fancy methods the `datetime.duck()` method was written for.\\
With this patch, I get the same behavior as with my ubuntu 14.04 / mythtv
fixes/0.27 installation,
for example, for a recording '2102_20180606202400.ts' with valid database
entry:
{{{
$ python2
Python 2.7.15rc1 (default, Apr 15 2018, 21:51:34)
>>> from MythTV import MythError, Recorded, MythDB, datetime
>>> db = MythDB()
>>>
>>> # recording in database : 2102_20180606202400.ts
>>> # local time : CEST = UTC+02:00
>>> chanid = 2102
>>> utc_mythtime = 20180606202400
>>> local_mythtime = 20180606222400
>>> local_time_str = '2018-06-06 22:24:00'
>>>
>>> Recorded((chanid,local_mythtime), db =db)
b'<Recorded 'WORLDjournal','2018-06-06 22:24:00+02:00' at 0x7fc746755ab8>'
>>>
>>> Recorded((chanid,local_time_str), db =db)
b'<Recorded 'WORDjournal','2018-06-06 22:24:00+02:00' at 0x7fc744d25990>'
}}}
Without this patch, every of the above mentioned calls fail with:
{{{
....
raise MythError('DBData() could not read from database')
MythTV.exceptions.MythError: DBData() could not read from database
}}}
I have to use some - non existing - intermediate time values to get the
`Recorded` class loaded:
Applying an offset of 1 hour (for whatever reason):
{{{
>>> Recorded((chanid,(local_mythtime-10000)), db =db)
b'<Recorded 'WORLDjournal','2018-06-06 21:24:00+01:00' at 0x7fc341e97ab8>'
>>> Recorded((chanid,'2018-06-06 21:24:00'), db =db)
b'<Recorded 'WORLDjournal','2018-06-06 21:24:00+01:00' at 0x7fc340452ab8>'
}}}
This makes absolutely no sense.
Please note:
MythTV decided to keep the 'chanid, starttime' tuple to initialize the
`Recorded` class of the Python Bindings.
See commit ce1935b0ebc0918391f05893be82cd275cbd3969 and #12260.
The property `Job(jobid, db=db).starttime` used when calling a python
script triggered by a user job is not affected by this bug.
Interesting observation:
I have seen python scripts available in the wiki or in the forum
implementing
some - more or less useful - workarounds to circumvent this problem, like
requiring date/time values and an offset as input on the command line for
the starttime.
But I found no message that complains about the broken datetime
implementation in dt.py
And, please, do not add an "But it works for me as it is." comment if you
are living in UTC (GMT, BST) Zone ;-)\\
Instead, try my patch and report the result.
--
Ticket URL: <https://code.mythtv.org/trac/ticket/13299#comment:4>
MythTV <http://www.mythtv.org>
MythTV Media Center
More information about the mythtv-commits
mailing list