4 Copyright © 2010 VideoLAN and AUTHORS
6 Authors: Rémi Duraffort <ivoire at videolan dot org>
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
26 return { title="Magnatune" }
33 function add_top_albums()
34 local fd = vlc.stream( "http://magnatune.com/genres/m3u/ranked_all.xspf" )
35 if not fd then return end
41 -- repair the XML stream if needed
42 file = file .. string.gsub(line, ' & ', ' & ')
46 local node = vlc.sd.add_node( {title = "Most popular albums"} )
48 local tree = simplexml.parse_string( file )
49 simplexml.add_name_maps( tree )
50 local track_list = tree.children_map['trackList'][1]
51 for _, track in ipairs( track_list.children ) do
52 simplexml.add_name_maps( track )
53 local track_item = node:add_subitem(
54 { path = string.gsub(track.children_map['location'][1].children[1], ' ', '%%20'),
55 title = track.children_map['annotation'][1].children[1],
56 arturl = track.children_map['image'][1].children[1] })