SageTV Community  

Go Back   SageTV Community > SageTV Development and Customizations > SageTV Customizations

Notices

SageTV Customizations This forums is for discussing and sharing user-created modifications for the SageTV application created by using the SageTV Studio or through the use of external plugins. Use this forum to discuss customizations for SageTV version 6 and earlier, or for the SageTV3 UI.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 02-05-2010, 09:05 PM
superdodge superdodge is offline
Sage User
 
Join Date: Feb 2009
Posts: 65
Post My Script to Archive TV Shows (VideoRedo/Handbrake)

I thought I would share the script I've written to archive my TV shows. This is very customized to how I want things to work, but I thought it might help some of you that are trying to do something similar. I execute this script using Sage Job Queue 3. My Ruleset and Client Configuration are shown after the script. Good Luck in making it your own!



The following tools are used in this script, I have no idea if other versions of these programs will behave correctly:
  1. VideoRedo TV Suite 4 Build 595
  2. HandBrakeCLI 0.9.4
  3. Batch MetaData Tools 3.1 by Stuckless
  4. Sage Job Queue v3.0.2.753 by slugger


The script is executed with the following syntax:
archive.bat <action> <complete file path>

The file path supplied should ALWAYS be to the original recording you are attempting to archive.

This script has five actions: QSF, TRIM, ENCODE, COPY2NAS and ARCHIVE
  1. QSF - Runs a VideoRedo Quick Stream Fix on the Video File and replaces the original in the recording directory
  2. TRIM - Uses VideoRedo to Trim the Commercials Identified in a user supplied .Vprj file
  3. ENCODE - Encodes to 720p H.264
  4. COPY2NAS - Copies the Encoded File to a Network Location and uses theTVdb to generate a properties file
  5. ARCHIVE - Parses the properties file, renames the encoded file and places it in a subdirectory specific to the show title.


The script looks for the user created .Vprj file to move to certain folders in order to proceed with the next step. You can change this folder structure easily in the batch file by looking the variables section at the start of the script. Each line in the SJQ3 Ruleset must be modified as well if you change this structure. The folder structure I use is:

D:\Archive\1-Marked - This is where I place a .Vprj file to initiate the archival process
D:\Archive\2-QSFixed - The .Vprj file is moved here after an in-place Quick Stream Fix is performed.
D:\Archive\3-Trimmed - The .Vprj file and the trimmed video are placed here after VideoRedo removes the commercials marked.
D:\Archive\4-Encoded - The .Vprj file and the final video are placed here after HandBrake finishes encoding.
D:\Archive\5-Completed - The .Vprj file is placed here after the video is completely archived.

The script renames the file to ShowName-SXXEXX.mp4 and files it in a folder called ShowName on the network location where I keep my videos. Anyone that is handy with a batch scripting can change this if they prefer another format.


Please note that the script does NOT remove the original recording automatically. I prefer to go and play the imported video to ensure it works before I delete the original; however, I have never had the script fail to create a proper video. It is possible to use SJQ3 to automatically remove the original recording if you wish, but I will NOT provide you the ruleset or client configuration to do it.



My Batch File
Code:
@ECHO OFF

REM  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
REM  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
REM  %%% THIS IS A GENERAL SCRIPT DESIGNED TO ALLOW  %%%
REM  %%%    FOR ARCHIVING OF SAGETV RECORDINGS USING %%%
REM  %%%  VIDEOREDO TV SUITE 4 AND HANDBRAKE 0.9.4   %%%
REM  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
REM  %%%         LAST REV - 2/5/2010 - RLS           %%%
REM  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
REM  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%





REM  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
REM  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
REM  %%%     DEFINE ALL VARIABLES FOR THE SCRIPT     %%%
REM  %%% ONLY CHANGE THE TEXT BEHIND THE EQUAL SIGN! %%%
REM  %%% PLEASE FORMAT YOUR INPUTS LIKE THE SAMPLES! %%%
REM  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
REM  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

