diff options
author | neodarz <neodarz@neodarz.net> | 2019-07-07 09:58:54 +0200 |
---|---|---|
committer | neodarz <neodarz@neodarz.net> | 2019-07-07 09:58:54 +0200 |
commit | 2efd74df4afb1127ef7d4289c7e5a1386318699e (patch) | |
tree | 0520f987e099f053c7494f907c8a452f6952aa46 | |
parent | 5d64e275f2d53039ab8a6738bc1e8fdcc41a0dcd (diff) | |
download | convert.py-2efd74df4afb1127ef7d4289c7e5a1386318699e.tar.xz convert.py-2efd74df4afb1127ef7d4289c7e5a1386318699e.zip |
Fix group access of a regex match
-rwxr-xr-x | convert.py | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -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') |