Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
b03e4ae6
Commit
b03e4ae6
authored
Sep 05, 2019
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
queue/Save: move code to LoadQueueSong()
parent
57808d1a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
16 deletions
+21
-16
QueueSave.cxx
src/queue/QueueSave.cxx
+21
-16
No files found.
src/queue/QueueSave.cxx
View file @
b03e4ae6
...
...
@@ -73,6 +73,26 @@ queue_save(BufferedOutputStream &os, const Queue &queue)
}
}
static
std
::
unique_ptr
<
DetachedSong
>
LoadQueueSong
(
TextFile
&
file
,
const
char
*
line
)
{
std
::
unique_ptr
<
DetachedSong
>
song
;
if
(
const
char
*
p
=
StringAfterPrefix
(
line
,
SONG_BEGIN
))
{
const
char
*
uri
=
p
;
return
song_load
(
file
,
uri
);
}
else
{
char
*
endptr
;
long
ret
=
strtol
(
line
,
&
endptr
,
10
);
if
(
ret
<
0
||
*
endptr
!=
':'
||
endptr
[
1
]
==
0
)
throw
std
::
runtime_error
(
"Malformed playlist line in state file"
);
const
char
*
uri
=
endptr
+
1
;
return
std
::
make_unique
<
DetachedSong
>
(
uri
);
}
}
void
queue_load_song
(
TextFile
&
file
,
const
SongLoader
&
loader
,
const
char
*
line
,
Queue
&
queue
)
...
...
@@ -90,22 +110,7 @@ queue_load_song(TextFile &file, const SongLoader &loader,
return
;
}
std
::
unique_ptr
<
DetachedSong
>
song
;
if
((
p
=
StringAfterPrefix
(
line
,
SONG_BEGIN
)))
{
const
char
*
uri
=
p
;
song
=
song_load
(
file
,
uri
);
}
else
{
char
*
endptr
;
long
ret
=
strtol
(
line
,
&
endptr
,
10
);
if
(
ret
<
0
||
*
endptr
!=
':'
||
endptr
[
1
]
==
0
)
throw
std
::
runtime_error
(
"Malformed playlist line in state file"
);
const
char
*
uri
=
endptr
+
1
;
song
=
std
::
make_unique
<
DetachedSong
>
(
uri
);
}
auto
song
=
LoadQueueSong
(
file
,
line
);
if
(
!
playlist_check_translate_song
(
*
song
,
nullptr
,
loader
))
return
;
...
...
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