SageTV Community  

Go Back   SageTV Community > SageTV Products > SageTV Software
Forum Rules FAQs Community Downloads Today's Posts Search

Notices

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.)

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 03-21-2006, 02:55 AM
klunde's Avatar
klunde klunde is offline
Sage User
 
Join Date: Nov 2005
Posts: 39
Send a message via ICQ to klunde Send a message via AIM to klunde Send a message via MSN to klunde Send a message via Yahoo to klunde
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.
Reply With Quote
  #2  
Old 03-21-2006, 03:49 AM
nielm's Avatar
nielm nielm is offline
SageTVaholic
 
Join Date: Oct 2003
Location: Belgium
Posts: 4,496
see the external utility Directory Monitor in the customisations sticky
__________________
Check out my enhancements for Sage in the Sage Customisations and Sageplugins Wiki
Reply With Quote
  #3  
Old 03-21-2006, 05:36 AM
klunde's Avatar
klunde klunde is offline
Sage User
 
Join Date: Nov 2005
Posts: 39
Send a message via ICQ to klunde Send a message via AIM to klunde Send a message via MSN to klunde Send a message via Yahoo to klunde
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.
Reply With Quote
  #4  
Old 03-21-2006, 06:57 AM
klunde's Avatar
klunde klunde is offline
Sage User
 
Join Date: Nov 2005
Posts: 39
Send a message via ICQ to klunde Send a message via AIM to klunde Send a message via MSN to klunde Send a message via Yahoo to klunde
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?
Reply With Quote
  #5  
Old 03-21-2006, 09:14 AM
nyplayer nyplayer is offline
SageTVaholic
 
Join Date: Sep 2005
Posts: 4,997
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.
Reply With Quote
  #6  
Old 03-21-2006, 11:21 AM
rickgillyon's Avatar
rickgillyon rickgillyon is offline
Sage Icon
 
Join Date: Sep 2005
Location: Whitley Bay, England
Posts: 1,950
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!
Reply With Quote
  #7  
Old 03-21-2006, 12:17 PM
nyplayer nyplayer is offline
SageTVaholic
 
Join Date: Sep 2005
Posts: 4,997
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.
Reply With Quote
  #8  
Old 03-21-2006, 01:59 PM
klunde's Avatar
klunde klunde is offline
Sage User
 
Join Date: Nov 2005
Posts: 39
Send a message via ICQ to klunde Send a message via AIM to klunde Send a message via MSN to klunde Send a message via Yahoo to klunde
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.
Reply With Quote
  #9  
Old 03-21-2006, 02:24 PM
matt91's Avatar
matt91 matt91 is offline
Sage Icon
 
Join Date: Feb 2005
Location: Washington, DC
Posts: 1,185
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
Reply With Quote
  #10  
Old 03-23-2006, 01:19 AM
klunde's Avatar
klunde klunde is offline
Sage User
 
Join Date: Nov 2005
Posts: 39
Send a message via ICQ to klunde Send a message via AIM to klunde Send a message via MSN to klunde Send a message via Yahoo to klunde
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.
Reply With Quote
  #11  
Old 03-23-2006, 02:40 AM
nielm's Avatar
nielm nielm is offline
SageTVaholic
 
Join Date: Oct 2003
Location: Belgium
Posts: 4,496
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
Reply With Quote
  #12  
Old 03-23-2006, 04:04 AM
klunde's Avatar
klunde klunde is offline
Sage User
 
Join Date: Nov 2005
Posts: 39
Send a message via ICQ to klunde Send a message via AIM to klunde Send a message via MSN to klunde Send a message via Yahoo to klunde
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%
Running this file with Dirmon2 will copy and rename the file when it has been closed. One thing to keep in mind, the paths must not contain -_. (if they do you must alter the FOR command)
Reply With Quote
  #13  
Old 03-29-2006, 03:05 AM
rickgillyon's Avatar
rickgillyon rickgillyon is offline
Sage Icon
 
Join Date: Sep 2005
Location: Whitley Bay, England
Posts: 1,950
Quote:
Originally Posted by klunde
::set a_FullFileSpec=F:/Recordings/SageTV/30692_80_0320_1700-0.mpg
This looks like you are getting channel numbers in your filenames - how is this? Are you using an import that does this?
Reply With Quote
  #14  
Old 03-30-2006, 12:25 AM
klunde's Avatar
klunde klunde is offline
Sage User
 
Join Date: Nov 2005
Posts: 39
Send a message via ICQ to klunde Send a message via AIM to klunde Send a message via MSN to klunde Send a message via Yahoo to klunde
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?
Reply With Quote
  #15  
Old 03-30-2006, 02:12 AM
rickgillyon's Avatar
rickgillyon rickgillyon is offline
Sage Icon
 
Join Date: Sep 2005
Location: Whitley Bay, England
Posts: 1,950
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...
Reply With Quote
  #16  
Old 03-30-2006, 05:36 AM
blade blade is offline
SageTVaholic
 
Join Date: Jan 2005
Posts: 2,500
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.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -6. The time now is 11:25 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2023, vBulletin Solutions Inc.
Copyright 2003-2005 SageTV, LLC. All rights reserved.