This commit is contained in:
David Maisonave
2025-01-06 15:31:46 -05:00
parent b07811a6ad
commit 31efd96593
5 changed files with 34 additions and 16 deletions

View File

@@ -9,6 +9,7 @@
# To test, uninstall packages via command line: pip uninstall -y watchdog schedule requests
import sys, os, pathlib, platform, traceback
# ToDo: Add logic to optionally pull package requirements from requirements.txt file.
# Add logic to report error sys.exit(126) -- 126 (0x7E) ERROR_MOD_NOT_FOUND: The specified module could not be found.
def modulesInstalled(moduleNames, install=True, silent=False):
retrnValue = True

View File

@@ -111,6 +111,9 @@ dockerMapVolumes = {}
dockerReverseMapVolumes = {}
dockerObservedPaths = {}
if not parse_args.docker == None and len(parse_args.docker) > 0:
if stash.IS_DOCKER:
stash.Error("You are running this script from within Docker. This is NOT supported. Run this script in the host machine instead. Performing early exit due to unsupported action.")
sys.exit(50) # ERROR_NOT_SUPPORTED: The request is not supported.
stash.Log(f"Docker compose YML file = {parse_args.docker}")
ModulesValidate.modulesInstalled(["pyyaml"], silent=True)
import yaml
@@ -140,6 +143,13 @@ if not parse_args.docker == None and len(parse_args.docker) > 0:
tb = traceback.format_exc()
stash.Error(f"Exception while parsing Docker file {parse_args.docker}; Error: {e}\nTraceBack={tb}")
if stash.IS_DOCKER:
stash.Error("You are running this script from within Docker. This is NOT supported. Run this script in the host machine instead.")
stash.Warn("For more information on running FileMonitor on host machine see following link:\n https://github.com/David-Maisonave/Axter-Stash/tree/main/plugins/FileMonitor#Docker")
stash.Warn("Performing early exit because FileMonitor has to run on the host machine, and can NOT run on Docker directly.")
sys.exit(10) # ERROR_BAD_ENVIRONMENT: The environment is incorrect.
# Alternate error: sys.exit(160) # ERROR_BAD_ARGUMENTS: One or more arguments are not correct.
if stash.DRY_RUN:
stash.Log("Dry run mode is enabled.")
stash.Trace(f"(SCAN_MODIFIED={SCAN_MODIFIED}) (SCAN_ON_ANY_EVENT={SCAN_ON_ANY_EVENT}) (RECURSIVE={RECURSIVE})")

View File

@@ -473,7 +473,7 @@ def rename_files_task():
all_scenes = scene_result['allScenes']
if not all_scenes:
stash.Error("No scenes found.")
exit()
sys.exit(13)
# Find the scene with the latest updated_at timestamp
latest_scene = max(all_scenes, key=lambda scene: scene['updated_at'])
# Extract the ID of the latest scene