Changeset 2f262c09f2bf3a40e98bfa749b3458ec1e4304ed

Show
Ignore:
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
  • httpserver.py

    r967eadd r2f262c0  
    11import time, os, BaseHTTPServer, SocketServer, socket, shutil, os.path 
    2 from urllib import unquote_plus 
     2from urllib import unquote_plus, quote, unquote 
    33from urlparse import urlparse 
     4from xml.sax.saxutils import escape 
    45from cgi import parse_qs 
    56from Cheetah.Template import Template 
     
    5455        else: 
    5556             
    56             subcname = unquote_plus(query['Container'][0]) 
     57            subcname = query['Container'][0] 
    5758            cname = subcname.split('/')[0] 
    5859              
     
    7071            
    7172 
    72             
    7373            files = os.listdir(path) 
    7474 
    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) 
    7676             
    7777            totalFiles = len(files) 
    7878  
    7979            def isdir(file): 
    80                 print os.path.join(path, file) 
    8180                return os.path.isdir(os.path.join(path, file))                      
    8281 
     
    8685                 
    8786                if query.has_key('AnchorItem'): 
    88                     anchor = query['AnchorItem'] [0] 
     87                    anchor = unquote(query['AnchorItem'][0]) 
     88                    print anchor 
    8989                    for i in range(len(files)): 
    9090                         
     
    108108            t.start = index 
    109109            t.isdir = isdir 
     110            t.quote = quote 
     111            t.escape = escape 
    110112            self.wfile.write(t) 
    111113 
  • templates/container.tmpl

    r1843633 r2f262c0  
    44    <ItemCount>#echo len($files) #</ItemCount> 
    55    <Details> 
    6         <Title>$name</Title> 
     6        <Title>$escape($name)</Title> 
    77        <ContentType>x-container/tivo-videos</ContentType> 
    88        <SourceFormat>x-container/folder</SourceFormat> 
     
    1313    <Item> 
    1414        <Details> 
    15             <Title>$file</Title> 
     15            <Title>$escape($file)</Title> 
    1616            <ContentType>x-container/folder</ContentType> 
    1717            <SourceFormat>x-tivo-container/tivo-dvr</SourceFormat> 
     
    1919        <Links> 
    2020            <Content> 
    21                     <Url>/TiVoConnect?Command=QueryContainer&amp;Container=$name/$file</Url> 
     21                    <Url>/TiVoConnect?Command=QueryContainer&amp;Container=$quote($name)/$quote($file)</Url> 
    2222                    <ContentType>x-tivo-container/folder</ContentType> 
    2323            </Content> 
     
    3636                <ContentType>video/x-tivo-mpeg</ContentType> 
    3737                    <AcceptsParams>No</AcceptsParams> 
    38                     <Url>/$name/$file</Url> 
     38                    <Url>/$quote($name)/$quote($file)</Url> 
    3939                </Content> 
    4040                <CustomIcon>