The branch, frodo has been updated
       via  82a6ed51a994ffc181c32371fe92816f154d734d (commit)
      from  f4368f6c872db578df98dc759283bc164dacb7df (commit)

- Log -----------------------------------------------------------------
http://xbmc.git.sourceforge.net/git/gitweb.cgi?p=xbmc/scripts;a=commit;h=82a6ed51a994ffc181c32371fe92816f154d734d

commit 82a6ed51a994ffc181c32371fe92816f154d734d
Author: unknown <[email protected]>
Date:   Sat Mar 30 00:44:40 2013 +0100

    [script.web.viewer] 0.9.10

diff --git a/script.web.viewer/addon.xml b/script.web.viewer/addon.xml
index 479eeab..c6598bf 100644
--- a/script.web.viewer/addon.xml
+++ b/script.web.viewer/addon.xml
@@ -1,11 +1,11 @@
 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
 <addon id="script.web.viewer"
        name="Web Viewer"
-       version="0.9.1"
+       version="0.9.10"
        provider-name="Rick Phillips (ruuk)">
   <requires>
-    <import addon="xbmc.python" version="2.0"/>
-    <import addon="script.module.beautifulsoup" version="3.0.8.1"/>
+    <import addon="xbmc.python" version="2.1.0"/>
+    <import addon="script.module.beautifulsoup" version="3.0.8"/>
   </requires>
   <extension point="xbmc.python.script"
              library="lib/webviewer/webviewer.py">
@@ -32,5 +32,8 @@ What it doesn't do:
     *Make web pages look good :)
     *Lots of other stuff
     </description>
+    <license>GNU GENERAL PUBLIC LICENSE. Version 2, June 1991</license>
+    <forum>http://forum.xbmc.org/showthread.php?tid=90007</forum>
+    <source>http://github.com/ruuk/script.web.viewer</source>
   </extension>
 </addon>
\ No newline at end of file
diff --git a/script.web.viewer/changelog.txt b/script.web.viewer/changelog.txt
index fa7dc38..fa084fe 100644
--- a/script.web.viewer/changelog.txt
+++ b/script.web.viewer/changelog.txt
@@ -1,6 +1,57 @@
-Web Viewer Changelog
+Web Viewer Changelog 
 
-Current Version : 0.9.1
+TODO:
+       Handle more video types
+
+Current Version : 0.9.10
+
+*** 0.9.10 ***
+
+Fix string IDs
+Convert static strings to string IDs
+Metacafe now falls back to metacafe addon for playing
+Metacafe now handles CBS based video if "appropriate" addon is installed
+Convert %s to .format() method
+Files can now be downloaded to writable network locations
+Added failed download dialogs
+Cleaned up code warnings
+
+*** 0.9.9 ***
+
+Added Metacafe to list of supported video URLs
+
+*** 0.9.8 ***
+
+Added Dailymotion to list of supported video URLs
+
+*** 0.9.7 ***
+
+Fix for image dialog not closing on 'Previous Menu' button
+Fix for inline frames links and images having incorrect URLs
+Added setting 'Show Frames At Bottom (More Compatible)' - helps prevent, for 
instance, the frame from being in the middle of a form
+
+*** 0.9.6 ***
+
+Added setting 'Experimental: Enable Inline Frames' which, when enabled, loads 
frames into the page
+Now processes embed tags as links
+Can now play YouTube, Vimeo and flickr video from links (asks if you want to 
view the video or visit the page)
+Context menu now shows 'Play Page Video' when on a video's page - also 
pressing play when on a video's page will play the video (if possible)
+
+*** 0.9.5 ***
+
+Added 'accept' header to mechanize.browser to avoid '403 Bad Behavior' errors 
on some sites
+
+*** 0.9.4 ***
+
+Improved labeling of form inputs
+
+*** 0.9.3 ***
+
+Fixed a bug causing some controls not to work in FRODO - so now you can exit 
the browser :)
+
+*** 0.9.2 ***
+
+Fixed a bug in onAction() causing errors in FRODO - (log said ignoring the 
error could cause memory leaks, so perhaps fixed a memory leak :) )
 
 *** 0.9.1 ***
 
diff --git a/script.web.viewer/lib/webviewer/htmltoxbmc.py 
b/script.web.viewer/lib/webviewer/htmltoxbmc.py
index e44706d..ac7cec9 100644
--- a/script.web.viewer/lib/webviewer/htmltoxbmc.py
+++ b/script.web.viewer/lib/webviewer/htmltoxbmc.py
@@ -25,15 +25,15 @@ class HTMLConverter:
 #              self.linkReplace = unicode.encode('[CR]\g<text> (%s: 
[B]\g<url>[/B])' % u'Link','utf8')
                self.linkReplace = '[COLOR '+self.linkColor+']%s[/COLOR] '
                self.frameReplace = '[CR][COLOR 
'+self.frameColor+']FRAME%s[/COLOR][CR]'
-               self.formReplace = '[CR][COLOR 
'+self.formColorA+']______________________________[/COLOR][CR][COLOR 
'+self.formColorB+'][B]- FORM: %s -[/B][/COLOR][CR]%s[CR][COLOR 
'+self.formColorC+']______________________________[/COLOR][CR][CR]'
+               self.formReplace = '[CR][COLOR 
'+self.formColorA+']'+'_'*200+'[/COLOR][CR][COLOR '+self.formColorB+'][B]- 
FORM: %s -[/B][/COLOR][CR]%s[CR][COLOR 
'+self.formColorC+']'+'_'*200+'[/COLOR][CR][CR]'
                self.submitReplace = '[\g<value>] '
                #static filters
-               self.linkFilter = 
re.compile('<a[^>]+?href=["\'](?P<url>[^>"]+?)["\'][^>]*?(?:title=["\'](?P<title>[^>"]+?)["\'][^>]*?)?>(?P<text>.*?)</a>',re.I|re.S|re.U)
+               self.linkFilter = 
re.compile('<(?:a|embed)[^>]+?(?:href|src)=["\'](?P<url>[^>"]+?)["\'][^>]*?(?:title=["\'](?P<title>[^>"]+?)["\'][^>]*?)?>(?P<text>.*?)</(?:a|embed)>',re.I|re.S|re.U)
                self.imageFilter = 
re.compile('<img[^>]+?src=["\'](?P<url>[^>"]+?)["\'][^>]*?>',re.I|re.S|re.U)
                self.scriptFilter = 
re.compile('<script[^>]*?>.*?</script>',re.S|re.I)
                self.styleFilter = re.compile('<style[^>]*?>.+?</style>',re.I)
                self.commentFilter = re.compile('<!.*?-->')
-               self.formFilter = 
re.compile('<form[^>]*?(?:id=["\'](?P<id>[^>"]+?)["\'][^>]*?)?>(?P<contents>.+?)(?:</form>|<form>|$)',re.I)
+               self.formFilter = 
re.compile('<form[^>]*?(?:id=["\'](?P<id>[^>"]+?)["\'][^>]*?)?>(?P<contents>.+?)(?:</form>|<form>|$)(?is)')
                self.labelFilter = 
re.compile('<label[^>]*?(?:(?:for=["\'])|(?:>\s*<input[^>]*?id="))(?P<inputid>[^>"].*?)["\'][^>]*?>(?P<label>.*?)</label>',re.I)
                self.altLabelFilter = 
