%ext% won't be needed
[ordnung.git] / ordnung.py
blob9937af1f07f6bbbb0c57aa13e00ab9cba83b7122
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 newpath(file, target, pattern):
16 # Create the tokens dictionary
17 try:
18 tokens = tag(file)
19 except:
20 return None
21 if tokens["album artist"] == None:
22 tokens["album artist"] = tokens["artist"]
23 tokens["base"] = target
25 def main():
26 ## Handle arguments (TODO)
27 # This will probably the default later one, at least until I
28 # implement %album artist%
29 pattern = "%base%/%artist%/%album%/%title%"
30 base = "D:/Eigene Musik"
32 basepath = path(base)
33 for filepath in basepath.walkfiles():
34 if issupportedfile(filepath):
35 print filepath
37 if __name__ == "__main__":
38 main()