Separate function to expand download directory
This commit is contained in:
parent
4c327a35f5
commit
c5f74ce479
11
mvw-dl.py
11
mvw-dl.py
@ -348,6 +348,13 @@ def handle_sigint(signum, frame):
|
||||
signal.signal(signal.SIGINT, handle_sigint)
|
||||
|
||||
|
||||
def expanded_dest_dir(
|
||||
raw_dest_dir: str) -> str:
|
||||
user_expanded_dest_dir = os.path.expanduser(raw_dest_dir)
|
||||
all_expanded_dest_dir = os.path.expandvars(user_expanded_dest_dir)
|
||||
return all_expanded_dest_dir
|
||||
|
||||
|
||||
def get_safe_filename(
|
||||
dirty_filename: str) -> str:
|
||||
"""https://stackoverflow.com/a/71199182"""
|
||||
@ -376,10 +383,8 @@ def copy_url(
|
||||
update_interval = config_obj.getint(section_name, "dl_progress_update_interval")
|
||||
max_quality_url = video_metadata["url"]
|
||||
filename = max_quality_url.split("/")[-1]
|
||||
dest_dir = config_obj.get(section_name, "dl_dir")
|
||||
dest_dir = expanded_dest_dir(config_obj.get(section_name, "dl_dir"))
|
||||
dest_path = os.path.join(dest_dir, filename)
|
||||
dest_path = os.path.expanduser(dest_path)
|
||||
dest_path = os.path.expandvars(dest_path)
|
||||
show_name = f"{show.topic} - {show.title}"
|
||||
publish_date = d.datetime.utcfromtimestamp(show.timestamp).strftime('%Y%m%d')
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user