Skip to content
Extraits de code Groupes Projets
Valider bbc8568f rédigé par Sting's avatar Sting
Parcourir les fichiers

Fix several bugs on ASS file read/write

parent 0715f3df
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -9,7 +9,7 @@ def timeToDate(time): ...@@ -9,7 +9,7 @@ def timeToDate(time):
remainder_sec = (seconds % 60) + centiseconds remainder_sec = (seconds % 60) + centiseconds
hours = int(mins // 60) hours = int(mins // 60)
remainder_mins = int(mins % 60) remainder_mins = int(mins % 60)
return f'{hours:02d}:{remainder_mins:02d}:{remainder_sec:.2f}' return f'{hours:02d}:{remainder_mins:02d}:{remainder_sec:05.2f}'
def dateToTime(date): def dateToTime(date):
...@@ -29,7 +29,7 @@ def getSyls(ass_file): ...@@ -29,7 +29,7 @@ def getSyls(ass_file):
with open(ass_file, 'r') as f: with open(ass_file, 'r') as f:
CONTENT = f.read() CONTENT = f.read()
strip_regex = re.compile('[^a-zA-Z]') strip_regex = re.compile('[^a-zA-Z]')
LINES_KARA = re.compile(r"Comment:.*(\d+:\d{2}:\d{2}.\d{2}),(\d+:\d{2}:\d{2}.\d{2}),([^,]*),([^,]*),(\d+),(\d+),(\d+),karaoke,(.*)\n"); LINES_KARA = re.compile(r"(?:Comment|Dialogue):.*(\d+:\d{2}:\d{2}.\d{2}),(\d+:\d{2}:\d{2}.\d{2}),([^,]*),([^,]*),(\d+),(\d+),(\d+),(?:(?!fx|template|code)\w)*,(.*)\n")
RGX_TAGS = re.compile(r"\{\\k(\d+)\}([^\{\n\r]*)") RGX_TAGS = re.compile(r"\{\\k(\d+)\}([^\{\n\r]*)")
for line in LINES_KARA.findall(CONTENT): for line in LINES_KARA.findall(CONTENT):
syl_line = [] syl_line = []
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter