fix for LibAddonMenu using stupid versioning

master
JoYo 2023-07-15 17:46:26 -04:00
parent a2825684f7
commit 68ad8fe0dd
2 changed files with 18 additions and 8 deletions

View File

@ -27,7 +27,7 @@ Follow the installation instructions for your `platform`:
- [Windows](#windows-installation) - [Windows](#windows-installation)
- [Linux](#linux-installation) - [Linux](#linux-installation)
On first run, the `addons.text` file will be created in your ESO live directory. On first run, the `addons.list` file will be created in your ESO live directory.
It will look similar to the following: It will look similar to the following:
``` ```
@ -117,12 +117,12 @@ sudo systemctl enable banana.timer
sudo systemctl enable banana.service sudo systemctl enable banana.service
``` ```
3. Now that `eso-banana-script` has been installed, run it once to create the `addons.text` file. 3. Now that `eso-banana-script` has been installed, run it once to create the `addons.list` file.
If the mentioned command is missing your may need to restart the TTY. If the mentioned command is missing your may need to restart the TTY.
4. The created file can be edited with vim to include additional adddon URLs at the following path. 4. The created file can be edited with vim to include additional adddon URLs at the following path.
`vim "~/.steam/steam/steamapps/compatdata/306130/pfx/drive_c/users/steamuser/Documents/Elder Scrolls Online/live/addons.text"` `vim "~/.steam/steam/steamapps/compatdata/306130/pfx/drive_c/users/steamuser/Documents/Elder Scrolls Online/live/addons.list"`
It will look similar to the following: It will look similar to the following:

View File

@ -6,6 +6,7 @@ from pathlib import Path
from platform import system from platform import system
from shutil import rmtree, copytree from shutil import rmtree, copytree
from tempfile import TemporaryDirectory from tempfile import TemporaryDirectory
from typing import Tuple
from zipfile import ZipFile from zipfile import ZipFile
import logging import logging
import re import re
@ -40,6 +41,7 @@ def live_to_esoui(*, path: Path, esoui_uris: list):
esoui_name, esoui_version, esoui_uri = _name, _version, _uri esoui_name, esoui_version, esoui_uri = _name, _version, _uri
break break
if not esoui_name: if not esoui_name:
rmtree(live_path) rmtree(live_path)
logging.info(f"{live_name} addon removed from: {live_path}") logging.info(f"{live_name} addon removed from: {live_path}")
@ -113,7 +115,7 @@ live_version = re.compile("##\s+Version:\s+.*")
live_version_split = re.compile("##\s+Version:\s+") live_version_split = re.compile("##\s+Version:\s+")
def esoui_parse(url: str): def esoui_parse(url: str) -> Tuple[str, version.Version, str]:
addon_name = esoui_prefix.split(url)[1] addon_name = esoui_prefix.split(url)[1]
addon_name = addon_name.split(".html")[0] addon_name = addon_name.split(".html")[0]
@ -122,7 +124,11 @@ def esoui_parse(url: str):
version_line = esoui_version_html.search(response.text).group(0) version_line = esoui_version_html.search(response.text).group(0)
_version = esoui_version_split.split(version_line)[1] _version = esoui_version_split.split(version_line)[1]
_version = version.parse(_version) try:
_version = version.parse(_version)
except version.InvalidVersion:
_version = version.parse("1")
return
esoui_page_url = url.replace("info", "download").replace(".html", "") esoui_page_url = url.replace("info", "download").replace(".html", "")
@ -161,7 +167,10 @@ def parsing_live(path: Path):
if result: if result:
_version = result.group(0) _version = result.group(0)
_version = live_version_split.split(_version)[1] _version = live_version_split.split(_version)[1]
_version = version.parse(_version) try:
_version = version.parse(_version)
except version.InvalidVersion:
_version = version.parse("0")
else: else:
_version = version.parse("0") _version = version.parse("0")
@ -228,7 +237,7 @@ def periodical_script():
logging.info(args) logging.info(args)
config_path = Path(args.eso_live_path).joinpath("addons.text") config_path = Path(args.eso_live_path).joinpath("addons.list")
if not config_path.exists(): if not config_path.exists():
config_new(config_path) config_new(config_path)
@ -244,7 +253,8 @@ def periodical_script():
for url in config_current: for url in config_current:
esoui = esoui_parse(url) esoui = esoui_parse(url)
esoui_uris.append(esoui) if esoui:
esoui_uris.append(esoui)
for child in live_path.iterdir(): for child in live_path.iterdir():
live_to_esoui(path=child, esoui_uris=esoui_uris) live_to_esoui(path=child, esoui_uris=esoui_uris)