![]() |
|
Phoenix This forum is for discussing the user-created Phoenix custom interface for SageTV. |
![]() |
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
Triggering batch files from menu
I've created a batch file that will
1 - rip a DVD 2 - encode that DVD rip with handbrake the file works properly when I run it by double clicking in windows, or if I execute it from the command line, but when I run it from a menuitem, part of the code doesn't seem to execute (the DVD rip works, but handbrakeCLI doesn't get called/command line never opens). any idea why that would be?
__________________
Alpine Website Design |
#2
|
||||
|
||||
Quote:
__________________
Batch Metadata Tools (User Guides) - SageTV App (Android) - SageTV Plex Channel - My Other Android Apps - sagex-api wrappers - Google+ - Phoenix Renamer Downloads SageTV V9 | Android MiniClient |
#3
|
|||
|
|||
I'm using absolute paths, so I don't think that's it. The file
I've put my fragment code below, and the batch code too. After a reboot, it won't even launch DVDFab anymore. Any thoughts? Code:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE menus SYSTEM "menus.dtd"> <menus> <fragment parentMenu="phoenix.menu.lz.videos" insertBefore="Movies-new"> <menuItem name="phoenix.menu.lz.useritem.ripnick" label="Import a Nick DVD" visible="true"> <exec cmd="C:\Program Files (x86)\SageTV\SageTV\userdata\Phoenix\RipNick.bat" /> </menuItem> </fragment> </menus> Code:
@echo off ::DECRYPTED DVD DIRECTORY set DVDFiles=C:\Users\jon\Videos ::VIDEO FILE OUTPUT DIRECTORY set VidOut=\\OFFICE\sage ::VIDEO FILE OUTPUT SUBDIRECTORY - used for separating different types of import videos set VidOutSub=NicholasVideos ::DVD DRIVE LETTER set DVD=D: ::BODY setlocal enableextensions enabledelayedexpansion %DVD% CLS for /f "tokens=5*" %%t in ('vol') do ( @set VolID=%%u goto :gotname ) :gotname C: set FileName=%VolID% @set VolID=%VolID: =_% echo %FileName% "C:\Program Files (x86)\DVDFab 8 Qt\dvdfab.exe" /MODE "FULLDISC" /SRC "%DVD%" /DEST "%DVDFiles%" /REMOVEPGC "yes" /OUTDISC "dvd9" /VOLUME "%VolID%" /CLOSE "C:\Program Files (x86)\Handbrake\HandbrakeCLI.exe" -i %DVDFiles%\FullDisc\%VolID% -o "%VidOut%\%VidOutSub%\%FileName%.mkv" -e x264 -q 20.0 -a 1 -E copy -f mkv --detelecine --decomb --loose-anamorphic -m -x b-adapt=2:rc-lookahead=50 --main-feature CLS echo %VidOut%\%VidOutSub%\%FileName%.mkv Created
__________________
Alpine Website Design |
#4
|
||||
|
||||
Once you get your answer, I'd generally be interested if you see an approach to map a keystroke/command to call the executable. I can imagine some cool scenerios for doing things from an extender... and having a Harmony 100 means I can have lots of virtual buttons in the LCD display.
|
#5
|
||||
|
||||
@JonTom - I may have to add some logging to the <exec> function to provide an option that will log the output of the commands to a log file. At least then you'd be able to see what the command is echoing out to the terminal window and... maybe the process is dying for some reason. YOu can check the logs/phoenix.log or the sagetv_0.txt log file to see if it is showing any errors.
@Tomahawk51 - I don't think that we allow for a keybinding to a command or menu, yet.
__________________
Batch Metadata Tools (User Guides) - SageTV App (Android) - SageTV Plex Channel - My Other Android Apps - sagex-api wrappers - Google+ - Phoenix Renamer Downloads SageTV V9 | Android MiniClient |
#6
|
|||
|
|||
I'll check. Additional logging would be great too, thanks.
__________________
Alpine Website Design |
#7
|
|||
|
|||
Quote:
Edit: oh, just saw you said with extenders. I don't know, then.
__________________
Alpine Website Design |
#8
|
|||
|
|||
The logs don't show anything beyond the menu frag being loaded.
The DVDFab part is working again, but still no luck with handbrake. I checked the process explorer and I see that handbrakeCLI.exe is running but it's using 0 CPU cycles and seems stuck. Should the terminal window not open when the batch is started? When I run the file manually, I get a command prompt/window and the script runs there (echos to the prompt, etc). That doesn't happen when I trigger the file from the menuitem, and handbrakeCLI.exe is a commandline only interface for handbrake. Is that maybe the problem? DVDFab runs the normal GUI with the attributes set from the commandline so that's a little different...
__________________
Alpine Website Design |
#9
|
||||
|
||||
Try using START commands in your batch file for launching the HandbrakeCLI. It may be that they are being launched in a process tied too closely to the sagetv service, keeping handbrake from accessing something it is needing. try changing your Handbrake line to :
Code:
START "HandBrakeCLI" /WAIT "C:\Program Files (x86)\Handbrake\HandbrakeCLI.exe" -i %DVDFiles%\FullDisc\%VolID% -o "%VidOut%\%VidOutSub%\%FileName%.mkv" -e x264 -q 20.0 -a 1 -E copy -f mkv --detelecine --decomb --loose-anamorphic -m -x b-adapt=2:rc-lookahead=50 --main-feature
__________________
Buy Fuzzy a beer! (Fuzzy likes beer) unRAID Server: i7-6700, 32GB RAM, Dual 128GB SSD cache and 13TB pool, with SageTVv9, openDCT, Logitech Media Server and Plex Media Server each in Dockers. Sources: HRHR Prime with Charter CableCard. HDHR-US for OTA. Primary Client: HD-300 through XBoxOne in Living Room, Samsung HLT-6189S Other Clients: Mi Box in Master Bedroom, HD-200 in kids room |
#10
|
|||
|
|||
That did it, thank you.
__________________
Alpine Website Design Last edited by JonTom; 09-07-2011 at 03:30 PM. |
#11
|
|||
|
|||
my working code, for anyone who wants it:
Code:
@echo off ::DECRYPTED DVD DIRECTORY set DVDFiles=C:\Users\Jon\Documents\DVDFab ::VIDEO FILE OUTPUT TEMP DIRECTORY set VidTemp=C:\Users\Jon\Documents\DVDFab\FullDisc ::VIDEO FILE DESTINATION DIRECTORY set VidOut=\\OFFICE\sage ::VIDEO FILE DESTINATION SUBDIRECTORY - used for separating different types of import videos set VidOutSub=NicholasVideos ::DVD DRIVE LETTER set DVD=D: ::BODY setlocal enableextensions enabledelayedexpansion %DVD% for /f "tokens=5*" %%t in ('vol') do ( @set VolID=%%u goto :gotname ) :gotname C: @set FileName=%VolID% @set VolID=%VolID: =_% @set Filename=%FileName:_= % "C:\Program Files (x86)\DVDFab 8 Qt\dvdfab.exe" /MODE "FULLDISC" /SRC "%DVD%" /DEST "%DVDFiles%" /REMOVEPGC "yes" /OUTDISC "dvd9" /VOLUME "%VolID%" /CLOSE START "HandBrakeCLI" /WAIT "C:\Program Files (x86)\Handbrake\HandbrakeCLI.exe" -i %DVDFiles%\FullDisc\%VolID% -o "%VidTemp%\%FileName%.mkv" --main-feature --preset="Normal" -a 1 -E copy:ac3 -f mkv --detelecine --decomb move /y "%VidTemp%\%FileName%.mkv" "%VidOut%\%VidOutSub%\" rmdir /s /q "%DVDFiles%\FullDisc\%VolID%"
__________________
Alpine Website Design |
#12
|
|||
|
|||
I'm now trying to pass the subdirectory via a command line parameter in the menufragment so that I can have only one version of the batch file (
::VIDEO FILE DESTINATION SUBDIRECTORY - used for separating different types of import videos set VidOutSub=%1 ) but that's not working from the fragment (commandline works fine). I looked at trying START again but the use of "" is problematic. Any ideas why the below cmd line isn't passing the parameter to the batch file (files end up in %VidOut% instead of %VidOut%\%VidOutSub%) Thanks Code:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE menus SYSTEM "menus.dtd"> <menus> <fragment parentMenu="phoenix.menu.lz.videos" insertBefore="Movies-new"> <menuItem name="phoenix.menu.lz.useritem.ripnick" label="Import a Nick DVD" visible="true"> <exec cmd="C:\Program Files (x86)\SageTV\SageTV\userdata\Phoenix\RipConvert.bat NicholasVideos" /> </menuItem> </fragment> </menus> Code:
@echo off ::DECRYPTED DVD DIRECTORY set DVDFiles=%USERPROFILE%\Documents\DVDFab ::VIDEO FILE OUTPUT TEMP DIRECTORY set VidTemp=%USERPROFILE%\Documents\DVDFab\FullDisc ::VIDEO FILE DESTINATION DIRECTORY set VidOut=\\OFFICE\sage ::VIDEO FILE DESTINATION SUBDIRECTORY - used for separating different types of import videos set VidOutSub=%1 ::DVD DRIVE LETTER set DVD=D: ::BODY setlocal enableextensions enabledelayedexpansion %DVD% for /f "tokens=5*" %%t in ('vol') do ( @set VolID=%%u goto :gotname ) :gotname C: @set FileName=%VolID% @set VolID=%VolID: =_% @set Filename=%FileName:_= % "%ProgramFiles(x86)%\DVDFab 8 Qt\dvdfab.exe" /MODE "FULLDISC" /SRC "%DVD%" /DEST "%DVDFiles%" /REMOVEPGC "yes" /OUTDISC "dvd9" /VOLUME "%VolID%" /CLOSE START "HandBrakeCLI" /WAIT "%ProgramFiles(x86)%\Handbrake\HandbrakeCLI.exe" -i %DVDFiles%\FullDisc\%VolID% -o "%VidTemp%\%FileName%.mkv" --main-feature --preset="Normal" -a 1 -E copy:ac3 -f mkv --detelecine --decomb move /y "%VidTemp%\%FileName%.mkv" %VidOut%\%VidOutSub%\ rmdir /s /q "%DVDFiles%\FullDisc\%VolID%"
__________________
Alpine Website Design |
#13
|
||||
|
||||
I answered that in your other post... you need to use the 'args' attribute on the <exec> item to pass args to a command.
__________________
Batch Metadata Tools (User Guides) - SageTV App (Android) - SageTV Plex Channel - My Other Android Apps - sagex-api wrappers - Google+ - Phoenix Renamer Downloads SageTV V9 | Android MiniClient |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Sage TV triggering BSOD | AlphaWolf | Hardware Support | 7 | 06-01-2013 05:30 PM |
Automated VideoRedo (DOS batch files) | grauchy | SageTV Customizations | 3 | 09-08-2011 10:01 PM |
Batch Rename Files | ldavis | Batch Metadata Tools | 1 | 07-24-2011 06:25 AM |
Batch files for CD rips | JUC | General Discussion | 4 | 04-09-2005 05:02 PM |