Compare commits

..

No commits in common. "e2d05bf782759eb167447388a0a05e6968ccdf7e" and "d009450b4fcc0898bdfacb026c6cfc19070d8689" have entirely different histories.

2 changed files with 14 additions and 13 deletions

View File

@ -1,5 +1,3 @@
import functools
from .common import InfoExtractor
from ..networking import HEADRequest
from ..utils import (
@ -11,9 +9,11 @@ from ..utils import (
update_url_query,
)
from functools import partial
class RedCDNLivxIE(InfoExtractor):
_VALID_URL = r'https?://[^.]+\.(?:dcs\.redcdn|atmcdn)\.pl/(?:live(?:dash|hls|ss)|nvr)/o2/(?P<tenant>[^/?#]+)/(?P<id>[^?#]+)\.livx'
_VALID_URL = r'https?://[^.]+\.(?:dcs\.redcdn|atmcdn)\.pl/(?:live(?:dash|hls|ss)|nvr)/o2/(?P<tenant>[^/]+)/(?P<id>[^?#]+)\.livx'
IE_NAME = 'redcdnlivx'
_TESTS = [{
@ -118,7 +118,7 @@ class RedCDNLivxIE(InfoExtractor):
time_scale = traverse_obj(ism_doc, ('@TimeScale', {int_or_none})) or 10000000
duration = traverse_obj(
ism_doc, ('@Duration', {functools.partial(float_or_none, scale=time_scale)})) or None
ism_doc, ('@Duration', {partial(float_or_none, scale=time_scale)})) or None
live_status = None
if traverse_obj(ism_doc, '@IsLive') == 'TRUE':

View File

@ -8,20 +8,20 @@ from ..utils import (
update_url_query,
)
import datetime
from datetime import datetime, timedelta
def is_dst(date):
year = date.year
# last sunday of march and october, respectively. might break on switch days.
dst_start = datetime.datetime(year, 3, 31, 2) - datetime.timedelta(days=(datetime.datetime(year, 3, 31).weekday() + 1) % 7)
dst_end = datetime.datetime(year, 10, 31, 3) - datetime.timedelta(days=(datetime.datetime(year, 10, 31).weekday() + 1) % 7)
dst_start = datetime(year, 3, 31, 2) - timedelta(days=(datetime(year, 3, 31).weekday() + 1) % 7)
dst_end = datetime(year, 10, 31, 3) - timedelta(days=(datetime(year, 10, 31).weekday() + 1) % 7)
return dst_start <= date <= dst_end
def rfc3339_to_atende(date):
date = datetime.datetime.fromisoformat(date)
date = date + datetime.timedelta(hours=1 if is_dst(date) else 0)
date = datetime.fromisoformat(date)
date = date + timedelta(hours=1 if is_dst(date) else 0)
return int((date.timestamp() - 978307200) * 1000)
@ -155,16 +155,17 @@ class SejmIE(InfoExtractor):
# end the stream at that time, while the session actually keeps going.
if live_status == 'was_live':
stop_time = rfc3339_to_atende(params['stop'])
duration = (stop_time - start_time) // 1000
else:
stop_time, duration = None, None
stop_time = None
duration = (stop_time - start_time) // 1000 if stop_time else None
entries = []
def add_entry(file, legacy_file=False):
if not file:
return
file = self._proto_relative_url(file)
file = f'https:{file}' if file.startswith('//') else file
if not legacy_file:
file = update_url_query(file, {'startTime': start_time})
if stop_time is not None:
@ -192,7 +193,7 @@ class SejmIE(InfoExtractor):
cameras = self._search_json(
r'var\s+cameras\s*=', frame, 'camera list', video_id,
contains_pattern=r'\[(?s:.+)\]', transform_source=js_to_json,
fatal=False) or []
fatal=not self.get_param('ignore_no_formats_error')) or []
for camera_file in traverse_obj(cameras, (..., 'file', {dict})):
if camera_file.get('flv'):
add_entry(camera_file['flv'])