NextPVR Forums
  • ______
  • Home
  • New Posts
  • Wiki
  • Members
  • Help
  • Search
  • Register
  • Login
  • Home
  • Wiki
  • Members
  • Help
  • Search
NextPVR Forums Public Add-ons (3rd party plugins, utilities and skins) Old Stuff (Legacy) GB-PVR Support (legacy) v
« Previous 1 … 394 395 396 397 398 … 1231 Next »
Batch file query

 
  • 0 Vote(s) - 0 Average
Batch file query
Caseyjones
Offline

Member

Posts: 119
Threads: 38
Joined: Oct 2007
#1
2007-12-27, 10:21 AM
Sorry if this is the wrong thread.

I'm looking to write a RecordingStatus.bat file to update my LCD display.

Part of the code is shown below


set count=1

Rem Check current recordings

for /F "tokens=1 delims=#" %%a in ('gbpvrcli.exe /inprogress /mes "{Title}"') do (

if "%count%" == "4" echo %%a > lcd/fourth.txt
if "%count%" == "3" echo %%a > lcd/third.txt
if "%count%" == "2" echo %%a > lcd/second.txt
if "%count%" == "1" echo %%a > lcd/first.txt

set /a count=count+1

echo %count%

)

if "%count%" == "5" goto five

REM Less than 4 recordings got. Pad missed files




The aim is to get upto four recordings listed into four separate files and then display on the LCD, however I need to handle when there are less than 4 recordings active which requires me to keep a count of how many I have.

Currently count only ever has a value of 1. It never seems to be incremented.

Any ideas from the batch experts out there?
Caseyjones
Offline

Member

Posts: 119
Threads: 38
Joined: Oct 2007
#2
2007-12-27, 10:45 AM
Regarding RecordingStatus.bat, if 2 recordings are started at the same time will this batch file be called twice?.

If one starts and one finishes at the same time will this batch file be called twice?.
pBS
Offline

Posting Freak

Posts: 4,829
Threads: 182
Joined: Aug 2005
#3
2007-12-27, 07:42 PM (This post was last modified: 2007-12-29, 08:10 AM by pBS.)
i made a batch file to do just that...but i write output to registry so i can read it with lcd smartie and display..Big Grin

i set mine up to reflect 'sleeping' when no cards are active, and echo the tray apps info for up to 4 or 5 cap cards when they're recording.....
it adds them together as a string instead of separate files...tho you could do that also...

note: %2 is the string from the tray...%1 is just a y/n recording status..

Code:
@echo off
for /f "usebackq delims=: tokens=1,2,3,4,5,6,7,8,9,10" %%f in ('%2') do (
set src1=%%g
set cap1=%%h
set src2=%%i
set cap2=%%j
set src3=%%k
set cap3=%%l
set src4=%%m
set cap4=%%n
)
echo %cap1% %cap2% %cap3% >"%~dp0rcstatus.log"
:: "%~dp0status.txt"
set cap01=%cap1:~0,-3%
set cap02=%cap2:~0,-3%
set cap03=%cap3:~0,-3%
set cap04=%cap4:~0,-1%
echo %cap01% -- %cap02% -- %cap03% -- %cap04%>"%~dp0rcstatus.log"

call :send
goto :eof

:send
if not "%cap01%" EQU "Sleeping" set out=%src1%:%cap01%
if not "%cap02%" EQU "Sleeping" set out=%out% %src2%:%cap02%
if not "%cap03%" EQU "Sleeping" set out=%out% %src3%:%cap03%
if not "%cap04%" EQU "Sleeping" set out=%out% %src4%:%cap04%
if "%out%" == "" set out=Sleeping[b]
::this line does all the output work
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\devnz" /v "recstatus" /d "%out%" /f [/b]
just change the bold part to output a single file with %out% or echo the individual %cap0x% > file for individual ones..
eg: echo %src01%-%cap01%>first.txt
Hardware: HDHR Prime, HDPVR 1212, Raspberry pi2, VFD display w/LCDSmartie
pBS
Offline

Posting Freak

Posts: 4,829
Threads: 182
Joined: Aug 2005
#4
2007-12-27, 07:43 PM
oh and it doesn't need to call the batch file twice for simultaneous recordings..
[this updates all cap sources at once on each run]
Hardware: HDHR Prime, HDPVR 1212, Raspberry pi2, VFD display w/LCDSmartie
Caseyjones
Offline

Member

Posts: 119
Threads: 38
Joined: Oct 2007
#5
2007-12-27, 09:43 PM
OK I'll give this a try.

Should I name the batch file RecordingStatus.bat and place in the gbpvr directory?

Do I need to restart any of the services so this file can be seen?
pBS
Offline

Posting Freak

Posts: 4,829
Threads: 182
Joined: Aug 2005
#6
2007-12-27, 11:54 PM
yes, rename to RecordingStatus.bat and place in gbpvr dir..
if need to access current dir from batch file, need to use %~dp0 for same dir as batch file...[say, to output files in this dir would be 'echo %cap01%>%~dp0first.txt ]

no restart needed, it runs the file anytime it finds it in gbpvr dir..Smile
Hardware: HDHR Prime, HDPVR 1212, Raspberry pi2, VFD display w/LCDSmartie
Caseyjones
Offline

Member

Posts: 119
Threads: 38
Joined: Oct 2007
#7
2007-12-28, 05:00 PM
I have created the following commands in RecordingStatus.bat in the gbpvr directory.

echo starting >%~dp0rs.output

echo %0 >>%~dp0rs.output

echo . >>%~dp0rs.output

echo %1 >>%~dp0rs.output

echo . >>%~dp0rs.output

echo %2 >>%~dp0rs.output

echo . >>%~dp0rs.output

echo %3 >>%~dp0rs.output

echo done >>%~dp0rs.output

I would expect whenever a recording action starts/stops the rs.output in gbpvr directory should be re-created. At the moment I am getting nothing.

Its obviously something stupid that I am doing but I can't see the wood for the trees Smile
pBS
Offline

Posting Freak

Posts: 4,829
Threads: 182
Joined: Aug 2005
#8
2007-12-29, 02:41 AM (This post was last modified: 2007-12-29, 07:42 AM by pBS.)
it's not %1...i create the variables in the for loop...
%1 is only a y or n depending on if you're recording anything on any tuner..
%2 is ALL the data for all capture cards and has to be 'cut' up to get the individual cards data...

i cut that data up into %src01% [source name] %cap01% [what it's doing]
for 1 thru 4 sources..

so here it is assuming you still want those same file names output..
Code:
@echo off

for /f "usebackq delims=: tokens=1,2,3,4,5,6,7,8,9,10" %%f in ('%2') do (
set src1=%%g
set cap1=%%h
set src2=%%i
set cap2=%%j
set src3=%%k
set cap3=%%l
set src4=%%m
set cap4=%%n
)
echo %cap1% %2 %3 >>"%~dp0rcstatus.log"
:: "%~dp0status.txt"
set cap01=%cap1:~0,-3%
set cap02=%cap2:~0,-3%
set cap03=%cap3:~0,-3%
set cap04=%cap4:~0,-1%
echo %cap01% -- %cap02% -- %cap03% -- %cap04%>"%~dp0rcstatus.log"

call :send
goto :eof

:send
::this line does all the output work
echo %cap01% >"%~dp0first.txt"
echo %cap02% >"%~dp0second.txt"
echo %cap03% >"%~dp0third.txt"
echo %cap04% >"%~dp0fourth.txt"
just save as is in gb dir and you'll be set..
[needed quotes around %~Dp0 as it's probably "c:\program files\devnz\gbpvr\"]
Hardware: HDHR Prime, HDPVR 1212, Raspberry pi2, VFD display w/LCDSmartie
Caseyjones
Offline

Member

Posts: 119
Threads: 38
Joined: Oct 2007
#9
2007-12-29, 12:10 PM
OK I try your script, mine was just to see what parameters are passed and check the batch file is actually running
Caseyjones
Offline

Member

Posts: 119
Threads: 38
Joined: Oct 2007
#10
2007-12-29, 08:48 PM
No Dice.

I have copied you program to RecordingStatus.bat and placed in the gbpvr directory (Does it need to be in one of the sub folders?). It either isn't running or is running but not creating any output.

I am running 1.1.5, do I need to enable anything to get it to work?
« Next Oldest | Next Newest »

Users browsing this thread: 1 Guest(s)

Pages (2): 1 2 Next »


Possibly Related Threads…
Thread Author Replies Views Last Post
  file types of recorded TV paul1 3 3,762 2012-09-30, 05:20 PM
Last Post: sub
  Query : How to use multiple TV Cards (thru GB-PVR) in a Desktop Computer? seymoria 7 4,719 2011-09-07, 08:17 PM
Last Post: martint123
  No Data In the Recorded File zb1 5 2,356 2010-08-24, 01:08 AM
Last Post: zb1
  Path to file being recorded. brianj 5 2,427 2010-08-08, 10:58 PM
Last Post: brianj
  error: failure playing back file yonu 4 2,121 2010-07-12, 12:52 AM
Last Post: yonu
  UK Freesat Scan.cache File jeffers 3 2,133 2010-05-25, 10:34 PM
Last Post: jeffers
  3 AC3Filter instances when playing back a still recording TS file? jksmurf 3 1,991 2010-05-17, 12:30 AM
Last Post: jksmurf
  Recording stops at 4gb file size experiencebliss 5 2,479 2010-05-04, 02:54 AM
Last Post: pBS
  Hauppage HVR-950q, no file created when recording, no pause. donbrowne 5 2,106 2010-04-08, 04:03 PM
Last Post: sub
  ffdshow postprocessing on .ts file playback alibert 2 1,742 2010-04-05, 05:33 AM
Last Post: alibert

  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Designed by D&D, modified by NextPVR - Powered by MyBB

Linear Mode
Threaded Mode