REM  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
REM  %%%    PRIORITY IS THE OPERATING PRIORITY ALL   %%%
REM  %%%            PROGRAMS WILL RUN AT:            %%%
REM  %%%  (REALTIME, NORMAL, BELOWNORMAL, LOW, ETC)  %%%
REM  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SET PRIORITY=LOW

REM  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
REM  %%%  MARKEDLOC IS THE FOLDER WHERE VPRJ FILES   %%%
REM  %%%    WILL BE PLACED TO INITIATE ARCHIVING     %%%
REM  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
REM  %%%  QSFIXEDLOC IS THE FOLDER WHERE VPRJ FILES  %%%
REM  %%%       WILL BE MOVED ONCE A VIDEO HAS        %%%
REM  %%%           BEEN QUICK STREAM FIXED           %%%
REM  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
REM  %%% TRIMMEDLOC IS THE FOLDER WHERE THE VPRJ AND %%%
REM  %%% VIDEO FILES WILL BE PLACED ONCE COMMERCIALS %%%
REM  %%%              HAVE BEEN REMOVED              %%%
REM  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
REM  %%% ENCODEDLOC IS THE FOLDER WHERE THE VPRJ AND %%%
REM  %%%    VIDEO FILES WILL BE PLACED FOLLOWING     %%%
REM  %%%          COMPRESSION IN HANDBRAKE           %%%
REM  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
REM  %%%   COMPLETELOC IS THE FOLDER WHERE THE VPRJ  %%%
REM  %%%   FILE WILL BE PLACED ONCE ALL ARCHIVING    %%%
REM  %%%           FUNCTIONS ARE COMPLETE            %%%
REM  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SET MARKEDLOC=D:\Archive\1-Marked
SET QSFIXEDLOC=D:\Archive\2-QSFixed
SET TRIMMEDLOC=D:\Archive\3-Trimmed
SET ENCODEDLOC=D:\Archive\4-Encoded
SET COMPLETELOC=D:\Archive\5-Completed

REM  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
REM  %%%    NASUNC IS THE UNC ADDRESS TO THE ROOT    %%%
REM  %%%   TV SHOW ARCHIVE FOLDER ON YOUR NETWORK    %%%
REM  %%% USERNAME AND PASSWORD MUST ALSO BE SUPPLIED %%%
REM  %%%     FOR A USER WITH WRITE ACCESS TO THE     %%%
REM  %%% NETWORK SHARE %%%
REM  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SET NASUNC=\\192.168.1.6\Videos
SET USER=YourNASUser
SET PASS=YourNASPassWord

REM  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
REM  %%% PICK A DRIVE LETTER THAT IS NEVER IN USE ON %%%
REM  %%%  YOUR SYSTEM AND THE SCRIPT WILL MAP YOUR   %%%
REM  %%%  NETWORK SHARE TO THAT DRIVE TEMPORARILY!   %%%
REM  %%%  THEN SET NASLOC TO A FOLDER ON THAT DRIVE  %%%
REM  %%% THIS FOLDER IS A TEMPORARY HOLDING LOCATION %%%
REM  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SET NASLOC=Q:\Archived

REM  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
REM  %%%      SAGETVLOC IS ROOT SAGETV DIRECTORY     %%%
REM  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SET SAGETVLOC=C:\Program Files (x86)\SageTV\SageTV

REM  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
REM  %%%  VRDLOC IS THE FOLDER WHERE THE VIDEOREDO   %%%
REM  %%%            EXECUTABLE IS LOCATED            %%%
REM  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SET VRDLOC=C:\Program Files (x86)\VideoReDoTVSuite4

REM  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
REM  %%%    HANDBRAKELOC IS THE FOLDER WHERE THE     %%%
REM  %%%     HANDBRAKE CLI EXECUTABLE IS LOCATED     %%%
REM  %%%  HANDBRAKEEXE IS THE NAME OF THE HANDBRAKE  %%%
REM  %%%          EXECUTABLE FILE TO BE RUN          %%%
REM  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SET HANDBRAKELOC=C:\HandBrakeCLI
SET HANDBRAKEEXE=HandBrakeCLI.exe

