Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
87200ffb
Commit
87200ffb
authored
Aug 31, 2010
by
Rémi Duraffort
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lua_sd: add an sd for magnatune (proof of concept for the moment).
parent
6a93cd19
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
59 additions
and
0 deletions
+59
-0
share/lua/sd/magnatune.lua
share/lua/sd/magnatune.lua
+59
-0
No files found.
share/lua/sd/magnatune.lua
0 → 100644
View file @
87200ffb
--[[
$Id$
Copyright © 2010 VideoLAN and AUTHORS
Authors: Rémi Duraffort <ivoire at videolan dot org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
--]]
require
"simplexml"
function
descriptor
()
return
{
title
=
"Magnatune"
}
end
function
main
()
add_top_albums
()
end
function
add_top_albums
()
local
fd
=
vlc
.
stream
(
"http://magnatune.com/genres/m3u/ranked_all.xspf"
)
if
not
fd
then
return
end
local
file
=
''
local
line
=
''
while
line
~=
nil
do
line
=
fd
:
readline
()
if
line
~=
nil
then
-- repair the XML stream if needed
file
=
file
..
string.gsub
(
line
,
' & '
,
' & '
)
end
end
local
node
=
vlc
.
sd
.
add_node
(
{
title
=
"Most popular albums"
}
)
local
tree
=
simplexml
.
parse_string
(
file
)
simplexml
.
add_name_maps
(
tree
)
local
track_list
=
tree
.
children_map
[
'trackList'
][
1
]
for
_
,
track
in
ipairs
(
track_list
.
children
)
do
simplexml
.
add_name_maps
(
track
)
local
track_item
=
node
:
add_subitem
(
{
path
=
string.gsub
(
track
.
children_map
[
'location'
][
1
].
children
[
1
],
' '
,
'%%20'
),
title
=
track
.
children_map
[
'annotation'
][
1
].
children
[
1
],
arturl
=
track
.
children_map
[
'image'
][
1
].
children
[
1
]
})
end
end
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