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

Stephen Worthington stephen_agent at jsw.gen.nz
Sun Aug 9 14:20:49 UTC 2015


On Sun, 9 Aug 2015 13:24:49 +0100, you wrote:

>Hello,
>
>I've already posted this on the forum, I guess it's no harm to post it 
>here as well. Otherwise, I apologize.
>
>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.
>
>Any help is appreciated.
>
>Regards,
>jss

My guess would be that since you are not recording using a regular
tuner, the file has not actually been created.  TuningNewRecorder has
created a name for the file, and run the algorithm to select which
recording location to use and cleared space for the file to start
being written to. Then it has reported both of the directory and
filename as one long put together full path in the log.  But as no
tuner was being used, there was no data to write to the file, and
consequently the file was never actually written to, and so never
existed.  Then when your script runs, MythTV looks for the file, which
it has the name for in the database, using the normal lookup process
that looks in all storage groups for it.  But of course can not find
it.  So it reports that it is unable to find the file in the %DIR%
parameter, and the file name in %FILE%.

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.
  


More information about the mythtv-users mailing list