REM  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
REM  %%%  DO NOT TOUCH!-DO NOT TOUCH!-DO NOT TOUCH!  %%%
REM  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
REM  %%%      THESE VARIABLES ARE AUTOMATICALLY      %%%
REM  %%% CALCULATED BASED ON PREVIOUSLY ENTERED ONES %%%
REM  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
REM  %%%  DO NOT TOUCH!-DO NOT TOUCH!-DO NOT TOUCH!  %%%
REM  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SET SAGETVDRV=%SAGETVLOC:~0,2%
SET HANDBRAKEDRV=%HANDBRAKELOC:~0,2%
SET VRDDRV=%VRDLOC:~0,2%
SET COMPLETEDRV=%COMPLETELOC:~0,2%
SET NASDRV=%NASLOC:~0,2%





REM  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
REM  %%% JUMP TO RIGHT SECTION OF SCRIPT USING FIRST %%%
REM  %%%    PROVIDED ARGUMENT AFTER ARCHIVE.BAT      %%%
REM  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

IF /I %1==QSF GOTO QSF
IF /I %1==TRIM GOTO TRIM
IF /I %1==ENCODE GOTO ENCODE
IF /I %1==COPY2NAS GOTO COPY2NAS
IF /I %1==ARCHIVE GOTO ARCHIVE
IF /I %1==HELP GOTO HELP
IF /I %1==-HELP GOTO HELP





:HELP

REM  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
REM  %%% IF INCORRECT SYNTAX IS PROVIDED OR HELP IS  %%%
REM  %%%    REQUESTED, PROVIDE ON-SCREEN GUIDANCE    %%%
REM  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

ECHO ###################################################
ECHO ###################################################
ECHO ###         INCORRECT ARGUMENT PROVIDED!        ###
ECHO ###################################################
ECHO ###  PROPER SYNTAX: ARCHIVE.BAT (ACTION) (FILE) ###
ECHO ###################################################
ECHO ## ACTIONS: QSF, TRIM, ENCODE, COPY2NAS, ARCHIVE ##
ECHO ###################################################
ECHO ##   QSF RUNS A VIDEOREDO QUICK STREAM FIX ON    ##
ECHO ##          THE SUPPLIED FILE IN PLACE           ##
ECHO ###################################################
ECHO ## TRIM CUTS THE COMMERCIALS OUT OF THE SUPPLIED ##
ECHO ##    FILE BASED ON THE VIDEOREDO PROJECT FILE   ##
ECHO ###################################################
ECHO ##     ENCODE RE-ENCODES THE SUPPLIED FILE IN    ##
ECHO ##            HANDBRAKE TO 720P/H.264            ##
ECHO ###################################################
ECHO ##  COPY2NAS MOVES THE ENCODED FILE TO A FINAL   ##
ECHO ##              NETWORK DESTINATION              ##
ECHO ###################################################
ECHO ##   ARCHIVE RENAMES THE FILE INTO SHOW-SXXEXX   ##
ECHO ##   FORMAT AND PLACES IT INTO FOLDERS BY SHOW   ##
ECHO ###################################################
ECHO ##   THIS SCRIPT IS INTENDED TO BE EXECUTED BY   ##
ECHO ##            SAGE JOB QUEUE VERSION 3           ##
ECHO ## FOR EXAMPLE RULESETS AND CLIENT CONFIGURATION ##
ECHO ##            VISIT THE SAGETV FORUMS!           ##
ECHO ###################################################
ECHO ###################################################

EXIT 1





:QSF

ECHO ###################################################
ECHO ###################################################
ECHO ###  THIS SCRIPT IS DESIGNED TO RUN A VIDEOREDO ###
ECHO ###    QUICK STREAM FIX ON A SAGETV RECORDING   ###
ECHO ###              PRIOR TO ARCHIVING             ###
ECHO ###################################################
ECHO ###################################################

ECHO ###################################################
ECHO ###     IF VPRJ FILE EXISTS, PERFORM QSFIX      ###
ECHO ###################################################

IF NOT EXIST "%MARKEDLOC%\%~n2.Vprj" GOTO FAILURE
ECHO ###################################################
ECHO ###   VPRJ FILE FOUND, PROCEEDING WITH QSFIX    ###
ECHO ###################################################

%VRDDRV%
CD "%VRDLOC%"
START /W /MIN /%PRIORITY% cscript //nologo vp.vbs "%2" "%QSFIXEDLOC%\%~nx2" /t1 /d /q /e
IF NOT EXIST "%QSFIXEDLOC%\%~nx2" GOTO FAILURE
ECHO ###################################################
ECHO ###    QSFIXED FILE GENERATED SUCCESSFULLY!     ###
ECHO ###################################################

DEL "%2"
IF EXIST "%2" GOTO FAILURE
ECHO ###################################################
ECHO ###          ORIGINAL VIDEO FILE DELETED        ###
ECHO ###################################################

MOVE "%QSFIXEDLOC%\%~nx2" "%2"
IF NOT EXIST "%2" GOTO FAILURE
ECHO ###################################################
ECHO ### QSFIXED FILE PLACED IN ORIGINAL'S LOCATION  ###
ECHO ###################################################

MOVE "%MARKEDLOC%\%~n2.Vprj" "%QSFIXEDLOC%\%~n2.Vprj"
IF NOT EXIST "%QSFIXEDLOC%\%~n2.Vprj" GOTO FAILURE
ECHO ###################################################
ECHO ###   VPRJ FILE MOVED TO QSFIXED DIRECTORY!     ###
ECHO ###################################################

GOTO SUCCESS





:TRIM

ECHO ###################################################
ECHO ###################################################
ECHO ### THIS SCRIPT IS DESIGNED TO CUT COMMERCIALS  ###
ECHO ###    FROM A QSFIXED FILE USING VIDEOREDO!     ###
ECHO ###################################################
ECHO ###################################################

ECHO ###################################################
ECHO ###    IF VPRJ FILE EXISTS, CUT COMMERCIALS     ###
ECHO ###################################################

IF NOT EXIST "%QSFIXEDLOC%\%~n2.Vprj" GOTO FAILURE
ECHO ###################################################
ECHO ###    VPRJ FILE FOUND, CUTTING COMMERCIALS     ###
ECHO ###################################################

%VRDDRV%
CD "%VRDLOC%"
START /W /MIN /%PRIORITY% cscript //nologo vp.vbs "%QSFIXEDLOC%\%~n2.Vprj" "%TRIMMEDLOC%\%~nx2" /t1 /d /q /e
IF NOT EXIST "%TRIMMEDLOC%\%~nx2" GOTO FAILURE
ECHO ###################################################
ECHO ###    TRIMMED FILE GENERATED SUCCESSFULLY!     ###
ECHO ###################################################

MOVE "%QSFIXEDLOC%\%~n2.Vprj" "%TRIMMEDLOC%\%~n2.Vprj"
IF NOT EXIST "%TRIMMEDLOC%\%~n2.Vprj" GOTO FAILURE
ECHO ###################################################
ECHO ###    VPRJ FILE MOVED TO TRIMMED DIRECTORY     ###
ECHO ###################################################

GOTO SUCCESS





:ENCODE

ECHO ###################################################
ECHO ###################################################
ECHO ###   THIS SCRIPT IS DESIGNED TO ENCODE SAGETV  ###
ECHO ###    RECORDINGS IN HANDBRAKE FOR ARCHIVING    ###
ECHO ###################################################
ECHO ###################################################

ECHO ###################################################
ECHO ###      IF VPRJ FILE EXISTS, ENCODE VIDEO      ###
ECHO ###################################################

