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
bdea03db
Commit
bdea03db
authored
Oct 25, 2010
by
Rémi Duraffort
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lua_sd_channels: implement the search function.
parent
ab20299e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
0 deletions
+23
-0
share/lua/sd/metachannels.lua
share/lua/sd/metachannels.lua
+23
-0
No files found.
share/lua/sd/metachannels.lua
View file @
bdea03db
...
@@ -26,6 +26,29 @@ function descriptor()
...
@@ -26,6 +26,29 @@ function descriptor()
return
{
title
=
"Channels.com"
}
return
{
title
=
"Channels.com"
}
end
end
function
search
(
string
)
-- Do the query
query
=
string.gsub
(
string
,
' '
,
'+'
)
local
feed
=
simplexml
.
parse_url
(
"http://www.metachannels.com/api/search?apikey=54868d5d73af69d6afa12d55db6f3d18735baa7d&searchTerms="
..
query
)
local
channel
=
feed
.
children
[
1
]
-- List all answers
local
node
=
vlc
.
sd
.
add_node
(
{
path
=
""
,
title
=
string
}
)
for
_
,
item
in
ipairs
(
channel
.
children
)
do
if
(
item
.
name
==
'item'
)
then
simplexml
.
add_name_maps
(
item
)
local
url
=
string.gsub
(
item
.
children_map
[
'link'
][
1
].
children
[
1
],
'&'
,
'&'
)
local
arturl
=
item
.
children_map
[
'media:thumbnail'
][
1
].
attributes
[
'url'
]
if
(
arturl
==
'/images/thumb_channel_default.jpg'
)
then
arturl
=
'http://www.metachannels.com/images/thumb_channel_default.jpg'
end
node
:
add_subitem
(
{
path
=
url
,
title
=
item
.
children_map
[
'title'
][
1
].
children
[
1
],
arturl
=
arturl
}
)
end
end
end
function
main
()
function
main
()
-- get the primary feed and parse the <channel> tag
-- get the primary feed and parse the <channel> tag
local
feed
=
simplexml
.
parse_url
(
"http://metachannels.com/meta_channels?device=vlc&lang=en,es,fr,de,it,other&format=rss&adult_ok=y"
)
local
feed
=
simplexml
.
parse_url
(
"http://metachannels.com/meta_channels?device=vlc&lang=en,es,fr,de,it,other&format=rss&adult_ok=y"
)
...
...
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