- Timestamp:
- 13/09/07 03:59:17 (4 years ago)
- File:
-
- 1 edited
-
trunk/spl-editor/main.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/spl-editor/main.py
r63 r64 3 3 import os, os.path 4 4 import sys 5 import getopt 5 6 6 7 byArtist = {} … … 10 11 #playlists = '/home/nigel/misc/Music/playlists' 11 12 def showUsage(): 12 print "main.py <Root directory> <Playlist directory>"13 print "main.py [-e <excluded directory> ...] <Root directory> <Playlist directory>" 13 14 14 15 15 16 if __name__ == '__main__': 16 if len(sys.argv) != 3: 17 optlist, args = getopt.getopt(sys.argv[1:],'e:') 18 if len(args) != 2: 17 19 showUsage() 18 20 sys.exit(1) 19 21 else: 20 start = sys.argv[1] 21 playlists = sys.argv[2] 22 start = args[0] 23 playlists = args[1] 24 excludeList = [] 25 for tag, exdir in optlist: 26 if tag == '-e': 27 excludeList.append(exdir) 28 # Iterate through the dirs below the start dir 22 29 for root, dirs, files in os.walk(start): 30 # Check the dir isn't excluded 31 skip = False 32 for ex in excludeList: 33 if root.startswith(ex): 34 print "skipping", root 35 skip = True 36 continue 37 if skip: 38 continue 39 23 40 for f in files: 24 41 md = kaa.metadata.parse(os.path.join(root, f)) … … 36 53 37 54 for a in byArtist: 38 files = [md.fileName.replace(start,'') for md in byArtist[a] ]55 files = [md.fileName.replace(start,'').replace('/','\\') for md in byArtist[a] ] 39 56 pl = spl.SPL() 40 57 pl.list = files
Note: See TracChangeset
for help on using the changeset viewer.