IF NOT EXIST "%TRIMMEDLOC%\%~n2.Vprj" GOTO FAILURE
ECHO ###################################################
ECHO ###       VPRJ FILE FOUND, ENCODING VIDEO       ###
ECHO ###################################################

%HANDBRAKEDRV%
CD "%HANDBRAKELOC%"
"%HANDBRAKEEXE%" -i "%TRIMMEDLOC%\%~nx2" -o "%ENCODEDLOC%\%~n2.mp4" -e x264 -x ref=2:bframes=2:me=umh -q 0.6078 -E ac3 -B 160 -w 1280 -5 -9
IF NOT EXIST "%ENCODEDLOC%\%~n2.mp4" GOTO FAILURE
ECHO ###################################################
ECHO ###    ENCODED VIDEO GENERATED SUCCESSFULLY     ###
ECHO ###################################################

DEL "%TRIMMEDLOC%\%~nx2"
IF EXIST "%TRIMMEDLOC%\%~nx2" GOTO FAILURE
ECHO ###################################################
ECHO ###            TRIMMED VIDEO DELETED            ###
ECHO ###################################################

MOVE "%TRIMMEDLOC%\%~n2.Vprj" "%ENCODEDLOC%\%~n2.Vprj"
IF NOT EXIST "%ENCODEDLOC%\%~n2.Vprj" GOTO FAILURE
ECHO ###################################################
ECHO ###    VPRJ FILE MOVED TO ENCODED DIRECTORY     ###
ECHO ###################################################

GOTO SUCCESS





:COPY2NAS

ECHO ###################################################
ECHO ###################################################
ECHO ###   THIS SCRIPT IS DESIGNED TO COPY A VIDEO   ###
ECHO ### FILE AFTER IT IS QSFIXED, TRIMMED & ENCODED ###
ECHO ###################################################
ECHO ###################################################

ECHO ###################################################
ECHO ###       IF VPRJ FILE EXISTS, COPY VIDEO       ###
ECHO ###################################################

IF NOT EXIST "%ENCODEDLOC%\%~n2.Vprj" GOTO FAILURE
ECHO ###################################################
ECHO ###       VPRJ FILE FOUND, COPYING VIDEO        ###
ECHO ######################a############################

NET USE * /DELETE /Y
NET USE %NASDRV% %NASUNC% /USER:%USER% %PASS%
IF NOT EXIST %NASLOC% MKDIR %NASLOC%
IF NOT EXIST %NASLOC% GOTO FAILURE
ECHO ###################################################
ECHO ###       NAS SUCCESSFULLY MAPPED TO %NASDRV%         ###
ECHO ###################################################

MOVE "%ENCODEDLOC%\%~n2.mp4" "%NASLOC%\%~n2.mp4"
IF NOT EXIST "%NASLOC%\%~n2.mp4" GOTO FAILURE
ECHO ###################################################
ECHO ###    VIDEO FILE MOVED TO NAS SUCCESSFULLY     ###
ECHO ###################################################

MOVE "%ENCODEDLOC%\%~n2.Vprj" "%COMPLETELOC%\%~n2.Vprj"
IF NOT EXIST "%COMPLETELOC%\%~n2.Vprj" GOTO FAILURE
ECHO ###################################################
ECHO ###   VPRJ FILE MOVED TO COMPLETED DIRECTORY    ###
ECHO ###################################################

%SAGETVDRV%
CD "%SAGETVLOC%"
JAVA -jar metadatatool.jar --metadataOnly=true --recurse=true --auto=true --provider=tvdb "%NASLOC%\%~n2.mp4"
IF NOT EXIST "%NASLOC%\%~n2.mp4.properties" GOTO FAILURE
ECHO ###################################################
ECHO ###  METADATA FOUND AND WRITTEN TO PROPERTIES   ###
ECHO ###################################################

NET USE %NASDRV% /DELETE

GOTO SUCCESS





:ARCHIVE

ECHO ###################################################
ECHO ###################################################
ECHO ### THIS SCRIPT IS DESIGNED TO RENAME AND FILE  ###
ECHO ###     A VIDEO FILE AFTER FINDING METADATA     ###
ECHO ###################################################
ECHO ###################################################

ECHO ###################################################
ECHO ###  IF VIDEO/PROPERTIES FILES EXISTS, ARCHIVE  ###
ECHO ###################################################

NET USE * /DELETE /Y
NET USE %NASDRV% %NASUNC% /USER:%USER% %PASS%
IF NOT EXIST %NASLOC% GOTO FAILURE
ECHO ###################################################
ECHO ###       NAS SUCCESSFULLY MAPPED TO %NASDRV%         ###
ECHO ###################################################

IF NOT EXIST "%NASLOC%\%~n2.mp4" GOTO FAILURE
ECHO ###################################################
ECHO ###  VIDEO FILE EXISTS, LOOKING FOR PROPERTIES  ###
ECHO ###################################################

SET PROPERTIES=%NASLOC%\%~n2.mp4.properties
IF NOT EXIST "%PROPERTIES%" GOTO FAILURE
ECHO ###################################################
ECHO ###   PROPERTIES FILE EXISTS, FINDING METADATA  ###
ECHO ###################################################

SET PAD=0
FIND "MediaType" <%PROPERTIES%>%NASLOC%\TYPE.txt
SET /p TYPETMP=<%NASLOC%\TYPE.txt
DEL %NASLOC%\TYPE.txt
SET TYPE=%TYPETMP:~10%
IF NOT %TYPE%==TV GOTO FAILURE

FIND "SeasonNumber" <%PROPERTIES%>%NASLOC%\SEASON.txt
SET /P SEASONTMP=<%NASLOC%\SEASON.txt
DEL %NASLOC%\SEASON.txt
SET SEASON=%SEASONTMP:~13%
IF %SEASON% LSS 10 SET SEASON=%PAD%%SEASON%

FIND "EpisodeNumber" <%PROPERTIES%>%NASLOC%\EPISODE.txt
SET /P EPISODETMP=<%NASLOC%\EPISODE.txt
DEL %NASLOC%\EPISODE.txt
SET EPISODE=%EPISODETMP:~14%
IF %EPISODE% LSS 10 SET EPISODE=%PAD%%EPISODE%

FIND "MediaTitle" <%PROPERTIES%>%NASLOC%\TITLE.txt
SET /p TITLETMP=<%NASLOC%\TITLE.txt
DEL %NASLOC%\TITLE.txt
SET TITLE=%TITLETMP:~11%

ECHO ###################################################
ECHO MEDIA TYPE IS: %TYPE%
ECHO SHOW TITLE IS: %TITLE%
ECHO EPISODE IS FROM SEASON: %SEASON%
ECHO EPISODE IS NUMBER: %EPISODE%
ECHO ###################################################

%NASDRV%
CD "%NASLOC%"
RENAME "%~n2.mp4" "%TITLE%-S%SEASON%E%EPISODE%.mp4"
IF NOT EXIST "%NASLOC%\%TITLE%-S%SEASON%E%EPISODE%.mp4" GOTO FAILURE
ECHO ###################################################
ECHO ###   ARCHIVE FILE RENAMED IN CORRECT FORMAT    ###
ECHO ###################################################

IF NOT EXIST "%NASDRV%\%TITLE%" MKDIR "%NASDRV%\%TITLE%"
IF NOT EXIST "%NASDRV%\%TITLE%" GOTo FAILURE
ECHO ###################################################
ECHO ###  CORRECT DIRECTORY EXISTS FOR ARCHIVE FILE  ###
ECHO ###################################################

MOVE "%NASLOC%\%TITLE%-S%SEASON%E%EPISODE%.mp4" "%NASDRV%\%TITLE%\%TITLE%-S%SEASON%E%EPISODE%.mp4"
IF NOT EXIST "%NASDRV%\%TITLE%\%TITLE%-S%SEASON%E%EPISODE%.mp4" GOTO FAILURE
ECHO ###################################################
ECHO ###    ARCHIVE FILE MOVED TO FINAL LOCATION     ###
ECHO ###################################################

MOVE "%PROPERTIES%" "%COMPLETELOC%"
%COMPLETEDRV%
CD %COMPLETELOC%
RENAME "%~n2.mp4.properties" "%~n2.properties"
IF NOT EXIST "%COMPLETELOC%\%~n2.properties" GOTO FAILURE
ECHO ###################################################
ECHO ###   PROPERTIES FILE MOVED TO FINAL LOCATION   ###
ECHO ###################################################

NET USE %NASDRV% /DELETE

GOTO SUCCESS





REM  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
REM  %%%  REPORT SCRIPT SUCCESS OR FAILURE TO USER   %%%
REM  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

:SUCCESS

ECHO ###################################################
ECHO ###################################################
ECHO ###         SCRIPT EXECUTED SUCCESSFULLY!       ###
ECHO ###   I KNEW IT WOULD ALL WORK OUT IN THE END!  ###
ECHO ###################################################
ECHO ###################################################

EXIT 0

:FAILURE

ECHO ###################################################
ECHO ###################################################
ECHO ###           SCRIPT FAILED MISERABLY!          ###
ECHO ### I WOULD BLAME THE LAME-BRAIN THAT WROTE IT! ###
ECHO ###################################################
ECHO ###################################################

EXIT 1


SJQ3 Ruleset
Code:
# RUN A QUICK STREAM FIX ON VIDEO FILES READY FOR ARCHIVE
if [IsObjMediaFile == true && $.IsTVFile{} == true && Filename =$ ".mpg" && FileExists == "D:/Archive/1-Marked/%p%.Vprj"] {
   :PRIORITY 10
   :RUNQLOADER "true"
   :FAILALERT "true"
   QSFIX
}

# CUT COMMERCIALS FROM VIDEO FILES READY FOR ARCHIVE
if [IsObjMediaFile == true && $.IsTVFile{} == true && Filename =$ ".mpg" && FileExists == "D:/Archive/2-QSFixed/%p%.vprj"] {
   :PRIORITY 10
   :RUNQLOADER "true"
   :FAILALERT "true"
   CUTCOMM
}

# ENCODE VIDEO FILES READY FOR ARCHIVE
if [IsObjMediaFile == true && $.IsTVFile{} == true && Filename =$ ".mpg" && FileExists == "D:/Archive/3-Trimmed/%p%.vprj" && FileExists == "D:/Archive/3-Trimmed/%p%.mpg"] {
   :PRIORITY 10
   :RUNQLOADER "true"
   :FAILALERT "true"
   ENCODE
}

# COPY VIDEO FILES TO NAS FOLLOWING QSFIX, COMMERCIAL CUT AND ENCODING
if [IsObjMediaFile == true && $.IsTVFile{} == true && Filename =$ ".mpg" && FileExists == "D:/Archive/4-Encoded/%p%.vprj" && FileExists == "D:/Archive/4-Encoded/%p%.mp4"] {
   :PRIORITY 10
   :RUNQLOADER "true"
   :FAILALERT "true"
   COPY2NAS
}

# ARCHIVE VIDEO FILES TO NAS FOLLOWING QSFIX, COMMERCIAL CUT, ENCODING & COPYING
if [IsObjMediaFile == true && $.IsTVFile{} == true && Filename =$ ".mpg" && FileExists == "D:/Archive/5-Completed/%p%.vprj" && FileExists != "D:/Archive/5-Completed/%p%.properties"] {
   :PRIORITY 10
   :SCANMEDIA "true"
   :RUNQLOADER "true"
   :DONEALERT "true"
   :FAILALERT "true"
   ARCHIVE
}


