<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, 28 Mar 2020 at 16:43, Klaas de Waal <<a href="mailto:klaas.de.waal@gmail.com">klaas.de.waal@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, 28 Mar 2020 at 14:26, Bill Meek <<a href="mailto:keemllib@gmail.com" target="_blank">keemllib@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 3/27/20 8:41 PM, David Engel wrote:<br>
> On Fri, Mar 27, 2020 at 06:58:16PM -0500, Bill Meek wrote:<br>
>> On 3/27/20 12:13 PM, Klaas de Waal wrote:<br>
>>> Hi all,<br>
>>><br>
>>> I am attempting to fix bug #13571 and to test this I need to start and then<br>
>>> delete recordings lots and lots of times. It would be great if I can start<br>
>>> a script that starts a recording on a specified channel, wait 10 seconds,<br>
>>> delete the recording, wait 10 seconds, start a recording etc etc.<br>
>>> And I then want to run another instance of the script on another channel,<br>
>>> etc.<br>
>>> Has anyone a script available that does something like this, or a basic<br>
>>> example on how to build something?<br>
>><br>
>> If the 10 second length, is a requirement, no need to read further. Otherwise,<br>
>> I might be able change the following to delete recordings automatically...<br>
> <br>
> Klaas can correct me if I'm wrong but I don't think 10 seconds is a<br>
> hard and fast requirement.  The problem at hand seems to occur when<br>
> deleting an in-progress recording but only occasionally.  I think the<br>
> 10 seconds is solely to recreate the in-progress, deletion condition<br>
> as frequently as possible in hopes of reproducing the problem more<br>
> quickly.<br>
> <br>
> David<br>
<br>
...<br>
<br>
Klaas,<br>
<br>
New version, you can run it from a remote host (FE.) It uses the Services API<br>
Dvr/DeleteRecording:<br>
<br>
  vcr.py --chanid=1021 --delete_while_recording --dst --host=<backend hostname or IP> --length=1 --number=5 --starttime=2020-03-28T13:16 --wrmi<br>
<br>
will create 5 recording rules, 1 minute apart and 1 minute long. --starttime is<br>
in local time and gets converted to UTC for the API.<br>
<br>
30 seconds (length/2) after --starttime the 1st recording and it's rule are<br>
deleted. Then every minute (length), the next recording and rule are deleted.<br>
<br>
The --dst switch is a kludge and subtracts 3600 seconds from --starttime. Works<br>
for North America.<br>
<br><br></blockquote><div>Hi all,</div><div><br></div><div>Thanks for the scripts. They do come close but I still miss a bit.</div><br><div>David, your description is spot on.</div><div>The crucial point is that I need to delete a recording in progress as often as possible.</div><div>Reproducing the problem takes usually about 3 to 10 deletes before the crash happens and this is still somewhat doable by hand.<br></div><div>However, to evaluate the effectiveness of various workarounds and maybe even fixes I want at least 100 deletes to be successful.<br></div><div>Hence the need for automation.</div><div><br></div><div>Ideally I would have two commands:</div><div>- (A) start recording now on a channel, identified by chanid</div><div>- (B) delete the recording that is now being recorded on  channel, identified by chanid</div><div>I can string this together with a trivial bit of bash and do the wait times with sleep commands.</div><div>Something like "while [ 1 ] ; do command_A <chanid>; sleep 10; command_B <chanid>; sleep 10; done".<br></div><div>If command A does return an ID that is to be used by command B then that is OK as well of course.</div><div>A combined script would need 3 parameters, chanid, time_recording and time_idle.<br></div><div><div><div>It looks like the mythtv-record.py comes close as it can do a "stop", it only misses a "delete"command.<br></div></div></div>I'll have a look into the scripts myself as well but I do greatly appreciate help with this as it is a bug that is difficult to catch.</div><br></div></blockquote><div><br></div><div>I did look into the mythtv-record.py script.</div><div>It looks like it can do what I want it to do by creating a Single manual recording (setting wrmi to True in the code was needed).<br></div><div><div> I then hacked a "delete recording" in it, copy&paste of the "stop recording".</div></div><div><br></div><div>Start of recording is OK:</div><div><br></div><div>[klaas@modu MythTVPython]$ ./mythtv-record.py add --chanid 170858 --manual --starttime 2020-03-28T20:00:00 --type Single --title test<br>-1: 170858 NPO 1 Single Record test  Start:2020-03-28T19:00:00Z  End:2020-03-28T20:00:00Z  Priority:0      Inactive:false  Profile:Default RecGroup:Default PlayGroup:Default LastRecorded:      Expire:true <br>Added: "test" (RecordId 3776).</div><div><br></div><div>But the delete of the recording is not:</div><div><br></div><div>[klaas@modu MythTVPython]$ ./mythtv-record.py delete --recordid 3776 --starttime 2020-03-28T20:00:00 --title test<br>Fatal API Error response: Unexpected status returned: 404: Reason: "N/A" URL was: <a href="http://modu.home.lan:6544/Dvr/DeleteRecording?RecordedId=3776">http://modu.home.lan:6544/Dvr/DeleteRecording?RecordedId=3776</a><br>Traceback (most recent call last):<br>  File "./mythtv-record.py", line 1479, in delete_recordingid<br>    resp_dict = backend.send(endpoint=endpoint, rest=rest, opts=opts)<br>  File "/home/klaas/mma-sat/usr/lib/python3.7/site-packages/MythTV/services_api/send.py", line 261, in send<br>    reason, url))<br>RuntimeError: Unexpected status returned: 404: Reason: "N/A" URL was: <a href="http://modu.home.lan:6544/Dvr/DeleteRecording?RecordedId=3776">http://modu.home.lan:6544/Dvr/DeleteRecording?RecordedId=3776</a><br></div><div><br></div><div>Looks to me that the python code does what it should do but that maybe the Dvr/DeleteRecording is not available?<br></div><div><br></div><div>Thanks,</div><div>Klaas.<br></div><div><br></div><div><br></div></div></div>