diff --git a/kodi-nfo-feeder.py b/kodi-nfo-feeder.py index 569e5b5..0c70148 100644 --- a/kodi-nfo-feeder.py +++ b/kodi-nfo-feeder.py @@ -2,16 +2,26 @@ import os import logging import sys import time +import re +import shutil from rich.logging import RichHandler from rich.traceback import install import configparser import inflect from inotify_simple import INotify, flags +import lxml.etree +import lxml.builder + + +# TODO Create season subdir if it doesn't exist +# TODO Thread config sections # Exit codes # 1: Config file invalid, it has no sections # 2: Config file invalid, sections must define at least CONST.CFG_MANDATORY +# 3: Watch directory does not exist and unable to create +# 4: Unable to create output directory class CONST(object): @@ -154,7 +164,7 @@ def setup_watch( log.debug(f"Watching for files moved to '{watch_this}' ...") except FileNotFoundError: log.error(f"Watch directory '{watch_this}' does not exist. Please create it. Exiting 3 ...") - sys.exit(4) + sys.exit(3) else: return inotify @@ -166,8 +176,8 @@ if __name__ == '__main__': else: log.error(f"No valid config section found. A valid config section has at least the mandatory " f"""{p.plural("option", len(CONST.CFG_MANDATORY))} """ - f"{CONST.CFG_MANDATORY} set. Exiting 1 ...") - sys.exit(1) + f"{CONST.CFG_MANDATORY} set. Exiting 2 ...") + sys.exit(2) log.debug(f"Iterating over config sections ...") for section in config.sections():