Author: duncan
Date: Fri Dec 22 09:03:01 2006
New Revision: 8787

Modified:
   branches/rel-1/freevo/src/www/htdocs/fileinfo.rpy
   branches/rel-1/freevo/src/www/htdocs/library.rpy
   branches/rel-1/freevo/src/www/htdocs/scripts/display_info-head.js
   branches/rel-1/freevo/src/www/htdocs/scripts/display_prog-head.js
   branches/rel-1/freevo/src/www/web_types.py

Log:
[ 1604844 ] 1.7RC1 - Webserver issue
[ 1604849 ] 1.7RC1 - Webserver bug
Fixes applied


Modified: branches/rel-1/freevo/src/www/htdocs/fileinfo.rpy
==============================================================================
--- branches/rel-1/freevo/src/www/htdocs/fileinfo.rpy   (original)
+++ branches/rel-1/freevo/src/www/htdocs/fileinfo.rpy   Fri Dec 22 09:03:01 2006
@@ -1,6 +1,5 @@
 #!/usr/bin/python
 
-#if 0 /*
 # -----------------------------------------------------------------------
 # proginfo.rpy - Dynamically update program info popup box.
 # -----------------------------------------------------------------------
@@ -22,22 +21,27 @@
 # with this program; if not, write to the Free Software Foundation, Inc.,
 # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 #
-# ----------------------------------------------------------------------- */
-#endif
+# -----------------------------------------------------------------------
 
-import sys,os, string
+import sys, os, stat, string
 import time
 
 from www.web_types import HTMLResource, FreevoResource
 from twisted.web.woven import page
 import util
 import config 
+import kaa.metadata as metadata 
 from twisted.web import static
 
 MAX_DESCRIPTION_CHAR = 1000
 
 class FileInfoResource(FreevoResource):
 
+    def __init__(self):
+        self.cache_dir = '%s/link_cache/' % (config.FREEVO_CACHEDIR)
+        if not os.path.isdir(self.cache_dir):
+            os.mkdir(self.cache_dir, 
stat.S_IMODE(os.stat(config.FREEVO_CACHEDIR)[stat.ST_MODE]))
+
     def _render(self, request):
         fv = HTMLResource()
         form = request.args
@@ -45,6 +49,7 @@
         img = fv.formValue(form, 'img')
         
         if file:
+            #medium = metadata.parse(file)
             title = ""
             info = "<table>"
             
@@ -63,25 +68,26 @@
                 media_info = util.mediainfo.get(file)
                 title = media_info['title']
                 #audio info
-                if media_info['artist'] != "":
+                if media_info['artist']:
                     info+='<tr><td><b>Artist: 
</b></td><td>'+media_info['artist'] +'</td></tr>'
-                if media_info['album'] != "":
+                if media_info['album']:
                     info+='<tr><td><b>Album: 
</b></td><td>'+media_info['album']+'</td></tr>'
-                if media_info['genre'] != "":
+                if media_info['genre']:
                     info+='<tr><td><b>Genre: 
</b></td><td>'+media_info['genre']+'</td></tr>'
-                if media_info['length'] != "" and media_info['length'] != 0:
+                if media_info['length'] and media_info['length'] != 0:
                     length = str(int(media_info['length']) / 60) + " min."
                     info+='<tr><td><b>Length: 
</b></td><td>'+length+'</td></tr>'
                 #movie info
                 if media_info['height'] != "" and media_info['width'] != "":
-                    info+='<tr><td><b>Dimensions: 
</b></td><td>'+str(media_info['height'])+' x 
'+str(media_info['width'])+'</td></tr>' 
+                    info +='<tr><td><b>Dimensions: 
</b></td><td>'+str(media_info['height'])+' x '\
+                        +str(media_info['width'])+'</td></tr>' 
                 if media_info['type'] != "":
                    info+='<tr><td><b>Type: 
</b></td><td>'+media_info['type']+'</td></tr>' 
             #add size
             info+='<tr><td><b>Size: 
</b></td><td>'+str((os.stat(file)[6]/1024)/1024)+' MB</td></tr>'
             info+= "</table>"
             
-            file_link = Unicode(self.create_file_link(file))
+            file_link = self.create_file_link(file)
             
             fv.res += (
                u"<script>\n" \
@@ -109,14 +115,13 @@
                u"</body></html>"
             ) % ( img_name, img )
             
-        return String( fv.res )
+        return String(fv.res)
     
     def create_file_link(self, file):
-        current_path = "%s/share/freevo/htdocs/" % sys.prefix
-        file_cache_link = "file_cache/" + file.replace("/", "_")
-        if not os.path.exists("%s/share/freevo/htdocs/" % sys.prefix + 
file_cache_link): 
-            os.symlink(file , current_path + file_cache_link)
-        return file_cache_link
+        cache_link = self.cache_dir + file.replace("/", "_")
+        if not os.path.exists(cache_link):
+            os.symlink(file, cache_link)
+        return cache_link
     
     def get_fxd_info(self, fxd_file):
         fxd_info = {}

