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
292d1dbd
Commit
292d1dbd
authored
Oct 14, 2011
by
Jean-Baptiste Kempf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
luahttp: Remove tabs, trailing spaces and reindent
parent
273a7a9c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
357 additions
and
357 deletions
+357
-357
share/lua/intf/modules/httprequests.lua
share/lua/intf/modules/httprequests.lua
+357
-357
No files found.
share/lua/intf/modules/httprequests.lua
View file @
292d1dbd
...
@@ -35,27 +35,27 @@ end
...
@@ -35,27 +35,27 @@ end
--split text where it matches the delimiter
--split text where it matches the delimiter
function
strsplit
(
text
,
delimiter
)
function
strsplit
(
text
,
delimiter
)
local
strfind
=
string.find
local
strfind
=
string.find
local
strsub
=
string.sub
local
strsub
=
string.sub
local
tinsert
=
table.insert
local
tinsert
=
table.insert
local
list
=
{}
local
list
=
{}
local
pos
=
1
local
pos
=
1
if
strfind
(
""
,
delimiter
,
1
)
then
-- this would result in endless loops
if
strfind
(
""
,
delimiter
,
1
)
then
-- this would result in endless loops
error
(
"delimiter matches empty string!"
)
error
(
"delimiter matches empty string!"
)
end
end
local
i
=
1
local
i
=
1
while
1
do
while
1
do
i
=
i
+
1
i
=
i
+
1
local
first
,
last
=
strfind
(
text
,
delimiter
,
pos
)
local
first
,
last
=
strfind
(
text
,
delimiter
,
pos
)
if
first
then
-- found?
if
first
then
-- found?
tinsert
(
list
,
i
,
strsub
(
text
,
pos
,
first
-
1
))
tinsert
(
list
,
i
,
strsub
(
text
,
pos
,
first
-
1
))
pos
=
last
+
1
pos
=
last
+
1
else
else
tinsert
(
list
,
i
,
strsub
(
text
,
pos
))
tinsert
(
list
,
i
,
strsub
(
text
,
pos
))
break
break
end
end
end
end
return
list
return
list
end
end
function
round
(
what
,
precision
)
function
round
(
what
,
precision
)
...
@@ -66,123 +66,123 @@ end
...
@@ -66,123 +66,123 @@ end
processcommands
=
function
()
processcommands
=
function
()
local
input
=
_GET
[
'input'
]
local
input
=
_GET
[
'input'
]
local
command
=
_GET
[
'command'
]
local
command
=
_GET
[
'command'
]
local
id
=
tonumber
(
_GET
[
'id'
]
or
-
1
)
local
id
=
tonumber
(
_GET
[
'id'
]
or
-
1
)
local
val
=
_GET
[
'val'
]
local
val
=
_GET
[
'val'
]
local
options
=
_GET
[
'option'
]
local
options
=
_GET
[
'option'
]
local
band
=
_GET
[
'band'
]
local
band
=
_GET
[
'band'
]
if
type
(
options
)
~=
"table"
then
-- Deal with the 0 or 1 option case
if
type
(
options
)
~=
"table"
then
-- Deal with the 0 or 1 option case
options
=
{
options
}
options
=
{
options
}
end
end
if
command
==
"in_play"
then
if
command
==
"in_play"
then
--[[
--[[
vlc.msg.err( "<options>" )
vlc.msg.err( "<options>" )
for a,b in ipairs(options) do
for a,b in ipairs(options) do
vlc.msg.err(b)
vlc.msg.err(b)
end
end
vlc.msg.err( "</options>" )
vlc.msg.err( "</options>" )
--]]
--]]
vlc
.
playlist
.
add
({{
path
=
vlc
.
strings
.
make_uri
(
input
),
options
=
options
}})
vlc
.
playlist
.
add
({{
path
=
vlc
.
strings
.
make_uri
(
input
),
options
=
options
}})
elseif
command
==
"addsubtitle"
then
elseif
command
==
"addsubtitle"
then
vlc
.
input
.
add_subtitle
(
vlc
.
strings
.
make_uri
(
val
))
vlc
.
input
.
add_subtitle
(
vlc
.
strings
.
make_uri
(
val
))
elseif
command
==
"in_enqueue"
then
elseif
command
==
"in_enqueue"
then
vlc
.
playlist
.
enqueue
({{
path
=
vlc
.
strings
.
make_uri
(
input
),
options
=
options
}})
vlc
.
playlist
.
enqueue
({{
path
=
vlc
.
strings
.
make_uri
(
input
),
options
=
options
}})
elseif
command
==
"pl_play"
then
elseif
command
==
"pl_play"
then
if
id
==
-
1
then
if
id
==
-
1
then
vlc
.
playlist
.
play
()
vlc
.
playlist
.
play
()
else
else
vlc
.
playlist
.
goto
(
id
)
vlc
.
playlist
.
goto
(
id
)
end
end
elseif
command
==
"pl_pause"
then
elseif
command
==
"pl_pause"
then
if
vlc
.
playlist
.
status
()
==
"stopped"
then
if
vlc
.
playlist
.
status
()
==
"stopped"
then
if
id
==
-
1
then
if
id
==
-
1
then
vlc
.
playlist
.
play
()
vlc
.
playlist
.
play
()
else
else
vlc
.
playlist
.
goto
(
id
)
vlc
.
playlist
.
goto
(
id
)
end
end
else
else
vlc
.
playlist
.
pause
()
vlc
.
playlist
.
pause
()
end
end
elseif
command
==
"pl_forcepause"
then
elseif
command
==
"pl_forcepause"
then
if
vlc
.
playlist
.
status
()
==
"playing"
then
if
vlc
.
playlist
.
status
()
==
"playing"
then
vlc
.
playlist
.
pause
()
vlc
.
playlist
.
pause
()
end
end
elseif
command
==
"pl_forceresume"
then
elseif
command
==
"pl_forceresume"
then
if
vlc
.
playlist
.
status
()
==
"paused"
then
if
vlc
.
playlist
.
status
()
==
"paused"
then
vlc
.
playlist
.
pause
()
vlc
.
playlist
.
pause
()
end
end
elseif
command
==
"pl_stop"
then
elseif
command
==
"pl_stop"
then
vlc
.
playlist
.
stop
()
vlc
.
playlist
.
stop
()
elseif
command
==
"pl_next"
then
elseif
command
==
"pl_next"
then
vlc
.
playlist
.
next
()
vlc
.
playlist
.
next
()
elseif
command
==
"pl_previous"
then
elseif
command
==
"pl_previous"
then
vlc
.
playlist
.
prev
()
vlc
.
playlist
.
prev
()
elseif
command
==
"pl_delete"
then
elseif
command
==
"pl_delete"
then
vlc
.
playlist
.
delete
(
id
)
vlc
.
playlist
.
delete
(
id
)
elseif
command
==
"pl_empty"
then
elseif
command
==
"pl_empty"
then
vlc
.
playlist
.
clear
()
vlc
.
playlist
.
clear
()
elseif
command
==
"pl_sort"
then
elseif
command
==
"pl_sort"
then
vlc
.
playlist
.
sort
(
val
,
id
>
0
)
vlc
.
playlist
.
sort
(
val
,
id
>
0
)
elseif
command
==
"pl_random"
then
elseif
command
==
"pl_random"
then
vlc
.
playlist
.
random
()
vlc
.
playlist
.
random
()
elseif
command
==
"pl_loop"
then
elseif
command
==
"pl_loop"
then
--if loop is set true, then repeat needs to be set false
--if loop is set true, then repeat needs to be set false
if
vlc
.
playlist
.
loop
()
then
if
vlc
.
playlist
.
loop
()
then
vlc
.
playlist
.
repeat_
(
"off"
)
vlc
.
playlist
.
repeat_
(
"off"
)
end
end
elseif
command
==
"pl_repeat"
then
elseif
command
==
"pl_repeat"
then
--if repeat is set true, then loop needs to be set false
--if repeat is set true, then loop needs to be set false
if
vlc
.
playlist
.
repeat_
()
then
if
vlc
.
playlist
.
repeat_
()
then
vlc
.
playlist
.
loop
(
"off"
)
vlc
.
playlist
.
loop
(
"off"
)
end
end
elseif
command
==
"pl_sd"
then
elseif
command
==
"pl_sd"
then
if
vlc
.
sd
.
is_loaded
(
val
)
then
if
vlc
.
sd
.
is_loaded
(
val
)
then
vlc
.
sd
.
remove
(
val
)
vlc
.
sd
.
remove
(
val
)
else
else
vlc
.
sd
.
add
(
val
)
vlc
.
sd
.
add
(
val
)
end
end
elseif
command
==
"fullscreen"
then
elseif
command
==
"fullscreen"
then
vlc
.
video
.
fullscreen
()
vlc
.
video
.
fullscreen
()
elseif
command
==
"snapshot"
then
elseif
command
==
"snapshot"
then
common
.
snapshot
()
common
.
snapshot
()
elseif
command
==
"volume"
then
elseif
command
==
"volume"
then
common
.
volume
(
val
)
common
.
volume
(
val
)
elseif
command
==
"seek"
then
elseif
command
==
"seek"
then
common
.
seek
(
val
)
common
.
seek
(
val
)
elseif
command
==
"key"
then
elseif
command
==
"key"
then
common
.
hotkey
(
"key-"
..
val
)
common
.
hotkey
(
"key-"
..
val
)
elseif
command
==
"audiodelay"
then
elseif
command
==
"audiodelay"
then
if
vlc
.
object
.
input
()
and
val
then
if
vlc
.
object
.
input
()
and
val
then
vlc
.
var
.
set
(
vlc
.
object
.
input
(),
"audio-delay"
,
val
)
vlc
.
var
.
set
(
vlc
.
object
.
input
(),
"audio-delay"
,
val
)
end
end
elseif
command
==
"rate"
then
elseif
command
==
"rate"
then
if
vlc
.
object
.
input
()
and
tonumber
(
val
)
>=
0
then
if
vlc
.
object
.
input
()
and
tonumber
(
val
)
>=
0
then
vlc
.
var
.
set
(
vlc
.
object
.
input
(),
"rate"
,
val
)
vlc
.
var
.
set
(
vlc
.
object
.
input
(),
"rate"
,
val
)
end
end
elseif
command
==
"subdelay"
then
elseif
command
==
"subdelay"
then
if
vlc
.
object
.
input
()
then
if
vlc
.
object
.
input
()
then
vlc
.
var
.
set
(
vlc
.
object
.
input
(),
"spu-delay"
,
val
)
vlc
.
var
.
set
(
vlc
.
object
.
input
(),
"spu-delay"
,
val
)
end
end
elseif
command
==
"aspectratio"
then
elseif
command
==
"aspectratio"
then
if
vlc
.
object
.
vout
()
then
if
vlc
.
object
.
vout
()
then
vlc
.
var
.
set
(
vlc
.
object
.
vout
(),
"aspect-ratio"
,
val
)
vlc
.
var
.
set
(
vlc
.
object
.
vout
(),
"aspect-ratio"
,
val
)
end
end
elseif
command
==
"preamp"
then
elseif
command
==
"preamp"
then
vlc
.
equalizer
.
preampset
(
val
)
vlc
.
equalizer
.
preampset
(
val
)
elseif
command
==
"equalizer"
then
elseif
command
==
"equalizer"
then
vlc
.
equalizer
.
equalizerset
(
band
,
val
)
vlc
.
equalizer
.
equalizerset
(
band
,
val
)
elseif
command
==
"enableeq"
then
elseif
command
==
"enableeq"
then
if
val
==
'0'
then
vlc
.
equalizer
.
enable
(
false
)
else
vlc
.
equalizer
.
enable
(
true
)
end
if
val
==
'0'
then
vlc
.
equalizer
.
enable
(
false
)
else
vlc
.
equalizer
.
enable
(
true
)
end
elseif
command
==
"setpreset"
then
elseif
command
==
"setpreset"
then
vlc
.
equalizer
.
setpreset
(
val
)
vlc
.
equalizer
.
setpreset
(
val
)
end
end
local
input
=
nil
local
input
=
nil
local
command
=
nil
local
command
=
nil
local
id
=
nil
local
id
=
nil
local
val
=
nil
local
val
=
nil
end
end
...
@@ -190,58 +190,58 @@ end
...
@@ -190,58 +190,58 @@ end
function
xmlString
(
s
)
function
xmlString
(
s
)
if
(
type
(
s
)
==
"string"
)
then
if
(
type
(
s
)
==
"string"
)
then
return
vlc
.
strings
.
convert_xml_special_chars
(
s
)
return
vlc
.
strings
.
convert_xml_special_chars
(
s
)
else
else
return
tostring
(
s
)
return
tostring
(
s
)
end
end
end
end
--dkjson outputs numbered tables as arrays
--dkjson outputs numbered tables as arrays
--so we don't need the array indicators
--so we don't need the array indicators
function
removeArrayIndicators
(
dict
)
function
removeArrayIndicators
(
dict
)
local
newDict
=
dict
local
newDict
=
dict
for
k
,
v
in
pairs
(
dict
)
do
for
k
,
v
in
pairs
(
dict
)
do
if
(
type
(
v
)
==
"table"
)
then
if
(
type
(
v
)
==
"table"
)
then
local
arrayEntry
=
v
.
_array
local
arrayEntry
=
v
.
_array
if
arrayEntry
then
if
arrayEntry
then
v
=
arrayEntry
v
=
arrayEntry
end
end
dict
[
k
]
=
removeArrayIndicators
(
v
)
dict
[
k
]
=
removeArrayIndicators
(
v
)
end
end
end
end
return
newDict
return
newDict
end
end
printTableAsJson
=
function
(
dict
)
printTableAsJson
=
function
(
dict
)
dict
=
removeArrayIndicators
(
dict
)
dict
=
removeArrayIndicators
(
dict
)
local
output
=
dkjson
.
encode
(
dict
,
{
indent
=
true
})
local
output
=
dkjson
.
encode
(
dict
,
{
indent
=
true
})
print
(
output
)
print
(
output
)
end
end
local
printXmlKeyValue
=
function
(
k
,
v
,
indent
)
local
printXmlKeyValue
=
function
(
k
,
v
,
indent
)
print
(
"
\n
"
)
print
(
"
\n
"
)
for
i
=
1
,
indent
do
print
(
" "
)
end
for
i
=
1
,
indent
do
print
(
" "
)
end
if
(
k
)
then
if
(
k
)
then
print
(
"<"
..
k
..
">"
)
print
(
"<"
..
k
..
">"
)
end
end
if
(
type
(
v
)
==
"table"
)
then
if
(
type
(
v
)
==
"table"
)
then
printTableAsXml
(
v
,
indent
+
2
)
printTableAsXml
(
v
,
indent
+
2
)
else
else
print
(
xmlString
(
v
))
print
(
xmlString
(
v
))
end
end
if
(
k
)
then
if
(
k
)
then
print
(
"</"
..
xmlString
(
k
)
..
">"
)
print
(
"</"
..
xmlString
(
k
)
..
">"
)
end
end
end
end
printTableAsXml
=
function
(
dict
,
indent
)
printTableAsXml
=
function
(
dict
,
indent
)
for
k
,
v
in
pairs
(
dict
)
do
for
k
,
v
in
pairs
(
dict
)
do
printXmlKeyValue
(
k
,
v
,
indent
)
printXmlKeyValue
(
k
,
v
,
indent
)
end
end
end
end
...
@@ -261,140 +261,140 @@ end
...
@@ -261,140 +261,140 @@ end
--main accessors
--main accessors
getplaylist
=
function
()
getplaylist
=
function
()
local
p
local
p
if
_GET
[
"search"
]
then
if
_GET
[
"search"
]
then
if
_GET
[
"search"
]
~=
""
then
if
_GET
[
"search"
]
~=
""
then
_G
.
search_key
=
_GET
[
"search"
]
_G
.
search_key
=
_GET
[
"search"
]
else
else
_G
.
search_key
=
nil
_G
.
search_key
=
nil
end
end
local
key
=
vlc
.
strings
.
decode_uri
(
_GET
[
"search"
])
local
key
=
vlc
.
strings
.
decode_uri
(
_GET
[
"search"
])
p
=
vlc
.
playlist
.
search
(
key
)
p
=
vlc
.
playlist
.
search
(
key
)
else
else
p
=
vlc
.
playlist
.
get
()
p
=
vlc
.
playlist
.
get
()
end
end
--logTable(p) --Uncomment to debug
--logTable(p) --Uncomment to debug
return
p
return
p
end
end
parseplaylist
=
function
(
item
)
parseplaylist
=
function
(
item
)
if
item
.
flags
.
disabled
then
return
end
if
item
.
flags
.
disabled
then
return
end
if
(
item
.
children
)
then
if
(
item
.
children
)
then
local
result
=
{}
local
result
=
{}
local
name
=
(
item
.
name
or
""
)
local
name
=
(
item
.
name
or
""
)
result
[
"type"
]
=
"node"
result
[
"type"
]
=
"node"
result
.
id
=
tostring
(
item
.
id
)
result
.
id
=
tostring
(
item
.
id
)
result
.
name
=
tostring
(
name
)
result
.
name
=
tostring
(
name
)
result
.
ro
=
item
.
flags
.
ro
and
"ro"
or
"rw"
result
.
ro
=
item
.
flags
.
ro
and
"ro"
or
"rw"
--store children in an array
--store children in an array
--we use _array as a proxy for arrays
--we use _array as a proxy for arrays
result
.
children
=
{}
result
.
children
=
{}
result
.
children
.
_array
=
{}
result
.
children
.
_array
=
{}
for
_
,
child
in
ipairs
(
item
.
children
)
do
for
_
,
child
in
ipairs
(
item
.
children
)
do
local
nextChild
=
parseplaylist
(
child
)
local
nextChild
=
parseplaylist
(
child
)
table.insert
(
result
.
children
.
_array
,
nextChild
)
table.insert
(
result
.
children
.
_array
,
nextChild
)
end
end
return
result
return
result
else
else
local
result
=
{}
local
result
=
{}
local
name
,
path
=
item
.
name
or
""
local
name
,
path
=
item
.
name
or
""
local
path
=
item
.
path
or
""
local
path
=
item
.
path
or
""
local
current_item
=
vlc
.
input
.
item
()
local
current_item
=
vlc
.
input
.
item
()
-- Is the item the one currently played
-- Is the item the one currently played
if
(
current_item
~=
nil
)
then
if
(
current_item
~=
nil
)
then
if
(
vlc
.
input
.
item
().
uri
(
current_item
)
==
path
)
then
if
(
vlc
.
input
.
item
().
uri
(
current_item
)
==
path
)
then
result
.
current
=
"current"
result
.
current
=
"current"
end
end
end
end
result
[
"type"
]
=
"leaf"
result
[
"type"
]
=
"leaf"
result
.
id
=
tostring
(
item
.
id
)
result
.
id
=
tostring
(
item
.
id
)
result
.
uri
=
tostring
(
path
)
result
.
uri
=
tostring
(
path
)
result
.
name
=
name
result
.
name
=
name
result
.
ro
=
item
.
flags
.
ro
and
"ro"
or
"rw"
result
.
ro
=
item
.
flags
.
ro
and
"ro"
or
"rw"
result
.
duration
=
math.floor
(
item
.
duration
)
result
.
duration
=
math.floor
(
item
.
duration
)
return
result
return
result
end
end
end
end
playlisttable
=
function
()
playlisttable
=
function
()
local
basePlaylist
=
getplaylist
()
local
basePlaylist
=
getplaylist
()
return
parseplaylist
(
basePlaylist
)
return
parseplaylist
(
basePlaylist
)
end
end
getbrowsetable
=
function
()
getbrowsetable
=
function
()
local
dir
=
nil
local
dir
=
nil
local
uri
=
_GET
[
"uri"
]
local
uri
=
_GET
[
"uri"
]
--uri takes precedence, but fall back to dir
--uri takes precedence, but fall back to dir
if
uri
then
if
uri
then
dir
=
vlc
.
strings
.
make_path
(
uri
)
dir
=
vlc
.
strings
.
make_path
(
uri
)
else
else
dir
=
_GET
[
"dir"
]
dir
=
_GET
[
"dir"
]
end
end
--backwards compatibility with old format driveLetter:\\..
--backwards compatibility with old format driveLetter:\\..
--this is forgiving with the slash type and number
--this is forgiving with the slash type and number
local
position
=
string.find
(
dir
,
'%a:[\\/]*%.%.'
,
0
)
local
position
=
string.find
(
dir
,
'%a:[\\/]*%.%.'
,
0
)
if
position
==
1
then
dir
=
""
end
if
position
==
1
then
dir
=
""
end
local
result
=
{}
local
result
=
{}
--paths are returned as an array of elements
--paths are returned as an array of elements
result
.
element
=
{}
result
.
element
=
{}
result
.
element
.
_array
=
{}
result
.
element
.
_array
=
{}
if
dir
then
if
dir
then
if
dir
==
"~"
then
dir
=
vlc
.
misc
.
homedir
()
end
if
dir
==
"~"
then
dir
=
vlc
.
misc
.
homedir
()
end
-- FIXME: hack for Win32 drive list
-- FIXME: hack for Win32 drive list
if
dir
~=
""
then
if
dir
~=
""
then
dir
=
common
.
realpath
(
dir
..
"/"
)
dir
=
common
.
realpath
(
dir
..
"/"
)
end
end
local
d
=
vlc
.
net
.
opendir
(
dir
)
local
d
=
vlc
.
net
.
opendir
(
dir
)
table.sort
(
d
)
table.sort
(
d
)
for
_
,
f
in
pairs
(
d
)
do
for
_
,
f
in
pairs
(
d
)
do
if
f
==
".."
or
not
string.match
(
f
,
"^%."
)
then
if
f
==
".."
or
not
string.match
(
f
,
"^%."
)
then
local
df
=
common
.
realpath
(
dir
..
f
)
local
df
=
common
.
realpath
(
dir
..
f
)
local
s
=
vlc
.
net
.
stat
(
df
)
local
s
=
vlc
.
net
.
stat
(
df
)
local
path
,
name
=
df
,
f
local
path
,
name
=
df
,
f
local
element
=
{}
local
element
=
{}
for
k
,
v
in
pairs
(
s
)
do
for
k
,
v
in
pairs
(
s
)
do
element
[
k
]
=
v
element
[
k
]
=
v
end
end
element
[
"path"
]
=
path
element
[
"path"
]
=
path
element
[
"name"
]
=
name
element
[
"name"
]
=
name
local
uri
=
vlc
.
strings
.
make_uri
(
df
)
local
uri
=
vlc
.
strings
.
make_uri
(
df
)
--windows paths are returned with / separators, but make_uri expects \ for windows and returns nil
--windows paths are returned with / separators, but make_uri expects \ for windows and returns nil
if
not
uri
then
if
not
uri
then
--convert failed path to windows format and try again
--convert failed path to windows format and try again
path
=
string.gsub
(
path
,
"/"
,
"
\\
"
)
path
=
string.gsub
(
path
,
"/"
,
"
\\
"
)
uri
=
vlc
.
strings
.
make_uri
(
df
)
uri
=
vlc
.
strings
.
make_uri
(
df
)
end
end
element
[
"uri"
]
=
uri
element
[
"uri"
]
=
uri
table.insert
(
result
.
element
.
_array
,
element
)
table.insert
(
result
.
element
.
_array
,
element
)
end
end
end
end
end
end
return
result
;
return
result
;
end
end
...
@@ -407,92 +407,92 @@ local playlist = vlc.object.playlist()
...
@@ -407,92 +407,92 @@ local playlist = vlc.object.playlist()
local
vout
=
vlc
.
object
.
vout
()
local
vout
=
vlc
.
object
.
vout
()
local
aout
=
vlc
.
object
.
aout
()
local
aout
=
vlc
.
object
.
aout
()
local
s
=
{}
local
s
=
{}
--update api version when new data/commands added
--update api version when new data/commands added
s
.
apiversion
=
1
s
.
apiversion
=
1
s
.
version
=
vlc
.
misc
.
version
()
s
.
version
=
vlc
.
misc
.
version
()
s
.
volume
=
vlc
.
volume
.
get
()
s
.
volume
=
vlc
.
volume
.
get
()
if
input
then
if
input
then
s
.
length
=
math.floor
(
vlc
.
var
.
get
(
input
,
"length"
))
s
.
length
=
math.floor
(
vlc
.
var
.
get
(
input
,
"length"
))
s
.
time
=
math.floor
(
vlc
.
var
.
get
(
input
,
"time"
))
s
.
time
=
math.floor
(
vlc
.
var
.
get
(
input
,
"time"
))
s
.
position
=
vlc
.
var
.
get
(
input
,
"position"
)
s
.
position
=
vlc
.
var
.
get
(
input
,
"position"
)
s
.
audiodelay
=
vlc
.
var
.
get
(
input
,
"audio-delay"
)
s
.
audiodelay
=
vlc
.
var
.
get
(
input
,
"audio-delay"
)
s
.
rate
=
vlc
.
var
.
get
(
input
,
"rate"
)
s
.
rate
=
vlc
.
var
.
get
(
input
,
"rate"
)
s
.
subtitledelay
=
vlc
.
var
.
get
(
input
,
"spu-delay"
)
s
.
subtitledelay
=
vlc
.
var
.
get
(
input
,
"spu-delay"
)
else
else
s
.
length
=
0
s
.
length
=
0
s
.
time
=
0
s
.
time
=
0
s
.
position
=
0
s
.
position
=
0
s
.
audiodelay
=
0
s
.
audiodelay
=
0
s
.
rate
=
1
s
.
rate
=
1
s
.
subtitledelay
=
0
s
.
subtitledelay
=
0
end
end
if
vout
then
if
vout
then
s
.
fullscreen
=
vlc
.
var
.
get
(
vout
,
"fullscreen"
)
s
.
fullscreen
=
vlc
.
var
.
get
(
vout
,
"fullscreen"
)
s
.
aspectratio
=
vlc
.
var
.
get
(
vout
,
"aspect-ratio"
);
s
.
aspectratio
=
vlc
.
var
.
get
(
vout
,
"aspect-ratio"
);
if
s
.
aspectratio
==
""
then
s
.
aspectratio
=
"default"
end
if
s
.
aspectratio
==
""
then
s
.
aspectratio
=
"default"
end
else
else
s
.
fullscreen
=
0
s
.
fullscreen
=
0
end
end
if
aout
then
if
aout
then
local
filters
=
vlc
.
var
.
get
(
aout
,
"audio-filter"
)
local
filters
=
vlc
.
var
.
get
(
aout
,
"audio-filter"
)
local
temp
=
strsplit
(
filters
,
":"
)
local
temp
=
strsplit
(
filters
,
":"
)
s
.
audiofilters
=
{}
s
.
audiofilters
=
{}
local
id
=
0
local
id
=
0
for
i
,
j
in
pairs
(
temp
)
do
for
i
,
j
in
pairs
(
temp
)
do
s
.
audiofilters
[
'filter_'
..
id
]
=
j
s
.
audiofilters
[
'filter_'
..
id
]
=
j
id
=
id
+
1
id
=
id
+
1
end
end
end
end
s
.
videoeffects
=
{}
s
.
videoeffects
=
{}
s
.
videoeffects
.
hue
=
round
(
vlc
.
config
.
get
(
"hue"
),
2
)
s
.
videoeffects
.
hue
=
round
(
vlc
.
config
.
get
(
"hue"
),
2
)
s
.
videoeffects
.
brightness
=
round
(
vlc
.
config
.
get
(
"brightness"
),
2
)
s
.
videoeffects
.
brightness
=
round
(
vlc
.
config
.
get
(
"brightness"
),
2
)
s
.
videoeffects
.
contrast
=
round
(
vlc
.
config
.
get
(
"contrast"
),
2
)
s
.
videoeffects
.
contrast
=
round
(
vlc
.
config
.
get
(
"contrast"
),
2
)
s
.
videoeffects
.
saturation
=
round
(
vlc
.
config
.
get
(
"saturation"
),
2
)
s
.
videoeffects
.
saturation
=
round
(
vlc
.
config
.
get
(
"saturation"
),
2
)
s
.
videoeffects
.
gamma
=
round
(
vlc
.
config
.
get
(
"gamma"
),
2
)
s
.
videoeffects
.
gamma
=
round
(
vlc
.
config
.
get
(
"gamma"
),
2
)
s
.
state
=
vlc
.
playlist
.
status
()
s
.
state
=
vlc
.
playlist
.
status
()
s
.
random
=
vlc
.
var
.
get
(
playlist
,
"random"
)
s
.
random
=
vlc
.
var
.
get
(
playlist
,
"random"
)
s
.
loop
=
vlc
.
var
.
get
(
playlist
,
"loop"
)
s
.
loop
=
vlc
.
var
.
get
(
playlist
,
"loop"
)
s
[
"repeat"
]
=
vlc
.
var
.
get
(
playlist
,
"repeat"
)
s
[
"repeat"
]
=
vlc
.
var
.
get
(
playlist
,
"repeat"
)
s
.
equalizer
=
{}
s
.
equalizer
=
{}
s
.
equalizer
.
preamp
=
round
(
vlc
.
equalizer
.
preampget
(),
2
)
s
.
equalizer
.
preamp
=
round
(
vlc
.
equalizer
.
preampget
(),
2
)
s
.
equalizer
.
bands
=
vlc
.
equalizer
.
equalizerget
()
s
.
equalizer
.
bands
=
vlc
.
equalizer
.
equalizerget
()
if
s
.
equalizer
.
bands
~=
null
then
if
s
.
equalizer
.
bands
~=
null
then
for
k
,
i
in
pairs
(
s
.
equalizer
.
bands
)
do
s
.
equalizer
.
bands
[
k
]
=
round
(
i
,
2
)
end
for
k
,
i
in
pairs
(
s
.
equalizer
.
bands
)
do
s
.
equalizer
.
bands
[
k
]
=
round
(
i
,
2
)
end
s
.
equalizer
.
presets
=
vlc
.
equalizer
.
presets
()
s
.
equalizer
.
presets
=
vlc
.
equalizer
.
presets
()
end
end
if
(
includecategories
and
item
)
then
if
(
includecategories
and
item
)
then
s
.
information
=
{}
s
.
information
=
{}
s
.
information
.
category
=
{}
s
.
information
.
category
=
{}
s
.
information
.
category
.
meta
=
item
:
metas
()
s
.
information
.
category
.
meta
=
item
:
metas
()
local
info
=
item
:
info
()
local
info
=
item
:
info
()
for
k
,
v
in
pairs
(
info
)
do
for
k
,
v
in
pairs
(
info
)
do
local
streamTable
=
{}
local
streamTable
=
{}
for
k2
,
v2
in
pairs
(
v
)
do
for
k2
,
v2
in
pairs
(
v
)
do
local
tag
=
string.gsub
(
k2
,
" "
,
"_"
)
local
tag
=
string.gsub
(
k2
,
" "
,
"_"
)
streamTable
[
tag
]
=
v2
streamTable
[
tag
]
=
v2
end
end
s
.
information
.
category
[
k
]
=
streamTable
s
.
information
.
category
[
k
]
=
streamTable
end
end
s
.
stats
=
{}
s
.
stats
=
{}
local
statsdata
=
item
:
stats
()
local
statsdata
=
item
:
stats
()
for
k
,
v
in
pairs
(
statsdata
)
do
for
k
,
v
in
pairs
(
statsdata
)
do
local
tag
=
string.gsub
(
k
,
"_"
,
""
)
local
tag
=
string.gsub
(
k
,
"_"
,
""
)
s
.
stats
[
tag
]
=
v
s
.
stats
[
tag
]
=
v
end
end
end
end
return
s
return
s
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