review: improve blackdetect parsing

sometimes ffmpeg will use a bare \r before writing out the blackdetect line,
not a \n. catch this case by splitting on either.
condor-scripts
Mike Lang 3 years ago
parent 345cb53f4e
commit 2b8bf96e62

@ -20,6 +20,7 @@ race_runs contains time for each racer
import datetime import datetime
import logging import logging
import os import os
import re
import subprocess import subprocess
from getpass import getpass from getpass import getpass
@ -135,7 +136,7 @@ def main(match_id, race_number,
if proc.wait() != 0: if proc.wait() != 0:
raise Exception("ffmpeg exited {}\n{}".format(proc.wait(), err)) raise Exception("ffmpeg exited {}\n{}".format(proc.wait(), err))
lines = [ lines = [
line for line in err.strip().split('\n') line for line in re.split('[\r\n]', err.strip())
if line.startswith('[blackdetect @ ') if line.startswith('[blackdetect @ ')
] ]
if len(lines) == 1: if len(lines) == 1:

@ -2,6 +2,7 @@
import datetime import datetime
import logging import logging
import os import os
import re
import subprocess import subprocess
from hashlib import sha256 from hashlib import sha256
from urlparse import urlparse from urlparse import urlparse
@ -155,7 +156,7 @@ def review(
if proc.wait() != 0: if proc.wait() != 0:
raise Exception("ffmpeg exited {}\n{}".format(proc.wait(), err)) raise Exception("ffmpeg exited {}\n{}".format(proc.wait(), err))
lines = [ lines = [
line for line in err.strip().split('\n') line for line in re.split('[\r\n]', err.strip())
if line.startswith('[blackdetect @ ') if line.startswith('[blackdetect @ ')
] ]
if len(lines) == 1: if len(lines) == 1:

Loading…
Cancel
Save