The branch, eden-pre has been updated
via 5587aa205fe5f0d8982973b4019e6619e9f879d0 (commit)
via 84970e6fdda4df9db5ad6693b0fed072c2b49a05 (commit)
via 9c426dcfd37478bd82b48e17e7a921ff7d7fba6d (commit)
from 5b3613c35d1cc7416e4708dd93a7e9bf93fac8be (commit)
- Log -----------------------------------------------------------------
http://xbmc.git.sourceforge.net/git/gitweb.cgi?p=xbmc/scripts;a=commit;h=5587aa205fe5f0d8982973b4019e6619e9f879d0
commit 5587aa205fe5f0d8982973b4019e6619e9f879d0
Author: spiff <[email protected]>
Date: Tue Dec 6 20:08:59 2011 +0100
[script.module.simple.downloader] -v0.9.0
initial commit
diff --git a/.gitignore b/.gitignore
index ccf23e0..91bf05f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -8,3 +8,4 @@ script.cdartmanager/.git
script.module.parsedom/.hg
script.common.plugin.cache/.hg
script.image.bigpictures/.git
+script.module.simple.downloader/.hg
http://xbmc.git.sourceforge.net/git/gitweb.cgi?p=xbmc/scripts;a=commit;h=84970e6fdda4df9db5ad6693b0fed072c2b49a05
commit 84970e6fdda4df9db5ad6693b0fed072c2b49a05
Author: spiff <[email protected]>
Date: Tue Dec 6 19:52:51 2011 +0100
[script.module.parsedom] - v0.9.0
diff --git a/script.module.parsedom/addon.xml b/script.module.parsedom/addon.xml
index 1d28736..2204221 100644
--- a/script.module.parsedom/addon.xml
+++ b/script.module.parsedom/addon.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="script.module.parsedom"
name="Parsedom for xbmc plugins."
- version="0.8"
+ version="0.9.0"
provider-name="TheCollective">
<requires>
<import addon="xbmc.python" version="2.0"/>
diff --git a/script.module.parsedom/changelog.txt
b/script.module.parsedom/changelog.txt
index 646b1ee..c5b7f32 100644
--- a/script.module.parsedom/changelog.txt
+++ b/script.module.parsedom/changelog.txt
@@ -1,2 +1,5 @@
-[B]Version 0.8 (Beta)[/B]
+[B]Version 0.9.0[/B]
+- Stability and more functions
+
+[B]Version 0.8.0[/B]
- Initial public test run.
diff --git a/script.module.parsedom/lib/CommonFunctions.py
b/script.module.parsedom/lib/CommonFunctions.py
index a51253a..a0f62fa 100644
--- a/script.module.parsedom/lib/CommonFunctions.py
+++ b/script.module.parsedom/lib/CommonFunctions.py
@@ -16,14 +16,15 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
'''
-import sys, urllib2, re, inspect
+import sys, urllib2, re, io, inspect
-class CommonFunctions():
-
+class CommonFunctions():
def __init__(self):
- self.plugin = "CommonFunctions-0.8"
- self.USERAGENT = "Mozilla/5.0 (Windows; U; Windows NT 6.1;
en-GB; rv:1.9.2.8) Gecko/20100722 Firefox/3.6.8"
+ self.version = "0.9.0"
+ self.plugin = "CommonFunctions-" + self.version
+ print self.plugin
+ self.USERAGENT = "Mozilla/5.0 (Windows; U; Windows NT 6.1;
en-GB; rv:1.9.2.8) Gecko/20100722 Firefox/3.6.8"
if sys.modules[ "__main__" ].xbmc:
self.xbmc = sys.modules["__main__"].xbmc
@@ -31,6 +32,12 @@ class CommonFunctions():
import xbmc
self.xbmc = xbmc
+ if sys.modules[ "__main__" ].xbmcgui:
+ self.xbmcgui = sys.modules["__main__"].xbmcgui
+ else:
+ import xbmcgui
+ self.xbmcgui = xbmcgui
+
if sys.modules[ "__main__" ].dbglevel:
self.dbglevel = sys.modules[ "__main__" ].dbglevel
else:
@@ -41,6 +48,63 @@ class CommonFunctions():
else:
self.dbg = True
+ if sys.modules[ "__main__" ].plugin:
+ self.plugin = sys.modules[ "__main__" ].plugin
+
+ # This function raises a keyboard for user input
+ def getUserInput(self, title = "Input", default="", hidden=False):
+ result = None
+
+ # Fix for when this functions is called with default=None
+ if not default:
+ default = ""
+
+ keyboard = self.xbmc.Keyboard(default, title)
+ keyboard.setHiddenInput(hidden)
+ keyboard.doModal()
+
+ if keyboard.isConfirmed():
+ result = keyboard.getText()
+
+ return result
+
+ # This function raises a keyboard for user input
+ def getUserInputNumbers(self, title = "Input", default="",
hidden=False):
+ result = None
+
+ # Fix for when this functions is called with default=None
+ if not default:
+ default = ""
+
+ keyboard = self.xbmcgui.Dialog()
+ result = keyboard.numeric(0, title, default)
+
+ return result
+
+ # Converts the request url passed on by xbmc to the plugin into a dict
of key-value pairs
+ def getParameters(self, parameterString):
+ commands = {}
+ splitCommands =
parameterString[parameterString.find('?')+1:].split('&')
+
+ for command in splitCommands:
+ if (len(command) > 0):
+ splitCommand = command.split('=')
+ key = splitCommand[0]
+ value = splitCommand[1]
+ commands[key] = value
+
+ return commands
+
+ def replaceHtmlCodes(self, str):
+ str = str.strip()
+ str = str.replace("&", "&")
+ str = str.replace(""", '"')
+ str = str.replace("…", "...")
+ str = str.replace(">",">")
+ str = str.replace("<","<")
+ str = str.replace("'","'")
+ return str
+
def stripTags(self, html):
sub_start = html.find("<")
sub_end = html.find(">")
@@ -62,9 +126,9 @@ class CommonFunctions():
while pos < end and pos != -1:
tend = html.find(endstr, end + len(endstr))
- if tend != -1:
- end = tend
- pos = html.find("<" + name, pos + 1)
+ if tend != -1:
+ end = tend
+ pos = html.find("<" + name, pos + 1)
self.log("loop: " + str(start) + " < " + str(end) + "
pos = " + str(pos), 8)
self.log("start: %s, end: %s" % ( start + len(match), end), 2)
@@ -72,25 +136,25 @@ class CommonFunctions():
html = ""
elif start > -1 and end > -1:
html = html[start + len(match):end]
- #elif end > -1:
- # html = html[:end]
- #elif start > -1:
- # html = html[start + len(match):]
+ elif end > -1:
+ html = html[:end]
+ elif start > -1:
+ html = html[start + len(match):]
- self.log("done html length: " + str(len(html)) + ", content: "
+ html, 2)
+ self.log("done html length: " + str(len(html)), 2)
return html
def getDOMAttributes(self, lst):
self.log("", 2)
ret = []
for tmp in lst:
- if tmp.find('="') > -1:
- tmp = tmp[:tmp.find('="')]
+ cont_char = tmp[0]
+ if tmp.find('="', tmp.find(cont_char, 1)) > -1:
+ tmp = tmp[:tmp.find('="', tmp.find(cont_char,
1))]
- if tmp.find('=\'') > -1:
- tmp = tmp[:tmp.find('=\'')]
+ if tmp.find('=\'', tmp.find(cont_char, 1)) > -1:
+ tmp = tmp[:tmp.find('=\'', tmp.find(cont_char,
1))]
- cont_char = tmp[0]
tmp = tmp[1:]
if tmp.rfind(cont_char) > -1:
tmp = tmp[:tmp.rfind(cont_char)]
@@ -165,12 +229,13 @@ class CommonFunctions():
self.log("Getting element content for %s
matches " % len(lst), 2)
lst2 = []
for match in lst:
+ self.log("Getting element content for
%s" % match, 4)
temp = self.getDOMContent(item, name,
match).strip()
- item = item[item.find(match + temp) +
len(match + temp):]
+ item = item[item.find(temp,
item.find(match)) + len(temp):]
lst2.append(temp)
- self.log(lst, 3)
- self.log(match, 3)
- self.log(lst2, 3)
+ self.log(lst, 4)
+ self.log(match, 4)
+ self.log(lst2, 4)
lst = lst2
ret_lst += lst
@@ -219,12 +284,52 @@ class CommonFunctions():
ret_obj["status"] = 500
return ret_obj
+
+ except urllib2.URLError, e:
+ err = str(e)
+ self.common.log("URLError : " + err)
+
+ time.sleep(3)
+ params["error"] = str(int(get("error", "0")) + 1)
+ ret_obj = self._fetchPage(params)
+ return ret_obj
+
+ # This function implements a horrible hack related to python 2.4's
terrible unicode handling.
+ def makeAscii(self, str):
+ if sys.hexversion >= 0x02050000:
+ return str
+ try:
+ return str.encode('ascii')
+ except:
+ print self.plugin + " Hit except on : " + repr(str)
+ s = ""
+ for i in str:
+ try:
+ i.encode("ascii", "ignore")
+ except:
+ continue
+ else:
+ s += i
+ return s
+
+ def openFile(self, filepath, options = "w"):
+ if options.find("b") == -1: # Toggle binary mode on failure
+ alternate = options + "b"
+ else:
+ alternate = options.replace("b", "")
+
+ try:
+ return io.open(filepath, options)
+ except:
+ return io.open(filepath, alternate)
def log(self, description, level = 0):
if self.dbg and self.dbglevel > level:
# Funny stuff..
# [1][3] needed for calls from scrapeShow
- if isinstance(description, str):
- self.xbmc.log("[%s] %s : '%s'" % (self.plugin,
inspect.stack()[1][3], description.encode("utf8", "ignore")),
self.xbmc.LOGNOTICE)
- else:
+ #print repr(inspect.stack())
+ try:
+ self.xbmc.log("[%s] %s : '%s'" % (self.plugin,
inspect.stack()[1][3], description.encode("utf-8", "ignore")),
self.xbmc.LOGNOTICE)
+ except:
self.xbmc.log("[%s] %s : '%s'" % (self.plugin,
inspect.stack()[1][3], description), self.xbmc.LOGNOTICE)
+
http://xbmc.git.sourceforge.net/git/gitweb.cgi?p=xbmc/scripts;a=commit;h=9c426dcfd37478bd82b48e17e7a921ff7d7fba6d
commit 9c426dcfd37478bd82b48e17e7a921ff7d7fba6d
Author: spiff <[email protected]>
Date: Tue Dec 6 19:39:26 2011 +0100
[script.common.plugin.cache] -v0.9.0
diff --git a/script.common.plugin.cache/addon.xml
b/script.common.plugin.cache/addon.xml
index 6974493..a54c8c9 100644
--- a/script.common.plugin.cache/addon.xml
+++ b/script.common.plugin.cache/addon.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="script.common.plugin.cache"
name="Common plugin cache"
- version="0.8"
+ version="0.9.0"
provider-name="TheCollective">
<requires>
<import addon="xbmc.python" version="2.0"/>
diff --git a/script.common.plugin.cache/changelog.txt
b/script.common.plugin.cache/changelog.txt
index 646b1ee..e4e5388 100644
--- a/script.common.plugin.cache/changelog.txt
+++ b/script.common.plugin.cache/changelog.txt
@@ -1,2 +1,5 @@
-[B]Version 0.8 (Beta)[/B]
+[B]Version 0.9.0[/B]
+- Better stability
+
+[B]Version 0.8.0[/B]
- Initial public test run.
diff --git a/script.common.plugin.cache/default.py
b/script.common.plugin.cache/default.py
index 44d27b7..5c07649 100755
--- a/script.common.plugin.cache/default.py
+++ b/script.common.plugin.cache/default.py
@@ -17,11 +17,13 @@
Version 0.8
'''
import platform
-import xbmc
+import xbmc, xbmcaddon
try: import xbmcvfs
except: import xbmcvfsdummy as xbmcvfs
-dbg = False
+settings = xbmcaddon.Addon(id='script.common.plugin.cache')
+language = settings.getLocalizedString
+dbg = settings.getSetting("debug") == "true"
dbglevel = 3
def run():
@@ -33,6 +35,6 @@ def run():
if __name__ == "__main__":
# ARM should run in instance mode, not as a service.
- if not xbmc.getCondVisibility('system.platform.ios'):
+ if not xbmc.getCondVisibility('system.platform.ios') and
settings.getSetting("autostart") == "true":
import StorageServer
run()
diff --git a/script.common.plugin.cache/xbmcvfsdummy.py
b/script.common.plugin.cache/xbmcvfsdummy.py
index e8d62bf..fe467f9 100644
--- a/script.common.plugin.cache/xbmcvfsdummy.py
+++ b/script.common.plugin.cache/xbmcvfsdummy.py
@@ -12,7 +12,7 @@ def rename(origin, target):
return os.rename(origin, target)
def delete(target):
- if os.path.isfile(target):
+ if os.path.isfile(target) and not os.path.isdir(target):
return os.unlink(target)
return False
-----------------------------------------------------------------------
Summary of changes:
.gitignore | 1 +
script.common.plugin.cache/addon.xml | 2 +-
script.common.plugin.cache/changelog.txt | 5 +-
script.common.plugin.cache/default.py | 8 +-
.../resources/language/English/strings.xml | 6 +
script.common.plugin.cache/resources/settings.xml | 9 +
script.common.plugin.cache/xbmcvfsdummy.py | 2 +-
script.module.parsedom/addon.xml | 2 +-
script.module.parsedom/changelog.txt | 5 +-
script.module.parsedom/lib/CommonFunctions.py | 155 ++++++--
.../addon.xml | 8 +-
script.module.simple.downloader/changelog.txt | 10 +
.../lib/DialogDownloadProgress.py | 297 +++++++++++++
.../lib/SimpleDownloader.py | 435 ++++++++++++++++++++
.../lib/storageserverdummy.py | 26 ++
.../lib}/xbmcvfsdummy.py | 2 +-
.../resources/language/English/strings.xml | 17 +
.../resources/settings.xml | 10 +
.../skins/default/720p/DialogDownloadProgress.xml | 57 +++
.../default/media/OverlayDialogBackground.png | Bin 0 -> 7807 bytes
.../resources/skins/default/media/ProgressBack.png | Bin 0 -> 1124 bytes
.../skins/default/media/ProgressFront.png | Bin 0 -> 1140 bytes
22 files changed, 1019 insertions(+), 38 deletions(-)
create mode 100644
script.common.plugin.cache/resources/language/English/strings.xml
create mode 100644 script.common.plugin.cache/resources/settings.xml
copy {script.module.parsedom => script.module.simple.downloader}/addon.xml
(62%)
create mode 100644 script.module.simple.downloader/changelog.txt
create mode 100644
script.module.simple.downloader/lib/DialogDownloadProgress.py
create mode 100644 script.module.simple.downloader/lib/SimpleDownloader.py
create mode 100644 script.module.simple.downloader/lib/storageserverdummy.py
copy {script.common.plugin.cache =>
script.module.simple.downloader/lib}/xbmcvfsdummy.py (82%)
create mode 100644
script.module.simple.downloader/resources/language/English/strings.xml
create mode 100644 script.module.simple.downloader/resources/settings.xml
create mode 100644
script.module.simple.downloader/resources/skins/default/720p/DialogDownloadProgress.xml
create mode 100644
script.module.simple.downloader/resources/skins/default/media/OverlayDialogBackground.png
create mode 100644
script.module.simple.downloader/resources/skins/default/media/ProgressBack.png
create mode 100644
script.module.simple.downloader/resources/skins/default/media/ProgressFront.png
hooks/post-receive
--
Scripts
------------------------------------------------------------------------------
Cloud Services Checklist: Pricing and Packaging Optimization
This white paper is intended to serve as a reference, checklist and point of
discussion for anyone considering optimizing the pricing and packaging model
of a cloud services business. Read Now!
http://www.accelacomm.com/jaw/sfnl/114/51491232/
_______________________________________________
Xbmc-addons mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xbmc-addons