fix(ALL4): Remove empty subtitle tracks
This commit is contained in:
parent
5a6bcdfda0
commit
44ea1f912b
@ -243,23 +243,9 @@ class ALL4(Service):
|
|||||||
tracks = DASH.from_url(self.manifest, self.session).to_tracks(title.language)
|
tracks = DASH.from_url(self.manifest, self.session).to_tracks(title.language)
|
||||||
tracks.videos[0].data = data
|
tracks.videos[0].data = data
|
||||||
|
|
||||||
if subtitle is not None:
|
if subtitle is None:
|
||||||
tracks.add(
|
self.log.warning("- Subtitles are either missing or empty")
|
||||||
Subtitle(
|
tracks.subtitles = [track for track in tracks.subtitles if subtitle is not None]
|
||||||
id_=hashlib.md5(subtitle.encode()).hexdigest()[0:6],
|
|
||||||
url=subtitle,
|
|
||||||
codec=Subtitle.Codec.from_mime(subtitle[-3:]),
|
|
||||||
language=title.language,
|
|
||||||
is_original_lang=True,
|
|
||||||
forced=False,
|
|
||||||
sdh=True,
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
for track in tracks.audio:
|
|
||||||
role = track.data["dash"]["representation"].find("Role")
|
|
||||||
if role is not None and role.get("value") in ["description", "alternative", "alternate"]:
|
|
||||||
track.descriptive = True
|
|
||||||
|
|
||||||
return tracks
|
return tracks
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user