[vlc-commits] commit: librivox: create a node for each book of the podcast. ( Rémi Duraffort )

git at videolan.org git at videolan.org
Thu Sep 9 18:58:20 CEST 2010


vlc | branch: master | Rémi Duraffort <ivoire at videolan.org> | Thu Sep  9 18:56:14 2010 +0200| [d51c1abd42bf36f715d42d58b169a1016f4fbee4] | committer: Rémi Duraffort 

librivox: create a node for each book of the podcast.

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

 share/lua/sd/librivox.lua |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/share/lua/sd/librivox.lua b/share/lua/sd/librivox.lua
index 85f7e15..89a34b4 100644
--- a/share/lua/sd/librivox.lua
+++ b/share/lua/sd/librivox.lua
@@ -45,16 +45,21 @@ function main()
     simplexml.add_name_maps( podcast )
     local channel = podcast.children_map['channel'][1]
     local arturl = ''
+    local books = {}
 
     for _, item in ipairs( channel.children ) do
         if( item.name == 'item' )
         then
             simplexml.add_name_maps( item )
-            local new_item = vlc.sd.add_item( { path = item.children_map['link'][1].children[1],
-                                                title = item.children_map['title'][1].children[1],
-                                                album = item.children_map['itunes:subtitle'][1].children[1],
-                                                duration = string_2_duration( item.children_map['itunes:duration'][1].children[1] ),
-                                                arturl = arturl } )
+            local book_title = item.children_map['itunes:subtitle'][1].children[1]
+            if(books[book_title] == nil) then
+                books[book_title] = vlc.sd.add_node( { title = book_title } )
+            end
+            books[book_title]:add_subitem( { path = item.children_map['link'][1].children[1],
+                                             title = item.children_map['title'][1].children[1],
+                                             album = item.children_map['itunes:subtitle'][1].children[1],
+                                             duration = string_2_duration( item.children_map['itunes:duration'][1].children[1] ),
+                                             arturl = arturl } )
         elseif( item.name == 'itunes:image' )
         then
             arturl = item.attributes['href']



More information about the vlc-commits mailing list