Modified: branches/rel-1/freevo/src/www/htdocs/library.rpy
==============================================================================
--- branches/rel-1/freevo/src/www/htdocs/library.rpy    (original)
+++ branches/rel-1/freevo/src/www/htdocs/library.rpy    Fri Dec 22 09:03:01 2006
@@ -29,7 +29,7 @@
 #
 # -----------------------------------------------------------------------
 
-import sys, os, string, urllib, re, types
+import sys, os, stat, string, urllib, re, types
 
 
 # needed to put these here to suppress its output
@@ -38,7 +38,8 @@
 import util.fxdparser as fxdparser
 import util.mediainfo
 import tv.record_client as ri
-import kaa.imlib2 as Image
+import kaa.imlib2 as imlib2
+import kaa.metadata as metadata
 
 from www.web_types import HTMLResource, FreevoResource
 from twisted.web import static
@@ -49,6 +50,12 @@
 
 class LibraryResource(FreevoResource):
     isLeaf=1
+
+    def __init__(self):
+        self.cache_dir = '%s/image_cache/' % (config.FREEVO_CACHEDIR)
+        if not os.path.isdir(self.cache_dir):
+            os.mkdir(self.cache_dir, 
stat.S_IMODE(os.stat(config.FREEVO_CACHEDIR)[stat.ST_MODE]))
+
     def is_access_allowed(self, dir_str):
         allowed_dirs = []
         allowed_dirs.extend(config.VIDEO_ITEMS)
@@ -113,39 +120,29 @@
         messages = []
         form = request.args
 
-        action           = fv.formValue(form, 'action')
-        action_file      = Unicode(fv.formValue(form, 'file'))
-        if isinstance( action_file, str ):
-            action_file = Unicode( action_file, 'latin-1' )
-            
-        action_newfile   = Unicode(fv.formValue(form, 'newfile'))
-        if isinstance( action_newfile, str ):
-            action_newfile = Unicode( action_newfile, 'latin-1' )
-            
-        action_dir       = Unicode(fv.formValue(form, 'dir'))
+        action = fv.formValue(form, 'action')
+        action_file = fv.formValue(form, 'file')
+        action_newfile = fv.formValue(form, 'newfile')
+        action_dir = fv.formValue(form, 'dir')
         dir_str = fv.formValue(form, 'dir')
         if isinstance(dir_str, str):
             if not self.is_access_allowed(dir_str):
                 action_dir = ""
-        if isinstance( action_dir, str ):
-            action_dir = Unicode( action_dir, 'latin-1' )
-            
         action_mediatype = fv.formValue(form, 'media')
-        action_script = os.path.basename(request.path)        
+        action_script = os.path.basename(request.path)
         #use request.postpath array to set action to download
         if not action and len(request.postpath) > 0:
             action = "download"
-            action_file = Unicode(request.postpath[-1])
-            action_dir = Unicode(os.sep + string.join(request.postpath[0:-1], 
os.sep))
+            action_file = request.postpath[-1]
+            action_dir = os.sep + string.join(request.postpath[0:-1], os.sep)
             action_mediatype = "download"
         elif not action:
             action = "view"
 
-
         #check to make sure no bad chars in action_file
         fs_result = 0
         bs_result = 0
-        if len(action_file):
+        if action_file and len(action_file):
             fs_result = string.find(action_file, '/')
             bs_result = string.find(action_file, '\\')
 
@@ -175,8 +172,8 @@
                         if os.path.exists(file_loc):
                             os.unlink(file_loc)
                             messages += [ _( 'Delete %s.' ) % 
('<b>'+file_loc+'</b>') ]
-                        file_loc_fxd = os.path.splitext(file_loc)[0] + '.fxd'
-                        if os.path.exists(file_loc_fxd): 
+                        file_loc_fxd = os.path.splitext(file_loc)[0]+'.fxd'
+                        if os.path.exists(file_loc_fxd):
                             os.unlink(file_loc_fxd)
                             messages += [ _('Delete %s.') % 
('<b>'+file_loc_fxd+'</b>') ]
                     except OSError, e:
@@ -184,15 +181,17 @@
                         messages += [ _( 'Delete %s, failed.' ) % 
('<b>'+file_loc+'</b>') ]
 
                 elif action == 'download':
-                    sys.stderr.write('download %s\n' % String(file_loc))
+                    sys.stderr.write('download %s\n' % file_loc)
                     sys.stderr.flush()
                     return static.File(file_loc).render(request)
                     #request.finish()
 
             else:
