-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathmusicchecker.py
More file actions
42 lines (32 loc) · 1.18 KB
/
musicchecker.py
File metadata and controls
42 lines (32 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import os
import sys
import yaml
from shutil import copy2
os.chdir(os.path.dirname(__file__))
arg = ""
if len(sys.argv) > 1:
arg = sys.argv[1]
musiclist = None
if arg != "":
with open(arg, 'r', encoding='utf-8') as music:
musiclist = yaml.load(music)
songs = list(filter(lambda x: os.path.isfile(x) and x.lower().endswith(('.mp3', '.ogg')), os.listdir(os.getcwd())))
Err = open("music_missing.txt", "w", encoding='utf-8')
Err2 = open("music_extra.txt", "w", encoding='utf-8')
if musiclist:
musics = []
for item in musiclist:
for song in item['songs']:
musics.append(song['name'])
for song in musics:
if not (song in songs):
Err.write('{}\n'.format(song))
print("Song {} missing!".format(song))
input("Checked for songs missing from music.yaml that should've been there. Press ENTER to check for songs that shouldn't be there.")
for song in songs:
if not (song in musics):
Err2.write('{}\n'.format(song))
print("Song {} is extra!".format(song))
input("Done!")
else:
input("Usage: drag and drop music.yaml on this program to check if any of the songs are missing from it.")