Actually use tag_wrapper, also change error message
[ordnung.git] / ordnung.py
blob859f3b034c6c1b2a8b30463f16e1812f0e14e2ce
1 from path import path
2 import fnmatch
3 import os
5 from tag_wrapper import tag
7 ACCEPTEXTS = [".ogg"] # Keep it simple for now
9 def issupportedfile(name):
10 for ext in ACCEPTEXTS:
11 if os.path.splitext(name)[1] == ext:
12 return True
13 return False
15 def main():
16 ## Handle arguments (TODO)
17 # This will probably the default later one, at least until I
18 # implement %album artist%
19 pattern = "%base%/%artist%/%album%/%title%.%ext%"
20 base = "D:/Eigene Musik"
22 basepath = path(base)
23 for filepath in basepath.walkfiles():
24 if issupportedfile(filepath):
25 print filepath
26 try:
27 audio = tag(filepath)
28 except: #TODO
29 print "Error reading tags"
30 else:
31 print audio["title"]
33 if __name__ == "__main__":
34 main()