From 2efd74df4afb1127ef7d4289c7e5a1386318699e Mon Sep 17 00:00:00 2001 From: neodarz Date: Sun, 7 Jul 2019 09:58:54 +0200 Subject: Fix group access of a regex match --- convert.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/convert.py b/convert.py index 2f39fd3..f8bd56c 100755 --- a/convert.py +++ b/convert.py @@ -78,14 +78,14 @@ for file in sorted(os.listdir(sourcedir)): ffmpeg_time = re.search('(Duration: [0-9][0-9]:[0-9][0-9]:[0-9][0-9].[0-9][0-9])', str(unknown_line), re.IGNORECASE) if ffmpeg_time: - total = str(ffmpeg_time[0]).split(' ')[1] + total = str(ffmpeg_time.group(0)).split(' ')[1] totalRange = time.strptime(total.split('.')[0],'%H:%M:%S') totalRangeS = datetime.timedelta(hours=totalRange.tm_hour,minutes=totalRange.tm_min,seconds=totalRange.tm_sec).total_seconds() ffmpeg_time = re.search('(time=[0-9][0-9]:[0-9][0-9]:[0-9][0-9].[0-9][0-9])', str(unknown_line), re.IGNORECASE) if ffmpeg_time: - timeRange = time.strptime(str(ffmpeg_time[0]).split('.')[0].split('=')[1],'%H:%M:%S') + timeRange = time.strptime(str(ffmpeg_time.group(0)).split('.')[0].split('=')[1],'%H:%M:%S') timeRangeS = datetime.timedelta(hours=timeRange.tm_hour,minutes=timeRange.tm_min,seconds=timeRange.tm_sec).total_seconds() print(str(round(100*timeRangeS/totalRangeS, 1))+"% / 100% "+str(exist), end='\r') -- cgit v1.2.1