diff --git a/fix_artist_album_date b/fix_artist_album_date new file mode 100755 index 0000000..5a1f390 --- /dev/null +++ b/fix_artist_album_date @@ -0,0 +1,10 @@ +#!/bin/bash + +dir="$(pwd)" +readarray -t album_paths < <(find "$dir" -mindepth 1 -type d) +for path in "${album_paths[@]}"; do + year_album="$(sed 's#.*/##' <<< "$path")" + year="${year_album%% *}" + album="${year_album#* }" + printf 'Year: %s Album: %s\n' "$year" "$album" +done diff --git a/fix_scene_file b/fix_scene_file new file mode 100755 index 0000000..5aec3ca --- /dev/null +++ b/fix_scene_file @@ -0,0 +1,36 @@ +#!/usr/bin/env python3 + +import os +import re +import sys + + +def is_flac(filename): + if len(filename) > 5 and filename[-5:].lower() == '.flac': + return True + return False + + +def fix_flac_name(filename): + return filename[:-5].replace('_', ' ').title() + '.flac' + + +def fix_name(filename): + fsplit = filename.split('.') + ext = fsplit[-1] + rest = ' '.join(fsplit[:-1]) + rest = re.sub(' +', ' ', rest) + rest = rest.replace('_', ' ').title() + '.' + ext.lower() + return rest + +files = os.listdir() +for file in files: + if is_flac(file): + new_file = fix_flac_name(file) + if new_file != file: + os.rename(file, new_file) + else: + new_file = fix_name(file) + if new_file != file: + os.rename(file, new_file) +