File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1111
1212from tqdm import tqdm
1313
14+ from _test3 import td_format_two_way
1415from util import requests_retry_session , get_webname , td_format
1516
1617
@@ -110,11 +111,19 @@ def parse_mpd(self, quality=None):
110111 mpd = self .mpd
111112 # availabilityStartTime="2024-05-06T01:21:00-07:00"
112113 # availabilityEndTime="2024-05-06T01:29:00-07:00"
114+
115+ def td_format_with_direction (td ):
116+ '''a wrapper around td_format to show both positive and negative time deltas'''
117+ if td .total_seconds () < 0 :
118+ return td_format (- td ) + " ago"
119+ else :
120+ return 'in ' + td_format (td )
113121 current_time = datetime .now ().astimezone ()
114122 availability_start_time = datetime .strptime (mpd .attrib ['availabilityStartTime' ], '%Y-%m-%dT%H:%M:%S%z' )
115123 availability_end_time = datetime .strptime (mpd .attrib ['availabilityEndTime' ], '%Y-%m-%dT%H:%M:%S%z' )
116- print (f'Availability start time: { availability_start_time } ({ td_format (availability_start_time - current_time )} )' )
117- print (f'Availability end time: { availability_end_time } ({ td_format (availability_end_time - current_time )} )' )
124+
125+ print (f'Availability start time: { availability_start_time } ({ td_format_with_direction (availability_start_time - current_time )} )' )
126+ print (f'Availability end time: { availability_end_time } ({ td_format_with_direction (availability_end_time - current_time )} )' )
118127
119128 # process video representations
120129 period = mpd [0 ]
You can’t perform that action at this time.
0 commit comments