This repository has been archived by the owner on Jun 15, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheyed3util.py
87 lines (75 loc) · 1.95 KB
/
eyed3util.py
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#!/bin/sh
''''which python >/dev/null 2>&1 && exec python "$0" "$@" # '''
''''which python2 >/dev/null 2>&1 && exec python2 "$0" "$@" # '''
''''which python2.7 >/dev/null 2>&1 && exec python2.7 "$0" "$@" # '''
''''exec echo "Error: Python not found!" # '''
import eyed3
import readline
import os
import signal
import sys
import main
def get_artist():
while True:
artist = raw_input("artist: ")
if artist:
break
else:
continue
return unicode(artist, "utf-8")
def get_album():
while True:
album = raw_input("album: ")
if album:
break
else:
continue
return unicode(album, "utf-8")
def get_album_artist():
while True:
album_artist = raw_input("album_artist: ")
if album_artist:
break
else:
continue
return unicode(album_artist, "utf-8")
def get_title():
while True:
title = raw_input("title: ")
if title:
break
else:
continue
return unicode(title, "utf-8")
def get_genre():
while True:
try:
genre = int(raw_input("genre: "))
except ValueError:
continue
else:
break
return genre
def main():
if not which("eyeD3"):
print('!!! eyeD3 required !!!')
print('Install eyeD3: pip install eyeD3')
shutdown()
for i in os.listdir('.'):
if i.endswith('.mp3'):
print(i)
artist = get_artist()
album = get_album()
album_artist = get_album_artist()
title = get_title()
genre = get_genre()
audiofile = eyed3.load(i)
audiofile.tag.artist = artist
audiofile.tag.album = album
audiofile.tag.album_artist = album_artist
audiofile.tag.title = title
audiofile.tag.genre = genre
audiofile.tag.save()
# Call main()
if __name__ == "__main__":
main()