Skip to content

Commit d7716f7

Browse files
committed
fix datetime display and formatting
1 parent 828d576 commit d7716f7

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

vod_recovery.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
logging.getLogger('asyncio').setLevel(logging.CRITICAL)
3434
logging.getLogger('aiohttp').setLevel(logging.CRITICAL)
3535

36-
CURRENT_VERSION = "1.5.3"
36+
CURRENT_VERSION = "1.5.4"
3737
SUPPORTED_FORMATS = [".mp4", ".mkv", ".mov", ".avi", ".ts"]
3838
RESOLUTIONS = ["chunked", "2160p60", "2160p30", "2160p20", "1440p60", "1440p30", "1440p20", "1080p60", "1080p30", "1080p20", "720p60", "720p30", "720p20", "480p60", "480p30", "360p60", "360p30", "160p60", "160p30"]
3939

@@ -769,7 +769,7 @@ def fetch_recent_streams_api(streamer_name, max_streams=100):
769769

770770
# Convert to local time only for display purposes
771771
dt_local = dt_utc.astimezone()
772-
dt_local_str = dt_local.strftime("%d/%b/%Y %H:%M")
772+
dt_local_str = dt_local.strftime("%Y-%m-%d %H:%M:%S")
773773

774774
length_seconds = node.get("lengthSeconds", 0)
775775
duration_hours = length_seconds / 3600.0
@@ -811,16 +811,19 @@ def fetch_recent_streams_api(streamer_name, max_streams=100):
811811
pass
812812

813813
final_timestamp = dt_utc_str
814+
final_local_timestamp = dt_local_str
814815
if extracted_timestamp:
815816
try:
816817
dt_from_url = datetime.fromtimestamp(int(extracted_timestamp), timezone.utc)
817818
final_timestamp = dt_from_url.strftime("%Y-%m-%d %H:%M:%S")
819+
dt_local_from_url = dt_from_url.astimezone()
820+
final_local_timestamp = dt_local_from_url.strftime("%Y-%m-%d %H:%M:%S")
818821
except Exception as e:
819822
pass
820823

821824
stream = {
822825
'dt_utc': final_timestamp,
823-
'dt_local': dt_local_str,
826+
'dt_local': final_local_timestamp,
824827
'title': node.get("title", ""),
825828
'duration': duration_hours,
826829
'stream_id': extracted_vod_id or node.get("id", ""),
@@ -2117,7 +2120,7 @@ def selenium_get_latest_streams_from_twitchtracker(streamer_name):
21172120
except Exception as pe:
21182121
continue
21192122
dt_utc_norm = dt_utc_obj.strftime("%Y-%m-%d %H:%M:%S")
2120-
dt_local = datetime.strftime(dt_utc_obj + timedelta(hours=timezone_offset_hours, minutes=timezone_offset_mins), "%d/%b/%Y %H:%M")
2123+
dt_local = datetime.strftime(dt_utc_obj + timedelta(hours=timezone_offset_hours, minutes=timezone_offset_mins), "%Y-%m-%d %H:%M:%S")
21212124
title = row[6]
21222125
duration = 0
21232126
try:
@@ -2186,7 +2189,7 @@ def selenium_get_latest_streams_from_twitchtracker(streamer_name):
21862189
dt_local_obj = datetime.strptime(row['dt_local'], "%d/%b/%Y %H:%M")
21872190
dt_utc_obj = dt_local_obj - timedelta(hours=timezone_offset_hours, minutes=timezone_offset_mins)
21882191
dt_utc = dt_utc_obj.strftime("%Y-%m-%d %H:%M:%S")
2189-
dt_local = dt_local_obj.strftime("%d/%b/%Y %H:%M")
2192+
dt_local = dt_local_obj.strftime("%Y-%m-%d %H:%M:%S")
21902193
except Exception:
21912194
dt_utc = row.get('dt_utc') or ''
21922195
try:

0 commit comments

Comments
 (0)