Created
January 15, 2020 13:29
-
-
Save outloudvi/356cffd8f033fa245eabe5a068c85232 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# pip install mp3_tagger before | |
from mp3_tagger import MP3File, VERSION_2 | |
from os import listdir | |
from os.path import isfile, join | |
import re | |
import json | |
PATH = "/tmp/songs" | |
def main(): | |
fr = open("names.json", "r") | |
VOCALLIST = json.load(fr) | |
files = [f for f in listdir(PATH) if isfile(join(PATH, f))] | |
print("{} files found.".format(len(files))) | |
for name in files: | |
path = join(PATH, name) | |
mp3 = MP3File(path) | |
vocal = re.search(r"\[(.+)\]", name) | |
song = re.search(r"\](.+?)(\(|\.)", name) | |
vocals = vocal[1].split("-") | |
for char in vocals: | |
if char not in VOCALLIST: | |
try: | |
VOCALLIST[char] = input( | |
"Enter the artist {} for {} (in {}): ".format( | |
char, vocal[1], name)) | |
except (EOFError, KeyboardInterrupt): | |
fr.close() | |
fw = open("names.json", "w") | |
json.dump(VOCALLIST, fw) | |
fw.close() | |
exit(1) | |
au = ",".join( | |
list( | |
filter(lambda x: x != "", | |
list(map(lambda x: VOCALLIST[x], vocals))))) | |
mp3.set_version(VERSION_2) | |
mp3.song = song[1] | |
mp3.artist = au | |
mp3.save() | |
print(name, " => ", au, " - ", song[1]) | |
fr.close() | |
fw = open("volog.json", "w") | |
json.dump(VOCALLIST, fw) | |
fw.close() | |
main() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"GUMI": "GUMI", | |
"VY2": "VY2", | |
"VY1V3": "VY1", | |
"初音": "初音ミク", | |
"初音Dark": "初音ミク", | |
"flower": "flower", | |
"结月": "結月ゆかり", | |
"V家8人": "VOCALOID", | |
"冰山": "氷山キヨテル", | |
"初音+": "初音ミク", | |
"镜音铃": "鏡音リン", | |
"音街": "音街ウナ", | |
"镜音连": "鏡音レン", | |
"V家10人": "VOCALOID", | |
"镜音双子": "鏡音リン, 鏡音レン", | |
"巡音": "巡音ルカ", | |
"IA": "IA", | |
"KAITO": "KAITO", | |
"MAYU": "MAYU", | |
"初音Append": "初音ミク", | |
"镜音双子power": "鏡音リン, 鏡音レン", | |
"歌爱": "歌愛ユキ", | |
"鸣花Mikoto": "鳴花ミコト", | |
"GUMI power": "GUMI", | |
"Fukase": "Fukase", | |
"心华": "心华", | |
"MEIKO": "MEIKO", | |
"猫村": "猫村いろは", | |
"Gakupo": "Gakupo", | |
"复数V": "VOCALOID", | |
"VOCALOIDs": "VOCALOID", | |
"GUMI's": "GUMI", | |
"miki": "miki", | |
"鏡音连": "鏡音レン", | |
"绁星": "紲星あかり", | |
"ONE(CeVIO)": "ONE", | |
"VOCALOIDS": "VOCALOID", | |
"初音Soft": "初音ミク", | |
"Lily": "Lily", | |
"GUMI V3 English": "GUMI", | |
"镜音连Append": "鏡音レン" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment