mirror of
https://github.com/fishyboteso/fishyboteso.git
synced 2024-08-30 18:32:13 +00:00
add Add-On versioncheck
This commit is contained in:
parent
b157420d77
commit
a5bcbaf28c
@ -59,11 +59,11 @@ def initialize(window_to_hide):
|
||||
helper.install_thread_excepthook()
|
||||
sys.excepthook = helper.unhandled_exception_logging
|
||||
|
||||
if not config.get("addoninstalled", False):
|
||||
if not config.get("addoninstalled", 0) or helper.get_addonversion(chalutier[0]) < chalutier[2]:
|
||||
helper.install_addon(*chalutier)
|
||||
helper.install_addon(*lam2)
|
||||
helper.remove_addon("ProvisionsChalutier")
|
||||
config.set("addoninstalled", True)
|
||||
helper.remove_addon("ProvisionsChalutier") #TODO delete with fishy 0.4.6
|
||||
config.set("addoninstalled", helper.get_addonversion(chalutier[0]))
|
||||
|
||||
|
||||
def main():
|
||||
|
@ -1,3 +1,3 @@
|
||||
apiversion = 1
|
||||
chalutier = ("Chalutier", "https://www.esoui.com/downloads/dl2934/1616505502-Chalutier_1.1.1.zip")
|
||||
lam2 = ("LibAddonMenu-2.0", "https://www.esoui.com/downloads/dl7/LibAddonMenu-2.0r32.zip")
|
||||
chalutier = ("Chalutier", "https://www.esoui.com/downloads/dl2934/1616505502-Chalutier_1.1.1.zip", 111)
|
||||
lam2 = ("LibAddonMenu-2.0", "https://www.esoui.com/downloads/dl7/LibAddonMenu-2.0r32.zip", 32)
|
@ -1,4 +1,4 @@
|
||||
from .auto_update import auto_upgrade, upgrade_avail, versions
|
||||
from .config import Config
|
||||
from .helper import open_web, initialize_uid, install_thread_excepthook, unhandled_exception_logging, manifest_file, \
|
||||
create_shortcut_first, addon_exists, install_addon, remove_addon, restart, create_shortcut, not_implemented, update
|
||||
create_shortcut_first, addon_exists, get_addonversion, install_addon, remove_addon, restart, create_shortcut, not_implemented, update
|
||||
|
@ -152,12 +152,25 @@ def get_addondir():
|
||||
return os.path.join(documents, "Elder Scrolls Online", "live", "Addons")
|
||||
|
||||
|
||||
def addon_exists(name):
|
||||
def addon_exists(name, url=None, v=None):
|
||||
return os.path.exists(os.path.join(get_addondir(), name))
|
||||
|
||||
|
||||
def get_addonversion(name, url=None, v=None):
|
||||
if addon_exists(name):
|
||||
txt = name + ".txt"
|
||||
try:
|
||||
with open(os.path.join(get_addondir(), name, txt)) as f:
|
||||
for line in f:
|
||||
if "AddOnVersion" in line:
|
||||
return int(line.split(' ')[2])
|
||||
except Exception:
|
||||
pass
|
||||
return 0
|
||||
|
||||
|
||||
# noinspection PyBroadException
|
||||
def install_addon(name, url):
|
||||
def install_addon(name, url, v=None):
|
||||
try:
|
||||
r = requests.get(url, stream=True)
|
||||
z = ZipFile(BytesIO(r.content))
|
||||
@ -167,7 +180,7 @@ def install_addon(name, url):
|
||||
logging.error("Could not install Add-On "+name+", try doing it manually")
|
||||
|
||||
|
||||
def remove_addon(name):
|
||||
def remove_addon(name, url=None, v=None):
|
||||
try:
|
||||
shutil.rmtree(os.path.join(get_addondir(), name))
|
||||
logging.info("Add-On "+name+" removed!")
|
||||
|
Loading…
Reference in New Issue
Block a user