|
SageTV Software Discussion related to the SageTV application produced by SageTV. Questions, issues, problems, suggestions, etc. relating to the SageTV software application should be posted here. (Check the descriptions of the other forums; all hardware related questions go in the Hardware Support forum, etc. And, post in the customizations forum instead if any customizations are active.) |
|
Thread Tools | Search this Thread | Display Modes |
#1
|
||||
|
||||
Running a batch file after recording
Hi
Is there a way to get SageTV to run a batch file after a recording has stopped? I want to create copies of my recordings outside of SageTV. |
#2
|
||||
|
||||
see the external utility Directory Monitor in the customisations sticky
__________________
Check out my enhancements for Sage in the Sage Customisations and Sageplugins Wiki |
#3
|
||||
|
||||
OK, thanks. I will take a look at that tool. But will not this program take hold of the files when the file is created?
Last edited by klunde; 03-21-2006 at 06:57 AM. |
#4
|
||||
|
||||
After fiddling around with DirMon2 I find that it probably can't be used since it grabs the file before it has finnished. As long as what I want to is to copy (and rename) a finnished recording I can't use a program that grabs files still being written to.
The best thing for me would be if there is a possibility to run a batch file when Sage-TV closes a recording, passing the filename to the batch file. Isn't there any way to do that? |
#5
|
|||
|
|||
Here is a simple Script that I use to run after midnight. That will check for activity in the sage folder.. when there is no activity in sage it will restart my computer. Instead of restarting the PC you can have it run a batch job.
do WScript.sleep(200 * 1000) on error resume next dim sage1size dim sage1chk dim filesys folder1="d:\sage1" set objFSO = CreateObject("Scripting.FileSystemObject") Set objFolder = objFSO.GetFolder(folder1) sage1size=objFolder.Size Wscript.Sleep (30000) '30000 milliseconds = 30 seconds set objFSO = CreateObject("Scripting.FileSystemObject") Set objFolder = objFSO.GetFolder(folder1) sage1chk=objFolder.Size if sage1chk=sage1size then Set objShell = CreateObject("WScript.Shell") objShell.Run "shutdown -r -f",0,false 'Put Batch job here else end if loop Last edited by nyplayer; 03-21-2006 at 09:17 AM. |
#6
|
||||
|
||||
Nice one , but I'm not familar with wscript. Does the fact that you have nothing in the ELSE towards the bottom cause an error, which causes it to "resume next"?
Can you just stick all this in a BAT file, or does it have to be named .vbs and called with CSCRIPT or WSCRIPT? Thanks! |
#7
|
|||
|
|||
Just simply save it as VBS. No need for CSCRIPT. You really don't need the on error resume next. As far as the else having nothing that simply does nothing if the folder is recording.
|
#8
|
||||
|
||||
Unfortunelately I can't use this script since you're talking about something that should run once a day. I need to run a batch file after each file has been recorded. And since my SageTV computer is to record 1 hour long files 24/7, this doesn't help me.
|
#9
|
||||
|
||||
Dirmon2 can be set to only work on a file that has no activity.
There is an option in the global settings, I believe, that you simply tick to select only completed files. Seems like this would work for you, in my experience. matt http://www.dragonglobal.org/forums/s...8&postcount=16 |
#10
|
||||
|
||||
And this Dirmon2 is the only way to go? I've tried that program and it has some huge flaws and can't be used. First, it's supposed to support command line variables, but it doesn't work, second, it grabs hold of files in progress even if I've marked "wait until target file is finnished" so it will indeed try to copy/rename my running recording.
When there are so many things that can be customized for SageTV I find it hard to believe that there is no possibility to run a batch file after a recording without having to use an external directory watcher. |
#11
|
||||
|
||||
There is nothing in the sage API that can annouce 'file has finished recording' at a global level (There is a 'RecordingScheduleChanged' hook, but that will be triggered for other reasons too, and is used in various places in the UI).
From the linked thread, Jere knows about the problem where dirmon2 thinks that the file has finished recording when it has not, and will look into it. If you feel like some programming, write something that interfaces with either my external status monitor plugin, or my webserver -- both of which list the currently recording shows. You would have to poll it regularly, and then see when each encoder has started recording something different to trigger your action. Otherwise, you would have to write your own plugin that works with the Sage API directly.
__________________
Check out my enhancements for Sage in the Sage Customisations and Sageplugins Wiki |
#12
|
||||
|
||||
Hmm. I might gonna have a try to look into the SageTV Api when I find some more time... For now I think I'v managed to get around the problems with DirMon2 by using this batchfile:
Code:
@echo off set a_channelname=unknown set a_targetpath=D:\Temp set a_FullFileSpec=%1 ::set a_FullFileSpec=F:/Recordings/SageTV/30692_80_0320_1700-0.mpg set a_FullFileSpec=%a_FullFileSpec:/=\% for /F "TOKENS=1-8* DELIMS=_-.=" %%A in ('set a_FullFileSpec') DO (set a_ChannelID=%%D&set a_Date=%%E&set a_Time=%%F&set a_drive=%%~dC&set a_path=%%~pC&set a_pre=%%~nC&set a_part=%%G&set a_ext=%%H) goto %a_ChannelID% goto continue :63 set a_channelname=TVN goto continue :76 set a_channelname=NRK2 goto continue :80 set a_channelname=NRK1 goto continue :85 set a_channelname=TV2 goto continue :109 set a_channelname=TV3 goto continue :continue ren %a_FullFileSpec% *.rename if ErrorLevel 1 exit /B ren %a_drive%%a_path%%a_pre%_%a_channelID%_%a_date%_%a_time%-%a_part%.rename *.mpg if not exist %a_targetpath%\%a_channelname% MD %a_targetpath%\%a_channelname% copy %a_FullFileSpec% %a_targetpath%\%a_channelname%\%a_channelname%_%a_date%-%a_time%.%a_ext% |
#13
|
||||
|
||||
Quote:
|
#14
|
||||
|
||||
Yes, I do get the channel number as a part of the filename and no, I haven't done anything in particular to get it. I'm running the .10 version and my recordings are manual timedbased recordings, not programguide based, maybe that has something to do with channelnumber ending up as a part of my filenames?
|
#15
|
||||
|
||||
Yes, I expect that's it, no title or id to use so Sage uses channel numbers. I think I'll request it as an option...
|
#16
|
|||
|
|||
If you can't wait until Jere gets the bug fixed in dirmon2 you might try the original dirmon program. I don't know what all it's capable of, but it might be able to do what you're looking for.
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|