windows scheduled task instructions and logging
							parent
							
								
									4d81453236
								
							
						
					
					
						commit
						8571b71298
					
				| 
						 | 
					@ -1,2 +1,4 @@
 | 
				
			||||||
__pycache__/
 | 
					__pycache__/
 | 
				
			||||||
.vscode/
 | 
					.vscode/
 | 
				
			||||||
 | 
					*.egg-info/
 | 
				
			||||||
 | 
					build/
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										60
									
								
								README.mdown
								
								
								
								
							
							
						
						
									
										60
									
								
								README.mdown
								
								
								
								
							| 
						 | 
					@ -12,6 +12,12 @@ On Windows, press `Windows Key + e` to open a file explorer and enter the follow
 | 
				
			||||||
%HOME%\Documents\Elder Scrolls Online\
 | 
					%HOME%\Documents\Elder Scrolls Online\
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					or on Windows 11
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					Documents\Elder Scrolls Online\
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Make a copy of the `live` folder and rename it to something meaningful like `old` or `backup`.
 | 
					Make a copy of the `live` folder and rename it to something meaningful like `old` or `backup`.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Dependencies
 | 
					# Dependencies
 | 
				
			||||||
| 
						 | 
					@ -22,11 +28,61 @@ python3-pip
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Linux Installation
 | 
					# Linux Installation
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Install `python3` and `pip3`, the following instructions are for Debian.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					sudo apt install python3-pip
 | 
				
			||||||
 | 
					pip3 install .
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Once the project is installed to python's packages you may invoke the addon script with the following command:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					eso-banana-script
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## Linux Scheduled
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					TODO linux chron job instructions.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Windows Installation
 | 
					# Windows Installation
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Usage
 | 
					Install the latest Python 3 using the installer provided by [python.org](https://www.python.org/downloads/windows/).
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Linux Development
 | 
					Open [Windows Terminal](https://www.microsoft.com/en-US/p/windows-terminal/9n0dx20hk701) or any windows command prompt and navigate to this project.
 | 
				
			||||||
 | 
					Use the Python package manager PIP to install `eso-banana`.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					```powershell
 | 
				
			||||||
 | 
					cd .\eso-banana\
 | 
				
			||||||
 | 
					pip install .
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Once the project is installed to python's packages you may invoke the addon script with the following command:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					```powershell
 | 
				
			||||||
 | 
					eso-banana-script.exe
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## Windows Scheduled
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					To schedule a periodic background run of `eso-banana`, open Powershell as a user and enter the following commands.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					```powershell
 | 
				
			||||||
 | 
					$Action = New-ScheduledTaskAction -Execute "eso-banana-script.exe" -Argument "--verbose"
 | 
				
			||||||
 | 
					$Trigger = New-ScheduledTaskTrigger -Daily -At 11am
 | 
				
			||||||
 | 
					$Settings = New-ScheduledTaskSettingsSet -RunOnlyIfNetworkAvailable -StartWhenAvailable -RunOnlyIfIdle
 | 
				
			||||||
 | 
					Register-ScheduledTask -TaskName "eso-banana" -Action $Action -Trigger $Trigger -Settings $Settings -Description "Elder Scrolls Online addon manager and a Tamriel Trade Centre price table updater."
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					To check to make sure the task is registered correctly, enter `Get-ScheduledTask` and check that the first entry looks similar:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					TaskPath                                TaskName                          State
 | 
				
			||||||
 | 
					--------                                --------                          -----
 | 
				
			||||||
 | 
					\                                       eso-banana                        Ready
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Development
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Use docker to test the python components.
 | 
					Use docker to test the python components.
 | 
				
			||||||
For docker installation run the following commands on [Ubuntu 20.04](https://ubuntu.com/download/):
 | 
					For docker installation run the following commands on [Ubuntu 20.04](https://ubuntu.com/download/):
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,5 +1,6 @@
 | 
				
			||||||
from argparse import ArgumentParser
 | 
					from argparse import ArgumentParser
 | 
				
			||||||
from pathlib import Path
 | 
					from pathlib import Path
 | 
				
			||||||
 | 
					from platform import system
 | 
				
			||||||
import logging
 | 
					import logging
 | 
				
			||||||
 | 
					
 | 
				
			||||||
from . import compare
 | 
					from . import compare
 | 
				
			||||||
| 
						 | 
					@ -13,18 +14,26 @@ def periodical_script():
 | 
				
			||||||
        description="Visit https://www.esoui.com/ to search for addons and their dependencies URLs. Edit addons.yaml in the ESO live path and add the URL for each addon for installation. "
 | 
					        description="Visit https://www.esoui.com/ to search for addons and their dependencies URLs. Edit addons.yaml in the ESO live path and add the URL for each addon for installation. "
 | 
				
			||||||
    )
 | 
					    )
 | 
				
			||||||
    parser.add_argument("-v", "--verbose", action="count", help="verbose logging")
 | 
					    parser.add_argument("-v", "--verbose", action="count", help="verbose logging")
 | 
				
			||||||
    parser.add_argument(
 | 
					    parser.add_argument("-p", "--eso_live_path")
 | 
				
			||||||
        "-p",
 | 
					 | 
				
			||||||
        "--eso_live_path",
 | 
					 | 
				
			||||||
        default=Path.home().joinpath("ESO/live/"),
 | 
					 | 
				
			||||||
        help='default: "~/.steam/steam/steamapps/compatdata/306130/pfx/drive_c/users/steamuser/Documents/Elder Scrolls Online/live/"',
 | 
					 | 
				
			||||||
    )
 | 
					 | 
				
			||||||
    args = parser.parse_args()
 | 
					    args = parser.parse_args()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if args.eso_live_path:
 | 
				
			||||||
 | 
					        args.eso_live_path = Path(args.eso_live_path)
 | 
				
			||||||
 | 
					    else:
 | 
				
			||||||
 | 
					        if system() == "Windows":
 | 
				
			||||||
 | 
					            args.eso_live_path = Path.home().joinpath(
 | 
				
			||||||
 | 
					                "Documents\Elder Scrolls Online\live"
 | 
				
			||||||
 | 
					            )
 | 
				
			||||||
 | 
					        else:
 | 
				
			||||||
 | 
					            args.eso_live_path = Path.home().joinpath(
 | 
				
			||||||
 | 
					                ".steam/steam/steamapps/compatdata/306130/pfx/drive_c/users/steamuser/Documents/Elder Scrolls Online/live/"
 | 
				
			||||||
 | 
					            )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if args.verbose:
 | 
					    if args.verbose:
 | 
				
			||||||
        logging.basicConfig(
 | 
					        logging.basicConfig(
 | 
				
			||||||
            level=logging.DEBUG,
 | 
					            level=logging.DEBUG,
 | 
				
			||||||
            format="%(asctime)s %(filename)s:%(lineno)d %(message)s",
 | 
					            format="%(asctime)s %(filename)s:%(lineno)d %(message)s",
 | 
				
			||||||
 | 
					            filename=args.eso_live_path.joinpath("banana.log"),
 | 
				
			||||||
        )
 | 
					        )
 | 
				
			||||||
    else:
 | 
					    else:
 | 
				
			||||||
        logging.basicConfig(
 | 
					        logging.basicConfig(
 | 
				
			||||||
| 
						 | 
					@ -34,10 +43,6 @@ def periodical_script():
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    logging.info(args)
 | 
					    logging.info(args)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if isinstance(args.eso_live_path, str):
 | 
					 | 
				
			||||||
        if args.eso_live_path[:2] == "~/":
 | 
					 | 
				
			||||||
            args.eso_live_path = Path.home().joinpath(args.eso_live_path[2:])
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    config_path = Path(args.eso_live_path).joinpath("addons.yaml")
 | 
					    config_path = Path(args.eso_live_path).joinpath("addons.yaml")
 | 
				
			||||||
    config_path.touch(exist_ok=True)
 | 
					    config_path.touch(exist_ok=True)
 | 
				
			||||||
    config_current = config.load(config_path)
 | 
					    config_current = config.load(config_path)
 | 
				
			||||||
| 
						 | 
					@ -49,7 +54,7 @@ def periodical_script():
 | 
				
			||||||
        config_current = config.load(config_path)
 | 
					        config_current = config.load(config_path)
 | 
				
			||||||
        logging.info(f'addons list created at "{config_path}"')
 | 
					        logging.info(f'addons list created at "{config_path}"')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    live_path = Path(args.eso_live_path).joinpath("AddOns")
 | 
					    live_path = args.eso_live_path.joinpath("AddOns")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if not live_path.is_dir():
 | 
					    if not live_path.is_dir():
 | 
				
			||||||
        logging.error(f"eso_live_path_invalid_dir {live_path}")
 | 
					        logging.error(f"eso_live_path_invalid_dir {live_path}")
 | 
				
			||||||
| 
						 | 
					@ -70,24 +75,28 @@ def periodical_script():
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def ttc():
 | 
					def ttc():
 | 
				
			||||||
    parser = ArgumentParser(
 | 
					    parser = ArgumentParser(description="Tamriel Trade Centre price table updater.")
 | 
				
			||||||
        description="Visit https://www.esoui.com/ to search for addons and their dependencies URLs. Edit addons.yaml in the ESO live path and add the URL for each addon for installation. "
 | 
					 | 
				
			||||||
    )
 | 
					 | 
				
			||||||
    parser.add_argument("-v", "--verbose", action="count", help="verbose logging")
 | 
					    parser.add_argument("-v", "--verbose", action="count", help="verbose logging")
 | 
				
			||||||
    parser.add_argument(
 | 
					    parser.add_argument("-p", "--eso_live_path")
 | 
				
			||||||
        "-p",
 | 
					 | 
				
			||||||
        "--eso_live_path",
 | 
					 | 
				
			||||||
        default=Path.home().joinpath(
 | 
					 | 
				
			||||||
            ".steam/steam/steamapps/compatdata/306130/pfx/drive_c/users/steamuser/Documents/Elder Scrolls Online/live/"
 | 
					 | 
				
			||||||
        ),
 | 
					 | 
				
			||||||
        help='default: "~/.steam/steam/steamapps/compatdata/306130/pfx/drive_c/users/steamuser/Documents/Elder Scrolls Online/live/"',
 | 
					 | 
				
			||||||
    )
 | 
					 | 
				
			||||||
    args = parser.parse_args()
 | 
					    args = parser.parse_args()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if args.eso_live_path:
 | 
				
			||||||
 | 
					        args.eso_live_path = Path(args.eso_live_path)
 | 
				
			||||||
 | 
					    else:
 | 
				
			||||||
 | 
					        if system() == "Windows":
 | 
				
			||||||
 | 
					            args.eso_live_path = Path.home().joinpath(
 | 
				
			||||||
 | 
					                "Documents\Elder Scrolls Online\live"
 | 
				
			||||||
 | 
					            )
 | 
				
			||||||
 | 
					        else:
 | 
				
			||||||
 | 
					            args.eso_live_path = Path.home().joinpath(
 | 
				
			||||||
 | 
					                ".steam/steam/steamapps/compatdata/306130/pfx/drive_c/users/steamuser/Documents/Elder Scrolls Online/live/"
 | 
				
			||||||
 | 
					            )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if args.verbose:
 | 
					    if args.verbose:
 | 
				
			||||||
        logging.basicConfig(
 | 
					        logging.basicConfig(
 | 
				
			||||||
            level=logging.DEBUG,
 | 
					            level=logging.DEBUG,
 | 
				
			||||||
            format="%(asctime)s %(filename)s:%(lineno)d %(message)s",
 | 
					            format="%(asctime)s %(filename)s:%(lineno)d %(message)s",
 | 
				
			||||||
 | 
					            filename=args.eso_live_path.joinpath("banana.log"),
 | 
				
			||||||
        )
 | 
					        )
 | 
				
			||||||
    else:
 | 
					    else:
 | 
				
			||||||
        logging.basicConfig(
 | 
					        logging.basicConfig(
 | 
				
			||||||
| 
						 | 
					@ -97,10 +106,6 @@ def ttc():
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    logging.info(args)
 | 
					    logging.info(args)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if isinstance(args.eso_live_path, str):
 | 
					 | 
				
			||||||
        if args.eso_live_path[:2] == "~/":
 | 
					 | 
				
			||||||
            args.eso_live_path = Path.home().joinpath(args.eso_live_path[2:])
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    live_path = Path(args.eso_live_path).joinpath("AddOns")
 | 
					    live_path = Path(args.eso_live_path).joinpath("AddOns")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if not live_path.is_dir():
 | 
					    if not live_path.is_dir():
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue