[mythtv-users] %DIR% doesn't work on EventCmdRecStarted System Event

José Silva jsantossilva at hotmail.com
Sun Aug 9 15:38:10 UTC 2015



On 09-08-2015 16:13, Stephen Worthington wrote:
> On Sun, 9 Aug 2015 15:50:53 +0100, you wrote:
>
>>
>>
>> On 09-08-2015 15:20, Stephen Worthington wrote:
>>> On Sun, 9 Aug 2015 13:24:49 +0100, you wrote:
>>>
>>>> I'm trying to use System Events and Import Recorder to interface an
>>>> Hauppauge HDPVR2 GE plus to mythtv. Hauppauge supplies a software
>>>> package that is not really a driver. The most I can get is a TestApp
>>>> that works like this:
>>>>
>>>> ./HDPVR2-testApp -f video.ts # there are two bin and a settings files
>>>> that must reside in the same dir
>>>>
>>>> So, I want to start this test app by EventCmdRecStarted at System
>>>> events, giving it the %DIR%/%FILE% parameters supplied and it works with
>>>> LiveTV:
>>>>
>>>> cd /home/mythtv/bin/hdpvr2;./HDPVR2-testApp -f %DIR%/%FILE%
>>>>
>>>> But in regular recordings I'm getting this log extract:
>>>>
>>>> Aug  9 12:51:25 golfinho mythbackend: mythbackend[3504]: I TVRecEvent
>>>> tv_rec.cpp:4130 (TuningNewRecorder) TVRec[2]: rec->GetPathname():
>>>> '/home/user/Data/mythtv/recordings/5082_20150809115100.mpg'
>>>>
>>>> Aug  9 12:51:26 golfinho mythbackend: mythbackend[3504]: W SystemEvent
>>>> mythsystemevent.cpp:55 (run) MythSystemEventHandler: Command 'cd
>>>> /home/mythtv/bin/hdpvr2;./HDPVR2-testApp -f
>>>> GetPlaybackURL/UNABLE/TO/FIND/LOCAL/FILE/ON/golfinho/5082_20150809115100.mpg'
>>>> returned 139
>>>>
>>>> Aug  9 12:51:27 golfinho mythbackend: mythbackend[3504]: E HttpServer56
>>>> programinfo.cpp:2358 (GetPlaybackURL)
>>>> ProgramInfo(5082_20150809115100.mpg): GetPlaybackURL:
>>>> '5082_20150809115100.mpg' should be local, but it can not be found.
>>>>
>>>> So, clearly the path has been established on first log, so it exists,
>>>> but second line says that %DIR% has been replaced by something else.
>>>> %FILE% is correct.
>>>>
>>>> Permission have all been checked and, as I already said, it works with
>>>> LiveTV which suggest a mythtv bug.
>>>>
>>
>> Thank you for replying
>>
>>>
>>> My guess would be that since you are not recording using a regular
>>> tuner, the file has not actually been created.
>>
>> Absolutely right. And then EventCmdRecStarted calls:
>> cd /home/mythtv/bin/hdpvr2;./HDPVR2-testApp -f %DIR%/%FILE%
>>
>> and then HDPVR2-testApp creates and starts writing to the file, provided
>> %DIR% and %FILE% are valid, which you can tell by the log %DIR% isn't,
>> although mythtv already determined it, also by the upper log.
>>
>> Everything else is irrelevant.
>>
>> Also, don't forget this works with LiveTV.
>>
>>> When I wrote a similar script to record FM radio from a PVR-500 card,
>>> I ran across this problem and solved it by reading the directory from
>>> the log file.  It is a pain, but does work.  I have put the latest
>>> (updated) versions of my scripts for this on my web server as blind
>>> URLs:
>>>
>>>     http://www.jsw.gen.nz/mythtv/event-start-recording.sh
>>>     http://www.jsw.gen.nz/mythtv/event-finished-recording.sh
>>>     http://www.jsw.gen.nz/mythtv/event_test.sh
>>>
>>> Look for recording_dir in event-start-recording.sh to see how I did
>>> it.  These scripts have not actually been used for a year or more, so
>>> it is possible the log format has changed and it no longer works
>>> properly, so please check first.
>>>
>>
>> Thank you for the pointers, I'm sure I'll have to use them if this bug
>> is not patched, which I'm trying to avoid given that the right approach
>> is so simple.
>>
>> Forgot to say that I'm on 0.27 fixes.
>>
>> Rgds,
>> jss
>
Thank you for your continued interest

> I am not actually sure this is a bug.  It is an oversight in the
> design, for sure, which was not noticed when the Import Recorder
> option was added, but it is a natural consequence of how the tuner
> code is kept separate from the other modules in mythbackend, and the
> fact that the path to recording files is only known at the time the
> tuner is started as it is not recorded in the database like the file
> name is.

Before System Event calls my HDPVR2-testApp, the path and filename are 
completely know of mythtv. Just look at the first log line:
...rec->GetPathname(): 
'/home/user/Data/mythtv/recordings/5082_20150809115100.mpg

And then, one second later, calling my app:
...MythSystemEventHandler: Command 'cd 
/home/mythtv/bin/hdpvr2;./HDPVR2-testApp -f 
GetPlaybackURL/UNABLE/TO/FIND/LOCAL/FILE/ON/golfinho/5082_20150809115100.mpg' 
returned 139

Isn't this a bug?

I would like it to be fixed, but since very little use is
> made of the Import Recorder, it is unlikely to get a high priority
> from the developers.  The best way to get it fixed is likely to submit
> a patch ourselves, but a simple patch is unlikely as anything simple
> would probably break the modular structure of mythbackend.

First, let me tell you that I admire and use mythtv for a number of 
years (6~8?). If only it was solid...

But I also have experience, by past situations, that bug resolving is 
usually very slow or non existent, and resources are placed on new 
functionalities instead of consolidating what's behind. With this policy 
you get a very "shaky" application that only stays upright if you, the 
user, deeply know how to maintain it. But that's my perspective, it's 
probably worth just for myself, not for external approval.

That said, I'm not expecting this problem to be solved soon and so I'm 
already working on a script based on your pointers, thank you.

Regards,
jss


More information about the mythtv-users mailing list