diff --git a/backend/main.py b/backend/main.py index f78ced1f..3103d10c 100644 --- a/backend/main.py +++ b/backend/main.py @@ -9,7 +9,11 @@ import threading import time import uvicorn +import argparse +parser = argparse.ArgumentParser() +parser.add_argument('--dev', action='store_true', help='Enable development mode') +args = parser.parse_args() class Server(uvicorn.Server): def install_signal_handlers(self): @@ -29,7 +33,7 @@ def run_in_thread(self): sys.exit(0) app = FastAPI() -app.program = Program() +app.program = Program(args) app.add_middleware( CORSMiddleware, diff --git a/backend/program/__init__.py b/backend/program/__init__.py index d4ce400f..ae415b63 100644 --- a/backend/program/__init__.py +++ b/backend/program/__init__.py @@ -18,9 +18,10 @@ class Program(threading.Thread): """Program class""" - def __init__(self): + def __init__(self, args): super().__init__(name="Iceberg") self.running = False + self.startup_args = args def start(self): logger.info("Iceberg v%s starting!", settings.get("version")) @@ -29,8 +30,9 @@ def start(self): self.data_path = get_data_path() if not os.path.exists(self.data_path): os.mkdir(self.data_path) - self.pickly = Pickly(self.media_items, self.data_path) - self.pickly.start() + if not self.startup_args.dev: + self.pickly = Pickly(self.media_items, self.data_path) + self.pickly.start() self.core_manager = ServiceManager(self.media_items, True, Content, Plex, Scraping, Debrid, Symlinker) if self.validate(): logger.info("Iceberg started!")