Changeset 2f262c09f2bf3a40e98bfa749b3458ec1e4304ed
- Timestamp:
- 11/26/06 16:06:23
(2 years ago)
- Author:
- Jason Michalski <armooo@armooo.net>
- git-committer:
- Jason Michalski <armooo@armooo.net> 1164578783 +0000
- git-parent:
[967eadd64907871282c80412987568bb38b2f481]
- git-author:
- Jason Michalski <armooo@armooo.net> 1164578783 +0000
- Message:
pyTivo
-Fixed & + and a few others in file names
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r967eadd |
r2f262c0 |
|
| 1 | 1 | import time, os, BaseHTTPServer, SocketServer, socket, shutil, os.path |
|---|
| 2 | | from urllib import unquote_plus |
|---|
| | 2 | from urllib import unquote_plus, quote, unquote |
|---|
| 3 | 3 | from urlparse import urlparse |
|---|
| | 4 | from xml.sax.saxutils import escape |
|---|
| 4 | 5 | from cgi import parse_qs |
|---|
| 5 | 6 | from Cheetah.Template import Template |
|---|
| … | … | |
| 54 | 55 | else: |
|---|
| 55 | 56 | |
|---|
| 56 | | subcname = unquote_plus(query['Container'][0]) |
|---|
| | 57 | subcname = query['Container'][0] |
|---|
| 57 | 58 | cname = subcname.split('/')[0] |
|---|
| 58 | 59 | |
|---|
| … | … | |
| 70 | 71 | |
|---|
| 71 | 72 | |
|---|
| 72 | | |
|---|
| 73 | 73 | files = os.listdir(path) |
|---|
| 74 | 74 | |
|---|
| 75 | | files = filter(lambda f: os.path.isdir(os.path.join(path, f)) or transcode.suported_format(path+'/'+f), files) |
|---|
| | 75 | files = filter(lambda f: os.path.isdir(os.path.join(path, f)) or transcode.suported_format(os.path.join(path,f)), files) |
|---|
| 76 | 76 | |
|---|
| 77 | 77 | totalFiles = len(files) |
|---|
| 78 | 78 | |
|---|
| 79 | 79 | def isdir(file): |
|---|
| 80 | | print os.path.join(path, file) |
|---|
| 81 | 80 | return os.path.isdir(os.path.join(path, file)) |
|---|
| 82 | 81 | |
|---|
| … | … | |
| 86 | 85 | |
|---|
| 87 | 86 | if query.has_key('AnchorItem'): |
|---|
| 88 | | anchor = query['AnchorItem'] [0] |
|---|
| | 87 | anchor = unquote(query['AnchorItem'][0]) |
|---|
| | 88 | print anchor |
|---|
| 89 | 89 | for i in range(len(files)): |
|---|
| 90 | 90 | |
|---|
| … | … | |
| 108 | 108 | t.start = index |
|---|
| 109 | 109 | t.isdir = isdir |
|---|
| | 110 | t.quote = quote |
|---|
| | 111 | t.escape = escape |
|---|
| 110 | 112 | self.wfile.write(t) |
|---|
| 111 | 113 | |
|---|
| r1843633 |
r2f262c0 |
|
| 4 | 4 | <ItemCount>#echo len($files) #</ItemCount> |
|---|
| 5 | 5 | <Details> |
|---|
| 6 | | <Title>$name</Title> |
|---|
| | 6 | <Title>$escape($name)</Title> |
|---|
| 7 | 7 | <ContentType>x-container/tivo-videos</ContentType> |
|---|
| 8 | 8 | <SourceFormat>x-container/folder</SourceFormat> |
|---|
| … | … | |
| 13 | 13 | <Item> |
|---|
| 14 | 14 | <Details> |
|---|
| 15 | | <Title>$file</Title> |
|---|
| | 15 | <Title>$escape($file)</Title> |
|---|
| 16 | 16 | <ContentType>x-container/folder</ContentType> |
|---|
| 17 | 17 | <SourceFormat>x-tivo-container/tivo-dvr</SourceFormat> |
|---|
| … | … | |
| 19 | 19 | <Links> |
|---|
| 20 | 20 | <Content> |
|---|
| 21 | | <Url>/TiVoConnect?Command=QueryContainer&Container=$name/$file</Url> |
|---|
| | 21 | <Url>/TiVoConnect?Command=QueryContainer&Container=$quote($name)/$quote($file)</Url> |
|---|
| 22 | 22 | <ContentType>x-tivo-container/folder</ContentType> |
|---|
| 23 | 23 | </Content> |
|---|
| … | … | |
| 36 | 36 | <ContentType>video/x-tivo-mpeg</ContentType> |
|---|
| 37 | 37 | <AcceptsParams>No</AcceptsParams> |
|---|
| 38 | | <Url>/$name/$file</Url> |
|---|
| | 38 | <Url>/$quote($name)/$quote($file)</Url> |
|---|
| 39 | 39 | </Content> |
|---|
| 40 | 40 | <CustomIcon> |
|---|