[vlc-devel] commit: Lua SD: freebox now should work correctly (Fabio Ritrovato )

git version control git at videolan.org
Mon Feb 15 23:59:14 CET 2010


vlc | branch: master | Fabio Ritrovato <sephiroth87 at videolan.org> | Mon Feb 15 23:58:45 2010 +0100| [a97b78c2fb57860b99d79e1f523ee3b5d4fce410] | committer: Fabio Ritrovato 

Lua SD: freebox now should work correctly

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

 share/lua/sd/freebox.lua |   25 ++++++++++++++++++++++++-
 1 files changed, 24 insertions(+), 1 deletions(-)

diff --git a/share/lua/sd/freebox.lua b/share/lua/sd/freebox.lua
index b1e3cd1..270b692 100644
--- a/share/lua/sd/freebox.lua
+++ b/share/lua/sd/freebox.lua
@@ -22,5 +22,28 @@
 --]]
 
 function main()
-    vlc.sd.add_item( {url="http://mafreebox.freebox.fr/freeboxtv/playlist.m3u",options={"deinterlace=1"}} )
+    local fd = vlc.stream( "http://mafreebox.freebox.fr/freeboxtv/playlist.m3u" )
+    local line=  fd:readline()
+    if line ~= "#EXTM3U" then
+        return nil
+    end
+    line = fd:readline()
+    local duration, artist, name
+    local options={"deinterlace=1"}
+    while line ~= nil do
+        if( string.find( line, "#EXTINF" ) ) then
+            _, _, duration, artist, name = string.find( line, ":(%w+),(%w+)%s*-%s*(.+)" )
+            --TODO: fix the name not showing special characters correctly
+        elseif( string.find( line, "#EXTVLCOPT" ) ) then
+            _, _, option = string.find( line, ":(.+)" )
+            table.insert( options, option )
+        else
+            vlc.sd.add_item( {url=line,duration=duration,artist=artist,title=name,options=options} )
+            duration = nil
+            artist = nil
+            name = nil
+            options={"deinterlace=1"}
+        end
+        line = fd:readline()
+    end
 end




More information about the vlc-devel mailing list