Skip to content

Commit

Permalink
[RELEASE][2.1.0] CLI for NexusDownloadFlow (#32)
Browse files Browse the repository at this point in the history
* beginning of 2.0.1

* beginning of 2.1.0

* [0033] [ndf-script] [debt] Accessibility scope organization (dev)

* [0018] [ndf-script] Commands (#23)

This merge closes #5

* [0024] [ndf-script] Keyboard shortcuts for commands (#28)

* Delete old template matching scripts

* Delete the ask to keep the logfile workaround

* Add the Pause, Resume, and Stop features

* Update requirements file

* Correcting doc

* [0034] [ndf-script] Technical documentation for 2.1.0 (#29)

* Add technical doc to typer cli

* Add technical doc to typer cli 2

* update git ignore file

* add technical documentation

* add operating documentation (#30)

* [0035] [ndf-script] Operating documentation for 2.1.0 #25 (#31)

* add operating documentation

* correction + ajout dans le dossier documentation

* Update build.spec
  • Loading branch information
greg-ynx authored Sep 16, 2024
1 parent 8059a31 commit f5d9a88
Show file tree
Hide file tree
Showing 39 changed files with 1,551 additions and 610 deletions.
9 changes: 6 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,9 @@ dmypy.json
# Cython debug symbols
cython_debug/

# monitor-1.png temp file
monitor-1.png

# NDF specific ignored files
screenshot.png
issue.txt
custom_templates/*
.distribution/*
__init__.py
186 changes: 172 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,182 @@
# NexusDownloadFlow: Auto-downloader for Nexus Mods
# NexusDownloadFlow (NDF)

NexusDownloadFlow (NDF) is a program that automates the download process with `Wabbajack modlist installation of Nexus
Mods` in which you have to manually click on `Slow download` button if your Nexus Mods account is not premium.
**NexusDownloadFlow (NDF)**
is an automated downloader designed to simplify the process of downloading mod lists from
[Nexus Mods](https://www.nexusmods.com/).
By automatically handling the download process,
it saves time and effort for users who frequently manage large collections of mods.

## How to use NexusDownloadFlow?
## Install

### Without Wabbajack
Download the latest version [here](https://github.com/greg-ynx/NexusDownloadFlow/releases).
NDF is only available for Windows as an executable.
If you wish to use it on another OS then download the project and run it with Python.

Execute `NexusDownloadFlow.exe` and open your Nexus Mods download page.
## Usage

### With Wabbajack
### Basic Usage

Execute `NexusDownloadFlow.exe` while the mod list is downloading.
While running `Wabbajack` modlist installer (for example), run `NexusDownloadFlow.exe`.
NDF should click on the `Slow download` button, automating the download process.

## Auto-clicker is not clicking
### Command-Line Interface (CLI) Usage

Open an issue [here](https://github.com/greg-ynx/NexusDownloadFlow/issues/new), and if possible, give the scenario in which you had this issue, which version of NDF you are using
and provide a screenshot of your logs or the contents of your current `{date}_ndf.log` file.
NexusDownloadFlow is a CLI application with commands that will allow you to configure and run the auto-downloader.

## Credits
To access detailed information about the available commands and options in NDF, you can use the `--help` option.
This will display a list of all commands and their descriptions.

Thanks to [parsiad](https://github.com/parsiad) for inspiring me with his repository named
[`parsiad/nexus-autodl`](https://github.com/parsiad/nexus-autodl).
Example:

```bash
.\NexusDownloadFlow.exe --help
```

#### Run

You can run NDF simply by clicking on the executable or with the command line:

```bash
.\NexusDownloadFlow.exe
```

NDF offers three different launch modes to suit your specific needs when downloading mod lists.

Each mode determines how the templates are handled during the download process.

1. **Classic Mode (default)**
<br>
This is the default mode.
It uses the predefined templates provided by NDF to automate the download of mods.
No additional setup is required.
To run in Classic mode, use:

```bash
.\NexusDownloadFlow.exe
```

2. **Custom Mode**
<br>
In Custom mode, NDF only uses the templates that you have manually added.
This allows NDF to be fully adapted to your environment.
To launch in Custom mode:

```bash
.\NexusDownloadFlow.exe --mode custom # Or .\NexusDownloadFlow.exe -m custom
```

3. **Hybrid Mode**
<br>
Hybrid mode combines both the default templates provided by NDF and your custom templates.
This allows for a more comprehensive approach, using both standard automation and user-specific customizations.
To launch in Hybrid mode:

```bash
.\NexusDownloadFlow.exe --mode hybrid # Or .\NexusDownloadFlow.exe -m hybrid
```

#### Adding Custom Templates

Users can enhance the flexibility of NDF by adding their own custom templates.
You can add your own templates using the `add-templates` command:

```bash
.\NexusDownloadFlow.exe add-templates path/of/custom_template.png path/of/second_custom_template.png
```

Custom templates are stored in a directory (`custom_templates`) located where `NexusDownloadFlow.exe` is.

#### Removing Custom Templates

In addition to adding templates,
NDF allows users to remove one or more custom templates that they have previously added.
This can be done using the `remove-templates` command.

**Removing a Specific Template**
To remove a specific custom template, use the following command:

```bash
.\NexusDownloadFlow.exe remove-templates custom_templates/custom_template_to_delete.png
```

**Removing All Custom Templates**
If you want to remove all custom templates at once, you can use the `--all` option with the `remove-templates` command:

```bash
.\NexusDownloadFlow.exe remove-templates --all
```

## Feature

### Run Command

The run feature is the core of NexusDownloadFlow (NDF),
allowing users to launch the automation process for downloading mods from Nexus Mods.
With this feature, users can choose between three distinct launch modes depending on their needs and preferences.

Available Modes:

1. Classic Mode (default)
Runs the automation using the default templates provided by NDF.

2. Custom Mode
Uses only the custom templates added by the user.

3. Hybrid Mode
Combines both default and custom templates.

### Version Command

The `version` command allows users to quickly check which version of NexusDownloadFlow they are using.
This can be useful for troubleshooting or ensuring that you have the latest features and updates.

To display the current version, run:

```bash
.\NexusDownloadFlow version # Or -v
```

This will output the version number of NDF installed on your system.

### Add-Templates Command

The `add-templates` command allows you to add your custom templates to NexusDownloadFlow.

### Remove-Templates Command

The `remove-templates` command allows you to delete your custom templates from NexusDownloadFlow.

### Clear-Logs Command

The `clear-logs` command is used to delete all log files generated by NDF.
This helps to free up disk space and remove old log data that is no longer needed.

To clear the logs, use:

```bash
.\NexusDownloadFlow clear-logs
```

### Writing issue template for GitHub

The `issue` command helps users quickly create a pre-filled GitHub issue form for reporting bugs or requesting features
related to NexusDownloadFlow.

To generate the issue form, use:

```bash
.\NexusDownloadFlow issue
```

## Development requirements

Python v3.11 and:

```text
keyboard~=0.13.5
opencv-python~=4.10.0.84
mss~=9.0.2
PyAutoGUI~=0.9.54
psutil~=6.0.0
typer~=0.12.5
```
16 changes: 16 additions & 0 deletions _global/constants/messages.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"""Messages constants module."""

from config.definitions import CUSTOM_TEMPLATES_DIRECTORY_PATH

NO_ACTION_REQUIRED_MESSAGE: str = "No action required."
CUSTOM_TEMPLATES_DIRECTORY_IS_NOT_A_DIRECTORY_ERROR_MESSAGE: str = (
f"'{CUSTOM_TEMPLATES_DIRECTORY_PATH}' exists but is not a directory."
)
CUSTOM_TEMPLATES_FOLDER_DOES_NOT_EXIST_WARNING_MESSAGE: str = (
f"The custom templates folder does not exist at '{CUSTOM_TEMPLATES_DIRECTORY_PATH}'. {NO_ACTION_REQUIRED_MESSAGE}"
)
CUSTOM_TEMPLATES_FOLDER_EMPTY_WARNING_MESSAGE: str = (
f"The custom templates folder is empty. {NO_ACTION_REQUIRED_MESSAGE}"
)
FILE_PATH_INVALID_FILE_ERROR_MESSAGE: str = "The provided path '{file_path}' is not a valid file."
FILE_PATH_INVALID_IMAGE_ERROR_MESSAGE: str = "The file '{file_path}' is not a valid image."
13 changes: 13 additions & 0 deletions assets/issue/issue.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# {issue_title}

## Environment

NexusDownloadFlow version: {ndf_version}
Operating System (OS) and its architecture (32/64 bits): {user_operating_system} - {user_operating_system_architecture}
System RAM capacity: {user_system_ram_capacity} GB
Monitors: {user_monitors_count}
Monitors resolution details: {user_monitors_resolutions}

## Description

{issue_description}
File renamed without changes
File renamed without changes
File renamed without changes
3 changes: 2 additions & 1 deletion build.spec
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# -*- mode: python ; coding: utf-8 -*-

extra_files = [
('assets/*', 'assets'),
('assets/template_matching/*', 'assets/template_matching/'),
('assets/issue/*', 'assets/issue/'),
('pyproject.toml', '.')
]

Expand Down
5 changes: 5 additions & 0 deletions config/application_properties.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
"""Public application properties."""

from config.definitions import PROJECT_DATA

PROJECT_VERSION: str = str(PROJECT_DATA.get("version"))
4 changes: 2 additions & 2 deletions config/ascii_art.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Print NexusDownloadFlow ascii art."""
import sys

from config.definitions import PROJECT_DATA
from config.application_properties import PROJECT_VERSION

__ASCII_COLOR: str = "\033[33m"
__ASCII_TEXT: str = """
Expand All @@ -19,7 +19,7 @@
|___/ \\___/ \\_/\\_/ |_| |_|_|\\___/ \\__,_|\\__,_| \\_| |_|\\___/ \\_/\\_/\
"""

__PROJECT_VERSION: str = "v{0}".format(str(PROJECT_DATA.get("version")))
__PROJECT_VERSION: str = "v{0}".format(PROJECT_VERSION)


def print_ascii_art() -> None:
Expand Down
42 changes: 31 additions & 11 deletions config/definitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,29 @@
__TEMP_DIRECTORY: str
__EXE_DIRECTORY: str = os.path.realpath(os.path.join(sys.executable, ".."))
__DEV_DIRECTORY: str = os.path.realpath(os.path.join(os.path.dirname(__file__), ".."))

# Paths constants definition
ROOT_DIRECTORY: str
MAIN_PATH: str
SCREENSHOT_PATH: str
ASSETS_DIRECTORY: str
CONFIG_DIRECTORY: str
LOGS_DIRECTORY: str
PYPROJECT_PATH: str
MAIN_FILE_NAME: str = "main.py"
SCREENSHOT_FILE_NAME: str = "screenshot.png"

# Directory names definition
ASSETS_DIRECTORY_NAME: str = "assets"
ISSUE_TEMPLATE_DIRECTORY_NAME: str = "issue"
TEMPLATE_MATCHING_DIRECTORY_NAME: str = "template_matching"
CONFIG_DIRECTORY_NAME: str = "config"
LOGS_DIRECTORY_NAME: str = "logs"
CUSTOM_TEMPLATES_DIRECTORY_NAME: str = "custom_templates"

# File names definition
MAIN_FILE_NAME: str = "main.py"
SCREENSHOT_FILE_NAME: str = "screenshot.png"
PYPROJECT_FILE_NAME: str = "pyproject.toml"
ISSUE_TEMPLATE_FILE_NAME: str = "issue.template"


def __set_path(directory: str, name: str) -> str:
Expand All @@ -32,21 +45,28 @@ def __set_path(directory: str, name: str) -> str:

if getattr(sys, "frozen", False) and hasattr(sys, "_MEIPASS"):
__TEMP_DIRECTORY = os.path.join(sys._MEIPASS)
ROOT_DIRECTORY = __EXE_DIRECTORY
MAIN_PATH = __set_path(__TEMP_DIRECTORY, MAIN_FILE_NAME)
SCREENSHOT_PATH = __set_path(__TEMP_DIRECTORY, SCREENSHOT_FILE_NAME)
ASSETS_DIRECTORY = __set_path(__TEMP_DIRECTORY, ASSETS_DIRECTORY_NAME)
LOGS_DIRECTORY = __set_path(__EXE_DIRECTORY, LOGS_DIRECTORY_NAME)
CONFIG_DIRECTORY = __set_path(__TEMP_DIRECTORY, CONFIG_DIRECTORY_NAME)
PYPROJECT_PATH = __set_path(__TEMP_DIRECTORY, PYPROJECT_FILE_NAME)
else:
MAIN_PATH = __set_path(__DEV_DIRECTORY, MAIN_FILE_NAME)
SCREENSHOT_PATH = __set_path(__DEV_DIRECTORY, SCREENSHOT_FILE_NAME)
ASSETS_DIRECTORY = __set_path(__DEV_DIRECTORY, ASSETS_DIRECTORY_NAME)
LOGS_DIRECTORY = __set_path(__DEV_DIRECTORY, LOGS_DIRECTORY_NAME)
PYPROJECT_PATH = __set_path(__DEV_DIRECTORY, PYPROJECT_FILE_NAME)
ROOT_DIRECTORY = __DEV_DIRECTORY
MAIN_PATH = __set_path(ROOT_DIRECTORY, MAIN_FILE_NAME)
SCREENSHOT_PATH = __set_path(ROOT_DIRECTORY, SCREENSHOT_FILE_NAME)
ASSETS_DIRECTORY = __set_path(ROOT_DIRECTORY, ASSETS_DIRECTORY_NAME)
CONFIG_DIRECTORY = __set_path(ROOT_DIRECTORY, CONFIG_DIRECTORY_NAME)
PYPROJECT_PATH = __set_path(ROOT_DIRECTORY, PYPROJECT_FILE_NAME)

LOGS_DIRECTORY = __set_path(ROOT_DIRECTORY, LOGS_DIRECTORY_NAME)
ISSUE_TEMPLATE_DIRECTORY_PATH: str = __set_path(ASSETS_DIRECTORY, ISSUE_TEMPLATE_DIRECTORY_NAME)
ISSUE_TEMPLATE_FILE_PATH: str = __set_path(ISSUE_TEMPLATE_DIRECTORY_PATH, ISSUE_TEMPLATE_FILE_NAME)
TEMPLATE_MATCHING_DIRECTORY_PATH: str = __set_path(ASSETS_DIRECTORY, TEMPLATE_MATCHING_DIRECTORY_NAME)
CUSTOM_TEMPLATES_DIRECTORY_PATH: str = __set_path(ROOT_DIRECTORY, CUSTOM_TEMPLATES_DIRECTORY_NAME)

with open(PYPROJECT_PATH, "rb") as pyproject:
PYPROJECT_DATA: dict[str, Any] = tomllib.load(pyproject)
PROJECT_DATA: dict[str, Any] = PYPROJECT_DATA.get("project")
GITHUB_DATA: dict[str, str] = PYPROJECT_DATA.get("github")
GITHUB_ISSUE_VALUE: str = GITHUB_DATA.get("issues")
PROJECT_DATA: dict[str, Any] = PYPROJECT_DATA.get("project") # type: ignore
GITHUB_DATA: dict[str, str] = PYPROJECT_DATA.get("github") # type: ignore
GITHUB_ISSUE_VALUE: str = str(GITHUB_DATA.get("issues"))
Loading

0 comments on commit f5d9a88

Please sign in to comment.