VBScript to Standby TV server with options and using PSS++ (1 Viewer)

TiboTv

Portal Pro
June 22, 2009
244
39
Home Country
Belgium Belgium
Hi,

I wrote this little vb script to solve 2 problems that can't be solved with PowerScheduler or PowerScheduler++ plugins :

1) I want to standby my TV server when there's no more "TV activities" (live streaming, recordings,...) even if one or more clients are still one. This idea come from the fact that my tv server is on about 6 hours a day (when clients are running to watch tv series, movies, listen music ) to do nothing! Now with my VBScript, Tv server is only on when needed (about 2 hours a day). So when I'm not using tv service on clients, after a while the tv server goes into standby, I get a "tv connexion lost" message on clients but everything is still running (database are local and medias are on a NAS). When I need tv service again, I enter into TV pages and WOL PowerMgt plugin send a WOL message to wake up my TV server.
2) With PowerScheduler and PowerScheduler++, we can start a batch file when entering in a standby mode but the plugin can't wait until the end of the batch file cause windows has already started the standby process and the batch file has approximately 2sec to do his job.

So this VBscript is just a kind of workaround.

How it works :

The script is started when windows starts (simply by adding a shortcut) and run in background (no interface).
The script need PowerScheduler ++ installed. The script periodically check the TV log file to find and interpret power scheduler ++ messages. When all messages of tv log file are read, the script check if a standby can be started or not and when this standby can be started. If conditions remain the same until a idle timeout (which must be smaller than the PSS++ or Windows idle timout), the script start a batch file to execute a custom action, wait the end of the batch file and start a second batch file to start the windows standby.

This script works fine for now about one week and I thing it could be interesting for some of you. This is VB script so you can edit and change it to get what you want if needed.

If you try this script and get issues, don't hesitate to give me feedback but I have not many times to improve this script. If you want to report an issues, please post tv log file and also script log file.

I only tested on my home configuration : Multiseat setup with one dedicaced TV server and 3 MP clients. Tested on both MP1.3 and MP1.4. Pay attention that log files are different from these 2 MP versions and a flag must be changed in the script config file to indicated if you use MP1.3 or MP1.4

TODO List : Improvement :
- Get windows standby timeout value in vbscript : If someone could help, it's great because I don't fin anyway to do it.

Who to install :

- Copy the attached files on your TV server (eg : C:\StandbyTVServer)
- Edit StandbyTVServer.config to change some settings
- Edit Custom.bat and standby.bat files
- Start the StandbyTVServer.vbs
- Check the result into StandbyTVServer.log
 

Attachments

  • StandbyTVServer.zip
    4.6 KB
Last edited:

doveman

Portal Pro
February 12, 2008
2,326
178
Home Country
United Kingdom United Kingdom
I guess what we really want is for Mediaportal to be modified so that it doesn't send keep-alive messages to the server unless it's using the TV functions but in the meantime, good job coming up with this workaround TiboTV.
 

TiboTv

Portal Pro
June 22, 2009
244
39
Home Country
Belgium Belgium
Yes you're right. This is what we need and what I've asked to @michael_t without succes :-( my workaround is just a way to make it working at home. I hope that one day this option comes. The ideal one is on client side as it's the most flexible: you can chose which client keep or not alive the server when tv service is not needed.
 

Users who are viewing this thread

Top Bottom