diff --git a/backend/program/__init__.py b/backend/program/__init__.py index 7a2d5691..6ed38e04 100644 --- a/backend/program/__init__.py +++ b/backend/program/__init__.py @@ -3,7 +3,7 @@ import threading import time import concurrent.futures -from program.scrapers import Scraping +from program.scrapers import Scraper from program.realdebrid import Debrid from program.symlink import Symlinker from program.media.container import MediaItemContainer @@ -37,7 +37,7 @@ def start(self): 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) + self.core_manager = ServiceManager(self.media_items, True, Content, Plex, Scraper, Debrid, Symlinker) if self.validate(): logger.info("Iceberg started!") else: diff --git a/backend/program/media/state.py b/backend/program/media/state.py index 5826c014..e63c3b83 100644 --- a/backend/program/media/state.py +++ b/backend/program/media/state.py @@ -21,7 +21,7 @@ def perform_action(self, _): class Content(MediaItemState): def perform_action(self, modules): - scraper = next(module for module in modules if module.key == "scraping") + scraper = next(module for module in modules if module.key == "scraper") if self.context.type in ["movie", "season", "episode"]: scraper.run(self.context) if self.context.state == Content and self.context.type == "season": diff --git a/backend/program/scrapers/__init__.py b/backend/program/scrapers/__init__.py index f3d11b56..5320d4c6 100644 --- a/backend/program/scrapers/__init__.py +++ b/backend/program/scrapers/__init__.py @@ -9,15 +9,15 @@ from program.scrapers.jackett import Jackett -class Scraping: +class Scraper: def __init__(self, _): - self.key = "scraping" + self.key = "scraper" self.initialized = False self.settings = settings_manager.settings.scraper self.sm = ServiceManager(None, False, Orionoid, Torrentio, Jackett) if not any(service.initialized for service in self.sm.services): logger.error( - "You have no scraping services enabled, please enable at least one!" + "You have no scraper services enabled, please enable at least one!" ) return self.initialized = True diff --git a/backend/program/settings/manager.py b/backend/program/settings/manager.py index 9f597169..5dd31c5d 100644 --- a/backend/program/settings/manager.py +++ b/backend/program/settings/manager.py @@ -6,7 +6,7 @@ from pydantic import ValidationError from utils import data_dir_path -from program.settings.models import AppModel +from program.settings.models import AppModel, NotifyingBaseModel from utils.logger import logger from utils.observable import Observable @@ -19,7 +19,7 @@ def __init__(self): self.filename = "settings.json" self.settings_file = data_dir_path / self.filename - AppModel.set_notify_observers(self.notify_observers) + NotifyingBaseModel.set_notify_observers(self.notify_observers) if not os.path.exists(self.settings_file): self.settings = AppModel() diff --git a/backend/program/settings/models.py b/backend/program/settings/models.py index 37cfd326..79daee34 100644 --- a/backend/program/settings/models.py +++ b/backend/program/settings/models.py @@ -1,8 +1,9 @@ """Iceberg settings models""" from typing import Optional -from pydantic import BaseModel, root_validator +from pathlib import Path +from pydantic import BaseModel, root_validator class NotifyingBaseModel(BaseModel): @@ -19,8 +20,8 @@ def set_notify_observers(cls, notify_observers_callable): def __setattr__(self, name, value): super().__setattr__(name, value) - if self.__class__.notify_observers: - self.__class__.notify_observers() + if self.__class__._notify_observers: + self.__class__._notify_observers() class PlexModel(NotifyingBaseModel): user: str = "" @@ -31,8 +32,8 @@ class DebridModel(NotifyingBaseModel): api_key: str = "" class SymlinkModel(NotifyingBaseModel): - host_path: str = "" - container_path: str = "" + host_path: Path = Path() + container_path: Path = Path() # Content Services class ContentNotifyingBaseModel(NotifyingBaseModel): @@ -79,17 +80,17 @@ class TorrentioConfig(NotifyingBaseModel): filter: str = "sort=qualitysize%7Cqualityfilter=480p,scr,cam,unknown" class ScraperModel(NotifyingBaseModel): - after_2: int = 0.5, - after_5: int = 2, - after_10: int = 24, + after_2: float = 0.5 + after_5: int = 2 + after_10: int = 24 jackett: JackettConfig = JackettConfig() orionoid: OrionoidConfig = OrionoidConfig() torrentio: TorrentioConfig = TorrentioConfig() class ParserModel(NotifyingBaseModel): - highest_quality: bool = False, - include_4k: bool = False, - repack_proper: bool = True, + highest_quality: bool = False + include_4k: bool = False + repack_proper: bool = True language: list[str] = ["English"] diff --git a/backend/program/symlink.py b/backend/program/symlink.py index d906028a..928514e2 100644 --- a/backend/program/symlink.py +++ b/backend/program/symlink.py @@ -26,14 +26,14 @@ def __init__(self, _): logger.error("Symlink initialization failed due to invalid configuration.") return logger.info("Rclone path symlinks are pointed to: %s", self.settings.host_path) - logger.info("Symlinks will be placed in: %s", self.library_path) + logger.info("Symlinks will be placed in: %s", self.settings.container_path) logger.info("Symlink initialized!") self.initialized = True def validate(self): """Validate paths and create the initial folders.""" - host_path = Path(self.settings.host_path) if self.settings.host_path else None - container_path = Path(self.settings.container_path) if self.settings.container_path else None + host_path = self.settings.host_path + container_path = self.settings.container_path if not host_path or not container_path or host_path == Path('.') or container_path == Path('.'): logger.error("Host or container path not provided, is empty, or is set to the current directory.") return False @@ -47,9 +47,6 @@ def validate(self): if not host_path.is_dir(): logger.error(f"Host path is not a directory or does not exist: {host_path}") return False - # if not container_path.is_dir(): - # logger.error(f"Container path is not a directory or does not exist: {container_path}") - # return False if Path(self.settings.host_path / "__all__").exists() and Path(self.settings.host_path / "__all__").is_dir(): logger.debug("Detected Zurg host path. Using __all__ folder for host path.") self.settings.host_path = self.settings.host_path / "__all__" @@ -71,7 +68,7 @@ def validate(self): def create_initial_folders(self): """Create the initial library folders.""" try: - self.library_path = self.settings.host_path.parent / "library" + self.library_path = self.settings.container_path / "library" self.library_path_movies = self.library_path / "movies" self.library_path_shows = self.library_path / "shows" self.library_path_anime_movies = self.library_path / "anime_movies" diff --git a/backend/utils/default_settings.json b/backend/utils/default_settings.json index 49551b00..762fd795 100644 --- a/backend/utils/default_settings.json +++ b/backend/utils/default_settings.json @@ -38,7 +38,7 @@ "api_key": "" } }, - "scraping": { + "scraper": { "after_2": 0.5, "after_5": 2, "after_10": 24, diff --git a/frontend/src/hooks.server.ts b/frontend/src/hooks.server.ts index 3ffdb5c6..fd28ebe7 100644 --- a/frontend/src/hooks.server.ts +++ b/frontend/src/hooks.server.ts @@ -9,7 +9,7 @@ const onboarding: Handle = async ({ event, resolve }) => { if (!data.success || !data.data) { error(500, 'API Error'); } - const toCheck = ['content', 'scraping', 'plex', 'real_debrid', 'symlink']; + const toCheck = ['content', 'scraper', 'plex', 'real_debrid', 'symlink']; const allServicesTrue: boolean = toCheck.every((service) => data.data[service] === true); if (!allServicesTrue) { redirect(302, '/onboarding'); diff --git a/frontend/src/lib/forms/helpers.ts b/frontend/src/lib/forms/helpers.ts index 1ca656fa..df61f5e0 100644 --- a/frontend/src/lib/forms/helpers.ts +++ b/frontend/src/lib/forms/helpers.ts @@ -216,8 +216,8 @@ export function mediaServerSettingsToSet(form: SuperValidated) { return [ { - key: 'scraping', + key: 'scraper', value: { after_2: form.data.after_2, after_5: form.data.after_5, diff --git a/frontend/src/routes/+page.svelte b/frontend/src/routes/+page.svelte index 251d2f98..2bc454fe 100644 --- a/frontend/src/routes/+page.svelte +++ b/frontend/src/routes/+page.svelte @@ -7,9 +7,9 @@ export let data: PageData; - const MandatoryServices = ['plex', 'content', 'scraping', 'real_debrid', 'symlink']; + const MandatoryServices = ['plex', 'content', 'scraper', 'real_debrid', 'symlink']; const ContentServices = ['mdblist', 'overseerr', 'plex_watchlist']; - const ScrapingServices = ['torrentio', 'jackett', 'orionoid']; + const ScraperServices = ['torrentio', 'jackett', 'orionoid']; function sortServices(services: string[], data: Record) { let sortedData = {} as Record; @@ -53,8 +53,8 @@

Content services


-

Scraping services

- +

Scraper services

+ {:catch}

Failed to fetch services status

{/await}