Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
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-gpu
Commits
e0b2c38d
Commit
e0b2c38d
authored
Aug 22, 2010
by
Rémi Duraffort
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
appletrailer: sort the elements of the playlist.
parent
30a80a47
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
3 deletions
+26
-3
share/lua/playlist/appletrailers.lua
share/lua/playlist/appletrailers.lua
+26
-3
No files found.
share/lua/playlist/appletrailers.lua
View file @
e0b2c38d
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
movie URL
movie URL
$Id$
$Id$
Copyright © 2007 the VideoLAN team
Copyright © 2007
-2010
the VideoLAN team
This program is free software; you can redistribute it and/or modify
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
it under the terms of the GNU General Public License as published by
...
@@ -31,6 +31,27 @@ function find( haystack, needle )
...
@@ -31,6 +31,27 @@ function find( haystack, needle )
return
r
return
r
end
end
function
sort
(
a
,
b
)
if
(
a
==
nil
)
then
return
false
end
if
(
b
==
nil
)
then
return
false
end
local
str_a
local
str_b
if
(
string.find
(
a
.
name
,
'%('
)
==
1
)
then
str_a
=
tonumber
(
string.sub
(
a
.
name
,
2
,
string.find
(
a
.
name
,
'p'
)
-
1
))
str_b
=
tonumber
(
string.sub
(
b
.
name
,
2
,
string.find
(
b
.
name
,
'p'
)
-
1
))
else
str_a
=
string.sub
(
a
.
name
,
1
,
string.find
(
a
.
name
,
'%('
)
-
2
)
str_b
=
string.sub
(
b
.
name
,
1
,
string.find
(
b
.
name
,
'%('
)
-
2
)
if
(
str_a
==
str_b
)
then
str_a
=
tonumber
(
string.sub
(
a
.
name
,
string.len
(
str_a
)
+
3
,
string.find
(
a
.
name
,
'p'
,
string.len
(
str_a
)
+
3
)
-
1
))
str_b
=
tonumber
(
string.sub
(
b
.
name
,
string.len
(
str_b
)
+
3
,
string.find
(
b
.
name
,
'p'
,
string.len
(
str_b
)
+
3
)
-
1
))
end
end
if
(
str_a
>
str_b
)
then
return
false
else
return
true
end
end
-- Parse function.
-- Parse function.
function
parse
()
function
parse
()
local
playlist
=
{}
local
playlist
=
{}
...
@@ -43,7 +64,7 @@ function parse()
...
@@ -43,7 +64,7 @@ function parse()
if
not
line
then
break
end
if
not
line
then
break
end
if
string.match
(
line
,
"class=\"
.
-
first
" ) then
if
string.match
(
line
,
"class=\"
.
-
first
" ) then
description = find( line, "
h
%
d
.
->
(.
-
)
</
h
%
d
")
description = find( line, "
h
%
d
.
->
(.
-
)
</
h
%
d
")
.. ' '
end
end
if string.match( line, 'img src=') then
if string.match( line, 'img src=') then
for img in string.gmatch(line, '<img src="
(
http
:
//
.
*
\
.
jpg
)
" ') do
for img in string.gmatch(line, '<img src="
(
http
:
//
.
*
\
.
jpg
)
" ') do
...
@@ -59,11 +80,13 @@ function parse()
...
@@ -59,11 +80,13 @@ function parse()
for urlline,resolution in string.gmatch(line, "
class
=
\
"hd\"
.
-
href
=
\
"(.-.mov)\"
.
-
(
%
d
+
.
-
p
)
") do
for urlline,resolution in string.gmatch(line, "
class
=
\
"hd\"
.
-
href
=
\
"(.-.mov)\"
.
-
(
%
d
+
.
-
p
)
") do
urlline = string.gsub( urlline, "
_
"..resolution, "
_h
"..resolution )
urlline = string.gsub( urlline, "
_
"..resolution, "
_h
"..resolution )
table.insert( playlist, { path = urlline,
table.insert( playlist, { path = urlline,
name = description ..
"
(
" .. resolution .. "
)
"
,
name = description ..
'(' .. resolution .. ')'
,
arturl = art_url,
arturl = art_url,
options = {"
:
http
-
user
-
agent
=
QuickTime
/
7
.
2
", "
:
demux
=
avformat
,
ffmpeg
","
:
play
-
and
-
pause
"} } )
options = {"
:
http
-
user
-
agent
=
QuickTime
/
7
.
2
", "
:
demux
=
avformat
,
ffmpeg
","
:
play
-
and
-
pause
"} } )
end
end
end
end
end
end
table.sort(playlist, sort)
return playlist
return playlist
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