blob: 3fc641bd26293d6e7a3414c6f7dcf0927f43d633 (
plain)
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
|
#!/usr/bin/env python2
"""Deletes the day and month from the 'date' tag in music files"""
import sys
try:
import mutagen
except ImportError:
sys.exit("You need mutagen to use this")
from os import walk
from os.path import join
if len(sys.argv) == 2:
basedir = sys.argv[1]
else:
sys.exit("Usage: %s directory" % sys.argv[0])
for root, dirs, files in walk(basedir):
for name in files:
print "Working on %s:" % join(root, name),
mufile = mutagen.File(join(root, name), easy=True)
if mufile is not None:
if "date" in mufile.keys():
mufile["date"] = [mufile["date"][0][:4]]
mufile.save()
print mufile["date"][0]
else:
print "No date to fix :-( "
|