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
e2281441
Commit
e2281441
authored
Apr 13, 2016
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
command/playlist: eliminate spl_print() calls
playlist_file_print() already handles stored playlists. spl_print() is never called with a successful result.
parent
9431a7b0
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
60 deletions
+4
-60
PlaylistPrint.cxx
src/PlaylistPrint.cxx
+0
-43
PlaylistPrint.hxx
src/PlaylistPrint.hxx
+0
-11
PlaylistCommands.cxx
src/command/PlaylistCommands.cxx
+4
-6
No files found.
src/PlaylistPrint.cxx
View file @
e2281441
...
...
@@ -115,46 +115,3 @@ playlist_print_changes_position(Response &r,
queue_print_changes_position
(
r
,
playlist
.
queue
,
version
,
start
,
end
);
}
#ifdef ENABLE_DATABASE
static
bool
PrintSongDetails
(
Response
&
r
,
Partition
&
partition
,
const
char
*
uri_utf8
)
{
const
Database
*
db
=
partition
.
instance
.
database
;
if
(
db
==
nullptr
)
return
false
;
const
LightSong
*
song
;
try
{
song
=
db
->
GetSong
(
uri_utf8
);
}
catch
(
const
std
::
runtime_error
&
e
)
{
return
false
;
}
song_print_info
(
r
,
partition
,
*
song
);
db
->
ReturnSong
(
song
);
return
true
;
}
#endif
void
spl_print
(
Response
&
r
,
Partition
&
partition
,
const
char
*
name_utf8
,
bool
detail
)
{
#ifndef ENABLE_DATABASE
(
void
)
partition
;
(
void
)
detail
;
#endif
PlaylistFileContents
contents
=
LoadPlaylistFile
(
name_utf8
);
for
(
const
auto
&
uri_utf8
:
contents
)
{
#ifdef ENABLE_DATABASE
if
(
!
detail
||
!
PrintSongDetails
(
r
,
partition
,
uri_utf8
.
c_str
()))
#endif
r
.
Format
(
SONG_FILE
"%s
\n
"
,
uri_utf8
.
c_str
());
}
}
src/PlaylistPrint.hxx
View file @
e2281441
...
...
@@ -91,15 +91,4 @@ playlist_print_changes_position(Response &r,
uint32_t
version
,
unsigned
start
,
unsigned
end
);
/**
* Send the stored playlist to the client.
*
* @param client the client which requested the playlist
* @param name_utf8 the name of the stored playlist in UTF-8 encoding
* @param detail true if all details should be printed
*/
void
spl_print
(
Response
&
r
,
Partition
&
partition
,
const
char
*
name_utf8
,
bool
detail
);
#endif
src/command/PlaylistCommands.cxx
View file @
e2281441
...
...
@@ -22,9 +22,9 @@
#include "Request.hxx"
#include "db/DatabasePlaylist.hxx"
#include "CommandError.hxx"
#include "PlaylistPrint.hxx"
#include "PlaylistSave.hxx"
#include "PlaylistFile.hxx"
#include "PlaylistError.hxx"
#include "db/PlaylistVector.hxx"
#include "SongLoader.hxx"
#include "BulkEdit.hxx"
...
...
@@ -85,11 +85,10 @@ handle_listplaylist(Client &client, Request args, Response &r)
const
char
*
const
name
=
args
.
front
();
if
(
playlist_file_print
(
r
,
client
.
partition
,
SongLoader
(
client
),
name
,
false
))
name
,
false
))
return
CommandResult
::
OK
;
spl_print
(
r
,
client
.
partition
,
name
,
false
);
return
CommandResult
::
OK
;
throw
PlaylistError
::
NoSuchList
();
}
CommandResult
...
...
@@ -101,8 +100,7 @@ handle_listplaylistinfo(Client &client, Request args, Response &r)
name
,
true
))
return
CommandResult
::
OK
;
spl_print
(
r
,
client
.
partition
,
name
,
true
);
return
CommandResult
::
OK
;
throw
PlaylistError
::
NoSuchList
();
}
CommandResult
...
...
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