Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions weeb_cli/commands/search/watch_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,13 +171,17 @@ def _play_episode(slug, selected_ep, details, season, episodes, completed_ids):
return False

from weeb_cli.services.stream_validator import stream_validator
from weeb_cli.config import config

console.print(f"[dim]{i18n.t('details.validating_streams')}...[/dim]")
valid_streams = []
for stream in streams_list:
is_valid, error = stream_validator.validate_url(stream.get("url"), timeout=3)
if is_valid:
valid_streams.append(stream)
if config.get("scraping_source") == "docchi":
valid_streams = streams_list
else:
console.print(f"[dim]{i18n.t('details.validating_streams')}...[/dim]")
for stream in streams_list:
is_valid, error = stream_validator.validate_url(stream.get("url"), timeout=3)
if is_valid:
valid_streams.append(stream)

if not valid_streams:
console.print(f"[red]{i18n.t('details.no_valid_streams')}[/red]")
Expand Down
4 changes: 2 additions & 2 deletions weeb_cli/commands/settings/settings_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ def toggle_shortcuts():
def change_language():
from weeb_cli.services.scraper import scraper

langs = {"Türkçe": "tr", "English": "en", "Deutsch": "de"}
langs = {"Türkçe": "tr", "English": "en", "Deutsch": "de", "Polski": "pl"}
try:
selected = questionary.select(
"Select Language / Dil Seçiniz:",
"",
choices=list(langs.keys()),
pointer=">",
use_shortcuts=False
Expand Down
4 changes: 2 additions & 2 deletions weeb_cli/commands/settings/settings_menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def _build_settings_menu():

choices.extend([
i18n.t("settings.trackers"),
i18n.t("settings.cache"),
i18n.t("settings.cache_title"),
i18n.t("settings.backup_restore")
])

Expand All @@ -91,7 +91,7 @@ def _handle_settings_action(answer):
i18n.t("settings.download_settings"): download_settings_menu,
i18n.t("settings.external_drives"): external_drives_menu,
i18n.t("settings.trackers"): trackers_menu,
i18n.t("settings.cache"): cache_settings_menu,
i18n.t("settings.cache_title"): cache_settings_menu,
i18n.t("settings.backup_restore"): backup_restore_menu,
}

Expand Down
22 changes: 14 additions & 8 deletions weeb_cli/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,40 +4,45 @@
APP_NAME = "weeb-cli"
CONFIG_DIR = Path.home() / f".{APP_NAME}"


def get_default_download_dir():
from weeb_cli.i18n import i18n

folder_name = i18n.t("downloads.default_folder_name", "weeb-downloads")
return os.path.join(os.getcwd(), folder_name)


DEFAULT_CONFIG = {
"language": None,
"language": None,
"aria2_enabled": True,
"ytdlp_enabled": True,
"aria2_max_connections": 16,
"max_concurrent_downloads": 3,
"download_dir": None,
"download_dir": None,
"ytdlp_format": "bestvideo+bestaudio/best",
"scraping_source": None,
"show_description": True,
"debug_mode": False,
"download_max_retries": 3,
"download_retry_delay": 10,
"discord_rpc_enabled": True,
"shortcuts_enabled": False
"shortcuts_enabled": False,
}


class Config:
def __init__(self):
self._db = None
self._headless = False

@property
def db(self):
if self._db is None:
from weeb_cli.services.database import db

self._db = db
return self._db

def get(self, key, default=None):
if not self._headless:
try:
Expand All @@ -46,20 +51,21 @@ def get(self, key, default=None):
return val
except Exception:
pass

# Special handling for download_dir
if key == "download_dir":
return default if default is not None else get_default_download_dir()

# Use provided default, fallback to DEFAULT_CONFIG, then None
if default is not None:
return DEFAULT_CONFIG.get(key, default)
return DEFAULT_CONFIG.get(key)

def set(self, key, value):
self.db.set_config(key, value)

def set_headless(self, headless: bool = True):
self._headless = headless


config = Config()
2 changes: 1 addition & 1 deletion weeb_cli/locales/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@
"restore_confirm": "Die aktuelle Datenbank wird überschrieben. Sind Sie sicher?",
"restore_success": "Wiederherstellung erfolgreich!",
"restore_failed": "Wiederherstellung fehlgeschlagen.",
"cache": "Cache-Verwaltung",
"cache_title": "Cache-Verwaltung",
"cache_title": "Cache-Verwaltung",
"cache_memory_entries": "Speichereinträge",
"cache_file_entries": "Dateieinträge",
Expand Down
Loading
Loading