-                messages += [ '<b>'+_('ERROR') + '</b>: ' + _( '%s does not 
exist. No action taken.') % ('<b>'+file_loc+'</b>') ]
+                messages += [ '<b>'+_('ERROR')+'</b>: '+_( '%s does not exist. 
No action taken.') %
+                    ('<b>'+file_loc+'</b>') ]
         elif action_file and action != 'view':
-            messages += [ '<b>'+_('ERROR')+'</b>: ' +_( 'I do not process 
names (%s) with slashes for security reasons.') % action_file ]
+            messages += [ '<b>'+_('ERROR')+'</b>: '\
+                +_( 'I do not process names (%s) with slashes for security 
reasons.') % action_file ]
 
         directories = []
         if action_mediatype:
@@ -200,26 +199,29 @@
 
 
         if action and action != "download":
-            fv.printHeader(_('Media Library'), 
'styles/main.css',script='scripts/display_info-head.js', selected=_("Media 
Library"))
+            fv.printHeader(_('Media Library'), 'styles/main.css', 
script='scripts/display_info-head.js',
+                selected=_("Media Library"))
             fv.res += '<script language="JavaScript"><!--' + "\n"
 
             fv.res += 'function deleteFile(basedir, file, mediatype) {' + "\n"
             fv.res += '   okdelete=window.confirm("Do you wish to delete 
"+file+" and its fxd?");' + "\n"
             fv.res += '   if(!okdelete) return;' + "\n"
-            fv.res += '   document.location="' + action_script 
+'?action=delete&file=" + escape(file) + "&dir=" + basedir + "&media=" + 
mediatype;' + "\n"
+            fv.res += '   document.location="' + action_script 
+'?action=delete&file=" + escape(file) + "&dir="'\
+                +'+ basedir + "&media=" + mediatype;' + "\n"
             fv.res += '}' + "\n"
 
             fv.res += 'function renameFile(basedir, file, mediatype) {' + "\n"
             fv.res += '   newfile=window.prompt("New name please.", file);' + 
"\n"
             fv.res += '   if(newfile == "" || newfile == null) return;' + "\n"
-            fv.res += '   document.location="' + action_script 
+'?action=rename&file=" + escape(file) + "&newfile=" + escape(newfile) + 
"&dir=" + basedir + "&media=" + mediatype;' + "\n"
+            fv.res += '   document.location="' + action_script 
+'?action=rename&file=" + escape(file) + "&newfile="'\
+                +'+ escape(newfile) + "&dir=" + basedir + "&media=" + 
mediatype;' + "\n"
             fv.res += '}' + "\n"
 
             fv.res += '//--></script>' + "\n"
 
             #check if the dir is password protected
-            if os.path.exists(String(action_dir) + "/.password"):
-                f = open(String(action_dir) + "/.password", "r")
+            if action_dir and os.path.exists(action_dir + "/.password"):
+                f = open(action_dir + "/.password", "r")
                 password = f.read()
                 f.close()
                 fv.printPassword(password)
@@ -233,12 +235,11 @@
                 for m in messages:
                     fv.res += "   <li>%s</li>\n" % m
                 fv.res += "</ul>\n"
-                
 
         if not action_mediatype:
             fv.tableOpen('class="library"')
-            movmuslink = '<a href="%s?media=%s&dir=">%s</a>' 
-            rectvlink = '<a href="%s?media=%s&dir=%s">%s</a>' 
+            movmuslink = '<a href="%s?media=%s&dir=">%s</a>'
+            rectvlink = '<a href="%s?media=%s&dir=%s">%s</a>'
             fv.tableRowOpen('class="chanrow"')
             fv.tableCell('<img src=\"images/library/library-movies.jpg\" 
class=\"right\">')
             fv.tableCell(movmuslink % (action_script, "movies",_("Movies")), 
'')
@@ -259,20 +260,23 @@
             fv.printSearchForm()
             fv.printLinks()
             fv.printFooter()
+
         elif action_mediatype and len(action_dir) == 0:
             # show the appropriate dirs from config variables
             # make a back to pick music or movies
             # now make the list unique
             fv.tableOpen('class="library"')
             fv.tableRowOpen('class="chanrow"')
-            fv.tableCell('<a href="library.rpy">Home</a>: <a 
href="library.rpy?media='+action_mediatype+'&dir=">'+action_mediatype+'</a>', 
'class="guidehead" colspan="1"')
+            fv.tableCell('<a href="library.rpy">Home</a>: <a 
href="library.rpy?media='+action_mediatype+'&dir=">'\
+                +Unicode(action_mediatype)+'</a>', 'class="guidehead" 
colspan="1"')
             fv.tableRowClose()
             fv.tableRowOpen('class="chanrow"')
-            fv.tableCell('<a href="' + action_script + '">&laquo; 
'+_('Back')+'</a>', 'class="basic" colspan="1"')
+            fv.tableCell('<a href="'+action_script+'">&laquo; 
'+_('Back')+'</a>', 'class="basic" colspan="1"')
             fv.tableRowClose()
             for d in directories:
                 (title, dir) = d
-                link = '<a href="' + action_script 
+'?media='+action_mediatype+'&dir='+urllib.quote(dir)+'">'+title+'</a>'
+                link = '<a 
href="'+action_script+'?media='+action_mediatype+'&dir='+urllib.quote(dir)+'">'\
+                    +Unicode(title)+'</a>'
                 fv.tableRowOpen('class="chanrow"')
                 fv.tableCell(link, 'class="basic" colspan="1"')
                 fv.tableRowClose()
@@ -280,13 +284,16 @@
             fv.printSearchForm()
             fv.printLinks()
             fv.printFooter()
+
         elif action_mediatype and len(action_dir) and action != "download":
             if not self.check_dir(action_mediatype,action_dir) and action != 
'view':
+                # why
                 sys.exit(1)
 
             fv.tableOpen('class="library"')
             fv.tableRowOpen('class="chanrow"')
-            
fv.tableCell(fv.printBreadcrumb(action_mediatype,self.get_dirlist(action_mediatype),
 action_dir), 'class="guidehead" colspan="3"')
+            
fv.tableCell(fv.printBreadcrumb(action_mediatype,self.get_dirlist(action_mediatype),
 action_dir), \
+                'class="guidehead" colspan="3"')
             fv.tableRowClose()
 
             # find out if anything is recording
@@ -302,7 +309,7 @@
                     progl.sort(f)
                     for prog in progl:
                         try:
-                            if prog.isRecording == TRUE:
+                            if prog.isRecording:
                                 recordingprogram = 
os.path.basename(tv_util.getProgFilename(prog))
                                 recordingprogram = 
string.replace(recordingprogram, ' ', '_')
                                 break
@@ -311,7 +318,7 @@
                             pass
                 else:
                     fv.res += '<h4>The recording server is down, recording 
information is unavailable.</h4>'
-            
+
                 #generate our favorites regular expression
                 favre = ''
                 (result, favorites) = ri.getFavorites()
@@ -323,11 +330,11 @@
                 if favs:
                     favtitles = [ fav.title for fav in favs ]
                     # no I am not a packers fan
-                    favre = string.join(favtitles, '|') 
+                    favre = string.join(favtitles, '|')
                     favre = string.replace(favre, ' ', '_')
 
             #put in back up directory link
-            #figure out if action_dir is in directories variable and change 
+            #figure out if action_dir is in directories variable and change
             #back if it is
             actiondir_is_root = FALSE
             for d in directories:
@@ -336,25 +343,26 @@
                     actiondir_is_root = TRUE
                     break
             backlink = ''
-            if actiondir_is_root == TRUE and action_mediatype == 'rectv':
+            if actiondir_is_root and action_mediatype == 'rectv':
                 backlink = '<a href="'+ action_script +'">&laquo; 
'+_('Back')+'</a>'
-            elif actiondir_is_root == TRUE:
+            elif actiondir_is_root:
                 backlink = '<a href="'+ action_script 
+'?media='+action_mediatype+'&dir=">&laquo; '+_('Back')+'</a>'
             else:
                 backdir = os.path.dirname(action_dir)
-                backlink = '<a href="'+ action_script 
+'?media='+action_mediatype+'&dir='+urllib.quote(backdir)+'">&laquo; 
'+_('Back')+'</a>'
+                backlink = '<a 
href="'+action_script+'?media='+action_mediatype+'&dir='+urllib.quote(backdir)+'">'\
+                    +'&laquo; '+_('Back')+'</a>'
             fv.tableRowOpen('class="chanrow"')
             fv.tableCell(backlink, 'class="basic" colspan="3"')
             fv.tableRowClose()
 
             # get me the directories to output
-            directorylist = util.getdirnames(String(action_dir))
             i = 0
+            directorylist = util.getdirnames(action_dir)
             for mydir in directorylist:
                 if i == 0:
                     fv.tableRowOpen('class="chanrow"')
-                mydir = Unicode(mydir)
-                mydispdir = os.path.basename(mydir)
+                #mydir = Unicode(mydir)
+                mydispdir = Unicode(os.path.basename(mydir))
                 mydirlink = ""
                 ### show music cover
                 if action_mediatype == "music":
@@ -363,7 +371,8 @@
                         image_link = self.get_images(mydir + str(y))
                     else:
                         image_link = "images/library/music.png"
-                    mydirlink = '<a href="'+ action_script 
+'?media='+action_mediatype+'&dir='+urllib.quote(mydir)+'"><img src="' + 
image_link + '" height="200px" width="200px" /><br />'+mydispdir+'</a>'
+                    mydirlink = '<a href="'+ action_script 
+'?media='+action_mediatype+'&dir='+urllib.quote(mydir)+'">'\
+                        +'<img src="' + image_link + '" height="200px" 
width="200px" /><br />'+mydispdir+'</a>'
                 ### show movie cover
                 elif action_mediatype == "movies":
                     y = self.cover_filter(mydir)
@@ -371,12 +380,14 @@
                         image_link = self.get_images(mydir + str(y))
                     else:
                         image_link = "images/library/movies.png"
-                    mydirlink = '<a href="'+ action_script 
+'?media='+action_mediatype+'&dir='+urllib.quote(mydir)+'"><img src="' + 
image_link + '" height="200px" width="200px" /><br />'+mydispdir+'</a>'
+                    mydirlink = '<a 
href="'+action_script+'?media='+action_mediatype+'&dir='+urllib.quote(mydir)+'">'\
+                        +'"<img src="' + image_link + '" height="200px" 
width="200px" /><br />'+mydispdir+'</a>'
                 ### show image cover
                 elif action_mediatype == "images":
                     image_link = "images/library/images.png"
-                    mydirlink = '<a href="'+ action_script 
+'?media='+action_mediatype+'&dir='+urllib.quote(mydir)+'"><img src="' + 
image_link + '" height="200px" width="200px" /><br />'+mydispdir+'</a>'
-                
+                    mydirlink = '<a 
href="'+action_script+'?media='+action_mediatype+'&dir='+urllib.quote(mydir)+'">'\
+                        +'<img src="'+image_link+'" height="200px" 
width="200px" /><br />'+mydispdir+'</a>'
+
                 fv.tableCell(mydirlink, 'class="basic" colspan="1"')
                 if i == 2:
                     fv.tableRowClose()
@@ -392,23 +403,26 @@
             suffixes = self.get_suffixes(action_mediatype)
 
             # loop over directory here
-            items = util.match_files(String(action_dir), suffixes)
             i=0
             image = ""
-            for file in items:
+            items = util.match_files(action_dir, suffixes)
+            for item in items:
                 #check for fxd file
-                fxd_file = file[:file.rindex('.')] + ".fxd"
+                fxd_file = item[:item.rindex('.')] + ".fxd"
                 if os.path.exists(fxd_file):
                     image = self.get_fxd_cover(fxd_file)
-                    
+
                 if i == 0:
                     fv.tableRowOpen('class="chanrow"')
                 status = 'basic'
                 suppressaction = FALSE
                 #find size
-                len_file = os.stat(file)[6]
+                info = metadata.parse(item)
+                print info
+                len_file = os.stat(item)[6]
                 #chop dir from in front of file
-                (basedir, file) = os.path.split(file)
+                (basedir, file) = os.path.split(item)
+                filepath = urllib.quote(item)
                 if recordingprogram and re.match(recordingprogram, file):
                     status = 'recording'
                     suppressaction = TRUE
@@ -417,25 +431,38 @@
                 ### show image
                 if action_mediatype == "images":
                     image_link = self.get_images(basedir + "/" + file)
-                    size = Image.open(basedir+"/"+file).size
+                    size = imlib2.open(basedir+"/"+file).size
                     new_size = self.resize_image(image_link, size)
-                    fv.tableCell('<a 
href="javascript:openfoto(\''+image_link+'\','+str(size[0])+','+str(size[1])+')"><img
 src="' + image_link + '" height="'+str(new_size[1])+'px" 
width="'+str(new_size[0])+'px" /><br />' + Unicode(file) + '</a>', 
'class="'+status+'" colspan="1"')
+                    fv.tableCell('<a 
href="javascript:openfoto(\''+image_link+'\','+str(size[0])+','+str(size[1])+')">'\
+                        +'<img src="'+image_link+'" 
height="'+str(new_size[1])+'px" width="'+str(new_size[0])+'px" />'\
+                        +'<br />'+Unicode(file)+'</a>', 'class="'+status+'" 
colspan="1"')
                 ### show movie
                 elif action_mediatype == "movies":
-                    fv.tableCell('<a onclick="info_click(this, event)" 
id="'+basedir+'/'+file+'"><img src="'+image+'" height="200px" width="200px" 
/><br />' + Unicode(file) + '</a>' , 'class="'+status+'" colspan="1"')          
         
+                    fv.tableCell('<a onclick="info_click(this, event)" 
id="'+filepath+'">'\
+                        +'<img src="'+image+'" height="200px" width="200px" 
/><br />'+Unicode(file)+'</a>',\
+                        'class="'+status+'" colspan="1"')
                 ### show music
-                elif action_mediatype== "music":
-                    info =  util.mediainfo.get(basedir +"/"+ file)
-                    fv.tableCell('<a onclick="info_click(this, event)" 
id="'+basedir+'/'+file+'">'+Unicode(info['trackno'] + "-" + 
info['artist']+"-"+info['title'])+'</a>' , 'class="'+status+'" colspan="1"')    
               
+                elif action_mediatype == "music":
+                    try:
+                        title = 
Unicode(info['trackno']+"-"+info['artist']+"-"+info['title'])
+                    except:
+                        title = Unicode(file)
+                    if len(title) > 45:
+                        title = "%s[...]%s" % (title[:20], 
title[len(title)-20:])
+                    fv.tableCell('<a onclick="info_click(this, event)" 
id="'+filepath+'">'\
+                        +title+'</a>' ,\
+                        'class="'+status+'" colspan="1"')
                 else:
-                    fv.tableCell(Unicode(file), 'class="'+status+'" 
colspan="1"')
-                if suppressaction == TRUE:
+                    fv.tableCell(file, 'class="'+status+'" colspan="1"')
+                if suppressaction:
                     fv.tableCell('&nbsp;', 'class="'+status+'" colspan="1"')
                 else:
-                    file_esc = urllib.quote(String(file))
-                    dllink = ('<a 
href="'+action_script+'%s">'+_('Download')+'</a>') %  
Unicode(os.path.join(basedir,file))
-                    delete = ('<a 
href="javascript:deleteFile(\'%s\',\'%s\',\'%s\')">'+_("Delete")+'</a>') % 
(basedir, file_esc, action_mediatype)
-                    rename = ('<a 
href="javascript:renameFile(\'%s\',\'%s\',\'%s\')">'+_("Rename")+'</a>') % 
(basedir, file_esc, action_mediatype)                
+                    file_esc = urllib.quote(file)
+                    dllink = ('<a 
href="'+action_script+'%s">'+_('Download')+'</a>') %  os.path.join(basedir,file)
+                    delete = ('<a 
href="javascript:deleteFile(\'%s\',\'%s\',\'%s\')">'+_("Delete")+'</a>') %\
+                        (basedir, file_esc, action_mediatype)
+                    rename = ('<a 
href="javascript:renameFile(\'%s\',\'%s\',\'%s\')">'+_("Rename")+'</a>') %\
+                        (basedir, file_esc, action_mediatype)
                 if i == 2:
                     fv.tableRowClose()
                     i = 0
@@ -445,7 +472,7 @@
                 fv.tableCell('&nbsp;', 'class="basic" colspan="1"')
                 if i == 2:
                     fv.tableRowClose()
-                i +=1           
+                i +=1
             fv.tableClose()
 
             fv.printSearchForm()
@@ -478,7 +505,8 @@
             u"                           "+_('Play file')+u"\n"\
             u"                        </td>\n"\
             u"                        <td id=\"program-favorites-button\">\n"\
-            u"                        "+_('Play file on host')+u"\n"\
+            #u"                        "+_('Play file on host')+u"\n"\
+            u"                        "+''+u"\n"\
             u"                        </td>\n"\
             u"                        <td 
onclick=\"program_popup_close();\">\n"\
             u"                        "+_('Close Window')+u"\n"\
@@ -494,21 +522,20 @@
             fv.res += "<iframe id='hidden' style='visibility: hidden; width: 
1px; height: 1px'></iframe>\n"
             fv.printFooter()
 
-        return String( fv.res )
-    
-    def get_images(self, myfile):
-        current_path = "%s/share/freevo/htdocs/" % sys.prefix
-        image_cache_link = "image_cache/" + myfile.replace("/", "_")
-        if not os.path.exists("%s/share/freevo/htdocs/" % sys.prefix + 
image_cache_link): 
-            os.symlink(myfile , current_path + image_cache_link)
-        return image_cache_link
-    
+        return String(fv.res)
+
+    def get_images(self, file):
+        cache_link = self.cache_dir + file.replace("/", "_")
+        if not os.path.exists(cache_link):
+            os.symlink(file, cache_link)
+        return cache_link
+
     def cover_filter(self, x):
         for i in os.listdir(x):
             cover = re.search(config.AUDIO_COVER_REGEXP, i, re.IGNORECASE)
             if cover:
                 return "/" + i
-    
+
     def get_fxd_cover(self, fxd_file):
         cover = ""
         fxd_info = {}
@@ -519,7 +546,7 @@
                 if b.name == 'cover-img':
                     cover = str(b.attrs.values()[0])
         return cover
-    
+
     def resize_image(self, image, size):
         new_size = []
         new_size.append(size[0])
@@ -529,6 +556,6 @@
             new_size[1] -= (new_size[1] * 10)/100
         return new_size
 
-    
+
 resource = LibraryResource()
 

Modified: branches/rel-1/freevo/src/www/htdocs/scripts/display_info-head.js
==============================================================================
--- branches/rel-1/freevo/src/www/htdocs/scripts/display_info-head.js   
(original)
+++ branches/rel-1/freevo/src/www/htdocs/scripts/display_info-head.js   Fri Dec 
22 09:03:01 2006
@@ -8,40 +8,40 @@
 function
 info_click(item, event)
 {
-       var iframe = document.getElementById("hidden");
-       iframe.src="fileinfo.rpy?dir="+item.id;
+    var iframe = document.getElementById("hidden");
+    iframe.src="fileinfo.rpy?dir="+item.id;
     document.getElementById("program-waiting").style.display = "";
-       document.getElementById("program-info").style.visibility = "hidden";
-       var popup = document.getElementById("popup");
-       popup.style.display = "";
-
-       w = N ? window.innerWidth : document.body.clientWidth;
-       h = N ? window.innerHeight : document.body.clientHeight;
-
-       //alert(event.clientX + "  "  + popup.clientWidth + "  " + w + "  " + 
h);
-       if (event.clientX + popup.clientWidth > w)
-               x = (w - popup.clientWidth) - 30;
-       else
-               x = event.clientX;
-       popup.style.left = x + "px";
-
-       page_top = N ? window.pageYOffset : document.body.scrollTop;
-
-       // We can't use popup.clientHeight because it's not valud until
-       // after proginfo.rpy gets executed, so we guess that it'll be
-       // about 175.  Someone else can fix this. :)
-       if (event.clientY + 175 > h)
-               y = page_top + (h - 175) - 20;
-       else
-               y = page_top + event.clientY;
-       popup.style.top = y + "px";
+    document.getElementById("program-info").style.visibility = "hidden";
+    var popup = document.getElementById("popup");
+    popup.style.display = "";
+
+    w = N ? window.innerWidth : document.body.clientWidth;
+    h = N ? window.innerHeight : document.body.clientHeight;
+
+    //alert(event.clientX + "  "  + popup.clientWidth + "  " + w + "  " + h);
+    if (event.clientX + popup.clientWidth > w)
+        x = (w - popup.clientWidth) - 30;
+    else
+        x = event.clientX;
+    popup.style.left = x + "px";
+
+    page_top = N ? window.pageYOffset : document.body.scrollTop;
+
+    // We can't use popup.clientHeight because it's not valud until
+    // after proginfo.rpy gets executed, so we guess that it'll be
+    // about 175.  Someone else can fix this. :)
+    if (event.clientY + 175 > h)
+        y = page_top + (h - 175) - 20;
+    else
+        y = page_top + event.clientY;
+    popup.style.top = y + "px";
 }
 
 function
 program_popup_close()
 {
-       var popup = document.getElementById("popup");
-       popup.style.display = "none";
+    var popup = document.getElementById("popup");
+    popup.style.display = "none";
 }
 
 function mouseDown(e) {
@@ -85,4 +85,4 @@
 
 document.onmousedown = mouseDown;
 document.onmousemove = mouseMove;
-document.onmouseup = mouseUp;
\ No newline at end of file
+document.onmouseup = mouseUp;

Modified: branches/rel-1/freevo/src/www/htdocs/scripts/display_prog-head.js
==============================================================================
--- branches/rel-1/freevo/src/www/htdocs/scripts/display_prog-head.js   
(original)
+++ branches/rel-1/freevo/src/www/htdocs/scripts/display_prog-head.js   Fri Dec 
22 09:03:01 2006
@@ -8,40 +8,40 @@
 function
 guide_click(item, event)
 {
-       var iframe = document.getElementById("hidden");
-       iframe.src="proginfo.rpy?id=" + item.id;
-       document.getElementById("program-waiting").style.display = "";
-       document.getElementById("program-info").style.visibility = "hidden";
-       var popup = document.getElementById("popup");
-       popup.style.display = "";
-
-       w = N ? window.innerWidth : document.body.clientWidth;
-       h = N ? window.innerHeight : document.body.clientHeight;
-
-       //alert(event.clientX + "  "  + popup.clientWidth + "  " + w + "  " + 
h);
-       if (event.clientX + popup.clientWidth > w)
-               x = (w - popup.clientWidth) - 30;
-       else
-               x = event.clientX;
-       popup.style.left = x + "px";
-
-       page_top = N ? window.pageYOffset : document.body.scrollTop;
-
-       // We can't use popup.clientHeight because it's not valud until
-       // after proginfo.rpy gets executed, so we guess that it'll be
-       // about 175.  Someone else can fix this. :)
-       if (event.clientY + 175 > h)
-               y = page_top + (h - 175) - 20;
-       else
-               y = page_top + event.clientY;
-       popup.style.top = y + "px";
+    var iframe = document.getElementById("hidden");
+    iframe.src="proginfo.rpy?id=" + item.id;
+    document.getElementById("program-waiting").style.display = "";
+    document.getElementById("program-info").style.visibility = "hidden";
+    var popup = document.getElementById("popup");
+    popup.style.display = "";
+
+    w = N ? window.innerWidth : document.body.clientWidth;
+    h = N ? window.innerHeight : document.body.clientHeight;
+
+    //alert(event.clientX + "  "  + popup.clientWidth + "  " + w + "  " + h);
+    if (event.clientX + popup.clientWidth > w)
+        x = (w - popup.clientWidth) - 30;
+    else
+        x = event.clientX;
+    popup.style.left = x + "px";
+
+    page_top = N ? window.pageYOffset : document.body.scrollTop;
+
+    // We can't use popup.clientHeight because it's not valud until
+    // after proginfo.rpy gets executed, so we guess that it'll be
+    // about 175.  Someone else can fix this. :)
+    if (event.clientY + 175 > h)
+        y = page_top + (h - 175) - 20;
+    else
+        y = page_top + event.clientY;
+    popup.style.top = y + "px";
 }
 
 function
 program_popup_close()
 {
-       var popup = document.getElementById("popup");
-       popup.style.display = "none";
+    var popup = document.getElementById("popup");
+    popup.style.display = "none";
 }
 
 function mouseDown(e) {

Modified: branches/rel-1/freevo/src/www/web_types.py
==============================================================================
--- branches/rel-1/freevo/src/www/web_types.py  (original)
+++ branches/rel-1/freevo/src/www/web_types.py  Fri Dec 22 09:03:01 2006
@@ -92,6 +92,7 @@
 
 
     def printHeader(self, title='unknown page', style=None, script=None, 
selected='Help',prefix=0):
+            (title, style, script, selected, prefix)
 
         strprefix = '../' * prefix
 
@@ -109,7 +110,8 @@
         self.res += '\n\n\n\n<body>\n'
         # Header
         self.res += '<!-- Header Logo and Status Line -->\n'
-        self.res += '<div id="titlebar"><span class="name"><a 
href="http://freevo.sourceforge.net/"; target="_blank">Freevo</a></span></div>\n'
+        self.res += '<div id="titlebar"><span class="name">'\
+            +'<a href="http://freevo.sourceforge.net/"; 
target="_blank">Freevo</a></span></div>\n'
      
         items = [(_('Home'),_('Home'),'%sindex.rpy' % str(strprefix)),
                  (_('TV Guide'),_('View TV Listings'),'%sguide.rpy' % 
str(strprefix)),
@@ -135,23 +137,9 @@
                 self.res += '<li>'
             self.res += "<a href=\"%s\" title=\"%s\">%s</a></li>\n" % (i[2], 
i[1],i[0])
         self.res += '</ul>\n</div>'
-        
-        #self.res += '<li id="current"><a href="#">Home</a></li>\n'
-        #self.res += '<li><a href="#">TV Guide</a></li>\n'
-        #self.res += '<li><a href="#">Scheduled Recordings</a></li>\n'
-        #self.res += '<li><a href="#">Media Library</a></li>\n'
-        #self.res += '<li><a href="#">Manual Record</a></li>\n'
-        #self.res += '<li><a href="#">Help</a></li>\n'
-        #self.res += '</ul>\n'
-        #self.res += '</div>\n<br/>'
- 
-        #self.res += '<div id="subtitle">\n'
-        #self.res += str(title) + '\n'
-        #self.res += '</div>\n'
         self.res += '\n<!-- Main Content -->\n';
 
 
-
     def tableOpen(self, opts=''):
         self.res += "<table "+opts+">\n"
 
@@ -167,6 +155,7 @@
     def tableHeadClose(self, opts=''):
         self.res += "  </thead>\n"
 
+
     def tableBodyOpen(self, opts=''):
         self.res += "  <tbody "+opts+">\n"
 
@@ -183,7 +172,6 @@
         self.res += "  </tfoot>\n"
 
 
-
     def tableRowOpen(self, opts=''):
         self.res += "     <tr "+opts+">\n"
 
@@ -254,7 +242,7 @@
         #    pass
         return
 
-    def printBreadcrumb(self,media, mediadirs, dir):
+    def printBreadcrumb(self, media, mediadirs, dir):
         breadcrumb='<a href="library.rpy">Home: </a><a 
href="library.rpy?media='+media+'&dir=">'+media+'</a>'
         _url = ""
         url = dir.split("/")
@@ -262,7 +250,7 @@
         for i in url:
             _url += i + "/"
             if i not in _mediadir or i == _mediadir[len(_mediadir)-1]:
-                breadcrumb += '/<a 
href="library.rpy?media='+media+'&dir='+_url+'">'+i+'</a>'
+                breadcrumb += '/<a 
href="library.rpy?media='+media+'&dir='+_url+'">'+Unicode(i)+'</a>'
 
         return breadcrumb
     

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to