[vlc-commits] Jamendo selected charts by genre

Claudio Ortelli git at videolan.org
Wed Feb 29 16:38:47 CET 2012


vlc/vlc-2.0 | branch: master | Claudio Ortelli <claudio at jamendo.com> | Wed Feb 29 16:16:07 2012 +0100| [9be9a1f92ef1cdc6297bf8d642e3139548bb653e] | committer: Jean-Baptiste Kempf

Jamendo selected charts by genre

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
(cherry picked from commit cdf21929f60f8fe692253ce0689b112f459bdd58)

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 share/lua/sd/jamendo.lua |   19 ++++++++++++++-----
 1 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/share/lua/sd/jamendo.lua b/share/lua/sd/jamendo.lua
index 5eff78e..4920d07 100644
--- a/share/lua/sd/jamendo.lua
+++ b/share/lua/sd/jamendo.lua
@@ -28,6 +28,13 @@ function descriptor()
 end
 
 function main()
+    add_top_tracks( "ratingweek_desc", "rock", 100 )
+    add_top_tracks( "ratingweek_desc", "pop", 100 )
+    add_top_tracks( "ratingweek_desc", "jazz", 100 )
+    add_top_tracks( "ratingweek_desc", "dance", 100 )
+    add_top_tracks( "ratingweek_desc", "hipop+rap", 100 )
+    add_top_tracks( "ratingweek_desc", "world+reggae", 100 )
+    add_top_tracks( "ratingweek_desc", "lounge+ambient", 100 )
     add_top_tracks( "ratingweek_desc", nil, 100 )
     add_top_albums( "ratingweek_desc", nil, 20 )
     add_radio_from_id( "9", 20 )
@@ -38,6 +45,7 @@ function main()
     add_radio_from_id( "4", 20 )
 end
 
+
 function add_top_albums( album_order, tag, max_results )
     local url = "http://api.jamendo.com/get2/id+name+artist_name+album_image/album/xml/?imagesize=500&order=" .. album_order .. "&n=" .. max_results
     if tag ~= nil then
@@ -69,10 +77,11 @@ function add_top_albums( album_order, tag, max_results )
 end
 
 function add_top_tracks( track_order, tag, max_results )
-    local url = "http://api.jamendo.com/get2/id+name+duration+artist_name+album_name+album_genre+album_image+album_dates/track/xml/track_album+album_artist/?imagesize=500&order=" .. track_order .. "&n=" .. max_results
+    local url = "http://api.jamendo.com/get2/id+name+duration+artist_name+album_name+genre+album_image+album_dates/track/xml/track_album+album_artist/?imagesize=500&order=" .. track_order .. "&n=" .. max_results
     if tag ~= nil then
-        url = url .. "&tag_idstr=" .. tag
+        url = url .. "&tag_minweight=0.35&tag_idstr=" .. tag
     end
+
     local tree = simplexml.parse_url( url )
     local node_name = "Top " .. max_results
     if track_order == "rating_desc" then node_name = node_name .. " most popular tracks"
@@ -86,16 +95,16 @@ function add_top_tracks( track_order, tag, max_results )
     elseif track_order == "needreviews_desc" then node_name = node_name .. " tracks requiring review"
     end
     if tag ~= nil then
-        node_name = tag .. " - " .. node_name
+        node_name = string.upper(tag) .. " - " .. node_name
     end
     local node = vlc.sd.add_node( {title=node_name} )
     for _, track in ipairs( tree.children ) do
         simplexml.add_name_maps( track )
         node:add_subitem( {path="http://api.jamendo.com/get2/stream/track/redirect/?id=" .. track.children_map["id"][1].children[1],
-                           title=track.children_map["name"][1].children[1],
+                           title=track.children_map["artist_name"][1].children[1].." - "..track.children_map["name"][1].children[1],
                            artist=track.children_map["artist_name"][1].children[1],
                            album=track.children_map["album_name"][1].children[1],
-                           genre=track.children_map["album_genre"][1].children[1],
+                           genre=track.children_map["genre"][1].children[1],
                            date=track.children_map["album_dates"][1].children_map["year"][1].children[1],
                            arturl=track.children_map["album_image"][1].children[1],
                            duration=track.children_map["duration"][1].children[1]} )



More information about the vlc-commits mailing list