Streamrip: the all in one music downloader.
(
ctx, config_path, folder, no_db, quality, codec, no_progress, no_ssl_verify, verbose
)
| 87 | ) |
| 88 | @click.pass_context |
| 89 | def rip( |
| 90 | ctx, config_path, folder, no_db, quality, codec, no_progress, no_ssl_verify, verbose |
| 91 | ): |
| 92 | """Streamrip: the all in one music downloader.""" |
| 93 | global logger |
| 94 | logging.basicConfig( |
| 95 | level="INFO", |
| 96 | format="%(message)s", |
| 97 | datefmt="[%X]", |
| 98 | handlers=[RichHandler()], |
| 99 | ) |
| 100 | logger = logging.getLogger("streamrip") |
| 101 | if verbose: |
| 102 | install( |
| 103 | console=console, |
| 104 | suppress=[ |
| 105 | click, |
| 106 | ], |
| 107 | show_locals=True, |
| 108 | locals_hide_sunder=False, |
| 109 | ) |
| 110 | logger.setLevel(logging.DEBUG) |
| 111 | logger.debug("Showing all debug logs") |
| 112 | else: |
| 113 | install(console=console, suppress=[click, asyncio], max_frames=1) |
| 114 | logger.setLevel(logging.INFO) |
| 115 | |
| 116 | if not os.path.isfile(config_path): |
| 117 | console.print( |
| 118 | f"No file found at [bold cyan]{config_path}[/bold cyan], creating default config.", |
| 119 | ) |
| 120 | set_user_defaults(config_path) |
| 121 | |
| 122 | # pass to subcommands |
| 123 | ctx.ensure_object(dict) |
| 124 | ctx.obj["config_path"] = config_path |
| 125 | |
| 126 | try: |
| 127 | c = Config(config_path) |
| 128 | except OutdatedConfigError as e: |
| 129 | console.print(e) |
| 130 | console.print("Auto-updating config file...") |
| 131 | Config.update_file(config_path) |
| 132 | c = Config(config_path) |
| 133 | except Exception as e: |
| 134 | console.print( |
| 135 | f"Error loading config from [bold cyan]{config_path}[/bold cyan]: {e}\n" |
| 136 | "Try running [bold]rip config reset[/bold]", |
| 137 | ) |
| 138 | ctx.obj["config"] = None |
| 139 | return |
| 140 | |
| 141 | # set session config values to command line args |
| 142 | if no_db: |
| 143 | c.session.database.downloads_enabled = False |
| 144 | if folder is not None: |
| 145 | c.session.downloads.folder = folder |
| 146 |
no test coverage detected