Skip to content

Commit

Permalink
Download file to month subdir
Browse files Browse the repository at this point in the history
  • Loading branch information
desbma committed Oct 4, 2022
1 parent 39d3f25 commit dfe9969
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion amg/__init__.py
Expand Up @@ -548,7 +548,9 @@ def download_audio(
filename, ext = os.path.splitext(dest_filename)
filename = ". ".join((filename, sanitize.sanitize_for_path(file_tags["title"][-1])))
dest_filename = "".join((filename, ext))
dest_filepath = os.path.join(os.getcwd(), dest_filename)
dest_dir = os.path.join(os.getcwd(), date_published.strftime("%Y%m"))
os.makedirs(dest_dir, exist_ok=True)
dest_filepath = os.path.join(dest_dir, dest_filename)
logging.getLogger().debug(f"Moving {repr(track_filepath)} to {repr(dest_filepath)}")
shutil.move(track_filepath, dest_filepath)
# restore sane perms fucked up by yt-dlp
Expand Down

0 comments on commit dfe9969

Please sign in to comment.