~ubuntu-branches/ubuntu/vivid/mpv/vivid

« back to all changes in this revision

Viewing changes to player/lua/ytdl_hook.lua

  • Committer: Package Import Robot
  • Author(s): Logan Rosen
  • Date: 2014-12-22 19:08:25 UTC
  • mfrom: (28.1.3 vivid-proposed)
  • Revision ID: package-import@ubuntu.com-20141222190825-bdtz8aiwvv65wpmi
Tags: 0.7.2-1ubuntu1
debian/rules: Disable altivec on ppc64el again, as it FTBFS with it.

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
 
4
4
local ytdl = {
5
5
    path = "youtube-dl",
6
 
    minver = "2014.11.09",
 
6
    minver = "2014.11.26",
7
7
    vercheck = nil,
8
8
}
9
9
 
97
97
        elseif not (json["_type"] == nil) and (json["_type"] == "playlist") then
98
98
            -- a playlist
99
99
 
100
 
            local playlist = "#EXTM3U\n"
101
 
            for i, entry in pairs(json.entries) do
102
 
                local site = entry.url
103
 
 
104
 
                -- some extractors will still return the full info for
105
 
                -- all clips in the playlist and the URL will point
106
 
                -- directly to the file in that case, which we don't
107
 
                -- want so get the webpage URL instead, which is what
108
 
                -- we want
109
 
                if not (entry["webpage_url"] == nil) then
110
 
                    site = entry["webpage_url"]
111
 
                end
112
 
 
113
 
                playlist = playlist .. "ytdl://" .. site .. "\n"
 
100
            -- some funky guessing to detect multi-arc videos
 
101
            if  not (json.entries[1]["webpage_url"] == nil)
 
102
                and (json.entries[1]["webpage_url"] == json["webpage_url"]) then
 
103
                msg.verbose("multi-arc video detected, building EDL")
 
104
 
 
105
 
 
106
                local playlist = "edl://"
 
107
                for i, entry in pairs(json.entries) do
 
108
 
 
109
                    playlist = playlist .. entry.url .. ";"
 
110
                end
 
111
 
 
112
                msg.debug("EDL: " .. playlist)
 
113
 
 
114
 
 
115
                mp.set_property("stream-open-filename", playlist)
 
116
                if not (json.title == nil) then
 
117
                    mp.set_property("file-local-options/media-title", json.title)
 
118
                end
 
119
 
 
120
            else
 
121
 
 
122
                local playlist = "#EXTM3U\n"
 
123
                for i, entry in pairs(json.entries) do
 
124
                    local site = entry.url
 
125
 
 
126
                    -- some extractors will still return the full info for
 
127
                    -- all clips in the playlist and the URL will point
 
128
                    -- directly to the file in that case, which we don't
 
129
                    -- want so get the webpage URL instead, which is what
 
130
                    -- we want
 
131
                    if not (entry["webpage_url"] == nil) then
 
132
                        site = entry["webpage_url"]
 
133
                    end
 
134
 
 
135
                    playlist = playlist .. "ytdl://" .. site .. "\n"
 
136
                end
 
137
 
 
138
                mp.set_property("stream-open-filename", "memory://" .. playlist)
114
139
            end
115
140
 
116
 
            mp.set_property("stream-open-filename", "memory://" .. playlist)
117
 
 
118
141
        else -- probably a video
119
142
            local streamurl = ""
120
143
 
121
144
            -- DASH?
122
145
            if not (json["requested_formats"] == nil) then
123
 
                msg.info("NOTE: Using DASH, expect inaccurate duration.")
 
146
                msg.info("Using DASH, expect inaccurate duration.")
 
147
                if not (json.duration == nil) then
 
148
                    msg.info("actual duration: " .. mp.format_time(json.duration))
 
149
                end
 
150
 
124
151
                -- video url
125
152
                streamurl = json["requested_formats"][1].url
126
153