Changeset f838e68464a57e5547f0f18cdd6473b198151e21

Show
Ignore:
Timestamp:
11/25/06 01:13:44 (2 years ago)
Author:
Jason Michalski <armooo@armooo.net>
git-committer:
Jason Michalski <armooo@armooo.net> 1164438824 +0000
git-parent:

[2393bc1b52479317efc5baadc25a513cd7a23e25]

git-author:
Jason Michalski <armooo@armooo.net> 1164438824 +0000
Message:

pyTivo
- Added service (requires pywin32)
- Fixed other crap

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • httpserver.py

    r2393bc1 rf838e68  
    55from Cheetah.Template import Template 
    66import transcode 
     7 
     8SCRIPTDIR = os.path.dirname(__file__) 
    79 
    810class TivoHTTPServer(SocketServer.ThreadingMixIn, BaseHTTPServer.HTTPServer): 
     
    4648        self.end_headers() 
    4749        if query['Container'][0] == '/': 
    48             t = Template(file="templates/root_container.tmpl"
     50            t = Template(file=os.path.join(SCRIPTDIR, 'templates', 'root_container.tmpl')
    4951            t.containers = self.server.containers 
    5052            t.hostname = socket.gethostname() 
     
    100102                return os.path.isdir(path) 
    101103             
    102             t = Template(file="templates/container.tmpl"
     104            t = Template(file=os.path.join(SCRIPTDIR,'templates', 'container.tmpl')
    103105            t.name = subcname 
    104106            t.files = files 
     
    126128        self.send_header('Content-type', 'text/html') 
    127129        self.end_headers() 
    128         t = Template(file="templates/info_page.tmpl"
     130        t = Template(file=os.path.join(SCRIPTDIR, 'templates', 'info_page.tmpl')
    129131        self.wfile.write(t) 
    130132        self.end_headers() 
     
    134136        self.send_header('Content-type', 'text/html') 
    135137        self.end_headers() 
    136         t = Template(file="templates/unsuported.tmpl"
     138        t = Template(file=os.path.join(SCRIPTDIR,'templates','unsuported.tmpl')
    137139        t.query = query 
    138140        self.wfile.write(t) 
  • pyTivo.py

    r94b3427 rf838e68  
    1 import beacon, httpserver, ConfigParser 
     1import beacon, httpserver, ConfigParser, os 
    22 
    33config = ConfigParser.ConfigParser() 
    4 config.read('pyTivo.conf') 
     4p = os.path.dirname(__file__) 
     5config.read(os.path.join('pyTivo.conf')) 
    56 
    67port = config.get('Server', 'Port') 
  • templates/container.tmpl

    r2393bc1 rf838e68  
    3030            <ContentType>video/x-tivo-mpeg</ContentType> 
    3131            <SourceFormat>video/x-tivo-mpeg</SourceFormat> 
    32             <SourceSize>5000000536</SourceSize> 
     32            <SourceSize>6000000536</SourceSize> 
    3333        </Details> 
    3434        <Links> 
  • transcode.py

    r2393bc1 rf838e68  
    11import subprocess, shutil, os, re 
     2 
     3SCRIPTDIR = os.path.dirname(__file__) 
    24 
    35def output_video(inFile, outFile): 
     
    1113def transcode(inFile, outFile): 
    1214 
    13     cmd = "ffmpeg_mp2.exe -i \"%s\" -vcodec mpeg2video -r 29.97 -b 4096 %s -ac 2 -ab 192 -f vob -" % (inFile, select_aspect(inFile)) 
     15    cmd = SCRIPTDIR + "\\ffmpeg_mp2.exe -i \"%s\" -vcodec mpeg2video -r 29.97 -b 4096 %s -ac 2 -ab 192 -f vob -" % (inFile, select_aspect(inFile)) 
    1416    ffmpeg = subprocess.Popen(cmd, stdout=subprocess.PIPE) 
    1517    try: 
     
    6567 
    6668def video_info(inFile): 
    67     cmd = "ffmpeg_mp2.exe -i \"%s\"" % inFile 
    68     print cmd 
     69    cmd = SCRIPTDIR + "\\ffmpeg_mp2.exe -i \"%s\"" % inFile 
    6970    ffmpeg = subprocess.Popen(cmd, stderr=subprocess.PIPE, stdout=subprocess.PIPE) 
    7071    output = ffmpeg.stderr.read() 
    71     print ffmpeg.stdout.read() 
    7272     
    7373    rezre = re.compile(r'.*Video: (.+), (\d+)x(\d+), (.+) fps.*')