aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorneodarz <neodarz@neodarz.net>2019-07-07 09:58:54 +0200
committerneodarz <neodarz@neodarz.net>2019-07-07 09:58:54 +0200
commit2efd74df4afb1127ef7d4289c7e5a1386318699e (patch)
tree0520f987e099f053c7494f907c8a452f6952aa46
parent5d64e275f2d53039ab8a6738bc1e8fdcc41a0dcd (diff)
downloadconvert.py-2efd74df4afb1127ef7d4289c7e5a1386318699e.tar.xz
convert.py-2efd74df4afb1127ef7d4289c7e5a1386318699e.zip
Fix group access of a regex match
-rwxr-xr-xconvert.py4
1 files 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')