Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
cdf21929
Commit
cdf21929
authored
Feb 29, 2012
by
Claudio Ortelli
Committed by
Jean-Baptiste Kempf
Feb 29, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Jamendo selected charts by genre
Signed-off-by:
Jean-Baptiste Kempf
<
jb@videolan.org
>
parent
a6817c36
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
5 deletions
+14
-5
share/lua/sd/jamendo.lua
share/lua/sd/jamendo.lua
+14
-5
No files found.
share/lua/sd/jamendo.lua
View file @
cdf21929
...
...
@@ -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
]}
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment