|
SageTV Customizations This forums is for discussing and sharing user-created modifications for the SageTV application created by using the SageTV Studio or through the use of external plugins. Use this forum to discuss customizations for SageTV version 6 and earlier, or for the SageTV3 UI. |
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
How do you check if Sage is recording?
So I want to write a little app to Reboot my Windows Sage server every 24 hours at say... 3am. So long as nothing is being recorded at the time.
Is there a xml/txt/cfg etc file I can read/check/parse to see if anything is currently recording before I reboot? Thanks. |
#3
|
||||
|
||||
__________________
Check out my enhancements for Sage in the Sage Customisations and Sageplugins Wiki |
#4
|
||||
|
||||
I remember someone posting a script a few months back that checked the drive space on each recording drive, then compared it a few moments later, and if the disk space free hadn't changed (no recordings happening), then it would reboot the PC.
I can't find it anywhere at the moment but it should be on the forum somewhere, but the plugin that was mentioned by a much more experienced sage user than myself may well be a better way to do it. |
#5
|
|||
|
|||
Here is the script below I have it setup to check 5 drives. You can tailor to your needs. I usually have it run at 6:00am...but you can set it anytime.
do 'WScript.sleep(1 * 1000) Set objFSO = CreateObject("Scripting.FileSystemObject") secondstowait=60 Set objDrive = objFSO.GetDrive("M:") Set objDrive2 = objFSO.GetDrive("N:") Set objDrive3 = objFSO.GetDrive("O:") Set objDrive4 = objFSO.GetDrive("T:") Set objDrive5 = objFSO.GetDrive("U:") diskm1=objDrive.DriveLetter & "=" & objDrive.AvailableSpace diskn1=objDrive2.DriveLetter & "=" & objDrive2.AvailableSpace disko1=objDrive3.DriveLetter & "=" & objDrive3.AvailableSpace diskt1=objDrive4.DriveLetter & "=" & objDrive4.AvailableSpace disku1=objDrive5.DriveLetter & "=" & objDrive5.AvailableSpace Wscript.Sleep (secondstowait * 1000) Set objDrive = objFSO.GetDrive("M:") Set objDrive2 = objFSO.GetDrive("N:") Set objDrive3 = objFSO.GetDrive("O:") Set objDrive4 = objFSO.GetDrive("T:") Set objDrive5 = objFSO.GetDrive("U:") diskm2=objDrive.DriveLetter & "=" & objDrive.AvailableSpace diskn2=objDrive2.DriveLetter & "=" & objDrive2.AvailableSpace disko2=objDrive3.DriveLetter & "=" & objDrive3.AvailableSpace diskt2=objDrive4.DriveLetter & "=" & objDrive4.AvailableSpace disku2=objDrive5.DriveLetter & "=" & objDrive5.AvailableSpace if diskm1=diskm2 and diskn1=diskn2 and disko1=disko2 and diskt1=diskt2 and disku1=disku2 then 'msgbox "equal will reboot" Set objShell = CreateObject("WScript.Shell") objShell.Run "s:\ResstartServer.bat",2,true else 'msgbox "not equal will not reboot" end if loop ResstartServer.bat below "s:\Program Files\SageTV\SageTV\SendMessage.exe" -C SageClientApp -N SageWin -m 16 0 0 "s:\Program Files\SageTV\SageTV\SendMessage.exe" -C SageApp -N SageWin -m 16 0 0 net stop dirmon2 net stop SageTV shutdown -r -f
__________________
Channels DVR UBUNTU Server 2 Primes 3 Connects TVE SageTV Docker with input from Channels DVR XMLTV and M3U VIA Opendct. Last edited by nyplayer; 12-02-2006 at 05:15 AM. |
#6
|
|||
|
|||
Just out of curiousity (sp?), why do people need to reboot every day? Is this needed for some other program?
That script looks like a good plan. I'd add my $0.02 though, and would say it would be better to schedule it at the quarter, even increments of an hour, say, 3:15AM, or 6:45AM, that way, 99.99% of the time, using this script will have no effect on your recordings (for instance, if the script checked to see that the drive space was not changing, but at some time a few seconds after the check, a recording was scheduled). I would think the 16 minutes is a bit excessive, or is it because it needs to be a fairly large difference before the script will notice it? In other words, what I'm saying, is that maybe check within 4-5 minutes, and then the reboot should be finished before the next quarter hour is over, hopefully taking into account any padding for shows.
__________________
-Jason |
#7
|
|||
|
|||
The Script checks then waits only 1 minute 60 seconds to check the second time. see "secondstowait=60" and that can be changed to your preference.
I chose my time because it works best for me. Also it is a good time to backup your wiz.bin etcc.. at that time just after sagetv shutdown and before restart-reboot. I reboot because I do a lot of Archiving and I move some series to an external drive. So I prefer a fresh Start. Below is my full restart batch file. tskill wscript /a "s:\Program Files\SageTV\SageTV\SendMessage.exe" -C SageClientApp -N SageWin -m 16 0 0 "s:\Program Files\SageTV\SageTV\SendMessage.exe" -C SageApp -N SageWin -m 16 0 0 net stop dirmon2 net stop SageTV move m:\sagem\StarTrek*.avi t:\importt move n:\sagen\StarTrek*.avi t:\importt move o:\sageo\StarTrek*.avi t:\importt move m:\sagem\StarTrek*.avi u:\importu move n:\sagen\StarTrek*.avi u:\importu move o:\sageo\StarTrek*.avi u:\importu move m:\sagem\TheOuterLimits*.avi t:\importt move n:\sagen\TheOuterLimits*.avi t:\importt move o:\sageo\TheOuterLimits*.avi t:\importt move m:\sagem\TheOuterLimits*.avi u:\importu move n:\sagen\TheOuterLimits*.avi u:\importu move o:\sageo\TheOuterLimits*.avi u:\importu move m:\sagem\Smallvil*.avi t:\importt move n:\sagen\Smallvil*.avi t:\importt move o:\sageo\Smallvil*.avi t:\importt move m:\sagem\Smallvil*.avi u:\importu move n:\sagen\Smallvil*.avi u:\importu move o:\sageo\Smallvil*.avi u:\importu cd U:\backujaned\janeds\public\wizbin\ U: del wiz_9.bin ren wiz_8.bin wiz_9.bin ren wiz_7.bin wiz_8.bin ren wiz_6.bin wiz_7.bin ren wiz_5.bin wiz_6.bin ren wiz_4.bin wiz_5.bin ren wiz_3.bin wiz_4.bin ren wiz_2.bin wiz_3.bin ren wiz_1.bin wiz_2.bin ren wiz.bak wiz_1.bin xcopy /y "S:\Program Files\SageTV\SageTV\wiz.bak" shutdown -r -f
__________________
Channels DVR UBUNTU Server 2 Primes 3 Connects TVE SageTV Docker with input from Channels DVR XMLTV and M3U VIA Opendct. Last edited by nyplayer; 12-02-2006 at 09:52 AM. |
#8
|
||||
|
||||
Hey nyplayer,
That script looks interesting. I wonder if I can tailor some of it to my needs. Any Dirmon people? I record quite a bit of shows and have Dirmon and VideoReDo setup to scan for commercials automatically, then I check and batch cut them and at some point I use Staxrip with X264 batch mode to encode them. What I would like to do is have Dirmon check for the resulting *.mp4 file and move it to it's appropriate import folder and then delete the 6 or 7 files created by Staxrip and finally refresh import folders. Does refresh importt folders have a way to run outside of sage?
__________________
If this doesn't work right, Then: "I'm going to blow up the Earth!" |
#9
|
|||
|
|||
seems like the only thing this won't account for is if the time to reboot is longer than the time until the next recording needs to start...
And yeah, sometimes there are shows on Comedy Central at 3:30am.... Why not go Linux if rebooting is an issue? |
#10
|
|||
|
|||
Quote:
__________________
Channels DVR UBUNTU Server 2 Primes 3 Connects TVE SageTV Docker with input from Channels DVR XMLTV and M3U VIA Opendct. |
#11
|
||||
|
||||
Kind of on Topic...
Can somebody help me write a script just to use the move command? I created a move.cmd file with the following line: move s:\Done\Done\StargateSG1*.mp4 I:\TV2\TV2\SciFi Series\StarGate Series\SG1 I tried it in a command prompt and get a syntax error. Is this because it uses dos naming convention? Is there a better file type to use than .cmd?
__________________
If this doesn't work right, Then: "I'm going to blow up the Earth!" |
#12
|
|||
|
|||
Put Quotes around it.
also why do use a command why not a batch file ..... name it whatever.bat move "s:\Done\Done\StargateSG1*.mp4" "I:\TV2\TV2\SciFi Series\StarGate Series\SG1"
__________________
Channels DVR UBUNTU Server 2 Primes 3 Connects TVE SageTV Docker with input from Channels DVR XMLTV and M3U VIA Opendct. |
#13
|
||||
|
||||
The real question is not whether Sage is recording anything right now. It's whether Sage wants to record anything in the next few minutes. No simple disk space check can tell you that for certain; for that you need to look at the recording schedule.
Seems to me it wouldn't be that hard to write an STVI that uses the RecordingScheduleChanged hook to write out the time of the next scheduled recording to an external text file. Then your reboot script could check that file and decide whether it has enough time to do what it needs to do.
__________________
-- Greg |
#14
|
||||
|
||||
Quote:
Thanx, I actually did change it to move.bat and I just changed my import directories to have no spaces. Now here is another issue: I setup Staxrip to batch encode sometimes 10+ files. I would LOVE to be able to put them away and clean up the staxrip temp files (About 7-8 of them)so this is what I have so far: move s:\Done\Done\BattlestarGalactica*.mp4 I:\TV2\TV2\SciFi\BSG\SG1 "Moves encoded file" move s:\Done\Done\BattlestarGalactica*.my I:\TV2\TV2\SciFi\BSG\SG1 "Moves video detail file" DEL s:\Done\Done\BattlestarGalactica*.* "Deletes all the remaining files created by Staxrip" move s:\Done\Done\StargateSG1*.mp4 I:\TV2\TV2\SciFi\StarGate\SG1 move s:\Done\Done\StargateSG1*.my I:\TV2\TV2\SciFi\StarGate\SG1 DEL s:\Done\Done\StargateSG1*.* I have DIRMON setup to process the move.bat file when there is .mp4 files present in the directory but say Staxrip does BattlestarGalactica first, I do not want it to delete all the Stargate files. Is there a way to do something like: if BattlestarGalactica*.mp4 move s:\Done\Done\BattlestarGalactica*.mp4 I:\TV2\TV2\SciFi\BSG\SG1 move s:\Done\Done\BattlestarGalactica*.my I:\TV2\TV2\SciFi\BSG\SG1 then DEL s:\Done\Done\BattlestarGalactica*.*
__________________
If this doesn't work right, Then: "I'm going to blow up the Earth!" Last edited by dvd_maniac; 12-02-2006 at 01:38 PM. |
#15
|
|||
|
|||
Quote:
IF NOT EXIST <filename> GOTO STEP2 REM Do the next action only if the file exists DEL <filename> :STEP2 REM Do the following in all cases DEL <anotherfile> Is this what you want? Andy. |
#16
|
||||
|
||||
Say I recorded 2 shows on Friday night.
Battlestar Galactica and SG1. I record to S:\Recordings directory. Then I cut out the Commercials and save them both into S:\Done folder So I have 2 files there now S:\Done\BattlestarGalactica-UnfinishedBusiness.mpg S:\Done\StargateSG1-Icon.mpg I then use Staxrip to encode them into H.264 which takes about 1 hour for each file to encode. So after I import them into Staxrip batch mode it creates a couple of temp files for each file in Staxrip's batch mode that it leaves. EX: BattlestarGalactica-UnfinishedBusiness.avs BattlestarGalactica-UnfinishedBusiness.d2v BattlestarGalactica-UnfinishedBusiness.mpa BattlestarGalactica-UnfinishedBusiness.rip BattlestarGalactica-UnfinishedBusiness_AUDIOOUTPUT.mp4 So now after BattlestarGalactica-UnfinishedBusiness.mp4 is created Dirmon will see it and run the .bat file Now in the folder I have the 2 mpeg files the BSG mp4 file and all the temp files for both videos. I want the batch file to move the BattlestarGalactica-UnfinishedBusiness.mp4 file to it's prope import directory and delete all the BattlestarGalactica*.* temp files. But I do not want it to delete ANY of the SG1 files because there is no correspoding mp4 file for SG1. So in short I want to put all my favorites that I encode and archive in this batch file. But when it goes through the batch file if there is not yet an .mp4 file for that favorite then skip it. If there is nothing to move then do not delete anything. Hope I am being clear enough. I am getting myself a little confused here....
__________________
If this doesn't work right, Then: "I'm going to blow up the Earth!" |
#17
|
|||
|
|||
Maniac What you are doing is a bit dangerous. As you stated you might lose some good mp4s.
If you are familar with DIRMON2 you can use something like this below. Your Target would be MP4 and your trigger could be something when Staxrip completes. This will move the MP4 to a staging folder (instantly) cleanup the Staxrip files by name. Then move according to where you want them to go. move.bat md %~d1%\STAGING move %~f1 %~d1%\STAGING move %~d1%~p1%~n1.my %~d1%\STAGING del %~d1%~p1%~n1.* move %~d1%\STAGING\BattlestarGalactica*.* I:\TV2\TV2\SciFi\BSG\SG1 move %~d1%\STAGING\StargateSG1*.* I:\TV2\TV2\SciFi\StarGate\SG1
__________________
Channels DVR UBUNTU Server 2 Primes 3 Connects TVE SageTV Docker with input from Channels DVR XMLTV and M3U VIA Opendct. Last edited by nyplayer; 12-02-2006 at 03:51 PM. |
#18
|
||||
|
||||
I planned on using this with Dirmon2. I was going to use .mp4 as the trigger and have it wait until target file is not growing. This works great if only one video is concerned.
A few questions... 1. So the script below will work as move."bat"? 2. Will the script you supplied work only for the corresponding .mp4 file that Dirmon2 passes to it? IE: So if SG1 finishes encoding and creates an .mp4 file the script will move the SG1 file and delete the temp files but won't move or delete the BSG files?
__________________
If this doesn't work right, Then: "I'm going to blow up the Earth!" |
#19
|
||||
|
||||
I tried the script and it creates the Staging folder, moves the .mp4 and .my files into it and that's it. It does not delete the temp files and does not move them from Staging to the import folders. any ideas?
Also, I really appreciate all the help. md %~d1%\STAGING move %~f1 %~d1%\STAGING move %~d1%~p1%~n1.my %~d1%\STAGING del %~d1%~p1%~n1.* move %~d1%\STAGING\BattlestarGalactica*.mp4 I:\TV2\TV2\SciFi\Galactica\2004 move %~d1%\STAGING\StargateSG1*.mp4 I:\TV2\TV2\SciFi\StarGate\SG1 move %~d1%\STAGING\LasVegas*.mp4 T:\TV1\TV\LasVegas
__________________
If this doesn't work right, Then: "I'm going to blow up the Earth!" |
#20
|
|||
|
|||
This should work below . Also for the Temp files if you know the extensions. You can add them below this line del del %~n1.* for ex: del *.tmp etc..
md %~d1%\STAGING move %~f1 %~d1%\STAGING move %~d1%~p1%~n1.my %~d1%\STAGING %~d1% cd %~p1 del %~n1.* del *.tmp cd %~d1%\STAGING %~d1% move %~d1%\STAGING\BattlestarGalactica*.mp4 I:\TV2\TV2\SciFi\Galactica\2004 move %~d1%\STAGING\StargateSG1*.mp4 I:\TV2\TV2\SciFi\StarGate\SG1 move %~d1%\STAGING\LasVegas*.mp4 T:\TV1\TV\LasVegas
__________________
Channels DVR UBUNTU Server 2 Primes 3 Connects TVE SageTV Docker with input from Channels DVR XMLTV and M3U VIA Opendct. Last edited by nyplayer; 12-03-2006 at 02:12 PM. |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|