diff options
-rwxr-xr-x | jamos | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -9,6 +9,11 @@ from pathlib import Path import sys import youtube_dl +def cleanup_metadata_files(music_directory): + files = glob.glob(os.path.join(music_directory, '*.json')) + + for file in files: + os.remove(file) def download_song(song_url, ytdl): @@ -84,7 +89,7 @@ def move_file(file, metadata, output_directory): artist = metadata['artist'].replace(' ', '_').lower() if ('album' in metadata.keys()) and (metadata['album'] is not None): - album = metadata['album'].replace(' ', '_').lower() + album = metadata['album'].replace(' ', '_').replace(',', '').replace("'", "").replace('"', "").lower() if ('title' in metadata.keys()) and (metadata['title'] is not None): title = metadata['title'].replace(' ', '_').replace('/', '').lower() @@ -189,3 +194,5 @@ if __name__ == "__main__": write_metadata_to_song_file(f, json_data) move_file(f, json_data, music_directory) + cleanup_metadata_files(music_directory) + |