Skip to content

Commit

Permalink
Fix #287 bug: paths with spaces don't work
Browse files Browse the repository at this point in the history
  • Loading branch information
vicwomg committed Dec 24, 2023
1 parent 757c981 commit f25e326
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ def filename_from_path(file_path, remove_youtube_id=True):
rc = rc.split("---".encode("utf-8", "ignore"))[0]
return rc

def arg_path_parse(path):
if (type(path) == list):
return " ".join(path)
else:
return path

def url_escape(filename):
return quote(filename.encode("utf8"))
Expand Down Expand Up @@ -681,13 +686,15 @@ def get_default_dl_dir(platform):
parser.add_argument(
"-d",
"--download-path",
nargs='+',
help="Desired path for downloaded songs. (default: %s)" % default_dl_dir,
default=default_dl_dir,
required=False,
)
parser.add_argument(
"-y",
"--youtubedl-path",
nargs='+',
help="Path of youtube-dl. (default: %s)" % default_youtubedl_path,
default=default_youtubedl_path,
required=False,
Expand Down Expand Up @@ -755,6 +762,7 @@ def get_default_dl_dir(platform):
)
parser.add_argument(
"--logo-path",
nargs='+',
help="Path to a custom logo image file for the splash screen. Recommended dimensions ~ 2048x1024px",
default=None,
required=False,
Expand Down Expand Up @@ -794,7 +802,7 @@ def get_default_dl_dir(platform):
sys.exit(1)

# setup/create download directory if necessary
dl_path = os.path.expanduser(args.download_path)
dl_path = os.path.expanduser(arg_path_parse(args.download_path))
if not dl_path.endswith("/"):
dl_path += "/"
if not os.path.exists(dl_path):
Expand All @@ -813,15 +821,15 @@ def get_default_dl_dir(platform):
port=args.port,
ffmpeg_port=args.ffmpeg_port,
download_path=dl_path,
youtubedl_path=args.youtubedl_path,
youtubedl_path=arg_path_parse(args.youtubedl_path),
splash_delay=args.splash_delay,
log_level=args.log_level,
volume=parsed_volume,
hide_url=args.hide_url,
hide_raspiwifi_instructions=args.hide_raspiwifi_instructions,
hide_splash_screen=args.hide_splash_screen,
high_quality=args.high_quality,
logo_path=args.logo_path,
logo_path=arg_path_parse(args.logo_path),
hide_overlay=args.hide_overlay,
screensaver_timeout=args.screensaver_timeout,
url=args.url,
Expand Down

0 comments on commit f25e326

Please sign in to comment.