Add arguments to latex_scanner and update Makefile with some defaults.

This commit is contained in:
Carlos Galindo 2020-12-12 17:21:04 +01:00
parent c7bca76c8c
commit 0c5f6a0da1
3 changed files with 35 additions and 28 deletions

View file

@ -5,18 +5,17 @@ import re
from datetime import datetime
AUDIO_DIR = "audios/"
def find_audios(index):
def find_audios(index, audio_dir):
"""
Finds all audios in a folder that match the given index.
Audios must be in the format [index]_[YYYY]-[MM]-[DD].mp3
:param index: An integer denoting the song's index
:param audio_dir: The directory where the songs can be found
:return: A list of matching Audio objects
"""
res = []
for f in listdir(AUDIO_DIR):
full_file = join(AUDIO_DIR, f)
for f in listdir(audio_dir):
full_file = join(audio_dir, 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:
continue