[mythtv] Undelete Recoding with Python Bindings

Casey McGinty casey.mcginty at gmail.com
Mon Apr 25 10:41:18 UTC 2016


I believe I tracked this down to a time conversion bug in the Python API.

In the capture, the query for the recid 20160421070000 returns start time
of 1461222000. The DELETE command is sending back a start time of
1461220200. The time of offset by 1800s or 30min. I'm running the script
from the same machine as the backend. I can't really figure out why the
time would shift 30min, but there must be some strange conversion happening
between the QUERY and conversion back to prog.toString().

Maybe Raymond W. can help since it looks like he's worked on a few of these
tickets. I'm not running the latest backend. Is it safe to run the latest
Python bindings without changing the backend?

Casey

On Sat, Apr 23, 2016 at 4:18 PM Casey McGinty <casey.mcginty at gmail.com>
wrote:

> I'm trying to create a tool that undeletes a recording. I have the
> following code working, except the backend does not actually perform the
> action*, even though it logs the undelete event, and return code is 0
> (i.e. success)*. Can anyone explain why this isn't working? I've even
> been using tcpdump to compare against a working client and the command
> looks almost identical.
>
> code sample:
>
> def undelete(rec):
>     prog = Program.fromRecorded(rec)
>     cmd = BACKEND_SEP.join(['UNDELETE_RECORDING', prog.toString()])
>     res = BE.backendCommand(cmd)
>     if int(res) != 0:
>         raise MythBEError("undelete failed")
>
> The TCP capture is:
>
> 14:29:00.447240 IP gandalf.local.33900 > gandalf.local.6543: Flags [P.],
> seq 124:176, ack 294442, win 3637, options [nop,nop,TS val 59730401 ecr
> 59729698], length 52 E..h~. at .@.:~.........l...8...+.....5....... ..i...g"44
> QUERY_RECORDING TIMESLOT 3101 20160421070000
> 14:29:00.447290 IP gandalf.local.6543 > gandalf.local.33900: Flags [.],
> ack 176, win 342, options [nop,nop,TS val 59730401 ecr 59730401], length 0
> E..47. at .@..............l.+...8.....V....... ..i...i.
> 14:29:00.450204 IP gandalf.local.6543 > gandalf.local.33900: Flags [P.],
> seq 294442:294991, ack 176, win 342, options [nop,nop,TS val 59730402 ecr
> 59730401], length 549 E..Y7. at .@..............l.+...8.....V.......
> ..i...i.541 OK[]:[]NOVA[]:[]Wild Ways[]:[]Newly established wildlife
> corridors offer hope to endangered species around the
> world.[]:[]0[]:[]0[]:[]4311[]:[]Science[]:[]3101[]:[]10_1[]:[]KMEB-HD[]:[]KMEB-HD[]:[]3101_20160421070000.mpg[]:[]6259832428[]:[]1461222000[]:[]1461225600[]:[]0[]:[]gandalf[]:[]0[]:[]0[]:[]0[]:[]0[]:[]-3[]:[]99[]:[]0[]:[]15[]:[]6[]:[]1461222000[]:[]1461225630[]:[]5[]:[]Deleted[]:[][]:[]EP00003163[]:[]EP000031630871[]:[][]:[]1461415115[]:[]0[]:[]2016-04-20[]:[]Default[]:[]0[]:[]0[]:[]Default[]:[]1[]:[]19[]:[]1[]:[]0[]:[]0[]:[]0
>
> 14:29:00.454521 IP gandalf.local.33900 > gandalf.local.6543: Flags [P.],
> seq 176:748, ack 294991, win 3979, options [nop,nop,TS val 59730403 ecr
> 59730402], length 572 E..p~. at .@.8u.........l...8...+.............
> ..i...i.564 UNDELETE_RECORDING[]:[]NOVA[]:[]Wild Ways[]:[]Newly established
> wildlife corridors offer hope to endangered species around the
> world.[]:[]0[]:[]0[]:[]4311[]:[]Science[]:[]3101[]:[]10_1[]:[]KMEB-HD[]:[]KMEB-HD[]:[]3101_20160421070000.mpg[]:[]6259832428[]:[]1461220200[]:[]1461223800[]:[]0[]:[]gandalf[]:[]0[]:[]0[]:[]0[]:[]0[]:[]-3[]:[]99[]:[]0[]:[]15[]:[]6[]:[]1461220200[]:[]1461223830[]:[]5[]:[]Deleted[]:[][]:[]EP00003163[]:[]EP000031630871[]:[][]:[]1461413315[]:[]0.000000[]:[]2016-04-20[]:[]Default[]:[]0[]:[]0[]:[]Default[]:[]1[]:[]19[]:[]1[]:[]0[]:[]0[]:[]0
>
> 14:29:00.458981 IP gandalf.local.6543 > gandalf.local.33900: Flags [P.],
> seq 294991:295000, ack 748, win 351, options [nop,nop,TS val 59730404 ecr
> 59730403], length 9 E..=7. at .@..............l.+...8.?..._....... ..i...i.1
> 0
> 14:29:00.479246 IP gandalf.local.33900 > gandalf.local.6543: Flags [P.],
> seq 748:760, ack 295000, win 3979, options [nop,nop,TS val 59730409 ecr
> 59730404], length 12 E..@~. at .@.:..........l...8.?.+.............
> ..i...i.4 DONE
>
> I also get the exact same log output from the backend as I do when the
> command is runs correctly in my frontend:
>
> Apr 23 16:13:25 gandalf mythbackend: mythbackend[10514]: I ProcessRequest
> mainserver.cpp:1420 (HandleAnnounce) MainServer::ANN Monitor
> Apr 23 16:13:25 gandalf mythbackend: mythbackend[10514]: I ProcessRequest
> mainserver.cpp:1422 (HandleAnnounce) adding: gandalf as a client (events:
> 0)
> Apr 23 16:13:27 gandalf mythbackend: mythbackend[10514]: I Scheduler
> scheduler.cpp:2098 (HandleReschedule) Reschedule requested for CHECK -3 99
> 0 DoHandleUndelete | NOVA | Wild Ways | Newly established wildlife
> corridors offer hope to endangered species around the world. |
> EP000031630871
> Apr 23 16:13:27 gandalf mythbackend: mythbackend[10514]: I Scheduler
> scheduler.cpp:2211 (HandleReschedule) Scheduled 50 items in 0.1 = 0.00
> match + 0.00 check + 0.07 place
>
> Can anyone expain why it works on the mythfrontend but not when using the
> Python bindings?
>
> Sincerely,
> Casey McGinty
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mythtv.org/pipermail/mythtv-dev/attachments/20160425/febd397e/attachment.html>


More information about the mythtv-dev mailing list