Skip to content

Commit

Permalink
Merge pull request #137 from dreulavelle/dev_startup
Browse files Browse the repository at this point in the history
Dev startup to disabling pickling
  • Loading branch information
Gaisberg authored Jan 17, 2024
2 parents 7be327d + 39f8753 commit 9020ee5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
6 changes: 5 additions & 1 deletion backend/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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,
Expand Down
8 changes: 5 additions & 3 deletions backend/program/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand All @@ -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!")
Expand Down

0 comments on commit 9020ee5

Please sign in to comment.