~ubuntu-branches/ubuntu/utopic/vlc/utopic

« back to all changes in this revision

Viewing changes to share/lua/playlist/soundcloud.lua

  • Committer: Package Import Robot
  • Author(s): Benjamin Drung
  • Date: 2012-02-18 01:29:48 UTC
  • mfrom: (1.1.45) (3.5.32 sid)
  • Revision ID: package-import@ubuntu.com-20120218012948-tvq9nhnfi98kra44
Tags: 2.0.0-1
* New upstream release (Closes: #499381, #573064, #624027, LP: #455825,
  #573775, #695882, #705151, #708448, #738381, #743581, #747757, #817924,
  #931083).
* Remove dropped mozilla-plugin-vlc, vlc-plugin-ggi, and vlc-plugin-svgalib.
  The Mozilla browser plug-in is now provided by a separate source tarball.
* Add new plugins to and remove dropped plugins from vlc-nox.
* Add new and remove dropped build dependencies:
  + libbluray-dev (for Blu-ray support)
  + libresid-builder-dev
  + libsamplerate0-dev
  + libsidplay2-dev
  + lbspeexdsp-dev
  + libxcb-composite0-dev
  - libgtk2.0-dev
  - xulrunner-dev
* vlc-plugin-fluidsynth depends on fluid-soundfont-gm or
  musescore-soundfont-gm for having a sound font for playing MIDI files.
* Drop all patches (they were either backported or accepted by upstream).
* Update symbols for libvlc5.
* Install plugins.dat instead of running vlc-cache-gen in postinst.
* Update minimum version of build dependencies.
* Change Build-Dependency from libupnp3-dev to unversioned libupnp-dev.
  (Closes: #656831)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
--[[
 
2
 $Id$
 
3
 
 
4
 Copyright © 2012 the VideoLAN team
 
5
 
 
6
 Authors: Cheng Sun <chengsun9atgmail.com>
 
7
 
 
8
 This program is free software; you can redistribute it and/or modify
 
9
 it under the terms of the GNU General Public License as published by
 
10
 the Free Software Foundation; either version 2 of the License, or
 
11
 (at your option) any later version.
 
12
 
 
13
 This program is distributed in the hope that it will be useful,
 
14
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 
15
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
16
 GNU General Public License for more details.
 
17
 
 
18
 You should have received a copy of the GNU General Public License
 
19
 along with this program; if not, write to the Free Software
 
20
 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
 
21
--]]
 
22
 
 
23
-- Probe function.
 
24
function probe()
 
25
    return vlc.access == "http"
 
26
        and string.match( vlc.path, "soundcloud\.com/.+/.+" )
 
27
end
 
28
 
 
29
-- Parse function.
 
30
function parse()
 
31
    if string.match ( vlc.path, "soundcloud\.com" ) then
 
32
        while true do
 
33
            line = vlc.readline()
 
34
            if not line then break end
 
35
            if string.match( line, "window\.SC\.bufferTracks\.push" ) then
 
36
                -- all the data is nicely stored on this one line
 
37
                _,_,uid,token,name = string.find (line,
 
38
                        "window\.SC\.bufferTracks\.push.*" ..
 
39
                        "\"uid\":\"([^\"]*)\".*" ..
 
40
                        "\"token\":\"([^\"]*)\".*" ..
 
41
                        "\"title\":\"([^\"]*)\"")
 
42
                -- we only want the first one of these lines
 
43
                break
 
44
            end
 
45
        end
 
46
        path = "http://media.soundcloud.com/stream/"..uid.."?stream_token="..token
 
47
        return { { path = path; name = name } }
 
48
    end
 
49
    return {}
 
50
end