Skip to content

Commit

Permalink
Add CreateMap function.
Browse files Browse the repository at this point in the history
  • Loading branch information
IceNature committed Aug 4, 2015
1 parent 1b70c55 commit ea262ac
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion EmbedLrc.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ def GetMatchFiles(filelist, regexs):
matchedFiles.extend(m for m in filelist if pattern.match(m))
return matchedFiles

def CreateMap(filelist):
tempMap={}
for file in filelist:
tempMap[os.path.basename(file)]=file
return tempMap

supportAudioTypes = ['.+\\' + m for m in supportAudioTypes]
supportLrcTypes = ['.+\\' + m for m in supportLrcTypes]

Expand All @@ -41,5 +47,12 @@ def GetMatchFiles(filelist, regexs):
else:
print('Error:{0} is not a directory!'.format(arg))

audioList = []
if not fileList:
print('Cant\'t find file!')
sys.exit(1)


audioList = CreateMap(GetMatchFiles(fileList, supportAudioTypes))
lrcList = CreateMap(GetMatchFiles(fileList, supportLrcTypes))


0 comments on commit ea262ac

Please sign in to comment.