all_subs = [] # Try OpenSubtitles first (hash match) console.print("[dim]Searching OpenSubtitles...[/dim]") subs_os = search_opensubs(video_file, lang_code) all_subs.extend(subs_os)
if not all_subs: console.print("[red]No subtitles found for the given language.[/red]") sys.exit(1) predestination subtitle download
def present_subtitle_choices(subtitles): """Show interactive table and return selected index.""" if not subtitles: console.print("[yellow]No subtitles found.[/yellow]") return None table = Table(title="Available Subtitles") table.add_column("#", style="cyan") table.add_column("Provider", style="magenta") table.add_column("Language", style="green") table.add_column("URL", style="blue") for idx, sub in enumerate(subtitles): table.add_row(str(idx+1), sub["provider"], sub["lang"], sub["url"][:60] + "...") console.print(table) choice = Prompt.ask("Select subtitle number", default="1") try: return int(choice) - 1 except: return 0 all_subs = [] # Try OpenSubtitles first (hash match) console
from setuptools import setup, find_packages setup( name="predestination-sub-dl", version="1.0", packages=find_packages(), install_requires=["requests", "beautifulsoup4", "rich", "click"], entry_points={ "console_scripts": [ "predsub=downloader:main", ] }, ) style="blue") for idx
console.print(f"[bold green]Searching subtitles for: {video_name}[/bold green]") console.print(f"Language: {LANG_CODES.get(lang_code, lang_code)}")
# Fallback to YIFY title search if none found if not all_subs: console.print("[dim]No hash match. Searching YIFY by title...[/dim]") subs_yify = search_yify("Predestination 2014", lang_code) all_subs.extend(subs_yify)
Install globally: