Update and add credits for code from SSDTTime

This commit is contained in:
Hoang Hong Quan
2024-10-16 21:59:12 +07:00
parent 81fe73dd03
commit 567006dc32
4 changed files with 78 additions and 23 deletions

View File

@@ -1,5 +1,4 @@
# Original source:
# https://github.com/corpnewt/SSDTTime/blob/b3863aff1b387585a54825f325f071f43e1970db/Scripts/dsdt.py
# Original source: https://github.com/corpnewt/SSDTTime/blob/64446d553fcbc14a4e6ebf3d8d16e3357b5cbf50/Scripts/dsdt.py
import os, errno, tempfile, shutil, plistlib, sys, binascii, zipfile, getpass, re
from Scripts import resource_fetcher
@@ -254,8 +253,29 @@ class DSDT:
#source = self.dl.get_string(self.acpi_binary_tools, headers=self.h)
source = self.fetcher.fetch_and_parse_content(self.acpi_binary_tools)
for line in source.split("\n"):
if "href" in line and ">iasl compiler and windows acpi tools" in line.lower():
return line.split('<a href="')[1].split('"')[0]
if '<a href="' in line and ">iasl compiler and windows acpi tools" in line.lower():
# Check if we have a direct download link - i.e. ends with .zip - or if we're
# redirected to a different download page - i.e. ends with .html
dl_link = line.split('<a href="')[1].split('"')[0]
if dl_link.lower().endswith(".zip"):
# Direct download - return as-is
return dl_link
elif dl_link.lower().endswith((".html",".htm")):
# Redirect - try to scrape for a download link
try:
if dl_link.lower().startswith(("http:","https:")):
# The existing link is likely complete - use it as-is
dl_page_url = dl_link
else:
# <a href="/content/www/us/en/download/774881/acpi-component-architecture-downloads-windows-binary-tools.html">iASL Compiler and Windows ACPI Tools
# Only a suffix - prepend to it
dl_page_url = "https://www.intel.com" + line.split('<a href="')[1].split('"')[0]
dl_page_source = self.dl.get_string(dl_page_url, progress=False, headers=self.h)
for line in dl_page_source.split("\n"):
if 'data-href="' in line and '"download-button"' in line:
# Should have the right line
return line.split('data-href="')[1].split('"')[0]
except: pass
except: pass
return None

3
Scripts/run.py Executable file → Normal file
View File

@@ -1,5 +1,4 @@
# Original source:
# https://github.com/corpnewt/SSDTTime/blob/7b3fb78112bf320a1bc6a7e50dddb2b375cb70b0/Scripts/run.py
# Source: https://github.com/corpnewt/SSDTTime/blob/7b3fb78112bf320a1bc6a7e50dddb2b375cb70b0/Scripts/run.py
import sys, subprocess, time, threading, shlex
try: