Skip to content

Bulk asynchronous downloader for multiple file hosts

fix: set refresh rate on startup (#1719)

NTFSvolume2f6fa652971e
diff --git a/cyberdrop_dl/__main__.py b/cyberdrop_dl/__main__.py
index 1e3a856b2..8a883c0aa 100644
--- a/cyberdrop_dl/__main__.py
+++ b/cyberdrop_dl/__main__.py
@@ -1,6 +1,8 @@
# ruff: noqa: E402
from rich.traceback import install as install_rich_tracebacks
+from cyberdrop_dl.progress import REFRESH_RATE
+
_ = install_rich_tracebacks(width=None)
import logging
@@ -27,7 +29,7 @@ logger = logging.getLogger("cyberdrop_dl")
async def _scrape(manager: Manager) -> None:
with setup_file_logging(manager.config.settings.logs.main_log):
await manager.async_startup()
-
+ REFRESH_RATE.set(manager.config.global_settings.ui_options.refresh_rate)
log_spacer()
async with manager.database:
log_spacer()
diff --git a/cyberdrop_dl/config/_global.py b/cyberdrop_dl/config/_global.py
index 26ed1abc6..2fc800cb9 100755
--- a/cyberdrop_dl/config/_global.py
+++ b/cyberdrop_dl/config/_global.py
@@ -97,7 +97,7 @@ class RateLimiting(SettingsGroup):
class UIOptions(SettingsGroup):
- refresh_rate: PositiveInt = 10
+ refresh_rate: PositiveFloat = 10.0
class GenericCrawlerInstances(SettingsGroup):
diff --git a/cyberdrop_dl/main.py b/cyberdrop_dl/main.py
deleted file mode 100644
index e69de29bb..000000000
diff --git a/cyberdrop_dl/progress/__init__.py b/cyberdrop_dl/progress/__init__.py
index 61763ee2c..e6af7297a 100644
--- a/cyberdrop_dl/progress/__init__.py
+++ b/cyberdrop_dl/progress/__init__.py
@@ -20,7 +20,7 @@ if TYPE_CHECKING:
from rich.console import RenderableType
-REFRESH_RATE: ContextVar[int] = ContextVar("REFRESH_RATE", default=10)
+REFRESH_RATE: ContextVar[float] = ContextVar("REFRESH_RATE", default=10)
TUI_DISABLED: ContextVar[bool] = ContextVar("TUI_DISABLED", default=False)