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
43567b83
Commit
43567b83
authored
Aug 28, 2013
by
Ludovic Fauvet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cue.lua: remove tabs
parent
3e43d99c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
81 additions
and
81 deletions
+81
-81
share/lua/playlist/cue.lua
share/lua/playlist/cue.lua
+81
-81
No files found.
share/lua/playlist/cue.lua
View file @
43567b83
...
@@ -21,13 +21,13 @@
...
@@ -21,13 +21,13 @@
-- Probe function.
-- Probe function.
function
probe
()
function
probe
()
if
(
not
string.match
(
string.upper
(
vlc
.
path
),
".CUE$"
)
)
then
if
(
not
string.match
(
string.upper
(
vlc
.
path
),
".CUE$"
)
)
then
return
false
return
false
end
end
header
=
vlc
.
peek
(
2048
)
header
=
vlc
.
peek
(
2048
)
return
string.match
(
header
,
"FILE.*WAVE%s*[\r\n]+"
)
or
return
string.match
(
header
,
"FILE.*WAVE%s*[\r\n]+"
)
or
string.match
(
header
,
"FILE.*AIFF%s*[\r\n]+"
)
or
string.match
(
header
,
"FILE.*AIFF%s*[\r\n]+"
)
or
string.match
(
header
,
"FILE.*MP3%s*[\r\n]+"
)
string.match
(
header
,
"FILE.*MP3%s*[\r\n]+"
)
end
end
-- Helpers
-- Helpers
...
@@ -36,106 +36,106 @@ function is_utf8( src )
...
@@ -36,106 +36,106 @@ function is_utf8( src )
end
end
function
cue_string
(
src
)
function
cue_string
(
src
)
if
not
is_utf8
(
src
)
then
if
not
is_utf8
(
src
)
then
-- Convert to UTF-8 since it's probably Latin1
-- Convert to UTF-8 since it's probably Latin1
src
=
vlc
.
strings
.
from_charset
(
"ISO_8859-1"
,
src
)
src
=
vlc
.
strings
.
from_charset
(
"ISO_8859-1"
,
src
)
end
end
local
sub
=
string.match
(
src
,
"^\"
(.
*
)
\
".*$"
);
local
sub
=
string.match
(
src
,
"^\"
(.
*
)
\
".*$"
);
if
(
sub
)
then
if
(
sub
)
then
return
sub
return
sub
end
end
return
string.match
(
src
,
"^(%S+).*$"
)
return
string.match
(
src
,
"^(%S+).*$"
)
end
end
function
cue_path
(
src
)
function
cue_path
(
src
)
if
(
string.match
(
src
,
"^/"
)
or
if
(
string.match
(
src
,
"^/"
)
or
string.match
(
src
,
"^\\"
)
or
string.match
(
src
,
"^\\"
)
or
string.match
(
src
,
"^[%l%u]:\\"
)
)
then
string.match
(
src
,
"^[%l%u]:\\"
)
)
then
return
vlc
.
strings
.
make_uri
(
src
)
return
vlc
.
strings
.
make_uri
(
src
)
end
end
local
slash
=
string.find
(
string.reverse
(
vlc
.
path
),
'/'
)
local
slash
=
string.find
(
string.reverse
(
vlc
.
path
),
'/'
)
local
prefix
=
vlc
.
access
..
"://"
..
string.sub
(
vlc
.
path
,
1
,
-
slash
)
local
prefix
=
vlc
.
access
..
"://"
..
string.sub
(
vlc
.
path
,
1
,
-
slash
)
-- FIXME: postfix may not be encoded correctly (esp. slashes)
-- FIXME: postfix may not be encoded correctly (esp. slashes)
local
postfix
=
vlc
.
strings
.
encode_uri_component
(
src
)
local
postfix
=
vlc
.
strings
.
encode_uri_component
(
src
)
return
prefix
..
postfix
return
prefix
..
postfix
end
end
function
cue_track
(
global
,
track
)
function
cue_track
(
global
,
track
)
if
(
track
.
index01
==
nil
)
then
if
(
track
.
index01
==
nil
)
then
return
nil
return
nil
end
end
t
=
{}
t
=
{}
t
.
path
=
cue_path
(
track
.
file
or
global
.
file
)
t
.
path
=
cue_path
(
track
.
file
or
global
.
file
)
t
.
title
=
track
.
title
t
.
title
=
track
.
title
t
.
album
=
global
.
title
t
.
album
=
global
.
title
t
.
artist
=
track
.
performer
or
global
.
performer
t
.
artist
=
track
.
performer
or
global
.
performer
t
.
genre
=
track
.
genre
or
global
.
genre
t
.
genre
=
track
.
genre
or
global
.
genre
t
.
date
=
track
.
date
or
global
.
date
t
.
date
=
track
.
date
or
global
.
date
t
.
description
=
global
.
comment
t
.
description
=
global
.
comment
t
.
tracknum
=
track
.
num
t
.
tracknum
=
track
.
num
t
.
options
=
{
":start-time="
..
math.floor
(
track
.
index01
)
}
t
.
options
=
{
":start-time="
..
math.floor
(
track
.
index01
)
}
return
t
return
t
end
end
function
cue_append
(
tracks
,
global
,
track
)
function
cue_append
(
tracks
,
global
,
track
)
local
t
=
cue_track
(
global
,
track
)
local
t
=
cue_track
(
global
,
track
)
if
(
t
~=
nil
)
then
if
(
t
~=
nil
)
then
if
(
#
tracks
>
0
)
then
if
(
#
tracks
>
0
)
then
local
prev
=
tracks
[
#
tracks
]
local
prev
=
tracks
[
#
tracks
]
table.insert
(
prev
.
options
,
":stop-time="
..
math.floor
(
track
.
index01
)
)
table.insert
(
prev
.
options
,
":stop-time="
..
math.floor
(
track
.
index01
)
)
end
end
table.insert
(
tracks
,
t
)
table.insert
(
tracks
,
t
)
end
end
end
end
-- Parse function.
-- Parse function.
function
parse
()
function
parse
()
p
=
{}
p
=
{}
global_data
=
nil
global_data
=
nil
data
=
{}
data
=
{}
file
=
nil
file
=
nil
while
true
while
true
do
do
line
=
vlc
.
readline
()
line
=
vlc
.
readline
()
if
not
line
then
break
end
if
not
line
then
break
end
cmd
,
arg
=
string.match
(
line
,
"^%s*(%S+)%s*(.*)$"
)
cmd
,
arg
=
string.match
(
line
,
"^%s*(%S+)%s*(.*)$"
)
if
(
cmd
==
"REM"
and
arg
)
then
if
(
cmd
==
"REM"
and
arg
)
then
subcmd
,
value
=
string.match
(
arg
,
"^(%S+)%s*(.*)$"
)
subcmd
,
value
=
string.match
(
arg
,
"^(%S+)%s*(.*)$"
)
if
(
subcmd
==
"GENRE"
and
value
)
then
if
(
subcmd
==
"GENRE"
and
value
)
then
data
.
genre
=
cue_string
(
value
)
data
.
genre
=
cue_string
(
value
)
elseif
(
subcmd
==
"DATE"
and
value
)
then
elseif
(
subcmd
==
"DATE"
and
value
)
then
data
.
date
=
cue_string
(
value
)
data
.
date
=
cue_string
(
value
)
elseif
(
subcmd
==
"COMMENT"
and
value
)
then
elseif
(
subcmd
==
"COMMENT"
and
value
)
then
data
.
comment
=
cue_string
(
value
)
data
.
comment
=
cue_string
(
value
)
end
end
elseif
(
cmd
==
"PERFORMER"
and
arg
)
then
elseif
(
cmd
==
"PERFORMER"
and
arg
)
then
data
.
performer
=
cue_string
(
arg
)
data
.
performer
=
cue_string
(
arg
)
elseif
(
cmd
==
"TITLE"
and
arg
)
then
elseif
(
cmd
==
"TITLE"
and
arg
)
then
data
.
title
=
cue_string
(
arg
)
data
.
title
=
cue_string
(
arg
)
elseif
(
cmd
==
"FILE"
)
then
elseif
(
cmd
==
"FILE"
)
then
file
=
cue_string
(
arg
)
file
=
cue_string
(
arg
)
elseif
(
cmd
==
"TRACK"
)
then
elseif
(
cmd
==
"TRACK"
)
then
if
(
not
global_data
)
then
if
(
not
global_data
)
then
global_data
=
data
global_data
=
data
else
else
cue_append
(
p
,
global_data
,
data
)
cue_append
(
p
,
global_data
,
data
)
end
end
data
=
{
file
=
file
,
num
=
string.match
(
arg
,
"^(%d+)"
)
}
data
=
{
file
=
file
,
num
=
string.match
(
arg
,
"^(%d+)"
)
}
elseif
(
cmd
==
"INDEX"
)
then
elseif
(
cmd
==
"INDEX"
)
then
local
idx
,
m
,
s
,
f
=
string.match
(
arg
,
"(%d+)%s+(%d+):(%d+):(%d+)"
)
local
idx
,
m
,
s
,
f
=
string.match
(
arg
,
"(%d+)%s+(%d+):(%d+):(%d+)"
)
if
(
idx
==
"01"
and
m
~=
nil
and
s
~=
nil
and
f
~=
nil
)
then
if
(
idx
==
"01"
and
m
~=
nil
and
s
~=
nil
and
f
~=
nil
)
then
data
.
index01
=
m
*
60
+
s
+
f
/
75
data
.
index01
=
m
*
60
+
s
+
f
/
75
end
end
end
end
end
end
cue_append
(
p
,
global_data
,
data
)
cue_append
(
p
,
global_data
,
data
)
return
p
return
p
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