From a51523b46c6833de1545e3c53d154a09d3ce0f64 Mon Sep 17 00:00:00 2001 From: Emmanuel Turbet Date: Tue, 15 May 2018 15:54:12 +0200 Subject: [PATCH] Fix Official Releases loop from LibreELEC-7.0 to the last version group --- resources/lib/builds.py | 14 +++++++++----- resources/lib/libreelec.py | 6 +++--- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/resources/lib/builds.py b/resources/lib/builds.py index 197b786..78111a2 100644 --- a/resources/lib/builds.py +++ b/resources/lib/builds.py @@ -186,7 +186,7 @@ def __iter__(self): html = self._text() self.build_re = re.compile( - self.BUILD_RE.format(dist=libreelec.OS_RELEASE['NAME'], arch=config.arch), + self.BUILD_RE.format(dist=libreelec.name(), arch=config.arch), re.I) soup = BeautifulSoup(html, 'html.parser', @@ -206,10 +206,14 @@ class ReleaseLinkExtractor(BaseExtractor): def __iter__(self): base_url = "http://releases.libreelec.tv" json = self._json() - if libreelec.release() not in json: - return - releases = json[libreelec.release()]['project'][config.arch]['releases'] - for release in releases.itervalues(): + i = 7.0 + releases = [] + while "{0}-{1}".format(libreelec.name(), i) in json: + rels = json["{0}-{1}".format(libreelec.name(), i)]['project'][config.arch]['releases'] + for rel in rels.itervalues(): + releases.append(rel) + i += 1 + for release in releases: filename = release['file']['name'] release_name = re.search('-([\d\.]+).tar', filename).group(1) release_link = ReleaseLink(base_url, filename, release_name) diff --git a/resources/lib/libreelec.py b/resources/lib/libreelec.py index a40bd2b..f2a9857 100644 --- a/resources/lib/libreelec.py +++ b/resources/lib/libreelec.py @@ -11,10 +11,10 @@ def release(): - dist = OS_RELEASE['NAME'] - return "{name}-{version}".format(name=dist, - version=OS_RELEASE['VERSION_ID']) + return "{name}-{version}".format(name=OS_RELEASE['NAME'], version=OS_RELEASE['VERSION_ID']) +def name(): + return OS_RELEASE['NAME'] def mount_readwrite(): subprocess.check_call(['mount', '-o', 'rw,remount', '/flash'])