[vlc-devel] commit: lua playlist: add playlist parser for Anevia Toucan list_streams. idp functionality. (Jean-Paul Saman )

git version control git at videolan.org
Fri Feb 20 17:11:21 CET 2009


vlc | branch: master | Jean-Paul Saman <jean-paul.saman at m2x.nl> | Fri Feb 20 16:56:11 2009 +0100| [07a69e826ecb666cce2fd75c91dcc88f40dd8b97] | committer: Jean-Paul Saman 

lua playlist: add playlist parser for Anevia Toucan list_streams.idp functionality.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=07a69e826ecb666cce2fd75c91dcc88f40dd8b97
---

 share/Makefile.am                     |    1 +
 share/lua/playlist/anevia_streams.lua |   90 +++++++++++++++++++++++++++++++++
 2 files changed, 91 insertions(+), 0 deletions(-)

diff --git a/share/Makefile.am b/share/Makefile.am
index 8667507..3abf2d1 100644
--- a/share/Makefile.am
+++ b/share/Makefile.am
@@ -242,6 +242,7 @@ DIST_lua= \
 	lua/meta/01_musicbrainz.lua \
 	lua/meta/10_googleimage.lua \
 	lua/playlist/README.txt \
+	lua/playlist/anevia_streams.lua \
 	lua/playlist/appletrailers.lua \
 	lua/playlist/break.lua \
 	lua/playlist/dailymotion.lua \
diff --git a/share/lua/playlist/anevia_streams.lua b/share/lua/playlist/anevia_streams.lua
new file mode 100644
index 0000000..c9b1f19
--- /dev/null
+++ b/share/lua/playlist/anevia_streams.lua
@@ -0,0 +1,90 @@
+--[[
+ $Id$
+
+ Parse list of available streams on Anevia Toucan servers.
+ The URI rtsp://ipaddress:554/list_streams.idp describes a list of
+ available streams on the server.
+
+ Copyright © 2009 M2X BV
+
+ Authors: Jean-Paul Saman <jpsaman at videolan.org>
+
+ 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, "list_streams.idp" )
+end
+
+-- Parse function.
+function parse()
+    p = {}
+    _,_,server = string.find( vlc.path, "(.*)/list_streams.idp" )
+    while true do
+        line = vlc.readline()
+        if not line then break end
+
+        if string.match( line, "<streams[-]list> </stream[-]list>" ) then
+            break
+        elseif string.match( line, "<streams[-]list xmlns=\"(.*)\">" ) then
+            while true do
+                line = vlc.readline()
+                if not line then break end
+                if string.match( line, "<streamer name=\"(.*)\"> </streamer>" ) then
+                    break;
+                elseif string.match( line, "<streamer name=\"(.*)\">" ) then
+                    _,_,streamer = string.find( line, "name=\"(.*)\"" )
+                    while true do
+                        line = vlc.readline()
+                        if not line then break end
+                        -- ignore <host name=".." /> tags
+                        -- ignore <port number=".." /> tags
+                        if string.match( line, "<input name=\"(.*)\">" ) then
+                            _,_,path = string.find( line, "name=\"(.*)\"" )
+                            while true do
+                                line = vlc.readline()
+                                if not line then break end
+                                if string.match( line, "<stream id=\"(.*)\" />" ) then
+                                    _,_,media = string.find( line, "id=\"(.*)\"" )
+                                    video = "rtsp://" .. tostring(server) .. "/" .. tostring(path) .. "/" .. tostring(media)
+                                    vlc.msg.dbg( "adding to playlist " .. tostring(video) )
+                                    table.insert( p, { path = video; name = media, url = video } )
+                                end
+--                              end of input tag found
+                                if string.match( line, "</input>" ) then
+                                    break
+                                end
+                            end
+                        end
+                    end
+                    if not line then break end
+--                  end of streamer tag found
+                    if string.match( line, "</streamer>" ) then
+                        break
+                    end
+                end
+                if not line then break end
+--              end of streams-list tag found
+                if string.match( line, "</streams-list>" ) then
+                    break
+                end
+            end
+        end
+
+    end
+    return p
+end




More information about the vlc-devel mailing list