Skip to content

Bulk asynchronous downloader for multiple file hosts

Add vscode to debug terminals

Jacobfff3ee9530d0
diff --git a/cyberdrop_dl/clients/download_client.py b/cyberdrop_dl/clients/download_client.py
index 8a6107d00..16474d3d2 100644
--- a/cyberdrop_dl/clients/download_client.py
+++ b/cyberdrop_dl/clients/download_client.py
@@ -61,7 +61,7 @@ class DownloadClient:
self._global_limiter = self.client_manager.global_rate_limiter
self.trace_configs = []
self._file_path=None
- if os.getenv("PYCHARM_HOSTED") is not None:
+ if os.getenv("PYCHARM_HOSTED") is not None or 'TERM_PROGRAM' in os.environ.keys() and os.environ['TERM_PROGRAM'] == 'vscode':
async def on_request_start(session, trace_config_ctx, params):
await log(f"Starting download {params.method} request to {params.url}", 40)
diff --git a/cyberdrop_dl/clients/scraper_client.py b/cyberdrop_dl/clients/scraper_client.py
index cab43f693..b7acd4cf6 100644
--- a/cyberdrop_dl/clients/scraper_client.py
+++ b/cyberdrop_dl/clients/scraper_client.py
@@ -46,7 +46,7 @@ class ScraperClient:
self._global_limiter = self.client_manager.global_rate_limiter
self.trace_configs = []
- if os.getenv("PYCHARM_HOSTED") is not None:
+ if os.getenv("PYCHARM_HOSTED") is not None or 'TERM_PROGRAM' in os.environ.keys() and os.environ['TERM_PROGRAM'] == 'vscode':
async def on_request_start(session, trace_config_ctx, params):
await log(f"Starting scrape {params.method} request to {params.url}", 10)
diff --git a/cyberdrop_dl/main.py b/cyberdrop_dl/main.py
index 27f91be4a..d991eb731 100644
--- a/cyberdrop_dl/main.py
+++ b/cyberdrop_dl/main.py
@@ -60,17 +60,17 @@ async def director(manager: Manager) -> None:
logger_debug = logging.getLogger("cyberdrop_dl_debug")
import cyberdrop_dl.utils.utilities
- if os.getenv("PYCHARM_HOSTED") is not None or manager.config_manager.settings_data['Runtime_Options']['log_level'] == -1:
+ if os.getenv("PYCHARM_HOSTED") is not None or manager.config_manager.settings_data['Runtime_Options']['log_level'] == -1 or 'TERM_PROGRAM' in os.environ.keys() and os.environ['TERM_PROGRAM'] == 'vscode':
manager.config_manager.settings_data['Runtime_Options']['log_level'] = 10
cyberdrop_dl.utils.utilities.DEBUG_VAR = True
- if os.getenv("PYCHARM_HOSTED") is not None or manager.config_manager.settings_data['Runtime_Options']['console_log_level'] == -1:
+ if os.getenv("PYCHARM_HOSTED") is not None or manager.config_manager.settings_data['Runtime_Options']['console_log_level'] == -1 or 'TERM_PROGRAM' in os.environ.keys() and os.environ['TERM_PROGRAM'] == 'vscode':
cyberdrop_dl.utils.utilities.CONSOLE_DEBUG_VAR = True
if cyberdrop_dl.utils.utilities.DEBUG_VAR:
logger_debug.setLevel(manager.config_manager.settings_data['Runtime_Options']['log_level'])
- if os.getenv("PYCHARM_HOSTED") is not None:
+ if os.getenv("PYCHARM_HOSTED") is not None or 'TERM_PROGRAM' in os.environ.keys() and os.environ['TERM_PROGRAM'] == 'vscode':
file_handler_debug = logging.FileHandler("../cyberdrop_dl_debug.log", mode="w")
else:
file_handler_debug = logging.FileHandler("./cyberdrop_dl_debug.log", mode="w")
diff --git a/cyberdrop_dl/managers/path_manager.py b/cyberdrop_dl/managers/path_manager.py
index caaf2b60d..dc2e123a2 100644
--- a/cyberdrop_dl/managers/path_manager.py
+++ b/cyberdrop_dl/managers/path_manager.py
@@ -7,7 +7,7 @@ from cyberdrop_dl.utils.dataclasses.url_objects import MediaItem
if TYPE_CHECKING:
from cyberdrop_dl.managers.manager import Manager
-if os.getenv("PYCHARM_HOSTED") is not None:
+if os.getenv("PYCHARM_HOSTED") is not None or 'TERM_PROGRAM' in os.environ.keys() and os.environ['TERM_PROGRAM'] == 'vscode':
"""This is for testing purposes only"""
APP_STORAGE = Path("../AppData")
DOWNLOAD_STORAGE = Path("../Downloads")