Add support for more audio name formats

This commit is contained in:
Carlos Galindo 2020-12-07 19:49:08 +01:00
parent 8528131948
commit 67bedb49e4

View file

@ -17,7 +17,7 @@ def find_audios(index):
res = [] res = []
for f in listdir(AUDIO_DIR): for f in listdir(AUDIO_DIR):
full_file = join(AUDIO_DIR, f) full_file = join(AUDIO_DIR, f)
re_date_match = re.match(r"^%03d_(\d{4}-[01]\d-[0-3]\d).mp3$" % index, f) re_date_match = re.match(r"^%03d[_ ](\d{4}-[01]\d-[0-3]\d).mp3$" % index, f)
if not isfile(full_file) or not re_date_match: if not isfile(full_file) or not re_date_match:
continue continue
date = datetime.strptime(re_date_match.group(1), "%Y-%m-%d") date = datetime.strptime(re_date_match.group(1), "%Y-%m-%d")