First commit
This commit is contained in:
commit
0634c8b56e
3
README.md
Normal file
3
README.md
Normal file
|
@ -0,0 +1,3 @@
|
|||
# Music Organizer
|
||||
Simple script to move my downloaded music into folders based on the artist and album name \
|
||||
Pairs well with [spotdl](https://github.com/spotDL/spotify-downloader)
|
29
main.py
Normal file
29
main.py
Normal file
|
@ -0,0 +1,29 @@
|
|||
import os, eyed3, re, shutil
|
||||
|
||||
path = input('Enter to full path to the directory containing you files: ')
|
||||
dest = input('Enter the full path to the destination: ')
|
||||
|
||||
with os.scandir(path) as dir_entries:
|
||||
for entry in dir_entries:
|
||||
for entry in dir_entries:
|
||||
if bool(re.search(r'.*\.mp3', entry.name)) is True:
|
||||
file = eyed3.load(entry)
|
||||
artist = file.tag.artist
|
||||
artist = re.sub(r'(\/)|(\\)|(\:)|(\*)|(\?)|(\")|(\<)|(\>)|(\|)|(\ )$', ' ', artist)
|
||||
album = file.tag.album
|
||||
album = re.sub(r'(\/)|(\\)|(\:)|(\*)|(\?)|(\")|(\<)|(\>)|(\|)|(\ )$', ' ', album)
|
||||
|
||||
artistIsExist = os.path.exists(f'{dest}\\{artist}')
|
||||
if not artistIsExist:
|
||||
os.makedirs(f'{dest}\\{artist}')
|
||||
albumIsExist = os.path.exists(f'{dest}\\{artist}\\{album}')
|
||||
if not albumIsExist:
|
||||
os.makedirs(f'{dest}\\{artist}\\{album}')
|
||||
song = entry.name
|
||||
song = re.sub(r'(\/)|(\\)|(\:)|(\*)|(\?)|(\")|(\<)|(\>)|(\-)|(\|)|(\ )$', '', song)
|
||||
song = re.sub(r'\ +', ' ', song)
|
||||
try:
|
||||
shutil.copy(entry.path, str(f'{dest}\\{artist}\\{album}\{song}'))
|
||||
except:
|
||||
print(song)
|
||||
|
1
requirements.txt
Normal file
1
requirements.txt
Normal file
|
@ -0,0 +1 @@
|
|||
eyeD3 == 0.9.7
|
Loading…
Reference in New Issue
Block a user