diff --git a/gui/blender-linux.watch.py b/gui/blender-linux.watch.py
index ac336551c..d6854545c 100644
--- a/gui/blender-linux.watch.py
+++ b/gui/blender-linux.watch.py
@@ -1,31 +1,6 @@
#os=Linux
-from urllib import request
-import re
-from datetime import datetime
+import sys, os
+sys.path.insert(0, os.path.abspath(os.path.dirname(__file__)))
+import blender
-def regex(url, pattern):
- return re.findall(pattern, request.urlopen(url).read().decode('utf-8'))
-
-def to_zi_version(input):
- suffix = ''
- if input.endswith('-alpha'):
- input = input.replace('-alpha', '')
- suffix = '-pre-pre'
- if input.endswith('-beta'):
- input = input.replace('-beta', '')
- suffix = '-pre'
- if not input[-1].isdigit():
- input = input[:-1] + '-' + str(ord(input[-1]) - 96)
- return input + suffix
-
-releases = []
-
-for version_main in regex('https://download.blender.org/release/', r'>Blender([\d\.a-z]+)\/<\/a>'):
- for match in regex('https://download.blender.org/release/Blender' + version_main + '/', r'>blender-([\d\.\-a-z]+)-linux-x64\.tar\.xz<\/a>\s+(..-...-....)'):
- releases.append({
- 'version': to_zi_version(match[0].replace('-release', '').replace('rc', '-rc')),
- 'version-main': version_main,
- 'version-full': match[0],
- 'stability': 'testing' if 'alpha' in match[0] or 'beta' in match[0] or 'rc' in match[0] else 'stable',
- 'released': datetime.strftime(datetime.strptime(match[1], '%d-%b-%Y'), '%Y-%m-%d')
- })
+releases = blender.releases('linux-x64.tar.xz')
diff --git a/gui/blender-linux.xml b/gui/blender-linux.xml
index 1ff2fb9ee..bf4dd1bc9 100644
--- a/gui/blender-linux.xml
+++ b/gui/blender-linux.xml
@@ -399,5 +399,44 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/gui/blender-linux.xml.template b/gui/blender-linux.xml.template
index 5e92fc980..1831f7c93 100644
--- a/gui/blender-linux.xml.template
+++ b/gui/blender-linux.xml.template
@@ -13,9 +13,9 @@
-
+
-
+
diff --git a/gui/blender-macos.watch.py b/gui/blender-macos.watch.py
index d38e752c1..56e89097f 100644
--- a/gui/blender-macos.watch.py
+++ b/gui/blender-macos.watch.py
@@ -1,31 +1,6 @@
#os=Darwin
-from urllib import request
-import re
-from datetime import datetime
+import sys, os
+sys.path.insert(0, os.path.abspath(os.path.dirname(__file__)))
+import blender
-def regex(url, pattern):
- return re.findall(pattern, request.urlopen(url).read().decode('utf-8'))
-
-def to_zi_version(input):
- suffix = ''
- if input.endswith('-alpha'):
- input = input.replace('-alpha', '')
- suffix = '-pre-pre'
- if input.endswith('-beta'):
- input = input.replace('-beta', '')
- suffix = '-pre'
- if not input[-1].isdigit():
- input = input[:-1] + '-' + str(ord(input[-1]) - 96)
- return input + suffix
-
-releases = []
-
-for version_main in regex('https://download.blender.org/release/', r'>Blender([\d\.a-z]+)\/<\/a>'):
- for match in regex('https://download.blender.org/release/Blender' + version_main + '/', r'>blender-([\d\.\-a-z]+)-macos-x64\.dmg<\/a>\s+(..-...-....)'):
- releases.append({
- 'version': to_zi_version(match[0].replace('-release', '').replace('rc', '-rc')),
- 'version-main': version_main,
- 'version-full': match[0],
- 'stability': 'testing' if 'alpha' in match[0] or 'beta' in match[0] or 'rc' in match[0] else 'stable',
- 'released': datetime.strftime(datetime.strptime(match[1], '%d-%b-%Y'), '%Y-%m-%d')
- })
+releases = blender.releases('macos-x64.dmg')
diff --git a/gui/blender-macos.xml b/gui/blender-macos.xml
index 2aab55117..8e6e2951c 100644
--- a/gui/blender-macos.xml
+++ b/gui/blender-macos.xml
@@ -252,5 +252,41 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/gui/blender-macos.xml.template b/gui/blender-macos.xml.template
index b84bff1ba..c85e63f61 100644
--- a/gui/blender-macos.xml.template
+++ b/gui/blender-macos.xml.template
@@ -13,9 +13,9 @@
-
+
-
+
diff --git a/gui/blender-windows.watch.py b/gui/blender-windows.watch.py
index d22658243..306431ad4 100644
--- a/gui/blender-windows.watch.py
+++ b/gui/blender-windows.watch.py
@@ -1,31 +1,6 @@
#os=Windows
-from urllib import request
-import re
-from datetime import datetime
+import sys, os
+sys.path.insert(0, os.path.abspath(os.path.dirname(__file__)))
+import blender
-def regex(url, pattern):
- return re.findall(pattern, request.urlopen(url).read().decode('utf-8'))
-
-def to_zi_version(input):
- suffix = ''
- if input.endswith('-alpha'):
- input = input.replace('-alpha', '')
- suffix = '-pre-pre'
- if input.endswith('-beta'):
- input = input.replace('-beta', '')
- suffix = '-pre'
- if not input[-1].isdigit():
- input = input[:-1] + '-' + str(ord(input[-1]) - 96)
- return input + suffix
-
-releases = []
-
-for version_main in regex('https://download.blender.org/release/', r'>Blender([\d\.a-z]+)\/<\/a>'):
- for match in regex('https://download.blender.org/release/Blender' + version_main + '/', r'>blender-([\d\.\-a-z]+)-windows-x64\.zip<\/a>\s+(..-...-....)'):
- releases.append({
- 'version': to_zi_version(match[0].replace('-release', '').replace('rc', '-rc')),
- 'version-main': version_main,
- 'version-full': match[0],
- 'stability': 'testing' if 'alpha' in match[0] or 'beta' in match[0] or 'rc' in match[0] else 'stable',
- 'released': datetime.strftime(datetime.strptime(match[1], '%d-%b-%Y'), '%Y-%m-%d')
- })
+releases = blender.releases('windows-x64.zip')
diff --git a/gui/blender-windows.xml b/gui/blender-windows.xml
index 8893fb162..cce7a564a 100644
--- a/gui/blender-windows.xml
+++ b/gui/blender-windows.xml
@@ -568,5 +568,41 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/gui/blender-windows.xml.template b/gui/blender-windows.xml.template
index bcff9cf21..eca3d3b83 100644
--- a/gui/blender-windows.xml.template
+++ b/gui/blender-windows.xml.template
@@ -13,9 +13,9 @@
-
+
-
+
diff --git a/gui/blender.py b/gui/blender.py
new file mode 100644
index 000000000..5aa6b8986
--- /dev/null
+++ b/gui/blender.py
@@ -0,0 +1,15 @@
+from urllib import request
+import re
+from datetime import datetime
+
+def regex(url, pattern):
+ return re.findall(pattern, request.urlopen(url).read().decode('utf-8'))
+
+def releases(suffix):
+ for minor_version in regex('https://download.blender.org/release/', r'>Blender([\d\.a-z]+)\/<\/a>'):
+ for match in regex('https://download.blender.org/release/Blender' + minor_version + '/', r'>blender-([\d\.\-a-z]+)-' + re.escape(suffix) + '<\/a>\s+(..-...-....)'):
+ yield {
+ 'version': match[0],
+ 'minor-version': minor_version,
+ 'released': datetime.strftime(datetime.strptime(match[1], '%d-%b-%Y'), '%Y-%m-%d')
+ }