fix: handle multi-word timezones (#4816)

This commit is contained in:
Jonathan Zhang 2022-12-30 06:34:01 -08:00 committed by GitHub
parent 6e519e0071
commit ffd637cc0c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -1088,14 +1088,14 @@ def vod_ts(camera_name, start_ts, end_ts):
@bp.route("/vod/<year_month>/<day>/<hour>/<camera_name>") @bp.route("/vod/<year_month>/<day>/<hour>/<camera_name>")
def vod_hour_no_timezone(year_month, day, hour, camera_name): def vod_hour_no_timezone(year_month, day, hour, camera_name):
return vod_hour( return vod_hour(
year_month, day, hour, camera_name, get_localzone_name().replace("/", "_") year_month, day, hour, camera_name, get_localzone_name().replace("/", ",")
) )
# TODO make this nicer when vod module is removed # TODO make this nicer when vod module is removed
@bp.route("/vod/<year_month>/<day>/<hour>/<camera_name>/<tz_name>") @bp.route("/vod/<year_month>/<day>/<hour>/<camera_name>/<tz_name>")
def vod_hour(year_month, day, hour, camera_name, tz_name): def vod_hour(year_month, day, hour, camera_name, tz_name):
tz_name = tz_name.replace("_", "/") tz_name = tz_name.replace(",", "/")
parts = year_month.split("-") parts = year_month.split("-")
start_date = datetime( start_date = datetime(
int(parts[0]), int(parts[1]), int(day), int(hour), tzinfo=pytz.timezone(tz_name) int(parts[0]), int(parts[1]), int(day), int(hour), tzinfo=pytz.timezone(tz_name)

View File

@ -71,7 +71,7 @@ export default function Recording({ camera, date, hour = '00', minute = '00', se
{ {
src: `${apiHost}vod/${year}-${month}/${day}/${h.hour}/${camera}/${timezone.replaceAll( src: `${apiHost}vod/${year}-${month}/${day}/${h.hour}/${camera}/${timezone.replaceAll(
'/', '/',
'_' ','
)}/master.m3u8`, )}/master.m3u8`,
type: 'application/vnd.apple.mpegurl', type: 'application/vnd.apple.mpegurl',
}, },