Commit 574f292a authored by Cheng Sun's avatar Cheng Sun Committed by Jean-Baptiste Kempf

lua soundcloud.com playlist

Adds support for soundcloud.com URL parsing
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent cc56ca3a
...@@ -195,6 +195,7 @@ nobase_vlclib_DATA = \ ...@@ -195,6 +195,7 @@ nobase_vlclib_DATA = \
lua/playlist/pinkbike.luac \ lua/playlist/pinkbike.luac \
lua/playlist/pluzz.luac \ lua/playlist/pluzz.luac \
lua/playlist/rockbox_fm_presets.luac \ lua/playlist/rockbox_fm_presets.luac \
lua/playlist/soundcloud.luac \
lua/playlist/vimeo.luac \ lua/playlist/vimeo.luac \
lua/playlist/youtube.luac \ lua/playlist/youtube.luac \
lua/playlist/youtube_homepage.luac \ lua/playlist/youtube_homepage.luac \
...@@ -265,6 +266,7 @@ EXTRA_DIST += \ ...@@ -265,6 +266,7 @@ EXTRA_DIST += \
lua/playlist/pinkbike.lua \ lua/playlist/pinkbike.lua \
lua/playlist/pluzz.lua \ lua/playlist/pluzz.lua \
lua/playlist/rockbox_fm_presets.lua \ lua/playlist/rockbox_fm_presets.lua \
lua/playlist/soundcloud.lua \
lua/playlist/vimeo.lua \ lua/playlist/vimeo.lua \
lua/playlist/youtube.lua \ lua/playlist/youtube.lua \
lua/playlist/youtube_homepage.lua \ lua/playlist/youtube_homepage.lua \
......
--[[
$Id$
Copyright © 2012 the VideoLAN team
Authors: Cheng Sun <chengsun9atgmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
--]]
-- Probe function.
function probe()
return vlc.access == "http"
and string.match( vlc.path, "soundcloud\.com/.+/.+" )
end
-- Parse function.
function parse()
if string.match ( vlc.path, "soundcloud\.com" ) then
while true do
line = vlc.readline()
if not line then break end
if string.match( line, "window\.SC\.bufferTracks\.push" ) then
-- all the data is nicely stored on this one line
_,_,uid,token,name = string.find (line,
"window\.SC\.bufferTracks\.push.*" ..
"\"uid\":\"([^\"]*)\".*" ..
"\"token\":\"([^\"]*)\".*" ..
"\"title\":\"([^\"]*)\"")
-- we only want the first one of these lines
break
end
end
path = "http://media.soundcloud.com/stream/"..uid.."?stream_token="..token
return { { path = path; name = name } }
end
return {}
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment