|
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. |
|
Thread Tools | Search this Thread | Display Modes |
#1
|
||||
|
||||
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 Code:
mencoder %1 -edl %~dpn1.edl -oac copy -ovc copy -of mpeg -o E:\\Archived\\%~n1.avi exit Last edited by JREkiwi; 07-12-2010 at 02:06 PM. |
#2
|
||||
|
||||
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?
|
#3
|
|||
|
|||
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. |
#4
|
|||
|
|||
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 Any ideas? |
#5
|
||||
|
||||
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. |
#6
|
|||
|
|||
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). |
#7
|
|||
|
|||
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" 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" 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. |
#8
|
||||
|
||||
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 |
#9
|
|||
|
|||
Quote:
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. |
#10
|
|||
|
|||
Quote:
Any other thoughts? |
#11
|
|||
|
|||
Quote:
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) |
#12
|
||||
|
||||
Try
Quote:
John |
#13
|
|||
|
|||
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. |
#14
|
|||
|
|||
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. |
#15
|
|||
|
|||
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 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? |
#16
|
|||
|
|||
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 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 |
#17
|
||||
|
||||
How about trying it without the Start and use Batch mode for cscript.exe
Quote:
|
#18
|
|||
|
|||
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. |
#19
|
|||
|
|||
Quote:
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. |
#20
|
|||
|
|||
Quote:
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. |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|
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 |