From d239f21654d35484e311dfc38f47ed398054e619 Mon Sep 17 00:00:00 2001 From: Jackson Taylor Date: Wed, 10 Nov 2021 13:38:02 -0500 Subject: pep8 fixes --- jamos | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'jamos') diff --git a/jamos b/jamos index 0280ea6..15209b8 100755 --- a/jamos +++ b/jamos @@ -24,8 +24,10 @@ AUDIO_OPTIONS = { 'cookiefile': 'cookies.txt', 'outtmpl': MUSIC_DIRECTORY + '%(title)s.%(ext)s', 'postprocessors': [ - {'key': 'FFmpegExtractAudio','preferredcodec': 'mp3', - 'preferredquality': '192', + { + 'key': 'FFmpegExtractAudio', + 'preferredcodec': 'mp3', + 'preferredquality': '192', }, {'key': 'FFmpegMetadata'}, ], @@ -57,11 +59,13 @@ def write_metadata_to_song_file(file, metadata): f.save() + def format_youtube_date(date): fmt = "%Y%m%d" d = datetime.datetime.strptime(date, fmt) return d.year + def sort_stuff(): # read in all the files and directories to move get_all_files() @@ -117,11 +121,19 @@ def get_directories(): def move_file(file, metadata): - p = os.path.join(MUSIC_DIRECTORY, metadata['artist'].replace(' ', '_').lower(), metadata['album'].replace(' ', '_').lower()) - Path(p).mkdir( parents=True, exist_ok=True ) + p = os.path.join( + MUSIC_DIRECTORY, + metadata['artist'].replace(' ', '_').lower(), + metadata['album'].replace(' ', '_').lower()) - os.rename(file, os.path.join(p, metadata['artist'].replace(' ', '_').lower() + '_' + metadata['title'].replace(' ', '_').lower() + '.mp3')) + Path(p).mkdir(parents=True, exist_ok=True) + os.rename( + file, + os.path.join( + p, + metadata['artist'].replace(' ', '_').lower() + + '_' + metadata['title'].replace(' ', '_').lower() + '.mp3')) if __name__ == "__main__": @@ -139,4 +151,3 @@ if __name__ == "__main__": json_data = json.load(json_file) write_metadata_to_song_file(f, json_data) move_file(f, json_data) - -- cgit v1.2.3