[vlc-commits] metachannels: fix search function too

Pierre Ynard git at videolan.org
Sun Feb 12 00:27:02 CET 2012


vlc | branch: master | Pierre Ynard <linkfanel at yahoo.fr> | Sun Feb 12 00:26:39 2012 +0100| [9dd9ba6340fe8591b673f0f786b8d767da81b891] | committer: Pierre Ynard

metachannels: fix search function too

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

 share/lua/sd/metachannels.lua |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/share/lua/sd/metachannels.lua b/share/lua/sd/metachannels.lua
index 21152e6..b1cdb5d 100644
--- a/share/lua/sd/metachannels.lua
+++ b/share/lua/sd/metachannels.lua
@@ -38,13 +38,15 @@ function search( string )
         if( item.name == 'item' ) then
             simplexml.add_name_maps( item )
             local url = string.gsub( item.children_map['link'][1].children[1], '&', '&' )
-            local arturl = item.children_map['media:thumbnail'][1].attributes['url']
-            if( arturl == '/images/thumb_channel_default.jpg' ) then
-                arturl = 'http://www.metachannels.com/images/thumb_channel_default.jpg'
+            local title = item.children_map['title'][1].children[1]
+            local arturl = nil
+            if item.children_map['media:thumbnail'] ~= nil then
+                arturl = item.children_map['media:thumbnail'][1].attributes['url']
+                if( arturl == '/images/thumb_channel_default.jpg' ) then
+                    arturl = 'http://www.metachannels.com/images/thumb_channel_default.jpg'
+                end
             end
-            node:add_subitem( { path = url,
-                                title = item.children_map['title'][1].children[1],
-                                arturl = arturl } )
+            node:add_subitem( { path = url, title = title, arturl = arturl } )
         end
     end
 end



More information about the vlc-commits mailing list