summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRicardo Constantino <wiiaboo@gmail.com>2017-12-29 17:14:36 +0000
committerRicardo Constantino <wiiaboo@gmail.com>2018-01-02 14:28:03 +0000
commit0da5688c84e33dee1ca0965521ed5c9b8a8e7320 (patch)
tree66955673a0e3bb036c451ad2e44c181186a784f4
parent33e5755c230c009119ac22282b74ac33451df2a9 (diff)
downloadmpv-0da5688c84e33dee1ca0965521ed5c9b8a8e7320.tar.bz2
mpv-0da5688c84e33dee1ca0965521ed5c9b8a8e7320.tar.xz
ytdl_hook: fix single-entry playlists
Close #5313
-rw-r--r--player/lua/ytdl_hook.lua17
1 files changed, 8 insertions, 9 deletions
diff --git a/player/lua/ytdl_hook.lua b/player/lua/ytdl_hook.lua
index 8aef3e4540..f20eed70d1 100644
--- a/player/lua/ytdl_hook.lua
+++ b/player/lua/ytdl_hook.lua
@@ -396,12 +396,15 @@ mp.add_hook("on_load", 10, function ()
return
end
+ local self_redirecting_url =
+ json.entries[1]["_type"] ~= "url_transparent" and
+ json.entries[1]["webpage_url"] and
+ json.entries[1]["webpage_url"] == json["webpage_url"]
+
-- some funky guessing to detect multi-arc videos
- if (not (json.entries[1]["_type"] == "url_transparent")) and
- (not (json.entries[1]["webpage_url"] == nil)
- and (json.entries[1]["webpage_url"] == json["webpage_url"]))
- and not (json.entries[1].url == nil) then
+ if self_redirecting_url and #json.entries > 1
+ and json.entries[1].url then
msg.verbose("multi-arc video detected, building EDL")
local playlist = edl_track_joined(json.entries)
@@ -446,11 +449,7 @@ mp.add_hook("on_load", 10, function ()
end
end
- elseif (not (json.entries[1]["_type"] == "url_transparent")) and
- (not (json.entries[1]["webpage_url"] == nil)
- and (json.entries[1]["webpage_url"] == json["webpage_url"]))
- and (#json.entries == 1) then
-
+ elseif self_redirecting_url then
msg.verbose("Playlist with single entry detected.")
add_single_video(json.entries[1])
else