-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmusic.py
More file actions
31 lines (29 loc) · 1 KB
/
music.py
File metadata and controls
31 lines (29 loc) · 1 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
#!/usr/bin/env python3
#
# Use this file to comfortable music download with 'MediaSave'
#
import sys, os, re;
from getpass import getuser
from mutagen.easyid3 import EasyID3
def main(argv: list):
__music__ = "/home/" + getuser() + "/Музыка/"
__downloads__ = "/home/" + getuser() + "/Загрузки/"
for f in os.listdir(__downloads__):
if re.search(".mp3$", f):
old = __downloads__ + f
if "-i" in argv: # ignore
continue
name = __music__ + input(f[:-len(".mp3")] + " to: ") + ".mp3"
os.renames(old, name)
try:
audio = EasyID3(name)
audio['title'] = input("Title: ")
audio['artist'] = input("Artist: ")
audio['album'] = input("Album: ")
audio['composer'] = input("Composer: ")
audio.save()
except:
print("Not ID3 file")
return 0
if __name__ == "__main__":
exit(main(sys.argv))