Changeset f838e68464a57e5547f0f18cdd6473b198151e21
- 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
| r2393bc1 |
rf838e68 |
|
| 5 | 5 | from Cheetah.Template import Template |
|---|
| 6 | 6 | import transcode |
|---|
| | 7 | |
|---|
| | 8 | SCRIPTDIR = os.path.dirname(__file__) |
|---|
| 7 | 9 | |
|---|
| 8 | 10 | class TivoHTTPServer(SocketServer.ThreadingMixIn, BaseHTTPServer.HTTPServer): |
|---|
| … | … | |
| 46 | 48 | self.end_headers() |
|---|
| 47 | 49 | if query['Container'][0] == '/': |
|---|
| 48 | | t = Template(file="templates/root_container.tmpl") |
|---|
| | 50 | t = Template(file=os.path.join(SCRIPTDIR, 'templates', 'root_container.tmpl')) |
|---|
| 49 | 51 | t.containers = self.server.containers |
|---|
| 50 | 52 | t.hostname = socket.gethostname() |
|---|
| … | … | |
| 100 | 102 | return os.path.isdir(path) |
|---|
| 101 | 103 | |
|---|
| 102 | | t = Template(file="templates/container.tmpl") |
|---|
| | 104 | t = Template(file=os.path.join(SCRIPTDIR,'templates', 'container.tmpl')) |
|---|
| 103 | 105 | t.name = subcname |
|---|
| 104 | 106 | t.files = files |
|---|
| … | … | |
| 126 | 128 | self.send_header('Content-type', 'text/html') |
|---|
| 127 | 129 | self.end_headers() |
|---|
| 128 | | t = Template(file="templates/info_page.tmpl") |
|---|
| | 130 | t = Template(file=os.path.join(SCRIPTDIR, 'templates', 'info_page.tmpl')) |
|---|
| 129 | 131 | self.wfile.write(t) |
|---|
| 130 | 132 | self.end_headers() |
|---|
| … | … | |
| 134 | 136 | self.send_header('Content-type', 'text/html') |
|---|
| 135 | 137 | self.end_headers() |
|---|
| 136 | | t = Template(file="templates/unsuported.tmpl") |
|---|
| | 138 | t = Template(file=os.path.join(SCRIPTDIR,'templates','unsuported.tmpl')) |
|---|
| 137 | 139 | t.query = query |
|---|
| 138 | 140 | self.wfile.write(t) |
|---|
| r94b3427 |
rf838e68 |
|
| 1 | | import beacon, httpserver, ConfigParser |
|---|
| | 1 | import beacon, httpserver, ConfigParser, os |
|---|
| 2 | 2 | |
|---|
| 3 | 3 | config = ConfigParser.ConfigParser() |
|---|
| 4 | | config.read('pyTivo.conf') |
|---|
| | 4 | p = os.path.dirname(__file__) |
|---|
| | 5 | config.read(os.path.join('pyTivo.conf')) |
|---|
| 5 | 6 | |
|---|
| 6 | 7 | port = config.get('Server', 'Port') |
|---|
| r2393bc1 |
rf838e68 |
|
| 30 | 30 | <ContentType>video/x-tivo-mpeg</ContentType> |
|---|
| 31 | 31 | <SourceFormat>video/x-tivo-mpeg</SourceFormat> |
|---|
| 32 | | <SourceSize>5000000536</SourceSize> |
|---|
| | 32 | <SourceSize>6000000536</SourceSize> |
|---|
| 33 | 33 | </Details> |
|---|
| 34 | 34 | <Links> |
|---|
| r2393bc1 |
rf838e68 |
|
| 1 | 1 | import subprocess, shutil, os, re |
|---|
| | 2 | |
|---|
| | 3 | SCRIPTDIR = os.path.dirname(__file__) |
|---|
| 2 | 4 | |
|---|
| 3 | 5 | def output_video(inFile, outFile): |
|---|
| … | … | |
| 11 | 13 | def transcode(inFile, outFile): |
|---|
| 12 | 14 | |
|---|
| 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)) |
|---|
| 14 | 16 | ffmpeg = subprocess.Popen(cmd, stdout=subprocess.PIPE) |
|---|
| 15 | 17 | try: |
|---|
| … | … | |
| 65 | 67 | |
|---|
| 66 | 68 | def video_info(inFile): |
|---|
| 67 | | cmd = "ffmpeg_mp2.exe -i \"%s\"" % inFile |
|---|
| 68 | | print cmd |
|---|
| | 69 | cmd = SCRIPTDIR + "\\ffmpeg_mp2.exe -i \"%s\"" % inFile |
|---|
| 69 | 70 | ffmpeg = subprocess.Popen(cmd, stderr=subprocess.PIPE, stdout=subprocess.PIPE) |
|---|
| 70 | 71 | output = ffmpeg.stderr.read() |
|---|
| 71 | | print ffmpeg.stdout.read() |
|---|
| 72 | 72 | |
|---|
| 73 | 73 | rezre = re.compile(r'.*Video: (.+), (\d+)x(\d+), (.+) fps.*') |
|---|