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
dee36954
Commit
dee36954
authored
Sep 09, 2010
by
Rémi Duraffort
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
librivox: some cleanup and add the book author as artist of the item.
parent
d51c1abd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
7 deletions
+13
-7
share/lua/sd/librivox.lua
share/lua/sd/librivox.lua
+13
-7
No files found.
share/lua/sd/librivox.lua
View file @
dee36954
...
...
@@ -26,6 +26,7 @@ function descriptor()
return
{
title
=
'librivox'
}
end
-- Transform a duration 'mm:ss' or 'hh::mm::ss' into an integer
function
string_2_duration
(
str
)
local
index
=
string.find
(
str
,
':'
)
if
(
index
==
nil
)
then
return
str
...
...
@@ -41,27 +42,32 @@ end
function
main
()
local
podcast
=
simplexml
.
parse_url
(
'http://librivox.org/podcast.xml'
)
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
if
(
item
.
name
==
'item'
)
then
simplexml
.
add_name_maps
(
item
)
-- If the book title is unknown, create a node for it in the sd
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
}
)
if
(
books
[
book_title
]
==
nil
)
then
books
[
book_title
]
=
vlc
.
sd
.
add_node
(
{
title
=
book_title
,
arturl
=
arturl
}
)
end
-- Add the new chapter to the book
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
],
artist
=
item
.
children_map
[
'itunes:author'
][
1
].
children
[
1
],
duration
=
string_2_duration
(
item
.
children_map
[
'itunes:duration'
][
1
].
children
[
1
]
),
arturl
=
arturl
}
)
elseif
(
item
.
name
==
'itunes:image'
)
then
elseif
(
item
.
name
==
'itunes:image'
)
then
arturl
=
item
.
attributes
[
'href'
]
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