check in lame scene_file fix and good beginning of fix_artist_album_date
This commit is contained in:
parent
b8789db0ef
commit
e9de91b555
10
fix_artist_album_date
Executable file
10
fix_artist_album_date
Executable file
@ -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
|
36
fix_scene_file
Executable file
36
fix_scene_file
Executable 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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user