jjlj
This commit is contained in:
@@ -1611,8 +1611,24 @@ def _run(result: Any, args: Sequence[str], config: Dict[str, Any], emit_results:
|
||||
# Priority 1: --storage flag
|
||||
if storage_location:
|
||||
try:
|
||||
final_output_dir = SharedArgs.resolve_storage(storage_location)
|
||||
debug(f"Using storage location: {storage_location} → {final_output_dir}")
|
||||
# For 'local' storage, check config first before using default
|
||||
if storage_location.lower() == 'local':
|
||||
from config import get_local_storage_path
|
||||
try:
|
||||
configured_path = get_local_storage_path(config)
|
||||
if configured_path:
|
||||
final_output_dir = configured_path
|
||||
debug(f"Using configured local storage path: {final_output_dir}")
|
||||
else:
|
||||
final_output_dir = SharedArgs.resolve_storage(storage_location)
|
||||
debug(f"Using default storage location: {storage_location} → {final_output_dir}")
|
||||
except Exception as exc:
|
||||
log(f"⚠️ Error reading local storage config: {exc}", file=sys.stderr)
|
||||
final_output_dir = SharedArgs.resolve_storage(storage_location)
|
||||
debug(f"Falling back to default storage location: {storage_location} → {final_output_dir}")
|
||||
else:
|
||||
final_output_dir = SharedArgs.resolve_storage(storage_location)
|
||||
debug(f"Using storage location: {storage_location} → {final_output_dir}")
|
||||
except ValueError as e:
|
||||
log(str(e), file=sys.stderr)
|
||||
return 1
|
||||
@@ -2237,6 +2253,14 @@ def _run(result: Any, args: Sequence[str], config: Dict[str, Any], emit_results:
|
||||
if 0 < idx <= len(formats):
|
||||
fmt = formats[idx-1]
|
||||
current_format_selector = fmt.get("format_id")
|
||||
|
||||
# If video-only format is selected, append +bestaudio to merge with best audio
|
||||
vcodec = fmt.get("vcodec")
|
||||
acodec = fmt.get("acodec")
|
||||
if vcodec and vcodec != "none" and (not acodec or acodec == "none"):
|
||||
current_format_selector = f"{current_format_selector}+bestaudio"
|
||||
debug(f"Video-only format selected, appending bestaudio: {current_format_selector}")
|
||||
|
||||
debug(f"Selected format #{idx}: {current_format_selector}")
|
||||
playlist_items = None # Clear so it doesn't affect download options
|
||||
else:
|
||||
@@ -2461,6 +2485,10 @@ def _run(result: Any, args: Sequence[str], config: Dict[str, Any], emit_results:
|
||||
from result_table import ResultTable
|
||||
table = ResultTable("Downloaded Files")
|
||||
for i, file_path in enumerate(downloaded_files):
|
||||
# Ensure file_path is a Path object
|
||||
if isinstance(file_path, str):
|
||||
file_path = Path(file_path)
|
||||
|
||||
row = table.add_row()
|
||||
row.add_column("#", str(i + 1))
|
||||
row.add_column("File", file_path.name)
|
||||
|
||||
Reference in New Issue
Block a user