Sagetv Download Mac

Posted April 8, 2006 by Jimmy S in Batch file programming

Last Updated on

I used to run SageTV as my PVR front-end but have later decided to switch to MCE2005 due to its cleanness and integration into XP. Anyway, in that time, I found a For statement batch file I used to create my own script to auto-encode video. After playing with For statements for quite some time, I realized that it could be used for so much more!


Requirements:
-Windows XP (any flavor) or 98 (I believe the statements will read fine.)
-Basic understanding of .bat files
-Full batch file contents for converting in sagetv (http://forums.sagetv.com/forums/showthread.php?t=10709)

Overview:

This tech-recipe is another of my sagetv/htpc based ones, but it also can be used for much more! This tutorial will explain how to use a For statement in a way you never thought you could. For statements can allow one to send data to apps via command line (if they support this), move data, create webportals, and more!

Also, I have included my own date parsing code. It is handy to have and hard to find on the web..

Download SageTV Client 9.2.5 Windows 64-bit 83MB Win64 Download SageTV Client 9.2.5 Windows 71MB Win Download old versions. Mac = Mac download version. It works on 32-bit and 64-bit Mac OS. Mac64 = Mac OS download version. It works only on 64-bit Mac OS. SageTV was added to AlternativeTo by Tucer on Jun 19, 2011 and this page was last updated Apr 15, 2021. SageTV is sometimes referred to as Sage. SageTv has too many features to list here, however here are a few that caught my eye: Client/Server - Simple media PCs at your TV, complex noisy media server somewhere out the way. Choice of clients, Media PC with full client, place shifter for when your on the move (like slingbox), windows, linux, mac.

Sagetv free download, and many more programs. Sagetv free download, and many more programs. Join or Sign In. Integrate Mac, PVR, online video.

Date Code:
Usage: use in any batch file you need to use the current date in a MMDDYYYY format; can be called in script by %date; place in beginning of script

    @REM parses month, day, and year into mm, dd, yyyy formats to create folders
    FOR /F “TOKENS=1* DELIMS= ” %%A IN (‘DATE/T’) DO SET CDATE=%%B
    FOR /F “TOKENS=1,2 eol=/ DELIMS=/ ” %%A IN (‘DATE/T’) DO SET mm=%%B
    FOR /F “TOKENS=1,2 DELIMS=/ eol=/” %%A IN (‘echo %CDATE%’) DO SET dd=%%B
    FOR /F “TOKENS=2,3 DELIMS=/ ” %%A IN (‘echo %CDATE%’) DO SET yyyy=%%B
    SET date=%mm%%dd%%yyyy%

____________________

Sagetv Download Mac

Here is a simple example of a For statement that will be used in this tutorial.

@echo on
@REM Seamonkey420's SageTV Batch File - MPG to WMV
@REM created on: 3/14/05
@REM RECOMMENDED TO TEST IN A TEMP DIR FIRST

@REM Setup as is; it will encode mpg to divx, then
@REM clean up the log, txt, ccno and VPrj files
@REM Then moves the avi file to a new folder (odir)
@REM Then finally deletes the original mpg

@REM 3/15/05: Added creation of subfolders with date encoded
@REM and also allows date variable to be globally available
@REM and added in cleanup of orphan files
@REM 3/19/05: Updated date parsing/folder to be more accurate
@REM also added in new functionality to create an embeded webpage
@REM for each movie file created, is created in the same folder as
@REM avi is encoded to!
@REM 3/27/05: Updated batch now to create a log file of any .wmv or the filetype your
@REM encoding your movies to prior to encoding, then checks to see if log file exists, if so,
@REM skips the file so you do not have to waste time re-encoding movies you have already encoded.
@REM 4/5/2005: Added PSP Video 9 integration; Requires PSPvideo9 be set up for auto-converting
@REM Must have Videora installed or this folder created(C:Program FilesVideora)
@REM moves original mpgs to new psp folder defined in pdir variable.

@REM Be sure to put this batch file in the same folder as your Virtualdub.exe/windows media encoder folder
@REM ALSO Be sure to create a .vcf settings file in Virtualdub or .prx profile in windows media encoder
@REM This file then needs to be saved in the same folder as virtualdub.exe/wme and this batch file
@REM And the embedE.txt, embedS.txt, ndexE, indexS, TVindexE, TVindexS text files
@REM need to be created in this same directory/folder

@REM PSPvideo9 can then autoconvert files later in day! Added for my PSP!! moves the movie to a new folder for psp video to look for!
@REM Be sure to setup PSP Video9 with videora (note, you only need the folder for it create and have settings in psp video 9
@REM look for this location: C:Program FilesVideora , just make that folder if you don't want to install videora

@REM parses month, day, and year into mm , dd, yyyy formats to create folders off of!
FOR /F 'TOKENS=1* DELIMS= ' %%A IN ('DATE/T') DO SET CDATE=%%B
FOR /F 'TOKENS=1,2 eol=/ DELIMS=/ ' %%A IN ('DATE/T') DO SET mm=%%B
FOR /F 'TOKENS=1,2 DELIMS=/ eol=/' %%A IN ('echo %CDATE%') DO SET dd=%%B
FOR /F 'TOKENS=2,3 DELIMS=/ ' %%A IN ('echo %CDATE%') DO SET yyyy=%%B
SET date=%mm%%dd%%yyyy%

@REM SETS SCRIPT VARIABLES, ie folder paths for files to be encoded
@REM idir = the directory that sageTV saves mpg recordings to
@REM odir = folder where wmv files will be saved and webpages
@REM oFile = File extension to be outputted, .wmv by default
@REM ldir = Log file directory
@REM trigger = file to check for to see if programs are done recording/viewed
@REM pdir = Folder where original mpg gets moved if encoded correctly! for use w/
@REM PSP Video 9 and autoconvert feature

set idir=T:Recorded Shows
set odir=T:Encoded Shows
set oFile=wmv
set profile=psp.prx
set ldir=T:Recorded ShowsLog
set trigger=VPrj
set pdir=T:Recorded ShowsPSP

@REM This line checks for a .VPrj file in the idir location.
@REM If it finds the file, it will first create a folder with todays date using mmddyyyy format
@REM into the odir folder and it will then call virtualdub/cscript (windows media encoder) w/the parameters
@REM and the .vcf/.prx profile and encode the mpg into avi/wmv, (a more streamable format than divx)

for /f 'tokens=1 delims=.' %%i in ('dir /s/b '%idir%*-?.%trigger%') do if EXIST '%%i.mpg' (md '%odir%%date%') 2>&1

@REM Newly added, creates log files for existing movies in the logdir folder
@REM Then checks for log file, if log file exists, it will not encode the mpg, but if it does, it will.

for /f 'tokens=4 delims=.' %%i in ('dir /s/b '%odir%*-?.%oFile%') do if NOT EXIST '%ldir%*%%i.log' (echo exists > '%ldir%%%i.log')
for /f 'tokens=1 delims=.' %%i in ('dir /b '%idir%*-?.%trigger%') do if NOT EXIST '%ldir%%%i.log' (cscript.exe wmcmd.vbs -input '%idir%%%i.mpg' -description '%%i' -author 'seamonkey420' -output '%idir%%%i.%oFile%' -loadprofile %profile%)

@REM this section cleans up the old files and moves the avi to the odirdate folder

for /f 'tokens=1 delims=.' %%i in ('dir /b '%idir%*-?.%oFile%') do if EXIST '%idir%%%i.%oFile%' (move '%idir%%%i.%oFile%' '%odir%%date%%%i.%oFile%')
for /f 'tokens=1 delims=.' %%i in ('dir /b '%odir%%date%*-?.%oFile%') do if EXIST '%odir%%date%%%i.%oFile%' (del '%idir%%%i.log')
for /f 'tokens=1 delims=.' %%i in ('dir /b '%odir%%date%*-?.%oFile%') do if EXIST '%odir%%date%%%i.%oFile%' (del '%idir%%%i.txt')
for /f 'tokens=1 delims=.' %%i in ('dir /b '%odir%%date%*-?.%oFile%') do if EXIST '%odir%%date%%%i.%oFile%' (del '%idir%%%i.%trigger%')
for /f 'tokens=1 delims=.' %%i in ('dir /b '%odir%%date%*-?.%oFile%') do if EXIST '%odir%%date%%%i.%oFile%' (del '%idir%%%i.ccno')

@REM This line move the original mpg movie if the avi/wmv is created and moved successfully to the psp directory for PSP Video 9 to encode!
@REM I would @REM this line when testing! NOTE, do your deleting in sagetv, batch shouldn't re-encode already encoded files!
@REM NEED TO FIX MOVING PART!!

DEL /Q '%pdir%*.*'
for /f 'tokens=1 delims=.' %%i in ('dir /b '%idir%*-?.%trigger%') do if NOT EXIST '%ldir%%%i.log' (COPY '%idir%%%i.mpg' '%pdir%%%i.mpg')

@REM Remove the @REM from the line below to delete the movie if its been encoded. Defaulted to not delete.
@REM for /f 'tokens=1 delims=.' %%i in ('dir /b '%idir%*-?.%trigger%') do if NOT EXIST '%ldir%%%i.log' (DEL /Q '%idir%%%i.mpg')

Sagetv Download Mac Version

@REM These lines create a web page for each movie encoded, embeds into page, play movie from page!
@REM NOTE! this again requires the embedE.txt and the embedS.txt to be located in the same folder
@REM as windows media encoder, this batch file, and the .prx profile (usually, C:Program FilesWindows Media ComponentsEncoder )
@REM Also creates an index.html with links to all html embedded pages in the %date% folder (ie 03192005index.html)
@REM And finally a shows_index.html in the root of the odir (all pages are linked together, so easy to use for your webserver!)
@REM Files are linked! Test before using, like always!

for /f 'tokens=1 delims=.' %%i in ('dir /b '%odir%%date%*-?.%oFile%') do if EXIST '%odir%%date%%%i.%oFile%' (type embedS.txt > '%odir%%date%%%i.html')

for /f 'tokens=1 delims=.' %%i in ('dir /b '%odir%%date%*-?.%oFile%') do if EXIST '%odir%%date%%%i.%oFile%' (echo ^ >> '%odir%%date%%%i.html')

for /f 'tokens=1 delims=.' %%i in ('dir /b '%odir%%date%*-?.%oFile%') do if EXIST '%odir%%date%%%i.%oFile%' (echo ^^ >> '%odir%%date%%%i.html')

for /f 'tokens=1 delims=.' %%i in ('dir /b '%odir%%date%*-?.%oFile%') do if EXIST '%odir%%date%%%i.%oFile%' (type embedE.txt >> '%odir%%date%%%i.html')

for /f 'tokens=1 delims=.' %%i in ('dir /b '%odir%%date%*-?.html') do if EXIST '%odir%%date%%%i.html' (type TVindexS.txt > '%odir%%date%index.html')
for /f 'tokens=1 delims=.' %%i in ('dir /b '%odir%%date%*-?.html') do if EXIST '%odir%%date%%%i.html' (echo ^%%i^^ >> '%odir%%date%index.html')
for /f 'tokens=1 delims=.' %%i in ('dir /b '%odir%%date%*-?.html') do if EXIST '%odir%%date%%%i.html' (type TVindexE.txt >> '%odir%%date%index.html')

    Overview: Well, it is amazing what a little time, thinking, discussing, and testing can accomplish. I know that currently ajuhawk has created an application to do most of this and more, but I am a fan of the batch file still, so here is the latest of my batch files.

    Notes: This DOES NOT handle compression in SageTV. Movies/shows may be encoded more than once if compression is used.

    Installation:

    Required Programs:
    -SageTV
    -Cayars Ultimate STV installed
    -Windows Media Encoder 9 (click to go to download page)
    -PSP Video 9 (http://pspvideo9.com)
    -Videora (http://videora.com )

    _________

    Where to Put Files
    -wme.bat put in Windows Media Encoder folder (i.e., C:Program FilesWindows Media ComponentsEncoder)
    -psp.prx or whatever you call your Windows Media Encoder profile; put in Windows Media Encoder folder (i.e., C:Program FilesWindows Media ComponentsEncoder)
    -All the .txt files (i.e., embedS.txt, embedE.txt, indexS.txt, etc.) Put this in Windows Media Encoder folder (i.e., C:Program FilesWindows Media ComponentsEncoder).
    -Put the Encode.cmd into your cayarsexternal folder (i.e., C:Program FilesFrey TechnologiesSageTVSTVsOriginalV2cayarsExternal )

    _________

    Files That Need to Be Modified
    -wme.bat
    You will need to change the idir and the odir parameters.
    The idir is the location where sagetv saves your TV recordings.
    The odir contains the locations where you want to save your encoded files. (Note: This batch will create a new folder in this directory with the date stamp mmddyyyy format)

    Here are the parameters that can be changed/need (with examples) and to what they refer:

    set idir=T:Recorded Shows (where sagetv saves the mpgs of tv shows)
    set odir=T:Encoded Shows (where you want to create your encoded tv show webportal)
    set oFile=wmv (file type you want to encode to)
    set profile=psp.prx (windows media player profile to use)
    set ldir=T:Recorded ShowsLog (location of log folder, be sure to create it before running)
    set trigger=VPrj (main trigger file )
    set pdir=T:Recorded ShowsPSP (location that PSP Video 9 looks for movies to auto-convert)

    Also, if you want to have the batch search for a different file type to trigger the encoding, you can do so here. By default, I have it set to look for a .VPrj file.

    -.txt files
    Modify these files to your liking. I would suggest to run the script/batch first and see how things look. These files are basically templates. I have my batch use to create the webpages and embed the movie into a webpage.

    -Encode.cmd (put and located in C:Program FilesFrey TechnologiesSageTVSTVsOriginalV2cayarsExternal)
    Edit this batch so that it points to where the wme.bat is saved (
    C:Program FilesWindows Media ComponentsEncoderwme.bat).

    -Then once you have all of this done, in Cayars Ultimate STV.
    you can add a menu item to point to this file.
    -Right-click in the menu/submenu where you want to add the encoding option.
    -Choose
    Add New Menu Item > External Program.
    -Then, for the external program, use cmd.exe.
    -For arguments/parameters, use /C “C:Program FilesFrey TechnologiesSageTVSTVsOriginalV2cayarsExternalEncode.cmd”
    (You can copy this line, and then use the Paste From Clipboard option.)
    -Then enter the menu title/text to show the following: i.e., Encode and Publish
    -Then once you are done, right-click again and now Save Menu Definition File.
    Hopefully, you should now be able to just click the option, and the encoding will start automatically in the background.

    ________

    Here is exactly what the batch does:
    1. In sagetv, click the new menu item we added that points to the batch/encode script.
    2. This calls our wme.bat script. This script does it all!
    3. First, it creates a new folder and is created with the current date mmddyyyy (i.e., 03192005)
    4. It then will check for a .VPrj file in the idir.
    5. If it finds one, it will then check the log file folder for a log. If not,
    6. it will then go and encode all the mpg movies that have a .VPrj file using Windows Media Encoder and the profile we saved in the psp.prx.
    7. Once it finishes encoding the .VPrj, it will go back and then create a webpage file .html with the show name/episode (i.e., FamilyGuyFunnyDay-3.html) in the folder that was created (i.e. 03192005/FamilyGuyFunnyDay-3.html).
    8. After the embedded webpage is created, it will go back and then create a main index.html file for that folder (i.e., 03192005index.html).
    9. After the date index is created, another index is then created with links to all of the index.html files that might exist.
    10. Finally, once this is done, the batch will go back and clean up all of the files assocated with the newly encoded wmv (i.e., ccno, txt, log, etc.) if it successfully encoded. Also, move the mpg to the psp folder (for psp video to auto-convert later).
    However, if the encoding of the mpg failed, the original mpg is left alone.
    11. Then it will do some quick orphaned file cleanup.

About Jimmy S

Jimmy Selix is an early adopter that loves to be one of the first on the block to have the latest and greatest in technology and gadgets. Another love of his is being able to share his knowledge to others seeking it. Feel free to drop any comments or questions that you may have.
View more articles by Jimmy S

Sagetv Mac Download

The Conversation

Follow the reactions below and share your own thoughts.

Sagetv Download Mac Free

SageTV enables you to set up a PC running Windows or Linux as a media center for recorded or live television programming. Now the company has released its Placeshifter software for the Macintosh, enabling Mac-toting users to access remote SageTV media centers. What’s more, the media center software is headed to the Mac soon.

With SageTV’s media center software installed, a PC can record movies and television shows and can also share other media types like music, imported video and photos. Right now the software’s only available for Windows and Linux, though a Mac version is due by the end of next month.

In the interim, users who have access to a SageTV media center can still watch their content on a Mac using the Placeshifter software, available for purchase and download and compatible with SageTV version 6. A 15-day trial version is available.

The Placeshifter software lets you watch the contents of your SageTV media center remotely. The quality of the connection scales depending on the speed, and it works inside a house using wireless networking or from anywhere you can access the Internet from a broadband Internet connection. Placeshifter costs $29.95, and licenses are also available bundled with the media center software.

System requirements call for Mac OS X v10.4 or later, G4/500MHz or faster (Intel included) and broadband Internet connection.