From 23153f007818d53bd6dbb1f9327746c4ec38d22d Mon Sep 17 00:00:00 2001 From: rlaphoenix Date: Wed, 8 Feb 2023 12:29:57 +0000 Subject: [PATCH] Only use SegmentBase's timescale as FPS if exists Also optimised it to not require FPS.parse, as the Video class will run it under FPS.parse anyway. --- devine/core/manifests/dash.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/devine/core/manifests/dash.py b/devine/core/manifests/dash.py index 0ffa3a2..976dab3 100644 --- a/devine/core/manifests/dash.py +++ b/devine/core/manifests/dash.py @@ -1,12 +1,11 @@ from __future__ import annotations import base64 -from hashlib import md5 - import math import re from copy import copy -from typing import Any, Optional, Union, Callable +from hashlib import md5 +from typing import Any, Callable, Optional, Union from urllib.parse import urljoin, urlparse from uuid import UUID @@ -17,8 +16,8 @@ from pywidevine.pssh import PSSH from requests import Session from devine.core.drm import Widevine -from devine.core.tracks import Tracks, Video, Audio, Subtitle -from devine.core.utilities import is_close_match, FPS +from devine.core.tracks import Audio, Subtitle, Tracks, Video +from devine.core.utilities import is_close_match from devine.core.utils.xml import load_xml @@ -248,7 +247,10 @@ class DASH: fps=( rep.get("frameRate") or adaptation_set.get("frameRate") or - FPS.parse(rep.find("SegmentBase").get("timescale")) + ( + rep.find("SegmentBase").get("timescale") if + rep.find("SegmentBase") else None + ) ), drm=drm ) if track_type is Video else dict(