NextPVR Forums
  • ______
  • Home
  • New Posts
  • Wiki
  • Members
  • Help
  • Search
  • Register
  • Login
  • Home
  • Wiki
  • Members
  • Help
  • Search
NextPVR Forums General General Discussion v
« Previous 1 … 110 111 112 113 114 … 159 Next »
detect Active or Idle ?

 
  • 0 Vote(s) - 0 Average
detect Active or Idle ?
silver217
Offline

Member

Posts: 51
Threads: 17
Joined: Oct 2006
#1
2006-10-20, 11:26 AM
Ideally I like to hibernate my PVR computer after scheduled recordings are done and wake-up just before the next one.
I read here that it is a complex thing to do, therefore my approach is
this:

I like to make a (bat, or AutoIt) program that shutsdown my PVR computer
when it is doing nothing but after 02:00 and wakeup at 17:55 each day.

How can I detect a recording activity on a remote computer ?

using sysinternals PSLIST shows all processes, but process GBPVRRecordingService is always listed, idle or active ?
replaytv
Offline

Senior Member

Posts: 352
Threads: 22
Joined: Oct 2004
#2
2006-10-20, 12:14 PM
silver217 Wrote:Ideally I like to hibernate my PVR computer after scheduled recordings are done and wake-up just before the next one.

Silver217,

I am doing this all the time. You need to use the psshutdown from sysinternal and put it in your postprocessing and parallelprocessing.bat to hibernate the computer and cancel the hibernate process. Since I only use MVP to view video so this is an ideal solution where I don't see the count down of the psshutdown utility. Turn off the window manage hibernate if you use this method.

Also you can use new blinky plugin or SlimGBPVR to know the recording status if you have multiple capture cards.

Dan L.

Sample of Postprocessing.bat

RenameRecording.exe %1 >> rename.log
ping -n 10 127.0.0.1
psshutdown -a

recstatus time=5 silent=yes
if Errorlevel 2 goto recording
if Errorlevel 1 goto recording
if Errorlevel 0 goto removerec

:recording
echo >> c:\recording.dat
goto end

:removerec
del c:\recording.dat
goto end


:end
call c:\shutdown.bat



Sample of shutdown.bat

if exist c:\recording.dat goto end

if exist c:\restart.dat goto restart

IF exist c:\now.dat GOTO found

psshutdown -a
ping -n 2 127.0.0.1
psshutdown -f -h -t 7700
GOTO end

:found
psshutdown -a
ping -n 2 127.0.0.1
psshutdown -f -h -t 60
goto end

:restart
psshutdown -a
del c:\restart.dat
ping -n 2 127.0.0.1
psshutdown -f -r -t 3
goto end

:end
::
Dell Dual Core 6400 XP Pro, PVR500, HVR-1600, MVPs on Belkin wireless bridge
silver217
Offline

Member

Posts: 51
Threads: 17
Joined: Oct 2006
#3
2006-10-20, 12:31 PM
thanks a lot, perfect help !!!
K.S.
Offline

Senior Member

Posts: 526
Threads: 12
Joined: Oct 2006
#4
2006-10-20, 02:01 PM (This post was last modified: 2007-10-16, 04:42 PM by K.S..)
it get's a little more complicated if you also want to check for client (MVP, another PC) activitiy, pending recordings.

at the moment, i'm building up a more complex checking batch, take a lock at the following. i'm still trying to figure a way to detect client activity (navigation on menues, video/audio playback) to integrate it into a batch file.

BleepBloop plugin at least is the right idea for the navigation issue, it just needs to be adapted to keep track of the last activity time... as to be used for checking "user felt asleep navigating menues 30 minutes ago, let's standby"

i'm curios if anybody knows how to check for video/audio playback besides cpu usage (for other reasons not the wanted indicator ;-)

--postprocessing.bat

@echo off

rem <user_defined_values>

rem changable settings are defined and documented within the <user_defined_values> block
rem standby is used as placeholder to standby / hibernate (depends on power config)

rem prerequisites: working GBPVRcli with tokens used within this batch supported
rem tokens currently used: {MinutesToEndWithPadding} {RecordingLengthWithPadding} {StartTimeWithPadding} {Title}

