The branch, frodo has been updated via 836c5ed61e003ce4dc786015f7d1d6a0d21617d8 (commit) via f9c7793b8daca069c9fc989c30c8f4eaa5f7d20b (commit) from 29f665419cc5a3c37a273fa2e02bbbe0c510cc8e (commit)
- Log ----------------------------------------------------------------- http://xbmc.git.sourceforge.net/git/gitweb.cgi?p=xbmc/scripts;a=commit;h=836c5ed61e003ce4dc786015f7d1d6a0d21617d8 commit 836c5ed61e003ce4dc786015f7d1d6a0d21617d8 Author: Martijn Kaijser <mcm.kaij...@gmail.com> Date: Thu Sep 11 18:09:53 2014 +0200 [script.module.six] 1.7.3 diff --git a/script.module.six/addon.xml b/script.module.six/addon.xml index 5085890..34f75c3 100644 --- a/script.module.six/addon.xml +++ b/script.module.six/addon.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <addon id="script.module.six" name="six" - version="1.5.2" + version="1.7.3" provider-name="gutworth"> <requires> <import addon="xbmc.python" diff --git a/script.module.six/lib/six.py b/script.module.six/lib/six.py index 7ec7f1b..f8f7d40 100644 --- a/script.module.six/lib/six.py +++ b/script.module.six/lib/six.py @@ -20,12 +20,13 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. +import functools import operator import sys import types __author__ = "Benjamin Peterson <benja...@python.org>" -__version__ = "1.5.2" +__version__ = "1.7.3" # Useful for very coarse version differentiation. @@ -105,14 +106,6 @@ class MovedModule(_LazyDescr): return _import_module(self.mod) def __getattr__(self, attr): - # Hack around the Django autoreloader. The reloader tries to get - # __file__ or __name__ of every module in sys.modules. This doesn't work - # well if this MovedModule is for an module that is unavailable on this - # machine (like winreg on Unix systems). Thus, we pretend __file__ and - # __name__ don't exist if the module hasn't been loaded yet. See issues - # #51 and #53. - if attr in ("__file__", "__name__") and self.mod not in sys.modules: - raise AttributeError _module = self._resolve() value = getattr(_module, attr) setattr(self, attr, value) @@ -159,9 +152,72 @@ class MovedAttribute(_LazyDescr): return getattr(module, self.attr) +class _SixMetaPathImporter(object): + """ + A meta path importer to import six.moves and its submodules. + + This class implements a PEP302 finder and loader. It should be compatible + with Python 2.5 and all existing versions of Python3 + """ + def __init__(self, six_module_name): + self.name = six_module_name + self.known_modules = {} + + def _add_module(self, mod, *fullnames): + for fullname in fullnames: + self.known_modules[self.name + "." + fullname] = mod + + def _get_module(self, fullname): + return self.known_modules[self.name + "." + fullname] + + def find_module(self, fullname, path=None): + if fullname in self.known_modules: + return self + return None + + def __get_module(self, fullname): + try: + return self.known_modules[fullname] + except KeyError: + raise ImportError("This loader does not know module " + fullname) + + def load_module(self, fullname): + try: + # in case of a reload + return sys.modules[fullname] + except KeyError: + pass + mod = self.__get_module(fullname) + if isinstance(mod, MovedModule): + mod = mod._resolve() + else: + mod.__loader__ = self + sys.modules[fullname] = mod + return mod + + def is_package(self, fullname): + """ + Return true, if the named module is a package. + + We need this method to get correct spec objects with + Python 3.4 (see PEP451) + """ + return hasattr(self.__get_module(fullname), "__path__") + + def get_code(self, fullname): + """Return None + + Required, if is_package is implemented""" + self.__get_module(fullname) # eventually raises ImportError + return None + get_source = get_code # same as get_code + +_importer = _SixMetaPathImporter(__name__) + class _MovedItems(_LazyModule): """Lazy loading of moved objects""" + __path__ = [] # mark as package _moved_attributes = [ @@ -174,6 +230,8 @@ _moved_attributes = [ MovedAttribute("reload_module", "__builtin__", "imp", "reload"), MovedAttribute("reduce", "__builtin__", "functools"), MovedAttribute("StringIO", "StringIO", "io"), + MovedAttribute("UserDict", "UserDict", "collections"), + MovedAttribute("UserList", "UserList", "collections"), MovedAttribute("UserString", "UserString", "collections"), MovedAttribute("xrange", "__builtin__", "builtins", "xrange", "range"), MovedAttribute("zip", "itertools", "builtins", "izip", "zip"), @@ -183,6 +241,7 @@ _moved_attributes = [ MovedModule("configparser", "ConfigParser"), MovedModule("copyreg", "copy_reg"), MovedModule("dbm_gnu", "gdbm", "dbm.gnu"), + MovedModule("_dummy_thread", "dummy_thread", "_dummy_thread"), MovedModule("http_cookiejar", "cookielib", "http.cookiejar"), MovedModule("http_cookies", "Cookie", "http.cookies"), MovedModule("html_entities", "htmlentitydefs", "html.entities"), @@ -222,17 +281,19 @@ _moved_attributes = [ MovedModule("urllib", __name__ + ".moves.urllib", __name__ + ".moves.urllib"), MovedModule("urllib_robotparser", "robotparser", "urllib.robotparser"), MovedModule("xmlrpc_client", "xmlrpclib", "xmlrpc.client"), + MovedModule("xmlrpc_server", "SimpleXMLRPCServer", "xmlrpc.server"), MovedModule("winreg", "_winreg"), ] for attr in _moved_attributes: setattr(_MovedItems, attr.name, attr) if isinstance(attr, MovedModule): - sys.modules[__name__ + ".moves." + attr.name] = attr + _importer._add_module(attr, "moves." + attr.name) del attr _MovedItems._moved_attributes = _moved_attributes -moves = sys.modules[__name__ + ".moves"] = _MovedItems(__name__ + ".moves") +moves = _MovedItems(__name__ + ".moves") +_importer._add_module(moves, "moves") class Module_six_moves_urllib_parse(_LazyModule): @@ -241,6 +302,7 @@ class Module_six_moves_urllib_parse(_LazyModule): _urllib_parse_moved_attributes = [ MovedAttribute("ParseResult", "urlparse", "urllib.parse"), + MovedAttribute("SplitResult", "urlparse", "urllib.parse"), MovedAttribute("parse_qs", "urlparse", "urllib.parse"), MovedAttribute("parse_qsl", "urlparse", "urllib.parse"), MovedAttribute("urldefrag", "urlparse", "urllib.parse"), @@ -254,6 +316,7 @@ _urllib_parse_moved_attributes = [ MovedAttribute("unquote", "urllib", "urllib.parse"), MovedAttribute("unquote_plus", "urllib", "urllib.parse"), MovedAttribute("urlencode", "urllib", "urllib.parse"), + MovedAttribute("splitquery", "urllib", "urllib.parse"), ] for attr in _urllib_parse_moved_attributes: setattr(Module_six_moves_urllib_parse, attr.name, attr) @@ -261,7 +324,8 @@ del attr Module_six_moves_urllib_parse._moved_attributes = _urllib_parse_moved_attributes -sys.modules[__name__ + ".moves.urllib_parse"] = sys.modules[__name__ + ".moves.urllib.parse"] = Module_six_moves_urllib_parse(__name__ + ".moves.urllib_parse") +_importer._add_module(Module_six_moves_urllib_parse(__name__ + ".moves.urllib_parse"), + "moves.urllib_parse", "moves.urllib.parse") class Module_six_moves_urllib_error(_LazyModule): @@ -279,7 +343,8 @@ del attr Module_six_moves_urllib_error._moved_attributes = _urllib_error_moved_attributes -sys.modules[__name__ + ".moves.urllib_error"] = sys.modules[__name__ + ".moves.urllib.error"] = Module_six_moves_urllib_error(__name__ + ".moves.urllib.error") +_importer._add_module(Module_six_moves_urllib_error(__name__ + ".moves.urllib.error"), + "moves.urllib_error", "moves.urllib.error") class Module_six_moves_urllib_request(_LazyModule): @@ -327,7 +392,8 @@ del attr Module_six_moves_urllib_request._moved_attributes = _urllib_request_moved_attributes -sys.modules[__name__ + ".moves.urllib_request"] = sys.modules[__name__ + ".moves.urllib.request"] = Module_six_moves_urllib_request(__name__ + ".moves.urllib.request") +_importer._add_module(Module_six_moves_urllib_request(__name__ + ".moves.urllib.request"), + "moves.urllib_request", "moves.urllib.request") class Module_six_moves_urllib_response(_LazyModule): @@ -346,7 +412,8 @@ del attr Module_six_moves_urllib_response._moved_attributes = _urllib_response_moved_attributes -sys.modules[__name__ + ".moves.urllib_response"] = sys.modules[__name__ + ".moves.urllib.response"] = Module_six_moves_urllib_response(__name__ + ".moves.urllib.response") +_importer._add_module(Module_six_moves_urllib_response(__name__ + ".moves.urllib.response"), + "moves.urllib_response", "moves.urllib.response") class Module_six_moves_urllib_robotparser(_LazyModule): @@ -362,22 +429,24 @@ del attr Module_six_moves_urllib_robotparser._moved_attributes = _urllib_robotparser_moved_attributes -sys.modules[__name__ + ".moves.urllib_robotparser"] = sys.modules[__name__ + ".moves.urllib.robotparser"] = Module_six_moves_urllib_robotparser(__name__ + ".moves.urllib.robotparser") +_importer._add_module(Module_six_moves_urllib_robotparser(__name__ + ".moves.urllib.robotparser"), + "moves.urllib_robotparser", "moves.urllib.robotparser") class Module_six_moves_urllib(types.ModuleType): """Create a six.moves.urllib namespace that resembles the Python 3 namespace""" - parse = sys.modules[__name__ + ".moves.urllib_parse"] - error = sys.modules[__name__ + ".moves.urllib_error"] - request = sys.modules[__name__ + ".moves.urllib_request"] - response = sys.modules[__name__ + ".moves.urllib_response"] - robotparser = sys.modules[__name__ + ".moves.urllib_robotparser"] + __path__ = [] # mark as package + parse = _importer._get_module("moves.urllib_parse") + error = _importer._get_module("moves.urllib_error") + request = _importer._get_module("moves.urllib_request") + response = _importer._get_module("moves.urllib_response") + robotparser = _importer._get_module("moves.urllib_robotparser") def __dir__(self): return ['parse', 'error', 'request', 'response', 'robotparser'] - -sys.modules[__name__ + ".moves.urllib"] = Module_six_moves_urllib(__name__ + ".moves.urllib") +_importer._add_module(Module_six_moves_urllib(__name__ + ".moves.urllib"), + "moves.urllib") def add_move(move): @@ -404,11 +473,6 @@ if PY3: _func_code = "__code__" _func_defaults = "__defaults__" _func_globals = "__globals__" - - _iterkeys = "keys" - _itervalues = "values" - _iteritems = "items" - _iterlists = "lists" else: _meth_func = "im_func" _meth_self = "im_self" @@ -418,11 +482,6 @@ else: _func_defaults = "func_defaults" _func_globals = "func_globals" - _iterkeys = "iterkeys" - _itervalues = "itervalues" - _iteritems = "iteritems" - _iterlists = "iterlists" - try: advance_iterator = next @@ -471,21 +530,37 @@ get_function_defaults = operator.attrgetter(_func_defaults) get_function_globals = operator.attrgetter(_func_globals) -def iterkeys(d, **kw): - """Return an iterator over the keys of a dictionary.""" - return iter(getattr(d, _iterkeys)(**kw)) +if PY3: + def iterkeys(d, **kw): + return iter(d.keys(**kw)) + + def itervalues(d, **kw): + return iter(d.values(**kw)) + + def iteritems(d, **kw): + return iter(d.items(**kw)) + + def iterlists(d, **kw): + return iter(d.lists(**kw)) +else: + def iterkeys(d, **kw): + return iter(d.iterkeys(**kw)) + + def itervalues(d, **kw): + return iter(d.itervalues(**kw)) -def itervalues(d, **kw): - """Return an iterator over the values of a dictionary.""" - return iter(getattr(d, _itervalues)(**kw)) + def iteritems(d, **kw): + return iter(d.iteritems(**kw)) -def iteritems(d, **kw): - """Return an iterator over the (key, value) pairs of a dictionary.""" - return iter(getattr(d, _iteritems)(**kw)) + def iterlists(d, **kw): + return iter(d.iterlists(**kw)) -def iterlists(d, **kw): - """Return an iterator over the (key, [values]) pairs of a dictionary.""" - return iter(getattr(d, _iterlists)(**kw)) +_add_doc(iterkeys, "Return an iterator over the keys of a dictionary.") +_add_doc(itervalues, "Return an iterator over the values of a dictionary.") +_add_doc(iteritems, + "Return an iterator over the (key, value) pairs of a dictionary.") +_add_doc(iterlists, + "Return an iterator over the (key, [values]) pairs of a dictionary.") if PY3: @@ -611,10 +686,26 @@ if print_ is None: _add_doc(reraise, """Reraise an exception.""") +if sys.version_info[0:2] < (3, 4): + def wraps(wrapped): + def wrapper(f): + f = functools.wraps(wrapped)(f) + f.__wrapped__ = wrapped + return f + return wrapper +else: + wraps = functools.wraps def with_metaclass(meta, *bases): """Create a base class with a metaclass.""" - return meta("NewBase", bases, {}) + # This requires a bit of explanation: the basic idea is to make a dummy + # metaclass for one level of class instantiation that replaces itself with + # the actual metaclass. + class metaclass(meta): + def __new__(cls, name, this_bases, d): + return meta(name, bases, d) + return type.__new__(metaclass, 'temporary_class', (), {}) + def add_metaclass(metaclass): """Class decorator for creating a class with a metaclass.""" @@ -630,3 +721,27 @@ def add_metaclass(metaclass): orig_vars.pop(slots_var) return metaclass(cls.__name__, cls.__bases__, orig_vars) return wrapper + +# Complete the moves implementation. +# This code is at the end of this module to speed up module loading. +# Turn this module into a package. +__path__ = [] # required for PEP 302 and PEP 451 +__package__ = __name__ # see PEP 366 @ReservedAssignment +if globals().get("__spec__") is not None: + __spec__.submodule_search_locations = [] # PEP 451 @UndefinedVariable +# Remove other six meta path importers, since they cause problems. This can +# happen if six is removed from sys.modules and then reloaded. (Setuptools does +# this for some reason.) +if sys.meta_path: + for i, importer in enumerate(sys.meta_path): + # Here's some real nastiness: Another "instance" of the six module might + # be floating around. Therefore, we can't use isinstance() to check for + # the six meta path importer, since the other six instance will have + # inserted an importer with different class. + if (type(importer).__name__ == "_SixMetaPathImporter" and + importer.name == __name__): + del sys.meta_path[i] + break + del i, importer +# Finally, add the importer to the meta path import hook. +sys.meta_path.append(_importer) http://xbmc.git.sourceforge.net/git/gitweb.cgi?p=xbmc/scripts;a=commit;h=f9c7793b8daca069c9fc989c30c8f4eaa5f7d20b commit f9c7793b8daca069c9fc989c30c8f4eaa5f7d20b Author: Martijn Kaijser <mcm.kaij...@gmail.com> Date: Thu Sep 11 18:01:53 2014 +0200 [weather.ozweather] 0.7.5 diff --git a/weather.ozweather/addon.xml b/weather.ozweather/addon.xml index 829de44..3337d39 100644 --- a/weather.ozweather/addon.xml +++ b/weather.ozweather/addon.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" standalone="yes"?> -<addon id="weather.ozweather" name="Oz Weather" version="0.7.4" provider-name="Bossanova808"> +<addon id="weather.ozweather" name="Oz Weather" version="0.7.5" provider-name="Bossanova808"> <requires> <import addon="xbmc.python" version="2.1.0"/> <import addon="script.module.pil" version="1.1.7"/> diff --git a/weather.ozweather/changelog.txt b/weather.ozweather/changelog.txt index 4a508ab..b61b4e8 100644 --- a/weather.ozweather/changelog.txt +++ b/weather.ozweather/changelog.txt @@ -1,3 +1,8 @@ +V0.7.5 +- Updates to scraper due to frickin' reverted Weatherzone changes +- Should cope with both old and new website versions with some luck +- Also updated ABC url scraping to be a bit more robust + V0.7.4 - Updates to scraper due to Weatherzone changes diff --git a/weather.ozweather/default.py b/weather.ozweather/default.py index 9a8380d..28393ad 100644 --- a/weather.ozweather/default.py +++ b/weather.ozweather/default.py @@ -345,6 +345,7 @@ def downloadBackground(radarCode, fileName): rgbimg.save(imageFileRGB, "PNG") os.remove(imageFileIndexed) except Exception as inst: + log("Error, couldn't retrieve " + fileName + " - error: ", inst) #ok try and get it via http instead? #try REALLY hard to get at least the background image @@ -362,14 +363,16 @@ def downloadBackground(radarCode, fileName): def prepareBackgrounds(radarCode): - log("Called prepareBackgrounds()") + log("Called prepareBackgrounds() with radarCode [" + radarCode + "]") downloadBackground(radarCode, "IDR.legend.0.png") downloadBackground(radarCode, "background.png") - downloadBackground(radarCode, "locations.png") - downloadBackground(radarCode, "range.png") - downloadBackground(radarCode, "topography.png") - downloadBackground(radarCode, "catchments.png") + #these images don't exist for the national radar, so don't try and get them + if radarCode != "IDR00004": + downloadBackground(radarCode, "locations.png") + downloadBackground(radarCode, "range.png") + downloadBackground(radarCode, "topography.png") + downloadBackground(radarCode, "catchments.png") ################################################################################ @@ -478,6 +481,9 @@ def propertiesPDOM(page, extendedFeatures): #pull data from the current observations table ret = common.parseDOM(page, "div", attrs = { "class": "details_lhs" }) observations = common.parseDOM(ret, "td", attrs = { "class": "hilite" }) + #old style website parise + if not observations: + observations = common.parseDOM(ret, "td", attrs = { "class": "hilite bg_yellow" }) #Observations now looks like - ['18.3°C', '4.7°C', '18.3°C', '41%', 'SSW 38km/h', '48km/h', '1015.7hPa', '-', '0.0mm / -'] log("Current Conditions Retrieved: " + str(observations)) temperature = str(int(round(float(observations[0].strip( '°C' ))))) @@ -493,8 +499,8 @@ def propertiesPDOM(page, extendedFeatures): windSpeed = windTemp[2].strip( 'km/h') #there's no UV so we get that from the forecast, see below except Exception as inst: - log("********** OzWeather Couldn't Parse Data, sorry!!", inst) - setProperty(WEATHER_WINDOW, 'Current.Condition', "Error w. Current Data!") + log("********** OzWeather Couldn't Parse Observations Data, sorry!!", inst) + setProperty(WEATHER_WINDOW, 'Current.Condition', "Error parsing observations!") setProperty(WEATHER_WINDOW, 'Current.ConditionLong', "Error - Couldn't retrieve current weather data from WeatherZone - this is usually just a temporary problem with their server and with any luck they'll fix it soon!") setProperty(WEATHER_WINDOW, "Weather.IsFetched", "false") ####END CURRENT DATA @@ -503,6 +509,9 @@ def propertiesPDOM(page, extendedFeatures): #pull data from the atrological table ret = common.parseDOM(page, "div", attrs = { "class": "details_rhs" }) observations = common.parseDOM(ret, "td", attrs = { "class": "hilite" }) + #old style website parsing + if not observations: + observations = common.parseDOM(ret, "td", attrs = { "class": "hilite bg_yellow" }) log("Astrological Retrieved: " + str(observations)) sunrise = str(observations[0]) sunset = str(observations[1]) @@ -514,11 +523,23 @@ def propertiesPDOM(page, extendedFeatures): try: #pull the basic data from the forecast table ret = common.parseDOM(page, "table", attrs = { "id": "forecast-table" }) - trs = common.parseDOM(ret, "tr") - # log("TRS is: " + str(trs)) + #old style website + if not ret: + ret = common.parseDOM(page, "div", attrs = { "class": "boxed_blue_nopad" }) + #create lists of each of the maxes, mins, and descriptions + #Get the days UV in text form like 'Extreme' and number '11' + UVchunk = common.parseDOM(ret, "td", attrs = { "style": "text-align: center;" }) + shortDesc = common.parseDOM(ret, "td", attrs = { "class": "bg_yellow" }) + shortDesc = common.parseDOM(ret, "span", attrs = { "style": "font-size: 0.9em;" }) + else: + trs = common.parseDOM(ret, "tr") + # log("TRS is: " + str(trs)) + UVchunk = common.parseDOM(trs[6], "td", attrs = { "style": "text-align: center;" }) + shortDesc = common.parseDOM(trs[1], "td", attrs = { }) + shortDesc = common.parseDOM(shortDesc, "span", attrs = { }) + #create lists of each of the maxes, mins, and descriptions #Get the days UV in text form like 'Extreme' and number '11' - UVchunk = common.parseDOM(trs[6], "td", attrs = { "style": "text-align: center;" }) # log("UVchunk is: " + str(UVchunk)) UVtext = common.parseDOM(UVchunk, "span") UVnumber = common.parseDOM(UVchunk, "span", ret = "title") @@ -532,10 +553,8 @@ def propertiesPDOM(page, extendedFeatures): rainAmountList = stripList(maxMin[28:35],'') # log (str(rainChanceList) + str(rainAmountList)) #and the short forecasts - shortDesc = common.parseDOM(trs[1], "td", attrs = { }) - shortDesc = common.parseDOM(shortDesc, "span", attrs = { }) - shortDesc = shortDesc[0:7] + shortDesc = shortDesc[0:7] log(" shortDesc is " + str(shortDesc)) for count, desc in enumerate(shortDesc): @@ -574,39 +593,42 @@ def propertiesPDOM(page, extendedFeatures): weathercode = 'na' except Exception as inst: - log("********** OzWeather Couldn't Parse Data, sorry!!", inst) - setProperty(WEATHER_WINDOW, 'Current.Condition', "Error w. Current Data!") + log("********** OzWeather Couldn't Parse Forecast Data, sorry!!", inst) + setProperty(WEATHER_WINDOW, 'Current.Condition', "Error parsing data!") setProperty(WEATHER_WINDOW, 'Current.ConditionLong', "Error - Couldn't retrieve forecast weather data from WeatherZone - this is usually just a temporary problem with their server and with any luck they'll fix it soon!") setProperty(WEATHER_WINDOW, "Weather.IsFetched", "false") #END FORECAST DATA #ABC VIDEO URL # note date and quality level variables... + #view source on http://www.abc.net.au/news/abcnews24/weather-in-90-seconds/ and find mp4 to see this list, + #the end of the URL can change regularly # {'url': 'http://mpegmedia.abc.net.au/news/news24/weather/video/201403/WINs_Weather1_0703_1000k.mp4', 'contentType': 'video/mp4', 'codec': 'AVC', 'bitrate': '928', 'width': '1024', 'height': '576', 'filesize': '11657344'} # {'url': 'http://mpegmedia.abc.net.au/news/news24/weather/video/201403/WINs_Weather1_0703_256k.mp4', 'contentType': 'video/mp4', 'codec': 'AVC', 'bitrate': '170', 'width': '320', 'height': '180', 'filesize': '2472086'} # {'url': 'http://mpegmedia.abc.net.au/news/news24/weather/video/201403/WINs_Weather1_0703_512k.mp4', 'contentType': 'video/mp4', 'codec': 'AVC', 'bitrate': '400', 'width': '512', 'height': '288', 'filesize': '5328218'} # {'url': 'http://mpegmedia.abc.net.au/news/news24/weather/video/201403/WINs_Weather1_0703_trw.mp4', 'contentType': 'video/mp4', 'codec': 'AVC', 'bitrate': '1780', 'width': '1280', 'height': '720', 'filesize': '21599356'} + #Other URLs - should match any of these + #http%3A//mpegmedia.abc.net.au/news/news24/wins/201409/WINm_Update1_0909_VSB03WF2_512k.mp4& + # http://mpegmedia.abc.net.au/news/news24/wins/201409/WINs_Weather2_0209_trw.mp4 + + #Thus + #//mpegmedia.abc.net.au/news/news24/wins/(.+?)/WIN(.*?)_512k.mp4 + try: log("Trying to get ABC weather video URL") abcURL = "http://www.abc.net.au/news/abcnews24/weather-in-90-seconds/" req = urllib2.Request(abcURL) response = urllib2.urlopen(req) htmlSource = str(response.read()) - #log(htmlSource) - #yearmonth = str(date.today().year) + str(date.today().month).zfill(2) - #daymonth = str(date.today().day).zfill(2) + str(date.today().month).zfill(2) - - # http://mpegmedia.abc.net.au/news/news24/wins/201409/WINs_Weather2_0209_trw.mp4 - - pattern_video = "//mpegmedia.abc.net.au/news/news24/wins/(.+?)/WINs_Weather(.*?)_(.+?)_512k.mp4" + pattern_video = "//mpegmedia.abc.net.au/news/news24/wins/(.+?)/WIN(.*?)_512k.mp4" video = re.findall( pattern_video, htmlSource ) log("Video url parts: " + str(video)) try: qual = ADDON.getSetting("ABCQuality") if qual=="Best": qual="trw" - url = "http://mpegmedia.abc.net.au/news/news24/wins/"+ video[0][0] + "/WINs_Weather" + video[0][1] + "_" + video[0][2] + "_" + qual + ".mp4" + url = "http://mpegmedia.abc.net.au/news/news24/wins/"+ video[0][0] + "/WIN" + video[0][1] + "_" + qual + ".mp4" log("Built url " + url) setProperty(WEATHER_WINDOW, 'Video.1',url) except Exception as inst: @@ -700,6 +722,9 @@ if sys.argv[1].startswith('Location'): if not responseurl.endswith('weatherzone.com.au/search/'): #we were redirected to an actual result page locationName = common.parseDOM(resultPage, "h1", attrs = { "class": "local" }) + #old style website + if not locationName: + locationName = common.parseDOM(resultPage, "h1", attrs = { "class": "unenclosed" }) locationName = locationName[0].split('Weather') locations = [locationName[0] + ', ' + text] locationids = [responseurl] @@ -711,6 +736,10 @@ if sys.argv[1].startswith('Location'): locationids=[] #middle = common.parseDOM(resultPage, "div", attrs = { "id": "structure_middle" }) skimmed = common.parseDOM(resultPage, "ul", attrs = { "class": "typ2" }) + #old style wesbite parsing + if not skimmed: + middle = common.parseDOM(resultPage, "div", attrs = { "id": "structure_middle" }) + skimmed = common.parseDOM(middle, "ul", attrs = { "class": "typ2" }) #ok now get two lists - one of the friendly names #and a matchin one of the URLs to store locations = common.parseDOM(skimmed[0], "a") ----------------------------------------------------------------------- Summary of changes: script.module.six/addon.xml | 2 +- script.module.six/lib/six.py | 207 +++++++++++++++++++++------ weather.ozweather/addon.xml | 2 +- weather.ozweather/changelog.txt | 5 + weather.ozweather/default.py | 75 +++++++--- weather.ozweather/resources/lib/.gitignore | 2 + 6 files changed, 222 insertions(+), 71 deletions(-) create mode 100644 weather.ozweather/resources/lib/.gitignore hooks/post-receive -- Scripts ------------------------------------------------------------------------------ Want excitement? Manually upgrade your production database. When you want reliability, choose Perforce Perforce version control. Predictably reliable. http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk _______________________________________________ Xbmc-addons mailing list Xbmc-addons@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/xbmc-addons