SJQ3 Client Configuration
Code:
# PERFORM QUICK STREAM FIX ON FILES TO BE ARCHIVED
QSFIX {
   :RESOURCES 32
   :MAX 1
   "\"C:\\scripts\\archive.bat\" QSF \"%c%\""
}

# TRIM COMMERCIALS FROM FILES TO BE ARCHIVED
CUTCOMM {
   :RESOURCES 32
   :MAX 1
   "\"C:\\scripts\\archive.bat\" TRIM \"%c%\""
}

# ENCODE FILES TO BE ARCHIVED
ENCODE {
   :RESOURCES 33
   :MAX 1
   "\"C:\\scripts\\archive.bat\" ENCODE \"%c%\""
}

# COPY FILES TO NAS FOLLOWING QSFIX, COMMERCIAL CUT AND ENCODING
COPY2NAS {
   :RESOURCES 1
   :MAX 1
   "\"C:\\scripts\\archive.bat\" COPY2NAS \"%c%\""
}


# ARCHIVE FILES FOLLOWING QSFIX, COMMERCIAL CUT AND ENCODING
ARCHIVE {
   :RESOURCES 1
   :MAX 1
   "\"C:\\scripts\\archive.bat\" ARCHIVE \"%c%\""
}


I hope this helps at least a few of you!
__________________
Thanks to the developers of the following tools - without your hard work my TV wouldn't be the same!

MeinMaui - SageMC ** stuckless - Phoenix & BMT ** PLUCKYHD - Sage Movie Wall ** razrsharpe - TVExplorer ** Slugger - SJQ, SRE and SageAlert ** bialio - Advanced Mini Guide

Last edited by superdodge; 02-06-2010 at 11:53 AM.
Reply With Quote
  #2  
Old 02-05-2010, 09:25 PM
PLUCKYHD PLUCKYHD is offline
SageTVaholic
 
Join Date: Dec 2007
Posts: 6,257
That is a nice share and I am sure many people can use it

I use DVRMS toolbox myself but allot of people use SJQ.



ps love your scripting comments

Last edited by PLUCKYHD; 02-05-2010 at 09:33 PM.
Reply With Quote
  #3  
Old 02-06-2010, 11:43 AM
ohpleaseno ohpleaseno is offline
Sage Aficionado
 
Join Date: Apr 2009
Location: South Florida
Posts: 464
This also would be perfect for scaling recordings down to the resolution of a ZuneHD.
__________________
Server: WHS with 11TB of storage
Clients:1) HD-200 to a Samsung 32" Slimfit CRT HDTV 2) HD-200 to a Pioneer 26" X1 LCD
Tuners: 1) HD-Homerun 2) Avermedia USB ATSC
Twitter: ohpleaseno
Reply With Quote
  #4  
Old 02-09-2010, 05:27 PM
bikesquid's Avatar
bikesquid bikesquid is offline
Sage Aficionado
 
Join Date: Jan 2010
Location: California's North Coast
Posts: 392
Hey superdodge, thanks for the post, it'll definately jump start my own efforts.

Question for you:

Wondering what you're using for creating the video redo project file? I find video redo seems to do the work faster than comskip, but I'm more concerned with more accurate marking of commercials.

Any opinion?
Reply With Quote
Reply

Tags
bmt, handbrake, sage job queue, sjq, videoredo


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

Advanced Search
Display Modes

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
Handbrake for encoding HD shows evilpenguin SageTV Customizations 1 10-11-2007 09:01 PM
Tip for organizing my library/archive of old TV shows? cineburk SageTV Software 2 07-25-2006 02:58 PM
Archive shows to DVD media? msmith8228 SageTV Software 2 11-10-2005 01:15 PM
SageTV Server 2.1 Issue (Archive Shows) ron.smythe SageTV Software 4 11-29-2004 03:26 PM
What are ppl using to archive shows!? jimbobuk SageTV Software 0 05-17-2003 12:37 PM


All times are GMT -6. The time now is 12:28 PM.


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