equal
deleted
inserted
replaced
|
1 #!/usr/bin/env python |
|
2 |
|
3 import codecs |
|
4 import sys |
|
5 import dateutil.parser |
|
6 from datetime import date, datetime, time |
|
7 from dateutil.tz import tzlocal |
|
8 import pytz |
|
9 |
|
10 if __name__ == "__main__": |
|
11 |
|
12 file_log = codecs.open(sys.argv[1], 'r', "UTF-16LE") |
|
13 start_time = "" |
|
14 duration = None |
|
15 start_stat = False |
|
16 for line in file_log: |
|
17 if "Session Started" in line: |
|
18 start_time = dateutil.parser.parse(":".join(line.split(":")[:-1]).strip()).replace(tzinfo=tzlocal()) |
|
19 start_time_utc = start_time.astimezone(pytz.utc) |
|
20 if "Encoding Statistics" in line: |
|
21 start_stat = True |
|
22 if start_stat and line.startswith("Video"): |
|
23 duration = dateutil.parser.parse(line.split()[2]) - datetime.combine(date.today(), time()) |
|
24 |
|
25 if start_stat and duration: |
|
26 print("Start time local: " + start_time.isoformat()) |
|
27 print("Start time UTC : " + start_time_utc.isoformat()) |
|
28 if duration: |
|
29 print("Duration : " + str(duration) + " - " + str(int(duration.total_seconds())) + " s - " + str(int(duration.total_seconds())*1000) + " ms") |
|
30 duration = None |
|
31 start_stat = False |
|
32 |
|
33 |