4 from filetypes import is_v1, is_v2, is_mp3, is_wav, is_ogg, is_flac, is_ape
7 locale.setlocale(locale.LC_ALL, '')
10 mp3_file = re.compile("^([^0-9]*)([0-9]+)(.*)$")
15 sys.exit("Dir is empty")
20 if not os.path.isfile(entry):
24 if not is_v1(entry) and not is_v2(entry) and not is_mp3(entry) and \
25 not is_wav(entry) and not is_ogg(entry) and \
26 not is_flac(entry) and not is_ape(entry) and \
27 not lower.endswith(".mp3") and not lower.endswith(".wav") and \
28 not lower.endswith(".ogg") and not lower.endswith(".flac") and \
29 not lower.endswith(".ape"):
32 match = mp3_file.match(entry)
35 number = match.group(2)
36 suffix = match.group(3)
38 new_list.append((int(number), locale.strxfrm(name), name, number, suffix))
41 name, suffix = os.path.splitext(entry)
42 new_list.append((number, locale.strxfrm(name), name, number, suffix))
49 outfile = open("PlayList.m3u", 'w')
50 for i, _xname, name, number, suffix in new_list:
51 outfile.write("%s%s%s\n" % (name, number, suffix))