SageTV Community  

Go Back   SageTV Community > SageTV Development and Customizations > SageTV v7 Customizations
Forum Rules FAQs Community Downloads Today's Posts Search

Notices

SageTV v7 Customizations This forums is for discussing and sharing user-created modifications for the SageTV version 7 application created by using the SageTV Studio or through the use of external plugins. Use this forum to discuss plugins for SageTV version 7 and newer.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 07-06-2010, 01:10 AM
JREkiwi's Avatar
JREkiwi JREkiwi is offline
Sage Icon
 
Join Date: Jan 2005
Location: Auckland, New Zealand
Posts: 2,132
Plugin: External Apps

A UI mod plugin that provides a button on the Video Options menu that can be used to run any external application, using the current video filename (among other things) as an argument.

This is a port of the V6 version which had a discussion here.

Options in Setup -> Detailed Setup -> Customize -> External App Options
Specify the External App directory where your batch/exe files are.
In each "slot" you can specify a Name, the batch/exe file you want to run, whether it should be available while a video is still recording or whether an xml file for the video needs to exist. And what Sage should do when you run the app, Sleep, Wait, Exit or have the app run in the Background.

Parameters passed to the batch file are:
%1 = MediaFile
%2 = Title
%3 = Episode
%4 = Description
%5 = Channel Number
%6 = Duration
%7 = Date
%8 = Category
%9 = SubCategory

Most success if achieved by using a trigger batch file which calls the functional batch file to actually do the processing. For example.

External Apps calls Compressit.cmd which contains
Code:
@echo off
C:
cd "C:\Program Files\SageTV\SageTV\Compressor"
start "Compress" /MIN /LOW /WAIT compress.cmd %1 %2 %3 %4 %5 %6 %7 %8 %9
and C:\Program Files\SageTV\SageTV\Compressor\compress.cmd contains
Code:
mencoder %1 -edl %~dpn1.edl -oac copy -ovc copy -of mpeg -o E:\\Archived\\%~n1.avi
exit
John

Last edited by JREkiwi; 07-12-2010 at 02:06 PM.
Reply With Quote
  #2  
Old 07-06-2010, 07:31 AM
dinki's Avatar
dinki dinki is offline
Sage Expert
 
Join Date: Mar 2006
Posts: 682
I'd like to use this to run an external command (batch file that sends a command to my Home Automation server to turn on/off lights in the living room) similar to the way I did using SageMC external command. Is there any way to tie this to an IR button?
Reply With Quote
  #3  
Old 07-06-2010, 10:28 AM
skyeclad skyeclad is offline
Sage Aficionado
 
Join Date: Nov 2007
Location: NY DMA
Posts: 441
Nice plugin! Saves me from having to diagnose VC-1/SageTV playback issues. I'll just run them in PDVD9 instead.

Any way to use this plugin to run an external app on BD ISO files? I would imagine that you would need something to mount the file first which Sage does but I don't know how to tell the next app where to look for the new BD mounted drive.
Reply With Quote
  #4  
Old 07-11-2010, 02:10 PM
peternm22 peternm22 is offline
Sage Expert
 
Join Date: Jan 2005
Posts: 709
I can't seem to get this to work on a batch file I want to run. I tried running running it from an HD100 and locally on the SageTV server, but the batch file never completes its actions. I'm running SageTV as a service, if that makes a difference.

I'm trying to use it to run a batch file that triggers VideoReDo's Quickstream Fix, but I can't get it to work. Here is the batch file that I am trying to run:

Code:
IF EXIST "%~d1%~p1%~n1.working" goto end
dir "%~f1">>"%~d1%~p1%~n1.working"
IF EXIST "%~d1%~p1%~n1.QFixed" goto end
IF EXIST "%~d1%~p1%~n1.compressed" goto end
del "%~d1%~p1tmpEncode\%~n1.tmp"

set extension=mpg
set usetouch=no

set touchpath=D:\Sage\QFixSage\
set videoredo_path=C:\Program Files (x86)\VideoReDoTVSuite\

set priority=low

set delOriginal=yes

rem "set delOriginal above to yes or no.... yes will delete original mpg and replace with QFixed file."
rem "if set to no will QFix file to tmpEncode directory but will not delete original...."

rem ........Do Not Touch Below................................................
Title QFixxing %1
if Not exist "%~f1" exit
if NOT exist "%videoredo_path%vp.vbs" goto :errorvrd
if /I "%usetouch%" EQU "yes" if Not exist "%touchpath%touch.exe" goto errtouch

md "%~d1%~p1tmpEncode"

START /B /W /MIN /%priority% cscript.exe //nologo "%videoredo_path%vp.vbs" "%~f1" "%~d1%~p1tmpEncode\%~n1.tmp" /t1 /d /q
if errorlevel = 1 goto end
if /I "%usetouch%" EQU "yes" if exist "%~d1%~p1tmpEncode\%~n1.tmp" "%touchpath%touch.exe" -r "%~f1" "%~d1%~p1tmpEncode\%~n1.tmp"
if /I "%usetouch%" EQU "yes" if errorlevel = 1 goto :errtouch
if /I "%delOriginal%" EQU "yes" if exist "%~d1%~p1tmpEncode\%~n1.tmp" del "%~f1"
if /I "%delOriginal%" EQU "yes" if not exist "%~f1" echo "Qfix Completed">>"%~d1%~p1%~n1.QFixed"
if /I "%delOriginal%" EQU "yes" if not exist "%~d1%~p1%~n1.QFixed" if exist "%~f1" echo "File In Use Not Replaced">>"%~d1%~p1%~n1.inuse%extension%"
if /I "%delOriginal%" EQU "yes" if exist "%~d1%~p1%~n1.QFixed" if not exist "%~f1" move "%~d1%~p1tmpEncode\%~n1.tmp" "%~d1%~p1%~n1.%extension%"
del "%~d1%~p1%~n1.working"
:end
exit
:errorvrd
echo "Videoredo not found in %videoredo_path%" >>"%~d1%~p1%~n1.error"
exit
:errtouch
echo "Error Touch.exe not found in %touchpath%" >>"%~d1%~p1%~n1.error"
exit
When I run the batch file from the External Apps, the .working file is created (which means the batch file is being run), but VideoReDO never starts.

Any ideas?
Reply With Quote
  #5  
Old 07-11-2010, 02:36 PM
gplasky's Avatar
gplasky gplasky is offline
SageTVaholic
 
Join Date: Jul 2003
Location: Howell, MI
Posts: 9,203
Your videoredo path has a space in it. It might require quotes around the path.

Gerry
__________________
Big Gerr
_______
Server - WHS 2011: Sage 7.1.9 - 1 x HD Prime and 2 x HDHomeRun - Intel Atom D525 1.6 GHz, Acer Easystore, RAM 4 GB, 4 x 2TB hotswap drives, 1 x 2TB USB ext Clients: 2 x PC Clients, 1 x HD300, 2 x HD-200, 1 x HD-100 DEV Client: Win 7 Ultimate 64 bit - AMD 64 x2 6000+, Gigabyte GA-MA790GP-DS4H MB, RAM 4GB, HD OS:500GB, DATA:1 x 500GB, Pace RGN STB.
Reply With Quote
  #6  
Old 07-11-2010, 02:54 PM
peternm22 peternm22 is offline
Sage Expert
 
Join Date: Jan 2005
Posts: 709
Tried it with quotes around the path, nothing changes.

I should note that the batch file works perfectly when run normally (when not called from Sage).
Reply With Quote
  #7  
Old 07-11-2010, 10:45 PM
peternm22 peternm22 is offline
Sage Expert
 
Join Date: Jan 2005
Posts: 709
Alright, I've made a little bit of progress but I'm still a bit stumped.

I reduced the batch file until I could make in runnable within Sage. The original batch file was created by someone else on the forum, so I never fully knew how it worked.

I can now successfully run the VideoReDo quickstream fix, but I'm having trouble getting the fixed file to replace the original. When I run the quickstream fix, I have the file temporally placed in a folder called "tmpEncode". Once VideoReDo is done being run, I want to delete the original file (which has a .ts file extension) and move the fixed file (which has a .mpg file extension) into its place. The batch file as it is now:

Code:
START /B /W /MIN /low cscript.exe //nologo "C:\Program Files (x86)\VideoReDoTVSuite\vp.vbs" "%~f1" "%~d1%~p1tmpEncode\%~n1.tmp" /t1 /d /q

del "%~f1"
move "%~d1%~p1tmpEncode\%~n1.tmp" "%~d1%~p1%~n1.mpg"
The problem with the above file is that it will delete the original file, but it never executes the "move" command on the second line. I decided to reverse the delete/move:

Code:
START /B /W /MIN /low cscript.exe //nologo "C:\Program Files (x86)\VideoReDoTVSuite\vp.vbs" "%~f1" "%~d1%~p1tmpEncode\%~n1.tmp" /t1 /d /q

move "%~d1%~p1tmpEncode\%~n1.tmp" "%~d1%~p1%~n1.mpg"
del "%~f1"
And this moves the fixed file into the correct position, but never deletes the original. Weird huh? It will execute the first command, but not the second.

Again, this batch file works perfectly when run within Windows. But it has issues when running from Sage.

I've been trying to get this running for well over a year now (you can see my previous postings on the forum with my failed attempts), but I seem to be really close to getting it to work this time. If anyone has any suggestions, I would be really appreciative.

Thanks.
Reply With Quote
  #8  
Old 07-11-2010, 10:56 PM
JREkiwi's Avatar
JREkiwi JREkiwi is offline
Sage Icon
 
Join Date: Jan 2005
Location: Auckland, New Zealand
Posts: 2,132
As you are running as a service you don't get any paths set so you will need a full path specified for cscript.exe.

C:\WINDOWS\system32\cscript.exe or whatever the path is.

Should there be a colon in goto :errorvrd ?

John
Reply With Quote
  #9  
Old 07-11-2010, 11:41 PM
nyplayer nyplayer is offline
SageTVaholic
 
Join Date: Sep 2005
Posts: 4,997
Quote:
Originally Posted by peternm22 View Post
Alright, I've made a little bit of progress but I'm still a bit stumped.

I reduced the batch file until I could make in runnable within Sage. The original batch file was created by someone else on the forum, so I never fully knew how it worked.

I can now successfully run the VideoReDo quickstream fix, but I'm having trouble getting the fixed file to replace the original. When I run the quickstream fix, I have the file temporally placed in a folder called "tmpEncode". Once VideoReDo is done being run, I want to delete the original file (which has a .ts file extension) and move the fixed file (which has a .mpg file extension) into its place. The batch file as it is now:

Code:
START /B /W /MIN /low cscript.exe //nologo "C:\Program Files (x86)\VideoReDoTVSuite\vp.vbs" "%~f1" "%~d1%~p1tmpEncode\%~n1.tmp" /t1 /d /q

del "%~f1"
move "%~d1%~p1tmpEncode\%~n1.tmp" "%~d1%~p1%~n1.mpg"
The problem with the above file is that it will delete the original file, but it never executes the "move" command on the second line. I decided to reverse the delete/move:

Code:
START /B /W /MIN /low cscript.exe //nologo "C:\Program Files (x86)\VideoReDoTVSuite\vp.vbs" "%~f1" "%~d1%~p1tmpEncode\%~n1.tmp" /t1 /d /q

move "%~d1%~p1tmpEncode\%~n1.tmp" "%~d1%~p1%~n1.mpg"
del "%~f1"
And this moves the fixed file into the correct position, but never deletes the original. Weird huh? It will execute the first command, but not the second.

Again, this batch file works perfectly when run within Windows. But it has issues when running from Sage.

I've been trying to get this running for well over a year now (you can see my previous postings on the forum with my failed attempts), but I seem to be really close to getting it to work this time. If anyone has any suggestions, I would be really appreciative.

Thanks.
The problem might be the path... you probably need to set the path in the batchfile to find the system commands. Add the below to the top of the batchfile and try it. if your windows paths are different for ex c:\winnt then make the changes.


set PATH=C:\;C:\windows;C:\WINDOWS\system32
__________________
Channels DVR UBUNTU Server 2 Primes 3 Connects TVE SageTV Docker with input from Channels DVR XMLTV and M3U VIA Opendct.
Reply With Quote
  #10  
Old 07-11-2010, 11:53 PM
peternm22 peternm22 is offline
Sage Expert
 
Join Date: Jan 2005
Posts: 709
Quote:
Originally Posted by nyplayer View Post
The problem might be the path... you probably need to set the path in the batchfile to find the system commands.
Thanks for the idea, but it still doesn't work. I don't think it is having trouble finding the system commands though, since it DOES execute the command I put first (the move or the delete), but it simply ignores the second command. If it was having trouble with the system commands, shouldn't they all fail regardless of where they are in the batch file?

Any other thoughts?
Reply With Quote
  #11  
Old 07-11-2010, 11:55 PM
peternm22 peternm22 is offline
Sage Expert
 
Join Date: Jan 2005
Posts: 709
Quote:
Originally Posted by JREkiwi View Post
As you are running as a service you don't get any paths set so you will need a full path specified for cscript.exe.

C:\WINDOWS\system32\cscript.exe or whatever the path is.

Should there be a colon in goto :errorvrd ?

John
Hi John,

I've managed to get VideoReDo running fine (which uses the cscript.exe program). It's what comes AFTER that isn't working now (moving/deleting the files).

Thanks. (awesome plugin BTW)
Reply With Quote
  #12  
Old 07-12-2010, 12:19 AM
JREkiwi's Avatar
JREkiwi JREkiwi is offline
Sage Icon
 
Join Date: Jan 2005
Location: Auckland, New Zealand
Posts: 2,132
Try
Quote:
move "%~d1%~p1tmpEncode\%~n1.tmp" "%~d1%~p1%~n1.mpg" >> c:\log.txt
del "%~f1" >> c:\log.txt
and see you you get anything logged.

John
Reply With Quote
  #13  
Old 07-12-2010, 12:24 AM
nyplayer nyplayer is offline
SageTVaholic
 
Join Date: Sep 2005
Posts: 4,997
peternm22,

Try what John suggested if that doesn't' work try using the call command

Code:
START /B /W /MIN /low cscript.exe //nologo "C:\Program Files (x86)\VideoReDoTVSuite\vp.vbs" "%~f1" "%~d1%~p1tmpEncode\%~n1.tmp" /t1 /d /q

call move "%~d1%~p1tmpEncode\%~n1.tmp" "%~d1%~p1%~n1.mpg"
del "%~f1"
__________________
Channels DVR UBUNTU Server 2 Primes 3 Connects TVE SageTV Docker with input from Channels DVR XMLTV and M3U VIA Opendct.
Reply With Quote
  #14  
Old 07-12-2010, 01:24 AM
peternm22 peternm22 is offline
Sage Expert
 
Join Date: Jan 2005
Posts: 709
John,

If I do the delete command first, the file log.txt is blank. (the file is deleted though). If I do the move command first, the log.txt file contains: "1 file(s) moved.", but the other file isn't deleted.


nyplayer,

Using the "call" command doesn't change anything. The first command is executed (whether it is the move or the delete), but the second command never happens. I tried a few different combination's of the "call" command (on both the move/delete, and just one, etc). No effect whatsoever.

This seems quite odd to me. It's not as if the move and delete commands are conflicting with each other, since they are being used on different files.
Reply With Quote
  #15  
Old 07-12-2010, 01:37 AM
peternm22 peternm22 is offline
Sage Expert
 
Join Date: Jan 2005
Posts: 709
More testing.... I thought that maybe since the script was using 2 different directories (the recordings, and tmpEncode), it might be getting confused which directly to write to. Long shot, I know.

So I decided to log the paths to text files after each command. Giving me this needlessly complex code:

Code:
START /B /W /MIN /low cscript.exe //nologo "C:\Program Files (x86)\VideoReDoTVSuite\vp.vbs" "%~f1" "%~d1%~p1tmpEncode\%~n1.tmp" /t1 /d /q

echo "%~d1%~p1tmpEncode\%~n1.tmp" >> c:\move1.txt
echo "%~f1" >> c:\del1.txt

move "%~d1%~p1tmpEncode\%~n1.tmp" "%~d1%~p1%~n1.mpg"

echo "%~d1%~p1tmpEncode\%~n1.tmp" >> c:\move2.txt
echo "%~f1" >> c:\del2.txt

del "%~f1"

echo "%~d1%~p1tmpEncode\%~n1.tmp" >> c:\move3.txt
echo "%~d1%~p1tmpEncode\%~n1.tmp" >> c:\move3.txt
So I run it, and it only creates the first text file (move1.txt). None of the other text files are created, and the "move" command is never executed either (despite being before the delete command).

It would appear that I can only execute batch files with 2 lines of commands in Sage. Everything after that is ignored. This seems to explain why the original batch file never ran properly (it would create a .working file, but nothing after that).

This seems to slightly narrow down the problem, but I don't know how to fix it or why it is happening. Thoughts?
Reply With Quote
  #16  
Old 07-12-2010, 01:51 AM
peternm22 peternm22 is offline
Sage Expert
 
Join Date: Jan 2005
Posts: 709
I ran a test, writing 5 different text files via a batch file from Sage. It worked perfectly. I put the call to VideoReDo at the top of the file, and it only writes the first text file.

So, this means there is a problem with this line, causing problems later on:

Code:
START /B /W /MIN /low cscript.exe //nologo "C:\Program Files (x86)\VideoReDoTVSuite\vp.vbs" "%~f1" "%~d1%~p1tmpEncode\%~n1.tmp" /t1 /d /q
I tried putting the full path in to cscript.exe, but I must have done it wrong since VideoReDo doesn't run:

Code:
START /B /W /MIN /low C:\WINDOWS\system32\cscript.exe //nologo "C:\Program Files (x86)\VideoReDoTVSuite\vp.vbs" "%~f1" "%~d1%~p1tmpEncode\%~n1.tmp" /t1 /d /q
Getting closer...
Reply With Quote
  #17  
Old 07-12-2010, 02:08 AM
JREkiwi's Avatar
JREkiwi JREkiwi is offline
Sage Icon
 
Join Date: Jan 2005
Location: Auckland, New Zealand
Posts: 2,132
How about trying it without the Start and use Batch mode for cscript.exe
Quote:
cscript.exe //B "C:\Program Files (x86)\VideoReDoTVSuite\vp.vbs" "%~f1" "%~d1%~p1tmpEncode\%~n1.tmp" /t1 /d /q
John
Reply With Quote
  #18  
Old 07-12-2010, 09:39 AM
nyplayer nyplayer is offline
SageTVaholic
 
Join Date: Sep 2005
Posts: 4,997
Peter and John,

For some reason qfixsage does not work with the external apps .... but it does work if you use a trigger job. Peter you can use the code below and just put in the correct path to your qfix. You can then have John's external apllication trigger it. I tested and it does work.

StartQfixSage.bat
Code:
if not exist c:\temp md c:\temp
c:\work\qfixsage.bat %1>c:\temp\logvrd.txt

PS Peter i was the one that had originally wrote that batch file. I will have to look further to see why it doesn't work without a trigger job.


John it appears for some reason your are not passing the file name by default? and the Qfix job does not use %1.
__________________
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; 07-12-2010 at 10:36 AM.
Reply With Quote
  #19  
Old 07-12-2010, 10:15 AM
peternm22 peternm22 is offline
Sage Expert
 
Join Date: Jan 2005
Posts: 709
Quote:
Originally Posted by nyplayer View Post
Peter and John,
For some reason qfixsage does not work with the external apps .... but it does work if you use a trigger job. Peter you can use the code below and just put in the correct path to your qfix. You can then have John's external apllication trigger it. I tested and it does work.
Is a "trigger" job simply one batch file calling another batch file? I'll try it out when I get home, see if it does the trick.

Quote:
Originally Posted by nyplayer View Post
PS Peter i was the one that had originally wrote that batch file.
I thought I recognized your name The script has come in VERY handy since I've been using a R5000. If I can get your original batch file running, that would be ideal over what I have cobbled together. You seem to have put a few safety checks in your batch file so I don't accidentally delete a recording if the QFix doesn't work.
Reply With Quote
  #20  
Old 07-12-2010, 10:35 AM
nyplayer nyplayer is offline
SageTVaholic
 
Join Date: Sep 2005
Posts: 4,997
Quote:
Originally Posted by peternm22 View Post
Is a "trigger" job simply one batch file calling another batch file? I'll try it out when I get home, see if it does the trick.



I thought I recognized your name The script has come in VERY handy since I've been using a R5000. If I can get your original batch file running, that would be ideal over what I have cobbled together. You seem to have put a few safety checks in your batch file so I don't accidentally delete a recording if the QFix doesn't work.
Yes a trigger is one batch calling another.

I believe the problem is that the filename is not passed by default to QFIXSAGE and no where in QFIXSAGE is %1 to select the file name.
__________________
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; 07-12-2010 at 10:40 AM.
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
External Command Tuner Plugin for Linux stuckless SageTV Linux 36 05-16-2017 03:11 PM
STV Import: External Apps for the Default STV (v4.0.3 18/November/2007) JREkiwi SageTV Customizations 51 03-30-2011 10:47 PM
External BluRay plugin for BDMV on Disc Fuzzy SageTV Customizations 34 05-04-2010 12:50 AM
Plugin to drive random apps on server tedson SageTV Customizations 0 07-13-2009 08:39 PM
External tuner plugin and subchannel jchiso Hardware Support 0 11-30-2005 10:35 PM


All times are GMT -6. The time now is 01:21 PM.


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