re.compile('>(?:(?P<header>[^<>]*?)<(?!input|select)\w+[^>]*?>)?(?P<label>[^<>]+?)(?:<(?!input|select)\w+[^>]*?>)?(?:<input
 |<select )[^>]*?(?:id|name)="(?P<inputid>[^>"]+?)"',re.I)
                self.submitFilter = re.compile('<input 
type=["\']submit["\'][^>]+?value=["\'](?P<value>[^>"\']+?)["\'][^>]*?>',re.I)
@@ -61,8 +61,6 @@ class HTMLConverter:
                
                #Secondary Filters
                self.lineItemLineFilter = 
re.compile('<li[^>]*?>(.+?)</li>',re.I)
-               self.charCodeFilter = re.compile('&#(\d{1,5});',re.I)
-               self.charNameFilter = re.compile('&(\w+?);')
                self.imageAltFilter = re.compile('alt="([^"]+?)"',re.I)
                self.titleAttrFilter = re.compile('title="([^>"]*?)"',re.I)
                self.nameAttrFilter = re.compile('name="([^>"]*?)"',re.I)
@@ -295,15 +293,21 @@ class HTMLConverter:
                else: bullet = '*'
                return  '%s %s\n' % (bullet,m.group(1))
        
-       def cUConvert(self,m): return unichr(int(m.group(1)))
-       def cTConvert(self,m):
-               return unichr(htmlentitydefs.name2codepoint.get(m.group(1),32))
-               
        def convertHTMLCodes(self,html):
-               try:
-                       html = self.charCodeFilter.sub(self.cUConvert,html)
-                       html = self.charNameFilter.sub(self.cTConvert,html)
-               except:
-                       pass
-               return html
+               return convertHTMLCodes(html)
+
+charCodeFilter = re.compile('&#(\d{1,5});',re.I)
+charNameFilter = re.compile('&(\w+?);')
+               
+def cUConvert(m): return unichr(int(m.group(1)))
+def cTConvert(m):
+       return unichr(htmlentitydefs.name2codepoint.get(m.group(1),32))
+       
+def convertHTMLCodes(html):
+       try:
+               html = charCodeFilter.sub(cUConvert,html)
+               html = charNameFilter.sub(cTConvert,html)
+       except:
+               pass
+       return html
        
diff --git a/script.web.viewer/lib/webviewer/webviewer.py 
b/script.web.viewer/lib/webviewer/webviewer.py
index 876c55c..b1e1bb6 100644
--- a/script.web.viewer/lib/webviewer/webviewer.py
+++ b/script.web.viewer/lib/webviewer/webviewer.py
@@ -1,17 +1,18 @@
-import xbmcaddon #@UnresolvedImport
+import xbmcaddon, xbmcvfs
 from htmltoxbmc import HTMLConverter
 import re, os, sys, time, urllib2, urlparse
 import xbmc, xbmcgui #@UnresolvedImport
 import mechanize, threading
+import video
 
 
 __plugin__ = 'Web Viewer'
 __author__ = 'ruuk (Rick Phillips)'
 __url__ = 'http://code.google.com/p/webviewer-xbmc/'
-__date__ = '01-19-2011'
-__version__ = '0.9.1'
+__date__ = '01-21-2013'
+__version__ = '0.9.10'
 __addon__ = xbmcaddon.Addon(id='script.web.viewer')
-__language__ = __addon__.getLocalizedString
+T = __addon__.getLocalizedString
 
 THEME = 'Default'
 
@@ -86,9 +87,18 @@ class WebReader:
                self.browser.set_handle_refresh(True, honor_time=False)
                self.browser.set_handle_equiv(True)
                self.browser.set_debug_redirects(True)
-               self.browser.addheaders = [('User-agent', 'Mozilla/3.0 
(compatible)')]
+               self.browser.addheaders = [('User-agent', 'Mozilla/3.0 
(compatible)'), ('Accept', '*/*')]
                #self.browser.addheaders = [('User-agent','Mozilla/5.0 (X11; 
Linux i686; rv:2.0.1) Gecko/20100101 Firefox/4.0.1')]
-               
+               self.frameFilter = 
re.compile('<i?frame[^>]*?src="(?P<url>[^>"]+?)"[^>]*?>(?:.*?</iframe>)?',re.I)
+               self.titleAttrFilter = re.compile('title="([^>"]*?)"',re.I)
+               self.nameAttrFilter = re.compile('name="([^>"]*?)"',re.I)
+               self.linkFilter = 
re.compile('<(?:a|embed)[^>]+?(?:href|src)=["\'](?P<url>[^>"]+?)["\'][^>]*?(?:title=["\'](?P<title>[^>"]+?)["\'][^>]*?)?>(?P<text>.*?)</(?:a|embed)>',re.I|re.S|re.U)
+               self.imageFilter = 
re.compile('<img[^>]+?src=["\'](?P<url>[^>"]+?)["\'][^>]*?>',re.I|re.S|re.U)
+               self.srcFilter = re.compile('src=["\'][^"\']+?["\']')
+               self.hrefFilter = re.compile('href=["\'][^"\']+?["\']')
+               self.frameFixBaseURL = ''
+               self.framesList = []
+
        def setBrowser(self,browser):
                LOG('Using Alternate Browser')
                self.browser = browser
@@ -97,18 +107,18 @@ class WebReader:
                LOG('Getting Page at URL: ' + url)
                if not callback: callback = self.fakeCallback
                resData = ResponseData(url)
-               id = ''
+               ID = ''
                urlsplit = url.split('#', 1)
-               if len(urlsplit) > 1: url, id = urlsplit
+               if len(urlsplit) > 1: url, ID = urlsplit
                try:
                        resData = self.readURL(url, callback)
                except:
                        err = ERROR('ERROR READING PAGE')
                        LOG('URL: %s' % url)
-                       xbmcgui.Dialog().ok('ERROR', __language__(30100), err)
+                       xbmcgui.Dialog().ok('ERROR', T(32100), err)
                        return None
                resData = self.checkRedirect(resData, callback)
-               if not callback(80, __language__(30101)): return None
+               if not callback(80, T(32101)): return None
                if not resData: return None
                formsProcessed = True
                forms = []
@@ -126,7 +136,7 @@ class WebReader:
                                except:
                                        ERROR('Could not process forms')
                                
-               return WebPage(resData, id=id, forms=resData.data and forms or 
[])
+               return WebPage(resData, ID=ID, forms=resData.data and forms or 
[])
        
        def cleanHTML(self, html):
                return re.sub('<![^>]*?>', '', html)
@@ -137,7 +147,7 @@ class WebReader:
                #print html
                if match:
                        LOG('REDIRECTING TO %s' % match.group('url'))
-                       if not callback(3, __language__(30102)): return None
+                       if not callback(3, T(32102)): return None
                        try:
                                url = match.group('url')
                                return self.readURL(url, callback)
@@ -149,7 +159,7 @@ class WebReader:
                return resData
        
        def readURL(self, url, callback):
-               if not callback(5, __language__(30103)): return None
+               if not callback(5, T(32103)): return None
                response = None
                try:
                        response = self.browser.open(url)
@@ -162,10 +172,59 @@ class WebReader:
                content = response.info().get('content-type', '')
                contentDisp = response.info().get('content-disposition', '')
                #print response.info()
-               if not content.startswith('text'): return 
ResponseData(response.geturl(), content, content_disp=contentDisp) 
-               if not callback(30, __language__(30104)): return None
-               return ResponseData(response.geturl(), content, response.read())
-               
+               if not content.startswith('text'): return 
ResponseData(response.geturl(), content, content_disp=contentDisp)
+               if not callback(30, T(32104)): return None
+               html = response.read()
+               if __addon__.getSetting('inline_frames') == 'true':
+                       self.framesList = []
+                       html = self.frameFilter.sub(self.frameLoader,html)
+                       for f in self.framesList: html = 
html.replace('</html>','<br />--FRAME' + ('-'*200) + '<br />'+ f + '<br />' + 
('-'*200) + '<br /></html>')
+                       response.set_data(html)
+                       self.browser.set_response(response)
+               return ResponseData(response.geturl(), content, html)
+               
+       def frameLoader(self,m):
+               try:
+                       url = m.group('url')
+                       html = self.readURL(url, self.fakeCallback).data
+                       html = self.fixFramePaths(html, url)
+                       title = ''
+                       title_m = self.titleAttrFilter.search(m.group(0))
+                       if not title_m:
+                               title_m = self.nameAttrFilter.search(m.group(0))
+                       if title_m: title = ':%s' % title_m.group(1)
+                       html = html.replace('<html>','').replace('</html>','')
+                       html = 
re.split('<body[^>]*?>',html,1)[-1].split('</body>')[0]
+                       if __addon__.getSetting('frames_at_end') == 'true':
+                               self.framesList.append(html)
+                               return ''
+                       else:
+                               return '<br />--FRAME' + title.replace(' ','_') 
+ ('-'*200) + '<br />'+ html + '<br />' + ('-'*200) + '<br />'
+               except:
+                       ERROR('Failed to load frame inline')
+                       return m.group(0)
+       
+       def fixFramePaths(self,html,url):
+               self.frameFixBaseURL = url
+               html = self.imageFilter.sub(self.fixFrameImages,html)
+               html = self.linkFilter.sub(self.fixFrameLinks,html)
+               return html
+       
+       def fixFrameImages(self,m):
+               url = m.group('url')
+               full = fullURL(self.frameFixBaseURL,url)
+               ret = self.srcFilter.sub('src="%s"' % full,m.group(0))
+               return ret
+       
+       def fixFrameLinks(self,m):
+               url = m.group('url')
+               full = fullURL(self.frameFixBaseURL,url)
+               ret = self.srcFilter.sub('src="%s"' % full,m.group(0))
+               ret = self.hrefFilter.sub('href="%s"' % full,ret)
+               #print m.group(0)
+               #print ret
+               return ret
+       
        def submitForm(self, form, submit_control, callback):
                if not callback: callback = self.fakeCallback
                self.browser.form = form
@@ -175,16 +234,16 @@ class WebReader:
                                if c.type == 'submit':
                                        if c == submit_control: break
                                        ct += 1 
-               if not callback(5, __language__(30105)): return None
+               if not callback(5, T(32105)): return None
                try:
                        res = self.browser.submit(nr=ct)
                except:
                        self.browser.back()
                        return None
-               if not callback(60, __language__(30106)): return None
+               if not callback(60, T(32106)): return None
                html = res.read()
                resData = self.checkRedirect(ResponseData(res.geturl(), 
data=html), callback=callback) #@UnusedVariable
-               if not callback(80, __language__(30101)): return None
+               if not callback(80, T(32101)): return None
                if not resData: return None
                return WebPage(resData, self.browser.geturl(), 
forms=resData.data and self.browser.forms() or [])
                
@@ -268,15 +327,14 @@ class WebReader:
 # Web Page
 
################################################################################
 class WebPage:
-       def __init__(self, resData, id='', forms=[]):
+       def __init__(self, resData, ID='', forms=[]):
                self.url = resData.url
-               end = ''
                #if not '<a ' in resData.data and not '<img ' in resData.data 
and not '<form ' in resData.data: 
                #       end = '<a href="#END">END OF PAGE</a><a 
name="#END"></a>'
                self.html = resData.data
                self.content = resData.content
                self.contentDisp = resData.contentDisp
-               self.id = id
+               self.id = ID
                self.title = ''
                self.forms = []
                self.imageURLDict = {}
@@ -337,41 +395,45 @@ class WebPage:
                self.frames()
                self.elements = []
                for part in re.split(alltags, disp):
-                       if pre != None:
-                               stack += pre
-                               index = len(stack)
-                               lines = stack.count('[CR]')
-                               stack += part
-                               pre = None
-                               type = types[part]
-                               if type == PE_LINK:
-                                       element = self._links[lct]
-                                       lct += 1
-                               elif type == PE_IMAGE:
-                                       element = self._images[ict]
-                                       ict += 1
-                               elif type == PE_FORM:
-                                       element = self.forms[fct]
-                                       fct += 1
-                               elif type == PE_FRAME:
-                                       element = self._frames[frct]
-                                       frct += 1
-                               element.elementIndex = ct
-                               element.displayPageIndex = index
-                               element.lineNumber = lines
-                               self.elements.append(element)
-                               ct += 1
-                       else:
-                               pre = part
+                       try:
+                               if pre != None:
+                                       stack += pre
+                                       index = len(stack)
+                                       lines = stack.count('[CR]')
+                                       stack += part
+                                       pre = None
+                                       ttype = types[part]
+                                       if ttype == PE_LINK:
+                                               element = self._links[lct]
+                                               lct += 1
+                                       elif ttype == PE_IMAGE:
+                                               element = self._images[ict]
+                                               ict += 1
+                                       elif ttype == PE_FORM:
+                                               element = self.forms[fct]
+                                               fct += 1
+                                       elif ttype == PE_FRAME:
+                                               element = self._frames[frct]
+                                               frct += 1
+                                       element.elementIndex = ct
+                                       element.displayPageIndex = index
+                                       element.lineNumber = lines
+                                       self.elements.append(element)
+                                       ct += 1
+                               
+                               else:
+                                       pre = part
+                       except IndexError:
+                               continue
                
        def getNextElementAfterPageIndex(self, index):
                for e in self.elements:
                        if e.displayPageIndex >= index:
                                return e
                        
-       def getElementByTypeIndex(self, type, index):
+       def getElementByTypeIndex(self, ttype, index):
                for e in self.elements:
-                       if e.type == type and e.typeIndex == index:
+                       if e.type == ttype and e.typeIndex == index:
                                return e
        
        def forDisplay(self):
@@ -522,13 +584,13 @@ PE_FORM = 'FORM'
 PE_FRAME = 'FRAME'
 
 class PageElement:
-       def __init__(self, type=0, type_index= -1):
+       def __init__(self, ttype=0, type_index= -1):
                self.typeIndex = type_index
                self.elementIndex = -1
                self.displayPageIndex = -1
                self.lineNumber = -1
                
-               self.type = type
+               self.type = ttype
 
 class Image(PageElement):
        def __init__(self, url='', image_index= -1, short_index= -1, 
base_url=''):
@@ -758,19 +820,19 @@ class ThreadWindow:
                return False
        
        def onAction(self, action):
-               if action == ACTION_RUN_IN_MAIN:
+               if action.getId() == ACTION_RUN_IN_MAIN:
                        if self._function:
                                self._function(*self._functionArgs, 
**self._functionKwargs)
                                self._resetFunction()
                                return True
-               elif action == ACTION_PREVIOUS_MENU:
+               elif action.getId() == ACTION_PREVIOUS_MENU:
                        if self._currentThread and 
self._currentThread.isAlive():
                                self._currentThread.stop()
                                if self._endCommand: self._endCommand()
                                if self._stopControl: 
self._stopControl.setVisible(False)
                        if self._isMain and len(threading.enumerate()) > 1:
                                d = xbmcgui.DialogProgress()
-                               d.create(__language__(30107), 
__language__(30108))
+                               d.create(T(32107), T(32108))
                                d.update(0)
                                self.stopThreads()
                                if d.iscanceled():
@@ -778,7 +840,7 @@ class ThreadWindow:
                                        return True
                                d.close()
                        return False
-               elif action == ACTION_STOP:
+               elif action.getId() == ACTION_STOP:
                        self.stopThread()
                        return True
                return False
@@ -833,10 +895,12 @@ class BaseWindow(ThreadWindow):
                return ThreadWindow.onClick(self, controlID)
                        
        def onAction(self, action):
-               if action == ACTION_PARENT_DIR or action == ACTION_PARENT_DIR2:
-                       action = ACTION_PREVIOUS_MENU
+               if action.getId() == ACTION_PARENT_DIR or action.getId() == 
ACTION_PARENT_DIR2:
+                       #action.getId() = ACTION_PREVIOUS_MENU
+                       self.close()
+                       return
                if ThreadWindow.onAction(self, action): return
-               xbmcgui.WindowXMLDialog.onAction(self, action)
+               #xbmcgui.WindowXMLDialog.onAction(self, action)
        
        def startProgress(self):
                self._progMessageSave = self.getControl(104).getLabel()
@@ -874,9 +938,11 @@ class ImageDialog(BaseWindow, xbmcgui.WindowXMLDialog):
                pass
        
        def onAction(self, action):
-               if action == ACTION_PARENT_DIR or action == ACTION_PARENT_DIR2:
-                       action = ACTION_PREVIOUS_MENU
-               xbmcgui.WindowXMLDialog.onAction(self, action)
+               if action.getId() == ACTION_PARENT_DIR or action.getId() == 
ACTION_PARENT_DIR2 or action.getId() == ACTION_PREVIOUS_MENU:
+                       #action.getId() = ACTION_PREVIOUS_MENU
+                       self.close()
+                       return
+               #xbmcgui.WindowXMLDialog.onAction(self, action)
                
 
######################################################################################
 # Source Dialog
@@ -898,13 +964,14 @@ class SourceDialog(BaseWindow, xbmcgui.WindowXMLDialog):
                pass
        
        def onAction(self, action):
-               if action == ACTION_PARENT_DIR or action == ACTION_PARENT_DIR2:
-                       action = ACTION_PREVIOUS_MENU
-               elif action == ACTION_PAGE_UP or action == 104:
-                       action = ACTION_MOVE_UP
-               elif action == ACTION_PAGE_DOWN  or action == 105:
-                       action = ACTION_MOVE_DOWN
-               xbmcgui.WindowXMLDialog.onAction(self, action)
+               if action.getId() == ACTION_PARENT_DIR or action.getId() == 
ACTION_PARENT_DIR2 or action.getId() == ACTION_PREVIOUS_MENU:
+                       self.close()
+                       return
+               #elif action.getId() == ACTION_PAGE_UP or action.getId() == 104:
+               #       action = ACTION_MOVE_UP
+               #elif action == ACTION_PAGE_DOWN  or action == 105:
+               #       action = ACTION_MOVE_DOWN
+               #xbmcgui.WindowXMLDialog.onAction(self, action)
        
 class LineItem:
        def __init__(self, text='', ids='', index=''):
@@ -1024,6 +1091,7 @@ class ViewerWindow(BaseWindow):
                self.lastPageSearch = ''
                self.bmManger = 
BookmarksManager(os.path.join(xbmc.translatePath(__addon__.getAddonInfo('profile')),
 'bookmarks'))
                self.standalone = True
+               self.videoHandler = video.WebVideo()
                BaseWindow.__init__(self, *args, **kwargs)
                
        def onInit(self):
@@ -1059,13 +1127,27 @@ class ViewerWindow(BaseWindow):
                self.setHistoryControls()
                self.refresh()
                
-       def gotoURL(self, url=None):
+       def gotoURL(self, url=None,force_video=False):
                if not url:
                        default = ''
                        if __addon__.getSetting('goto_pre_filled') == 'true': 
default = self.page.url
-                       url = doKeyboard(__language__(30111), default=default)
-                       if not url: return
+                       url = doKeyboard(T(32111), default=default)
+                       if not url: return False
                        if not url.startswith('http://'): url = 'http://' + url
+               elif self.videoHandler.mightBeVideo(url):
+                       try:
+                               vid = self.videoHandler.getVideoObject(url)
+                               if vid and vid.isVideo:
+                                       if force_video:
+                                               yes = True
+                                       else:
+                                               yes = 
xbmcgui.Dialog().yesno(T(32164),T(32165),T(32166),'',T(32167),T(32168))
+                                       if yes:
+                                               video.play(vid.getPlayableURL())
+                                               return True
+                       except:
+                               ERROR('Failed play video')
+                               return False
                old = HistoryLocation(self.page and self.page.url or self.url, 
self.pageList.getSelectedPosition())
                new = HistoryLocation(url)
                self.history.addURL(old, new)
@@ -1073,6 +1155,7 @@ class ViewerWindow(BaseWindow):
                self.line = 0
                self.setHistoryControls()
                self.refresh()
+               return True
                
        def setHistoryControls(self):
                self.getControl(200).setVisible(self.history.canGoBack())
@@ -1088,7 +1171,7 @@ class ViewerWindow(BaseWindow):
        def viewHistory(self):
                options = []
                if self.isBoxee and not self.simpleControls:
-                       options.append(__language__(30133))
+                       options.append(T(32133))
                        options.append('-                         -')
                ct = 0
                for h in self.history.history:
@@ -1098,7 +1181,7 @@ class ViewerWindow(BaseWindow):
                        options.append(t)
                        ct += 1
                dialog = xbmcgui.Dialog()
-               idx = dialog.select(__language__(30112), options)
+               idx = dialog.select(T(32112), options)
                if self.isBoxee:
                        if idx == 0:
                                self.openSettings()
@@ -1121,7 +1204,7 @@ class ViewerWindow(BaseWindow):
        def getRefreshData(self, callback=None, donecallback=None):
                page = WR.getWebPage(self.url, callback=callback)
                if not page or not page.isDisplayable():
-                       callback(100, __language__(30109))
+                       callback(100, T(32109))
                donecallback(page)
                
        def refreshDo(self, page):
@@ -1131,7 +1214,7 @@ class ViewerWindow(BaseWindow):
                                        self.playMedia(page.url)
                                elif page.content.startswith('audio'):
                                        self.playMedia(page.url, mtype='music')
-                               elif 
xbmcgui.Dialog().yesno(__language__(30113), __language__(30114), 
page.getFileName(), __language__(30115) % page.content):
+                               elif xbmcgui.Dialog().yesno(T(32113), T(32114), 
page.getFileName(), T(32115).format(page.content)):
                                        self.downloadLink(page.url, 
page.getFileName())
                        self.endProgress()
                        if self.page: 
self.getControl(104).setLabel(self.page.title or self.page.url)
@@ -1170,9 +1253,9 @@ class ViewerWindow(BaseWindow):
        
        def pageDown(self):
                pos = self.pageList.getSelectedPosition()
-               max = self.pageList.size()
+               pmax = self.pageList.size()
                ct = 0
-               for i in range(pos, max):
+               for i in range(pos, pmax):
                        item = self.pageList.getListItem(i)
                        if item.displayLen < self.CHAR_PER_LINE:
                                ct += 1
@@ -1183,14 +1266,14 @@ class ViewerWindow(BaseWindow):
                        return
                i -= 1
                if i < 0: i = 0
-               if i > max: return
+               if i > pmax: return
                self.pageList.selectItem(i)
                self.refreshFocus()
                
-       def calculateLines(self, pos, max):
+       def calculateLines(self, pos, lmax):
                ct = 0
                toppos = -1
-               for i in range(max * -1, (pos * -1) + 1):
+               for i in range(lmax * -1, (pos * -1) + 1):
                        i = abs(i)
                        item = self.pageList.getListItem(i)
                        if item.displayLen < self.CHAR_PER_LINE:
@@ -1350,7 +1433,7 @@ class ViewerWindow(BaseWindow):
                                        hasControl = True
                                elif c.type == 'text' or c.type == 'password' 
or c.type == 'textarea':
                                        a = c.attrs
-                                       label = labels.get(c.id) or 
labels.get(c.name) or a.get('title') or a.get('value') or a.get('type') or ''
+                                       label = labels.get(c.id,'').strip() or 
labels.get(c.name,'').strip() or a.get('title','').title().strip() or 
a.get('value','').title().strip() or a.get('id','').title().strip() or 
a.get('name','').title().strip() or a.get('type','').title().strip() or ''
                                        if c.type == 'password':
                                                value = '*' * len(c.value or '')
                                        else:
@@ -1369,7 +1452,7 @@ class ViewerWindow(BaseWindow):
                                                citem = c.get(value)
                                                label = 
citem.attrs.get('label', value)
                                        else:
-                                               label = __language__(30116)
+                                               label = T(32116)
                                        item = xbmcgui.ListItem(label=label)
                                        item.setInfo('video', 
{'Genre':'select'})
                                        item.setProperty('index', str(idx))
@@ -1393,7 +1476,7 @@ class ViewerWindow(BaseWindow):
                if not hasControl:
                        self.addLabel('Empty Form')
                if not hasSubmit and hasControl and 
__addon__.getSetting('add_missing_submit') == 'true':
-                       item = xbmcgui.ListItem(label=__language__(30147))
+                       item = xbmcgui.ListItem(label=T(32147))
                        item.setInfo('video', {'Genre':'submit'})
                        item.setProperty('index', str(idx))
                        self.controlList.addItem(item)
@@ -1449,7 +1532,7 @@ class ViewerWindow(BaseWindow):
                        self.submitForm(None)
                        return
                elif ctype == 'file':
-                       fname = xbmcgui.Dialog().browse(1, __language__(30117), 
'files')
+                       fname = xbmcgui.Dialog().browse(1, T(32117), 'files')
                        control.add_file(open(fname, 'r'), 
filename=os.path.basename(fname))
                        item.setLabel(fname)
                        
@@ -1464,7 +1547,7 @@ class ViewerWindow(BaseWindow):
                        options.append(cb + ' ' + unicode(i.attrs.get('label', 
i.name) or i.name, 'utf8', 'replace'))
                        #options.append(i.attrs.get('label',i.name) or i.name)
                dialog = xbmcgui.Dialog()
-               idx = dialog.select(__language__(30118), options)
+               idx = dialog.select(T(32118), options)
                if idx < 0: return False
                i = control.items[idx]
                if not i.disabled:
@@ -1474,9 +1557,9 @@ class ViewerWindow(BaseWindow):
                        for i in control.items:
                                if i.selected: ct += 1
                        if ct:
-                               label = __language__(30119) % ct
+                               label = T(32119).format(ct)
                        else:
-                               label = __language__(30116)
+                               label = T(32116)
                else:
                        value = control.value[0]
                        citem = control.get(value)
@@ -1547,7 +1630,7 @@ class ViewerWindow(BaseWindow):
                LOG('displayPage() - END')
                                
        def doAutoClose(self, heading, message):
-               if xbmcgui.Dialog().yesno(heading, message, 
__language__(30148)): self.close()
+               if xbmcgui.Dialog().yesno(heading, message, T(32148)): 
self.close()
                
        def getLinks(self):
                ulist = self.getControl(148)
@@ -1607,8 +1690,8 @@ class ViewerWindow(BaseWindow):
                w.doModal()
                del w
        
-       def gotoID(self, id):
-               id = id.replace('#', '')
+       def gotoID(self, ID):
+               ID = ID.replace('#', '')
                plist = self.pageList
                bottom = plist.size() - 1
                for i in range((bottom) * -1, 1):
@@ -1616,7 +1699,7 @@ class ViewerWindow(BaseWindow):
                        item = plist.getListItem(i)
                        ids = item.IDs
                        #print id,ids
-                       if id in ids:
+                       if ID in ids:
                                plist.selectItem(i)
                                return
                        
@@ -1658,7 +1741,7 @@ class ViewerWindow(BaseWindow):
                        link = self.currentElement()
                if not link.type == PE_LINK and not link.type == PE_FRAME: 
return
                if link.cannotBeFollowed():
-                       xbmcgui.Dialog().ok(__language__(30151), 
__language__(30152), '', link.cannotBeFollowed())
+                       xbmcgui.Dialog().ok(T(32151), T(32152), '', 
link.cannotBeFollowed())
                        return
                if link.url.startswith('#'):
                        self.gotoID(link.url)
@@ -1668,11 +1751,11 @@ class ViewerWindow(BaseWindow):
                        self.showImage(url)
                else:
                        self.gotoURL(url)
-                       #base = 
xbmcgui.Dialog().browse(3,__language__(30144),'files')
+                       #base = xbmcgui.Dialog().browse(3,T(32144),'files')
                        #if not base: return
-                       #fname,ftype = 
Downloader(message=__language__(30145)).downloadURL(base,link.url)
+                       #fname,ftype = 
Downloader(message=T(32145)).downloadURL(base,link.url)
                        #if not fname: return
-                       
#xbmcgui.Dialog().ok(__language__(30052),__language__(30146),fname,__language__(30147)
 % ftype)
+                       #xbmcgui.Dialog().ok(T(32052),T(32146),fname,T(32147) % 
ftype)
                
        def showImage(self, url):
                LOG('SHOWING IMAGE: ' + url)
@@ -1728,13 +1811,13 @@ class ViewerWindow(BaseWindow):
                        #xbmcgui.unlock()
        
        def bookmarks(self):
-               options = [__language__(30120), __language__(30121), '-         
                -']
+               options = [T(32120), T(32121), '-                         -']
                for bm in self.bmManger.bookmarks: options.append(bm.title)
                dialog = xbmcgui.Dialog()
-               idx = dialog.select(__language__(30122), options)
+               idx = dialog.select(T(32122), options)
                if idx < 0: return
                if idx == 0:
-                       title = doKeyboard(__language__(30123), 
default=self.page.title)
+                       title = doKeyboard(T(32123), default=self.page.title)
                        if title == None: title = self.page.title
                        self.bmManger.addBookmark(Bookmark(title, 
self.page.url))
                elif idx == 1: self.manageBookmarks()
@@ -1749,25 +1832,26 @@ class ViewerWindow(BaseWindow):
                        options = []
                        for bm in self.bmManger.bookmarks: 
options.append(bm.title)
                        dialog = xbmcgui.Dialog()
-                       idx = dialog.select(__language__(30124), options)
+                       idx = dialog.select(T(32124), options)
                        if idx < 0: return
-                       if xbmcgui.Dialog().yesno(__language__(30125), 
__language__(30126), __language__(30127) % 
self.bmManger.getBookmark(idx).title):
+                       if xbmcgui.Dialog().yesno(T(32125), T(32126), 
T(32127).format(self.bmManger.getBookmark(idx).title)):
                                self.bmManger.removeBookmark(idx)
        
        def onAction(self, action):
                #print action.getId()
                #check for exit so errors won't prevent it
                if self.simpleControls:
-                       if action == ACTION_PAUSE or action == 
ACTION_PLAYER_PLAY:
-                               action = ACTION_CONTEXT_MENU
-               if action == ACTION_PREVIOUS_MENU:
+                       if action.getId() == ACTION_PAUSE or action.getId() == 
ACTION_PLAYER_PLAY:
+                               self.c()
+                               return
+               if action.getId() == ACTION_PREVIOUS_MENU:
                        if action.getButtonCode() or self.getFocusId() == 111:
-                               #Escape was pressed
-                               BaseWindow.onAction(self, action)
+                               self.close()
                                return
                        else:
                                #This was a mouse right click on a button
-                               action = ACTION_CONTEXT_MENU
+                               self.doMenu()
+                               return
                                        
                #if self.getFocusId() == 122:   
                if self.getFocusId() == 148:
@@ -1775,138 +1859,171 @@ class ViewerWindow(BaseWindow):
                        if pos != self.linkLastPos:
                                self.linkSelectionChanged(pos, self.linkLastPos)
                                self.linkLastPos = pos
-                       elif action == ACTION_CONTEXT_MENU:
+                       elif action.getId() == ACTION_CONTEXT_MENU:
                                self.doMenu(PE_LINK)
                elif self.getFocusId() == 150:
-                       if action == ACTION_CONTEXT_MENU:
+                       if action.getId() == ACTION_CONTEXT_MENU:
                                self.doMenu(PE_IMAGE)
                elif self.getFocusId() == 120:
-                       if action == ACTION_CONTEXT_MENU:
+                       if action.getId() == ACTION_CONTEXT_MENU:
                                self.doMenu(PE_FORM)
                else:
                        pos = self.pageList.getSelectedPosition()
                        if pos != self.lastPos:
                                self.selectionChanged(pos, self.lastPos)
                                self.lastPos = pos
-                       if action == ACTION_MOVE_RIGHT:
+                       if action.getId() == ACTION_MOVE_RIGHT:
                                if not self.formFocused: self.nextElement()
                                self.formFocused = False
                                #self.nextLink()
                                return
-                       elif action == ACTION_MOVE_LEFT:
+                       elif action.getId() == ACTION_MOVE_LEFT:
                                if not self.formFocused:  self.prevElement()
                                self.formFocused = False
                                return
-                       if action == ACTION_MOVE_UP or action == 104:
+                       if action.getId() == ACTION_MOVE_UP or action.getId() 
== 104:
                                pos = self.pageList.moveUp()
                                self.selectionChanged(pos, self.lastPos)
                                self.lastPos = pos
                                return
-                       elif action == ACTION_MOVE_DOWN  or action == 105:
+                       elif action.getId() == ACTION_MOVE_DOWN  or 
action.getId() == 105:
                                pos = self.pageList.moveDown()
                                self.selectionChanged(pos, self.lastPos)
                                self.lastPos = pos
                                return
-                       elif action == ACTION_PAGE_UP or action == 
ACTION_PREV_ITEM:
+                       elif action.getId() == ACTION_PAGE_UP or action.getId() 
== ACTION_PREV_ITEM:
                                self.pageUp()
                                return
-                       elif action == ACTION_PAGE_DOWN or action == 
ACTION_NEXT_ITEM:
+                       elif action.getId() == ACTION_PAGE_DOWN or 
action.getId() == ACTION_NEXT_ITEM:
                                self.pageDown()
                                return
-                       elif action == ACTION_CONTEXT_MENU:
+                       elif action.getId() == ACTION_CONTEXT_MENU:
                                self.doMenu()
                                return
                        
-               if action == ACTION_PARENT_DIR or action == ACTION_PARENT_DIR2 
or action == ACTION_PLAYER_REWIND:
+               if action.getId() == ACTION_PARENT_DIR or action.getId() == 
ACTION_PARENT_DIR2 or action.getId() == ACTION_PLAYER_REWIND:
                        if not self.back() and (not self.standalone or 
self.simpleControls):
-                               action == ACTION_PREVIOUS_MENU
+                               self.close()
                        else:
                                return
-               elif action == ACTION_PLAYER_FORWARD:
+               elif action.getId() == ACTION_PLAYER_FORWARD:
                        self.forward()
                        return
-               elif action == ACTION_PAUSE:
+               elif action.getId() == ACTION_PAUSE:
                        self.viewHistory()
                        return
-               elif action == ACTION_SHOW_INFO:
-                               self.focusElementList()
-                               return
-               elif action == ACTION_PLAYER_PLAY:
-                               self.refresh()
+               elif action.getId() == ACTION_SHOW_INFO:
+                       self.focusElementList()
+                       return
+               elif action.getId() == ACTION_PLAYER_PLAY:
+                       if 
self.videoHandler.getVideoObject(self.page.url,just_ID=True):
+                               self.gotoURL(self.page.url,force_video=True)
                                return
+                       self.refresh()
+                       return
                
                BaseWindow.onAction(self, action)
                
        def downloadLink(self, url, fname=None):
-               base = xbmcgui.Dialog().browse(3, __language__(30128), 'files')
+               base = xbmcgui.Dialog().browse(3, T(32128), 'files')
                if not base: return
-               fname, ftype = 
Downloader(message=__language__(30129)).downloadURL(base, url, fname, 
opener=WR.browser.open)
+               cache = 
os.path.join(xbmc.translatePath(__addon__.getAddonInfo('profile')),'cache')
+               if not os.path.exists(cache): os.makedirs(cache)
+               fname, ftype = Downloader(message=T(32129)).downloadURL(cache, 
url, fname, opener=WR.browser.open)
                if not fname: return
-               xbmcgui.Dialog().ok(__language__(30109), __language__(30130), 
fname, __language__(30115) % ftype)
+               local = os.path.join(cache,fname)
+               target = base + fname
+               if not os.path.exists(local):
+                       xbmcgui.Dialog().ok(T(32169), T(32170))
+                       return
+               try:
+                       xbmcvfs.copy(local,target)
+                       if not xbmcvfs.exists(target):
+                               xbmcgui.Dialog().ok(T(32169), T(32171))
+               except:
+                       ERROR('Failed: xbmcfs.copy()')
+                       xbmcgui.Dialog().ok(T(32169), T(32171))
+               xbmcvfs.delete(local)
+               xbmcgui.Dialog().ok(T(32109), T(32130), fname, 
T(32115).format(ftype))
                
        def doMenu(self, etype=None):
                element = self.currentElement()
                if element and not etype: etype = element.type
                
                #populate options
-               options = [     __language__(30131),
-                                       __language__(30132),
-                                       __language__(30110),
-                                       __language__(30146),
-                                       __language__(30149),
-                                       __language__(30153)]
+               optionsMatch = [        'goto_url',
+                                                       'bookmarks',
+                                                       'settings',
+                                                       'help',
+                                                       'google_search',
+                                                       'page_search']
+               
+               options = [     T(32131),
+                                       T(32132),
+                                       T(32110),
+                                       T(32146),
+                                       T(32149),
+                                       T(32153)]
                
                if self.simpleControls:
-                       options += [__language__(30158), __language__(30159), 
__language__(30160), __language__(30112),__language__(30161)]
+                       optionsMatch += 
['back','forward','refresh','history','close']
+                       options += [T(32158), T(32159), T(32160), 
T(32112),T(32161)]
                
-               idx_base = len(options) - 1
                if etype == PE_LINK:
-                       options += [__language__(30134), __language__(30135)]
-                       if element.image: options.append(__language__(30136))
-                       if element.isImage(): 
options.append(__language__(30137))
-               elif etype == PE_IMAGE: options += [__language__(30138), 
__language__(30139)]
-               elif etype == PE_FORM: options.append(__language__(30140))
+                       optionsMatch += ['open_link','save_link']
+                       options += [T(32134), T(32135)]
+                       if element.image:
+                               optionsMatch.append('link_image')
+                               options.append(T(32136))
+                       if element.isImage():
+                               optionsMatch.append('target_image')
+                               options.append(T(32137))
+               elif etype == PE_IMAGE:
+                       optionsMatch += ['view_image','save_image']
+                       options += [T(32138), T(32139)]
+               elif etype == PE_FORM:
+                       optionsMatch.append('submit_form')
+                       options.append(T(32140))
+               if self.videoHandler.getVideoObject(self.page.url,just_ID=True):
+                       optionsMatch.append('play_video')
+                       options.append(T(32163))
                
                #do dialog/handle common
                dialog = xbmcgui.Dialog()
-               idx = dialog.select(__language__(30110), options)
+               idx = dialog.select(T(32110), options)
                if idx < 0: return
-               elif idx == 0: self.gotoURL()
-               elif idx == 1: self.bookmarks()
-               elif idx == 2: self.settings()
-               elif idx == 3: self.doHelp()
-               elif idx == 4: self.googleSearch()
-               elif idx == 5: self.searchPage()
                
-               if self.simpleControls:
-                       if idx == 6: self.back()
-                       elif idx == 7: self.forward()
-                       elif idx == 8: self.refresh()
-                       elif idx == 9: self.viewHistory()
-                       elif idx == 10: self.close()
-                       
-               #handle contextual options
-               if etype == PE_LINK:
-                       if idx == idx_base + 1: self.linkSelected()
-                       elif idx == idx_base + 2: 
self.downloadLink(element.fullURL())
-                       elif options[idx] == __language__(30136): 
self.showImage(fullURL(self.url, element.image))
-                       elif options[idx] == __language__(30137): 
self.showImage(element.fullURL())
-               elif etype == PE_IMAGE:
-                       if idx == idx_base + 1: 
self.showImage(element.fullURL())
-                       elif idx == idx_base + 2: 
self.downloadLink(element.fullURL())
-               elif etype == PE_FORM:
-                       if idx == idx_base + 1: self.submitForm(None)
+               oid = optionsMatch[idx]
+               if   oid == 'goto_url': self.gotoURL()
+               elif oid == 'bookmarks': self.bookmarks()
+               elif oid == 'settings': self.settings()
+               elif oid == 'help': self.doHelp()
+               elif oid == 'google_search': self.googleSearch()
+               elif oid == 'page_search': self.searchPage()
+               elif oid == 'back': self.back()
+               elif oid == 'forward': self.forward()
+               elif oid == 'refresh': self.refresh()
+               elif oid == 'history': self.viewHistory()
+               elif oid == 'close': self.close()
+               elif oid == 'open_link': self.linkSelected()
+               elif oid == 'save_link': self.downloadLink(element.fullURL())
+               elif oid == 'link_image': self.showImage(fullURL(self.url, 
element.image))
+               elif oid == 'target_image': self.showImage(element.fullURL())
+               elif oid == 'view_image': self.showImage(element.fullURL())
+               elif oid == 'save_image': self.downloadLink(element.fullURL())
+               elif oid == 'submit_form': self.submitForm(None)
+               elif oid == 'play_video': 
self.gotoURL(self.page.url,force_video=True)
                
        def settings(self):
                dialog = xbmcgui.Dialog()
-               idx = dialog.select(__language__(30110), [__language__(30133), 
__language__(30142), __language__(30157), __language__(30162)])
+               idx = dialog.select(T(32110), [T(32133), T(32142), T(32157), 
T(32162)])
                if idx < 0: return
                
                if idx == 0:
                        self.openSettings()
                elif idx == 1:
                        setHome(self.page.url)
-                       xbmcgui.Dialog().ok(__language__(30109), 
__language__(30143), self.page.getTitle())
+                       xbmcgui.Dialog().ok(T(32109), T(32143), 
self.page.getTitle())
                elif idx == 2:
                        self.viewPageSource()
                elif idx == 3:
@@ -1951,7 +2068,7 @@ class ViewerWindow(BaseWindow):
                self.setFocusId(122)
                                
        def googleSearch(self):
-               terms = doKeyboard(__language__(30150))
+               terms = doKeyboard(T(32150))
                if terms == None: return
                import urllib
                terms = urllib.quote_plus(terms)
@@ -1960,7 +2077,7 @@ class ViewerWindow(BaseWindow):
                
        def searchPage(self, term=None, start=None):
                if not term:
-                       term = doKeyboard(__language__(30150), 
default=self.lastPageSearch)
+                       term = doKeyboard(T(32150), default=self.lastPageSearch)
                        if term == None: return
                self.lastPageSearch = term
                term = term.lower()
@@ -1979,9 +2096,9 @@ class ViewerWindow(BaseWindow):
                        self.refreshFocus()
                else:
                        if start != None:
-                               xbmcgui.Dialog().ok(__language__(30154), '%s:' 
% __language__(30155), '', term)
+                               xbmcgui.Dialog().ok(T(32154), '%s:' % T(32155), 
'', term)
                        else:
-                               if xbmcgui.Dialog().yesno(__language__(30154), 
__language__(30155), '', __language__(30156)):
+                               if xbmcgui.Dialog().yesno(T(32154), T(32155), 
'', T(32156)):
                                        self.searchPage(term, 0)
                
 
@@ -1989,8 +2106,8 @@ class ViewerWindowDialog(ViewerWindow, 
xbmcgui.WindowXMLDialog): IS_DIALOG = Tru
 class ViewerWindowNormal(ViewerWindow, xbmcgui.WindowXML): pass
 
 class BookmarksManager:
-       def __init__(self, file=''):
-               self.file = file
+       def __init__(self, bfile=''):
+               self.file = bfile
                self.bookmarks = []
                self.load()
                
@@ -2036,7 +2153,7 @@ class Bookmark:
                return self
        
 class Downloader:
-       def __init__(self, header=__language__(30129), message=''):
+       def __init__(self, header=T(32129), message=''):
                self.message = message
                self.prog = xbmcgui.DialogProgress()
                self.prog.create(header, message)
@@ -2058,7 +2175,7 @@ class Downloader:
                        for url, i in zip(urllist, range(0, self.total)):
                                self.current = i
                                if self.prog.iscanceled(): break
-                               self.display = __language__(30144) % (i + 1, 
self.total)
+                               self.display = T(32144).format(i + 1, 
self.total)
                                self.prog.update(int((i / float(self.total)) * 
100), self.message, self.display)
                                fname = os.path.join(targetdir, str(i) + ext)
                                file_list.append(fname)
@@ -2087,7 +2204,7 @@ class Downloader:
                
                try:
                        self.current = 0
-                       self.display = __language__(30145) % 
os.path.basename(path)
+                       self.display = T(32145).format(os.path.basename(path))
                        self.prog.update(0, self.message, self.display)
                        t, ftype = self.getUrlFile(url, path, 
callback=self.progCallback, opener=opener) #@UnusedVariable
                except:
diff --git a/script.web.viewer/resources/language/English/strings.xml 
b/script.web.viewer/resources/language/English/strings.xml
index 214ef8c..cb38f26 100644
--- a/script.web.viewer/resources/language/English/strings.xml
+++ b/script.web.viewer/resources/language/English/strings.xml
@@ -1,79 +1,91 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <strings>
-    <!-- All %s must remain in string but can change position -->
-    <string id="30000">General</string>
-    <string id="30001">Add Submit Button If Missing</string>
-    <string id="30002">Goto URL option edits current URL</string>
-    <string id="30003">Simple Controls (ie ATV2)</string>
+    <!-- All {0} and {1} must remain in string but can change position -->
+    <string id="32000">General</string>
+    <string id="32001">Add Submit Button If Missing</string>
+    <string id="32002">Goto URL option edits current URL</string>
+    <string id="32003">Simple Controls (ie ATV2)</string>
+    <string id="32004">Eperimental: Enable Inline Frames</string>
+    <string id="32005">Show Frames At Bottom (More Compatible)</string>
     
-    <string id="30100">Error loading page.</string>
-    <string id="30101">Processing Data</string>
-    <string id="30102">Redirecting</string>
-    <string id="30103">Opening Page</string>
-    <string id="30104">Reading Data</string>
-    <string id="30105">Submitting Form</string>
-    <string id="30106">Reading Result</string>
-    <string id="30107">Waiting</string>
-    <string id="30108">Waiting for threads to close...</string>
-    <string id="30109">Done</string>
+    <string id="32100">Error loading page.</string>
+    <string id="32101">Processing Data</string>
+    <string id="32102">Redirecting</string>
+    <string id="32103">Opening Page</string>
+    <string id="32104">Reading Data</string>
+    <string id="32105">Submitting Form</string>
+    <string id="32106">Reading Result</string>
+    <string id="32107">Waiting</string>
+    <string id="32108">Waiting for threads to close...</string>
+    <string id="32109">Done</string>
     
-    <string id="30110">Options</string>  
-    <string id="30111">Enter URL</string>
-    <string id="30112">History</string>
-    <string id="30113">File</string>
-    <string id="30114">Download File?</string>
-    <string id="30115">Type: %s</string>
-    <string id="30116">Multi-Select</string>
-    <string id="30117">Select File</string>
-    <string id="30118">Select</string>
-    <string id="30119">%s Selected</string>
+    <string id="32110">Options</string>  
+    <string id="32111">Enter URL</string>
+    <string id="32112">History</string>
+    <string id="32113">File</string>
+    <string id="32114">Download File?</string>
+    <string id="32115">Type: {0}</string>
+    <string id="32116">Multi-Select</string>
+    <string id="32117">Select File</string>
+    <string id="32118">Select</string>
+    <string id="32119">{0} Selected</string>
     
-    <string id="30120">Add Bookmark</string>
-    <string id="30121">Manage Bookmarks</string>
-    <string id="30122">Bookmarks Menu</string>
-    <string id="30123">Enter Title</string>
-    <string id="30124">Select A Bookmark To Delete</string>
-    <string id="30125">Really?</string>
-    <string id="30126">Remove Bookmark:</string>
-    <string id="30127">%s?</string><!--  Example: Remove Bookmark: %s? where 
%s is bookmark title -->
-    <string id="30128">Save Link</string>
-    <string id="30129">Downloading</string>
-    <string id="30130">Downloaded File</string>
-    <string id="30131">Go To URL</string>
-    <string id="30132">Bookmarks</string>
-    <string id="30133">Settings</string>
-    <string id="30134">Open Link</string>
-    <string id="30135">Save Link</string>
-    <string id="30136">View Link Image</string>
-    <string id="30137">View Target Image</string>
-    <string id="30138">View Image</string>
-    <string id="30139">Save Image</string>
-    <string id="30140">Submit Form</string>
-    <string id="30141">Preferences</string>
-    <string id="30142">Set Home/Start Page</string>
-    <string id="30143">Home/Start Page Set To:</string>
-    <string id="30144">File %s of %s</string><!-- Example: File 2 of 9 -->
-    <string id="30145">Downloading %s</string>
-    <string id="30146">Help</string>
-    <string id="30147">Submit</string>
-    <string id="30148">Close Web Viewer?</string>
+    <string id="32120">Add Bookmark</string>
+    <string id="32121">Manage Bookmarks</string>
+    <string id="32122">Bookmarks Menu</string>
+    <string id="32123">Enter Title</string>
+    <string id="32124">Select A Bookmark To Delete</string>
+    <string id="32125">Really?</string>
+    <string id="32126">Remove Bookmark:</string>
+    <string id="32127">{0}?</string><!--  Example: Remove Bookmark: {0}? where 
{0} is bookmark title -->
+    <string id="32128">Save Link</string>
+    <string id="32129">Downloading</string>
+    <string id="32130">Downloaded File</string>
+    <string id="32131">Go To URL</string>
+    <string id="32132">Bookmarks</string>
+    <string id="32133">Settings</string>
+    <string id="32134">Open Link</string>
+    <string id="32135">Save Link</string>
+    <string id="32136">View Link Image</string>
+    <string id="32137">View Target Image</string>
+    <string id="32138">View Image</string>
+    <string id="32139">Save Image</string>
+    <string id="32140">Submit Form</string>
+    <string id="32141">Preferences</string>
+    <string id="32142">Set Home/Start Page</string>
+    <string id="32143">Home/Start Page Set To:</string>
+    <string id="32144">File {0} of {1}</string><!-- Example: File 2 of 9 -->
+    <string id="32145">Downloading {0}</string>
+    <string id="32146">Help</string>
+    <string id="32147">Submit</string>
+    <string id="32148">Close Web Viewer?</string>
     
-    <string id="30149">Search Google</string>
-    <string id="30150">Enter Search Terms</string>
+    <string id="32149">Search Google</string>
+    <string id="32150">Enter Search Terms</string>
     
-    <string id="30151">Unknown URL Type</string>
-    <string id="30152">Web Viewer cannot open links of type:</string>
+    <string id="32151">Unknown URL Type</string>
+    <string id="32152">Web Viewer cannot open links of type:</string>
     
-    <string id="30153">Search Page</string>
-    <string id="30154">Not Found</string>
-    <string id="30155">Match Not Found</string>
-    <string id="30156">Try again from top of page?</string>
+    <string id="32153">Search Page</string>
+    <string id="32154">Not Found</string>
+    <string id="32155">Match Not Found</string>
+    <string id="32156">Try again from top of page?</string>
     
-    <string id="30157">View Page Source</string>
-    <string id="30158">Back</string>
-    <string id="30159">Forward</string>
-    <string id="30160">Refresh</string>
-    <string id="30161">Exit Web Viewer</string>
-    <string id="30162">Read View</string>
-
+    <string id="32157">View Page Source</string>
+    <string id="32158">Back</string>
+    <string id="32159">Forward</string>
+    <string id="32160">Refresh</string>
+    <string id="32161">Exit Web Viewer</string>
+    <string id="32162">Read View</string>
+    <string id="32163">Play Page Video</string>
+    
+    <string id="32164">Play Video?</string>
+    <string id="32165">Play the video the link points to,</string>
+    <string id="32166">or follow the link to the page?</string>
+    <string id="32167">Follow Link</string>
+    <string id="32168">Play Video</string>
+    
+    <string id="32169">Failed</string>
+    <string id="32170">File download failed.</string>
+    <string id="32171">Failed to copy file to target directory.</string>
 </strings>
diff --git a/script.web.viewer/resources/settings.xml 
b/script.web.viewer/resources/settings.xml
index a94e6cd..6c91e83 100644
--- a/script.web.viewer/resources/settings.xml
+++ b/script.web.viewer/resources/settings.xml
@@ -1,9 +1,11 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <settings>
   <!-- General -->
-  <category label="30000">
-    <setting id="add_missing_submit" type="bool" label="30001" default="true" 
/>
-    <setting id="goto_pre_filled" type="bool" label="30002" default="false" />
-    <setting id="simple_controls" type="bool" label="30003" />
+  <category label="32000">
+    <setting id="add_missing_submit" type="bool" label="32001" default="true" 
/>
+    <setting id="goto_pre_filled" type="bool" label="32002" default="false" />
+    <setting id="simple_controls" type="bool" label="32003" />
+    <setting id="inline_frames" type="bool" label="32004" default="false"/>
+    <setting id="frames_at_end" type="bool" label="32005" subsetting="true" 
default="false"  enable="eq(-1,true)"/>
   </category>
 </settings>
\ No newline at end of file

-----------------------------------------------------------------------

Summary of changes:
 script.web.viewer/addon.xml                        |    9 +-
 script.web.viewer/changelog.txt                    |   55 +++-
 script.web.viewer/lib/webviewer/htmltoxbmc.py      |   34 +-
 script.web.viewer/lib/webviewer/video.py           |  349 ++++++++++++++
 script.web.viewer/lib/webviewer/webviewer.py       |  475 ++++++++++++--------
 .../resources/language/English/strings.po          |  344 ++++++++++++++
 .../resources/language/English/strings.xml         |  150 ++++---
 script.web.viewer/resources/settings.xml           |   10 +-
 8 files changed, 1154 insertions(+), 272 deletions(-)
 create mode 100644 script.web.viewer/lib/webviewer/video.py
 create mode 100644 script.web.viewer/resources/language/English/strings.po


hooks/post-receive
-- 
Scripts

------------------------------------------------------------------------------
Own the Future-Intel(R) Level Up Game Demo Contest 2013
Rise to greatness in Intel's independent game demo contest. Compete 
for recognition, cash, and the chance to get your game on Steam. 
$5K grand prize plus 10 genre and skill prizes. Submit your demo 
by 6/6/13. http://altfarm.mediaplex.com/ad/ck/12124-176961-30367-2
_______________________________________________
Xbmc-addons mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xbmc-addons

Reply via email to