Index: multimedia/vlc/Makefile =================================================================== --- multimedia/vlc/Makefile (revision 414971) +++ multimedia/vlc/Makefile (working copy) @@ -3,7 +3,7 @@ PORTNAME= vlc DISTVERSION= 2.2.1 -PORTREVISION= 9 +PORTREVISION= 10 PORTEPOCH= 4 CATEGORIES= multimedia audio ipv6 net www MASTER_SITES= http://download.videolan.org/pub/videolan/${PORTNAME}/${DISTVERSION:S/a$//}/ \ Index: multimedia/vlc/files/patch-share_lua_playlist_soundcloud.lua =================================================================== --- multimedia/vlc/files/patch-share_lua_playlist_soundcloud.lua (nonexistent) +++ multimedia/vlc/files/patch-share_lua_playlist_soundcloud.lua (working copy) @@ -0,0 +1,117 @@ +--- share/lua/playlist/soundcloud.lua.orig 2014-08-14 07:20:04 UTC ++++ share/lua/playlist/soundcloud.lua +@@ -1,9 +1,10 @@ + --[[ + $Id$ + +- Copyright © 2012 the VideoLAN team ++ Copyright © 2012, 2015 the VideoLAN team + + Authors: Cheng Sun ++ Pierre Ynard + + 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 +@@ -26,30 +27,82 @@ function probe() + and string.match( vlc.path, "soundcloud%.com/.+/.+" ) + end + ++function fix_quotes( value ) ++ if string.match( value, "^\"" ) then ++ return "" -- field was really empty string ++ end ++ ++ -- TODO: handle escaped backslashes and others ++ return string.gsub( value, "\\\"", "\"" ) ++end ++ + -- Parse function. + function parse() +- if string.match ( vlc.path, "soundcloud%.com" ) then +- arturl = nil +- 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 ++ while true do ++ line = vlc.readline() ++ if not line then break end ++ ++ -- Parameters for API call ++ if not track then ++ track = string.match( line, "soundcloud:tracks:(%d+)" ) ++ end ++ ++ -- For private tracks ++ if not secret then ++ secret = string.match( line, "[\"']secret_token[\"'] *: *[\"'](.-)[\"']" ) ++ end ++ ++ -- Metadata ++ if not name then ++ name = string.match( line, "[\"']title[\"'] *: *\"(.-[^\\])\"" ) ++ if name then ++ name = fix_quotes( name ) + end +- -- try to get the art url +- if string.match( line, "artwork--download--link" ) then +- _,_,arturl = string.find( line, " href=\"(.*)\" " ) ++ end ++ ++ if not description then ++ description = string.match( line, "[\"']artwork_url[\"'] *:.-[\"']description[\"'] *: *\"(.-[^\\])\"" ) ++ if description then ++ description = fix_quotes( description ) + end + end +- path = "http://media.soundcloud.com/stream/"..uid.."?stream_token="..token +- return { { path = path; name = name; arturl = arturl } } ++ ++ if not artist then ++ artist = string.match( line, "[\"']username[\"'] *: *\"(.-[^\\])\"" ) ++ if artist then ++ artist = fix_quotes( artist ) ++ end ++ end ++ ++ if not arturl then ++ arturl = string.match( line, "[\"']artwork_url[\"'] *: *[\"'](.-)[\"']" ) ++ end + end +- return {} ++ ++ if track then ++ -- API magic ++ local client_id = "02gUJC0hH2ct1EGOcYXQIzRFU91c72Ea" ++ -- app_version is not required by the API but we send it anyway ++ -- to remain unconspicuous ++ local app_version = "a089efd" ++ ++ local api = vlc.stream( vlc.access.."://api.soundcloud.com/i1/tracks/"..track.."/streams?client_id="..client_id.."&app_version="..app_version..( secret and "&secret_token="..secret or "" ) ) ++ ++ if api then ++ local streams = api:readline() -- data is on one line only ++ -- For now only quality available is 128 kbps (http_mp3_128_url) ++ path = string.match( streams, "[\"']http_mp3_%d+_url[\"'] *: *[\"'](.-)[\"']" ) ++ if path then ++ -- FIXME: do this properly ++ path = string.gsub( path, "\\u0026", "&" ) ++ end ++ end ++ end ++ ++ if not path then ++ vlc.msg.err( "Couldn't extract soundcloud audio URL, please check for updates to this script" ) ++ return { } ++ end ++ ++ return { { path = path, name = name, description = description, artist = artist, arturl = arturl } } + end Property changes on: multimedia/vlc/files/patch-share_lua_playlist_soundcloud.lua ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property