rem change the following line to the path where GBPVR & GBPVRcli are installed if not default progs-dir
set gbpvr_dir=%ProgramFiles%\devnz\gbpvr

rem change time_to_check to value in minutes to check for pending recordings before initiating standby
rem i.e. makes no sense to standby / hibernate with the next recording scheduled within 15 minutes...
set time_to_check=60

rem change the following line use yes/no to enabled/disable logging
set logging_enabled=yes
set logging_to_file=%gbpvr_dir%\check_status_befor_standby.log

rem change the following lines to create your own messages if you want to keep some logfile
rem message is composed like {Title} message_part_1 {StartTimeWithPadding} message_part_2
set message_part_1=is pending to be recorded in
set message_part_2=minutes

rem change the following line to reflect your system language
rem change ESTABLISHED to i.e. established or whatever is displayed in netstat under the Status row
rem be careful about umlaut or other non-standard characters, notepad i.e. doesn't use the right DOS chars for these ;-)
set status_connected=ESTABLISHED

rem change the following lines to the ports to check, GBPVR by default uses 7967 & 7968 (?) for PC-Client
set port=7967
set port2=7968

rem </user_defined_values>

rem <pending_recording_check>

set pending_recording=no

for /F "tokens=1,2,3,4 delims=#" %%a in ('%gbpvr_dir%\GBPVRcli /pending /message "{MinutesToEndWithPadding}#{RecordingLengthWithPadding}#{StartTimeWithPadding}#{Title}"') do (

rem Setlocal EnableDelayedExpansion needed to get the current values inside for-loop
Setlocal EnableDelayedExpansion

rem initialize calculation of variable e = MinutesToStartWithPadding & some math
set e=0
set /a "e=!e!+%%a-%%b"

if !e! LSS %time_to_check% (
if %logging_enabled%==yes (echo %date% %time% %%d %message_part_1% !e! %message_part_2% at %%c >> %logging_to_file%)

rem Endlocal needs to be set inside the for-loop to preserve the pending_recording value beyond for-loop
Endlocal
set pending_recording=yes
)
)

if %logging_enabled%==yes (echo %date% %time% pending recording = %pending_recording% >> %logging_to_file%)
rem </pending_recording_check>

rem <client_connected_check>

set client_connected=no

for /F "tokens=2,3,4,5,6 delims=: " %%i in ('netstat -an') do (
rem echo %%i $ %%j $ %%k $ %%l $ %%m
if %%m==%status_connected% (
if NOT %%i==%%k (
if %%j==%port% (
if %logging_enabled%==yes (echo %date% %time% Client %%k is connected to local port %%j >> %logging_to_file%)
set client_connected=yes
)
rem copy the following 4 lines to add an additional port to check
if %%j==%port2% (
if %logging_enabled%==yes (echo %date% %time% Client %%k is connected to local port %%j >> %logging_to_file%)
set client_connected=yes
)
)
)
)

if %logging_enabled%==yes (echo %date% %time% client connected = %client_connected% >> %logging_to_file%)
rem </client_connected_check>

rem <suspend_possible_check>

set suspend_possible=no

if %client_connected%==no if %pending_recording%==no if %local_client_activity%==no (
set suspend_possible=yes
)

if %logging_enabled%==yes (echo %date% %time% suspend possible = %suspend_possible% >> %logging_to_file%)

rem </suspend_possible_check>

if %suspend_possible%==yes (

rem insert your own code here to hibernate/standby/shutdown your computer
rem use i.e. psshutdown from sysinternals/microsoft
rem dont' use "rundll32.exe powrprof.dll,SetSuspendState", that caused my box
rem to not automaticaly wake up for recordings Sad

)

--postprocessing.bat
sub Wrote:Yep, what he said.

curiosity killed the cat Big Grin
« Next Oldest | Next Newest »

Users browsing this thread: 1 Guest(s)



Possibly Related Threads…
Thread Author Replies Views Last Post
  Getting Windows to detect a hard drive Deadpool 5 2,440 2006-07-06, 05:51 PM
Last Post: Deadpool

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

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

Linear Mode
Threaded Mode