Misc cleanup (#73)

* Stop previously running zeroconf instances

* Lots of formatting fixes

* Use f-strings for time delta

* More line fixes

* Update requirements.txt

* More misc cleanup

* Simplify README.md
This commit is contained in:
2024-01-27 22:56:33 -06:00
committed by GitHub
parent d216ae822e
commit d673d7d4bf
21 changed files with 136 additions and 106 deletions

View File

@@ -15,7 +15,6 @@ supported_formats = ['.zip', '.tar.xz', '.dmg']
class BlenderDownloader(EngineDownloader):
engine = Blender
@staticmethod
@@ -43,11 +42,13 @@ class BlenderDownloader(EngineDownloader):
response = requests.get(base_url, timeout=5)
response.raise_for_status()
versions_pattern = r'<a href="(?P<file>[^"]+)">blender-(?P<version>[\d\.]+)-(?P<system_os>\w+)-(?P<cpu>\w+).*</a>'
versions_pattern = \
r'<a href="(?P<file>[^"]+)">blender-(?P<version>[\d\.]+)-(?P<system_os>\w+)-(?P<cpu>\w+).*</a>'
versions_data = [match.groupdict() for match in re.finditer(versions_pattern, response.text)]
# Filter to just the supported formats
versions_data = [item for item in versions_data if any(item["file"].endswith(ext) for ext in supported_formats)]
versions_data = [item for item in versions_data if any(item["file"].endswith(ext) for ext in
supported_formats)]
# Filter down OS and CPU
system_os = system_os or current_system_os()
@@ -105,11 +106,12 @@ class BlenderDownloader(EngineDownloader):
try:
logger.info(f"Requesting download of blender-{version}-{system_os}-{cpu}")
major_version = '.'.join(version.split('.')[:2])
minor_versions = [x for x in cls.__get_minor_versions(major_version, system_os, cpu) if x['version'] == version]
minor_versions = [x for x in cls.__get_minor_versions(major_version, system_os, cpu) if
x['version'] == version]
# we get the URL instead of calculating it ourselves. May change this
cls.download_and_extract_app(remote_url=minor_versions[0]['url'], download_location=download_location,
timeout=timeout)
timeout=timeout)
except IndexError:
logger.error("Cannot find requested engine")
@@ -117,5 +119,4 @@ class BlenderDownloader(EngineDownloader):
if __name__ == '__main__':
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
print(BlenderDownloader.__get_major_versions())
print(BlenderDownloader.find_most_recent_version())