Skip to content
Extraits de code Groupes Projets
Vérifiée Valider 0f7775b2 rédigé par Kubat's avatar Kubat
Parcourir les fichiers

Now retrieve all the syllabs and their duration from the ass file

parent 9368061b
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -11,18 +11,22 @@ with open(FILE, 'r') as f: ...@@ -11,18 +11,22 @@ with open(FILE, 'r') as f:
CONTENT = f.read() CONTENT = f.read()
LINES_KARA = re.compile(r"Comment:.*(\d+:\d{2}:\d{2}.\d{2}),(\d+:\d{2}:\d{2}.\d{2}),.*,karaoke,(.*)\n"); LINES_KARA = re.compile(r"Comment:.*(\d+:\d{2}:\d{2}.\d{2}),(\d+:\d{2}:\d{2}.\d{2}),.*,karaoke,(.*)\n");
print(LINES_KARA)
RGX_TAGS = re.compile(r"\{\\k(\d+)\}([^\{\n\r]*)")
LINES = { LINES = {
'start': set(), 'start': [],
'end': set(), 'end': [],
'text': set() 'text': []
} }
for line in LINES_KARA.findall(CONTENT): for line in LINES_KARA.findall(CONTENT):
print(line) LINES['start'].append(line[0])
LINES['start'] = line[0] LINES['end'].append(line[1])
LINES['end'] = line[1] text = []
LINES['text'] = line[2] for couple in RGX_TAGS.findall(line[2]):
text.append((couple[0], couple[1]))
LINES['text'].append(text)
print(LINES) for i in range (0, len(LINES['start'])):
print(LINES['start'][i], LINES['end'][i], LINES['text'][i])
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter