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
71ce1a25
Commit
71ce1a25
authored
Feb 24, 2017
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SongPrint: remove Storage::MapToRelativeUTF8() call
This code (added 7 years ago with commit
b233c145
) has been obsoleted by the SongLoader class (added 3 years ago).
parent
cd522f52
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
71 additions
and
107 deletions
+71
-107
PlaylistPrint.cxx
src/PlaylistPrint.cxx
+12
-18
PlaylistPrint.hxx
src/PlaylistPrint.hxx
+6
-13
SongPrint.cxx
src/SongPrint.cxx
+9
-24
SongPrint.hxx
src/SongPrint.hxx
+4
-9
OtherCommands.cxx
src/command/OtherCommands.cxx
+2
-2
PlayerCommands.cxx
src/command/PlayerCommands.cxx
+1
-1
QueueCommands.cxx
src/command/QueueCommands.cxx
+6
-8
StickerCommands.cxx
src/command/StickerCommands.cxx
+1
-3
DatabasePrint.cxx
src/db/DatabasePrint.cxx
+8
-10
Print.cxx
src/playlist/Print.cxx
+8
-4
QueuePrint.cxx
src/queue/QueuePrint.cxx
+10
-10
QueuePrint.hxx
src/queue/QueuePrint.hxx
+4
-5
No files found.
src/PlaylistPrint.cxx
View file @
71ce1a25
...
@@ -33,17 +33,15 @@
...
@@ -33,17 +33,15 @@
#define SONG_TIME "Time: "
#define SONG_TIME "Time: "
void
void
playlist_print_uris
(
Response
&
r
,
Partition
&
partition
,
playlist_print_uris
(
Response
&
r
,
const
playlist
&
playlist
)
const
playlist
&
playlist
)
{
{
const
Queue
&
queue
=
playlist
.
queue
;
const
Queue
&
queue
=
playlist
.
queue
;
queue_print_uris
(
r
,
partition
,
queue
,
0
,
queue
.
GetLength
());
queue_print_uris
(
r
,
queue
,
0
,
queue
.
GetLength
());
}
}
void
void
playlist_print_info
(
Response
&
r
,
Partition
&
partition
,
playlist_print_info
(
Response
&
r
,
const
playlist
&
playlist
,
const
playlist
&
playlist
,
unsigned
start
,
unsigned
end
)
unsigned
start
,
unsigned
end
)
{
{
const
Queue
&
queue
=
playlist
.
queue
;
const
Queue
&
queue
=
playlist
.
queue
;
...
@@ -56,11 +54,11 @@ playlist_print_info(Response &r, Partition &partition,
...
@@ -56,11 +54,11 @@ playlist_print_info(Response &r, Partition &partition,
/* an invalid "start" offset is fatal */
/* an invalid "start" offset is fatal */
throw
PlaylistError
::
BadRange
();
throw
PlaylistError
::
BadRange
();
queue_print_info
(
r
,
partition
,
queue
,
start
,
end
);
queue_print_info
(
r
,
queue
,
start
,
end
);
}
}
void
void
playlist_print_id
(
Response
&
r
,
Partition
&
partition
,
const
playlist
&
playlist
,
playlist_print_id
(
Response
&
r
,
const
playlist
&
playlist
,
unsigned
id
)
unsigned
id
)
{
{
int
position
;
int
position
;
...
@@ -70,38 +68,34 @@ playlist_print_id(Response &r, Partition &partition, const playlist &playlist,
...
@@ -70,38 +68,34 @@ playlist_print_id(Response &r, Partition &partition, const playlist &playlist,
/* no such song */
/* no such song */
throw
PlaylistError
::
NoSuchSong
();
throw
PlaylistError
::
NoSuchSong
();
playlist_print_info
(
r
,
partition
,
playlist_print_info
(
r
,
playlist
,
position
,
position
+
1
);
playlist
,
position
,
position
+
1
);
}
}
bool
bool
playlist_print_current
(
Response
&
r
,
Partition
&
partition
,
playlist_print_current
(
Response
&
r
,
const
playlist
&
playlist
)
const
playlist
&
playlist
)
{
{
int
current_position
=
playlist
.
GetCurrentPosition
();
int
current_position
=
playlist
.
GetCurrentPosition
();
if
(
current_position
<
0
)
if
(
current_position
<
0
)
return
false
;
return
false
;
queue_print_info
(
r
,
p
artition
,
p
laylist
.
queue
,
queue_print_info
(
r
,
playlist
.
queue
,
current_position
,
current_position
+
1
);
current_position
,
current_position
+
1
);
return
true
;
return
true
;
}
}
void
void
playlist_print_find
(
Response
&
r
,
Partition
&
partition
,
playlist_print_find
(
Response
&
r
,
const
playlist
&
playlist
,
const
playlist
&
playlist
,
const
SongFilter
&
filter
)
const
SongFilter
&
filter
)
{
{
queue_find
(
r
,
p
artition
,
p
laylist
.
queue
,
filter
);
queue_find
(
r
,
playlist
.
queue
,
filter
);
}
}
void
void
playlist_print_changes_info
(
Response
&
r
,
Partition
&
partition
,
playlist_print_changes_info
(
Response
&
r
,
const
playlist
&
playlist
,
const
playlist
&
playlist
,
uint32_t
version
,
uint32_t
version
,
unsigned
start
,
unsigned
end
)
unsigned
start
,
unsigned
end
)
{
{
queue_print_changes_info
(
r
,
p
artition
,
p
laylist
.
queue
,
version
,
queue_print_changes_info
(
r
,
playlist
.
queue
,
version
,
start
,
end
);
start
,
end
);
}
}
...
...
src/PlaylistPrint.hxx
View file @
71ce1a25
...
@@ -23,7 +23,6 @@
...
@@ -23,7 +23,6 @@
#include <stdint.h>
#include <stdint.h>
struct
playlist
;
struct
playlist
;
struct
Partition
;
class
SongFilter
;
class
SongFilter
;
class
Response
;
class
Response
;
...
@@ -31,8 +30,7 @@ class Response;
...
@@ -31,8 +30,7 @@ class Response;
* Sends the whole playlist to the client, song URIs only.
* Sends the whole playlist to the client, song URIs only.
*/
*/
void
void
playlist_print_uris
(
Response
&
r
,
Partition
&
partition
,
playlist_print_uris
(
Response
&
r
,
const
playlist
&
playlist
);
const
playlist
&
playlist
);
/**
/**
* Sends a range of the playlist to the client, including all known
* Sends a range of the playlist to the client, including all known
...
@@ -43,8 +41,7 @@ playlist_print_uris(Response &r, Partition &partition,
...
@@ -43,8 +41,7 @@ playlist_print_uris(Response &r, Partition &partition,
* Throws #PlaylistError if the range is invalid.
* Throws #PlaylistError if the range is invalid.
*/
*/
void
void
playlist_print_info
(
Response
&
r
,
Partition
&
partition
,
playlist_print_info
(
Response
&
r
,
const
playlist
&
playlist
,
const
playlist
&
playlist
,
unsigned
start
,
unsigned
end
);
unsigned
start
,
unsigned
end
);
/**
/**
...
@@ -53,8 +50,7 @@ playlist_print_info(Response &r, Partition &partition,
...
@@ -53,8 +50,7 @@ playlist_print_info(Response &r, Partition &partition,
* Throws #PlaylistError if the range is invalid.
* Throws #PlaylistError if the range is invalid.
*/
*/
void
void
playlist_print_id
(
Response
&
r
,
Partition
&
partition
,
playlist_print_id
(
Response
&
r
,
const
playlist
&
playlist
,
unsigned
id
);
const
playlist
&
playlist
,
unsigned
id
);
/**
/**
* Sends the current song to the client.
* Sends the current song to the client.
...
@@ -62,23 +58,20 @@ playlist_print_id(Response &r, Partition &partition,
...
@@ -62,23 +58,20 @@ playlist_print_id(Response &r, Partition &partition,
* @return true on success, false if there is no current song
* @return true on success, false if there is no current song
*/
*/
bool
bool
playlist_print_current
(
Response
&
r
,
Partition
&
partition
,
playlist_print_current
(
Response
&
r
,
const
playlist
&
playlist
);
const
playlist
&
playlist
);
/**
/**
* Find songs in the playlist.
* Find songs in the playlist.
*/
*/
void
void
playlist_print_find
(
Response
&
r
,
Partition
&
partition
,
playlist_print_find
(
Response
&
r
,
const
playlist
&
playlist
,
const
playlist
&
playlist
,
const
SongFilter
&
filter
);
const
SongFilter
&
filter
);
/**
/**
* Print detailed changes since the specified playlist version.
* Print detailed changes since the specified playlist version.
*/
*/
void
void
playlist_print_changes_info
(
Response
&
r
,
Partition
&
partition
,
playlist_print_changes_info
(
Response
&
r
,
const
playlist
&
playlist
,
const
playlist
&
playlist
,
uint32_t
version
,
uint32_t
version
,
unsigned
start
,
unsigned
end
);
unsigned
start
,
unsigned
end
);
...
...
src/SongPrint.cxx
View file @
71ce1a25
...
@@ -33,24 +33,13 @@
...
@@ -33,24 +33,13 @@
#define SONG_FILE "file: "
#define SONG_FILE "file: "
static
void
static
void
song_print_uri
(
Response
&
r
,
Partition
&
partition
,
const
char
*
uri
,
bool
base
)
song_print_uri
(
Response
&
r
,
const
char
*
uri
,
bool
base
)
{
{
std
::
string
allocated
;
std
::
string
allocated
;
if
(
base
)
{
if
(
base
)
{
uri
=
PathTraitsUTF8
::
GetBase
(
uri
);
uri
=
PathTraitsUTF8
::
GetBase
(
uri
);
}
else
{
}
else
{
#ifdef ENABLE_DATABASE
const
Storage
*
storage
=
partition
.
instance
.
storage
;
if
(
storage
!=
nullptr
)
{
const
char
*
suffix
=
storage
->
MapToRelativeUTF8
(
uri
);
if
(
suffix
!=
nullptr
)
uri
=
suffix
;
}
#else
(
void
)
partition
;
#endif
allocated
=
uri_remove_auth
(
uri
);
allocated
=
uri_remove_auth
(
uri
);
if
(
!
allocated
.
empty
())
if
(
!
allocated
.
empty
())
uri
=
allocated
.
c_str
();
uri
=
allocated
.
c_str
();
...
@@ -60,20 +49,18 @@ song_print_uri(Response &r, Partition &partition, const char *uri, bool base)
...
@@ -60,20 +49,18 @@ song_print_uri(Response &r, Partition &partition, const char *uri, bool base)
}
}
void
void
song_print_uri
(
Response
&
r
,
Partition
&
partition
,
song_print_uri
(
Response
&
r
,
const
LightSong
&
song
,
bool
base
)
const
LightSong
&
song
,
bool
base
)
{
{
if
(
!
base
&&
song
.
directory
!=
nullptr
)
if
(
!
base
&&
song
.
directory
!=
nullptr
)
r
.
Format
(
SONG_FILE
"%s/%s
\n
"
,
song
.
directory
,
song
.
uri
);
r
.
Format
(
SONG_FILE
"%s/%s
\n
"
,
song
.
directory
,
song
.
uri
);
else
else
song_print_uri
(
r
,
partition
,
song
.
uri
,
base
);
song_print_uri
(
r
,
song
.
uri
,
base
);
}
}
void
void
song_print_uri
(
Response
&
r
,
Partition
&
partition
,
song_print_uri
(
Response
&
r
,
const
DetachedSong
&
song
,
bool
base
)
const
DetachedSong
&
song
,
bool
base
)
{
{
song_print_uri
(
r
,
partition
,
song
.
GetURI
(),
base
);
song_print_uri
(
r
,
song
.
GetURI
(),
base
);
}
}
static
void
static
void
...
@@ -95,10 +82,9 @@ PrintRange(Response &r, SongTime start_time, SongTime end_time)
...
@@ -95,10 +82,9 @@ PrintRange(Response &r, SongTime start_time, SongTime end_time)
}
}
void
void
song_print_info
(
Response
&
r
,
Partition
&
partition
,
song_print_info
(
Response
&
r
,
const
LightSong
&
song
,
bool
base
)
const
LightSong
&
song
,
bool
base
)
{
{
song_print_uri
(
r
,
partition
,
song
,
base
);
song_print_uri
(
r
,
song
,
base
);
PrintRange
(
r
,
song
.
start_time
,
song
.
end_time
);
PrintRange
(
r
,
song
.
start_time
,
song
.
end_time
);
...
@@ -109,10 +95,9 @@ song_print_info(Response &r, Partition &partition,
...
@@ -109,10 +95,9 @@ song_print_info(Response &r, Partition &partition,
}
}
void
void
song_print_info
(
Response
&
r
,
Partition
&
partition
,
song_print_info
(
Response
&
r
,
const
DetachedSong
&
song
,
bool
base
)
const
DetachedSong
&
song
,
bool
base
)
{
{
song_print_uri
(
r
,
partition
,
song
,
base
);
song_print_uri
(
r
,
song
,
base
);
PrintRange
(
r
,
song
.
GetStartTime
(),
song
.
GetEndTime
());
PrintRange
(
r
,
song
.
GetStartTime
(),
song
.
GetEndTime
());
...
...
src/SongPrint.hxx
View file @
71ce1a25
...
@@ -23,22 +23,17 @@
...
@@ -23,22 +23,17 @@
struct
LightSong
;
struct
LightSong
;
class
DetachedSong
;
class
DetachedSong
;
class
Response
;
class
Response
;
struct
Partition
;
void
void
song_print_info
(
Response
&
r
,
Partition
&
partition
,
song_print_info
(
Response
&
r
,
const
DetachedSong
&
song
,
bool
base
=
false
);
const
DetachedSong
&
song
,
bool
base
=
false
);
void
void
song_print_info
(
Response
&
r
,
Partition
&
partition
,
song_print_info
(
Response
&
r
,
const
LightSong
&
song
,
bool
base
=
false
);
const
LightSong
&
song
,
bool
base
=
false
);
void
void
song_print_uri
(
Response
&
r
,
Partition
&
partition
,
song_print_uri
(
Response
&
r
,
const
LightSong
&
song
,
bool
base
=
false
);
const
LightSong
&
song
,
bool
base
=
false
);
void
void
song_print_uri
(
Response
&
r
,
Partition
&
partition
,
song_print_uri
(
Response
&
r
,
const
DetachedSong
&
song
,
bool
base
=
false
);
const
DetachedSong
&
song
,
bool
base
=
false
);
#endif
#endif
src/command/OtherCommands.cxx
View file @
71ce1a25
...
@@ -193,7 +193,7 @@ handle_lsinfo_relative(Client &client, Response &r, const char *uri)
...
@@ -193,7 +193,7 @@ handle_lsinfo_relative(Client &client, Response &r, const char *uri)
}
}
static
CommandResult
static
CommandResult
handle_lsinfo_path
(
Client
&
client
,
Response
&
r
,
handle_lsinfo_path
(
Client
&
,
Response
&
r
,
const
char
*
path_utf8
,
Path
path_fs
)
const
char
*
path_utf8
,
Path
path_fs
)
{
{
DetachedSong
song
(
path_utf8
);
DetachedSong
song
(
path_utf8
);
...
@@ -202,7 +202,7 @@ handle_lsinfo_path(Client &client, Response &r,
...
@@ -202,7 +202,7 @@ handle_lsinfo_path(Client &client, Response &r,
return
CommandResult
::
ERROR
;
return
CommandResult
::
ERROR
;
}
}
song_print_info
(
r
,
client
.
partition
,
song
);
song_print_info
(
r
,
song
);
return
CommandResult
::
OK
;
return
CommandResult
::
OK
;
}
}
...
...
src/command/PlayerCommands.cxx
View file @
71ce1a25
...
@@ -86,7 +86,7 @@ handle_stop(Client &client, gcc_unused Request args, gcc_unused Response &r)
...
@@ -86,7 +86,7 @@ handle_stop(Client &client, gcc_unused Request args, gcc_unused Response &r)
CommandResult
CommandResult
handle_currentsong
(
Client
&
client
,
gcc_unused
Request
args
,
Response
&
r
)
handle_currentsong
(
Client
&
client
,
gcc_unused
Request
args
,
Response
&
r
)
{
{
playlist_print_current
(
r
,
client
.
p
artition
,
client
.
p
laylist
);
playlist_print_current
(
r
,
client
.
playlist
);
return
CommandResult
::
OK
;
return
CommandResult
::
OK
;
}
}
...
...
src/command/QueueCommands.cxx
View file @
71ce1a25
...
@@ -188,7 +188,7 @@ handle_deleteid(Client &client, Request args, gcc_unused Response &r)
...
@@ -188,7 +188,7 @@ handle_deleteid(Client &client, Request args, gcc_unused Response &r)
CommandResult
CommandResult
handle_playlist
(
Client
&
client
,
gcc_unused
Request
args
,
Response
&
r
)
handle_playlist
(
Client
&
client
,
gcc_unused
Request
args
,
Response
&
r
)
{
{
playlist_print_uris
(
r
,
client
.
p
artition
,
client
.
p
laylist
);
playlist_print_uris
(
r
,
client
.
playlist
);
return
CommandResult
::
OK
;
return
CommandResult
::
OK
;
}
}
...
@@ -212,8 +212,7 @@ handle_plchanges(Client &client, Request args, Response &r)
...
@@ -212,8 +212,7 @@ handle_plchanges(Client &client, Request args, Response &r)
{
{
uint32_t
version
=
ParseCommandArgU32
(
args
.
front
());
uint32_t
version
=
ParseCommandArgU32
(
args
.
front
());
RangeArg
range
=
args
.
ParseOptional
(
1
,
RangeArg
::
All
());
RangeArg
range
=
args
.
ParseOptional
(
1
,
RangeArg
::
All
());
playlist_print_changes_info
(
r
,
client
.
partition
,
playlist_print_changes_info
(
r
,
client
.
playlist
,
version
,
client
.
playlist
,
version
,
range
.
start
,
range
.
end
);
range
.
start
,
range
.
end
);
return
CommandResult
::
OK
;
return
CommandResult
::
OK
;
}
}
...
@@ -233,7 +232,7 @@ handle_playlistinfo(Client &client, Request args, Response &r)
...
@@ -233,7 +232,7 @@ handle_playlistinfo(Client &client, Request args, Response &r)
{
{
RangeArg
range
=
args
.
ParseOptional
(
0
,
RangeArg
::
All
());
RangeArg
range
=
args
.
ParseOptional
(
0
,
RangeArg
::
All
());
playlist_print_info
(
r
,
client
.
p
artition
,
client
.
p
laylist
,
playlist_print_info
(
r
,
client
.
playlist
,
range
.
start
,
range
.
end
);
range
.
start
,
range
.
end
);
return
CommandResult
::
OK
;
return
CommandResult
::
OK
;
}
}
...
@@ -243,10 +242,9 @@ handle_playlistid(Client &client, Request args, Response &r)
...
@@ -243,10 +242,9 @@ handle_playlistid(Client &client, Request args, Response &r)
{
{
if
(
!
args
.
IsEmpty
())
{
if
(
!
args
.
IsEmpty
())
{
unsigned
id
=
args
.
ParseUnsigned
(
0
);
unsigned
id
=
args
.
ParseUnsigned
(
0
);
playlist_print_id
(
r
,
client
.
partition
,
playlist_print_id
(
r
,
client
.
playlist
,
id
);
client
.
playlist
,
id
);
}
else
{
}
else
{
playlist_print_info
(
r
,
client
.
p
artition
,
client
.
p
laylist
,
playlist_print_info
(
r
,
client
.
playlist
,
0
,
std
::
numeric_limits
<
unsigned
>::
max
());
0
,
std
::
numeric_limits
<
unsigned
>::
max
());
}
}
...
@@ -263,7 +261,7 @@ handle_playlist_match(Client &client, Request args, Response &r,
...
@@ -263,7 +261,7 @@ handle_playlist_match(Client &client, Request args, Response &r,
return
CommandResult
::
ERROR
;
return
CommandResult
::
ERROR
;
}
}
playlist_print_find
(
r
,
client
.
p
artition
,
client
.
p
laylist
,
filter
);
playlist_print_find
(
r
,
client
.
playlist
,
filter
);
return
CommandResult
::
OK
;
return
CommandResult
::
OK
;
}
}
...
...
src/command/StickerCommands.cxx
View file @
71ce1a25
...
@@ -33,7 +33,6 @@
...
@@ -33,7 +33,6 @@
struct
sticker_song_find_data
{
struct
sticker_song_find_data
{
Response
&
r
;
Response
&
r
;
Partition
&
partition
;
const
char
*
name
;
const
char
*
name
;
};
};
...
@@ -44,7 +43,7 @@ sticker_song_find_print_cb(const LightSong &song, const char *value,
...
@@ -44,7 +43,7 @@ sticker_song_find_print_cb(const LightSong &song, const char *value,
struct
sticker_song_find_data
*
data
=
struct
sticker_song_find_data
*
data
=
(
struct
sticker_song_find_data
*
)
user_data
;
(
struct
sticker_song_find_data
*
)
user_data
;
song_print_uri
(
data
->
r
,
data
->
partition
,
song
);
song_print_uri
(
data
->
r
,
song
);
sticker_print_value
(
data
->
r
,
data
->
name
,
value
);
sticker_print_value
(
data
->
r
,
data
->
name
,
value
);
}
}
...
@@ -137,7 +136,6 @@ handle_sticker_song(Response &r, Partition &partition, Request args)
...
@@ -137,7 +136,6 @@ handle_sticker_song(Response &r, Partition &partition, Request args)
struct
sticker_song_find_data
data
=
{
struct
sticker_song_find_data
data
=
{
r
,
r
,
partition
,
args
[
3
],
args
[
3
],
};
};
...
...
src/db/DatabasePrint.cxx
View file @
71ce1a25
...
@@ -96,10 +96,9 @@ print_playlist_in_directory(Response &r, bool base,
...
@@ -96,10 +96,9 @@ print_playlist_in_directory(Response &r, bool base,
}
}
static
void
static
void
PrintSongBrief
(
Response
&
r
,
Partition
&
partition
,
PrintSongBrief
(
Response
&
r
,
bool
base
,
const
LightSong
&
song
)
bool
base
,
const
LightSong
&
song
)
{
{
song_print_uri
(
r
,
partition
,
song
,
base
);
song_print_uri
(
r
,
song
,
base
);
if
(
song
.
tag
->
has_playlist
)
if
(
song
.
tag
->
has_playlist
)
/* this song file has an embedded CUE sheet */
/* this song file has an embedded CUE sheet */
...
@@ -108,10 +107,9 @@ PrintSongBrief(Response &r, Partition &partition,
...
@@ -108,10 +107,9 @@ PrintSongBrief(Response &r, Partition &partition,
}
}
static
void
static
void
PrintSongFull
(
Response
&
r
,
Partition
&
partition
,
PrintSongFull
(
Response
&
r
,
bool
base
,
const
LightSong
&
song
)
bool
base
,
const
LightSong
&
song
)
{
{
song_print_info
(
r
,
partition
,
song
,
base
);
song_print_info
(
r
,
song
,
base
);
if
(
song
.
tag
->
has_playlist
)
if
(
song
.
tag
->
has_playlist
)
/* this song file has an embedded CUE sheet */
/* this song file has an embedded CUE sheet */
...
@@ -182,7 +180,7 @@ db_selection_print(Response &r, Partition &partition,
...
@@ -182,7 +180,7 @@ db_selection_print(Response &r, Partition &partition,
std
::
ref
(
r
),
base
,
_1
)
std
::
ref
(
r
),
base
,
_1
)
:
VisitDirectory
();
:
VisitDirectory
();
VisitSong
s
=
std
::
bind
(
full
?
PrintSongFull
:
PrintSongBrief
,
VisitSong
s
=
std
::
bind
(
full
?
PrintSongFull
:
PrintSongBrief
,
std
::
ref
(
r
),
std
::
ref
(
partition
),
base
,
_1
);
std
::
ref
(
r
),
base
,
_1
);
const
auto
p
=
selection
.
filter
==
nullptr
const
auto
p
=
selection
.
filter
==
nullptr
?
std
::
bind
(
full
?
PrintPlaylistFull
:
PrintPlaylistBrief
,
?
std
::
bind
(
full
?
PrintPlaylistFull
:
PrintPlaylistBrief
,
std
::
ref
(
r
),
base
,
_1
,
_2
)
std
::
ref
(
r
),
base
,
_1
,
_2
)
...
@@ -248,9 +246,9 @@ db_selection_print(Response &r, Partition &partition,
...
@@ -248,9 +246,9 @@ db_selection_print(Response &r, Partition &partition,
}
}
static
void
static
void
PrintSongURIVisitor
(
Response
&
r
,
Partition
&
partition
,
const
LightSong
&
song
)
PrintSongURIVisitor
(
Response
&
r
,
const
LightSong
&
song
)
{
{
song_print_uri
(
r
,
partition
,
song
);
song_print_uri
(
r
,
song
);
}
}
static
void
static
void
...
@@ -279,7 +277,7 @@ PrintUniqueTags(Response &r, Partition &partition,
...
@@ -279,7 +277,7 @@ PrintUniqueTags(Response &r, Partition &partition,
if
(
type
==
LOCATE_TAG_FILE_TYPE
)
{
if
(
type
==
LOCATE_TAG_FILE_TYPE
)
{
using
namespace
std
::
placeholders
;
using
namespace
std
::
placeholders
;
const
auto
f
=
std
::
bind
(
PrintSongURIVisitor
,
const
auto
f
=
std
::
bind
(
PrintSongURIVisitor
,
std
::
ref
(
r
),
std
::
ref
(
partition
),
_1
);
std
::
ref
(
r
),
_1
);
db
.
Visit
(
selection
,
f
);
db
.
Visit
(
selection
,
f
);
}
else
{
}
else
{
assert
(
type
<
TAG_NUM_OF_ITEM_TYPES
);
assert
(
type
<
TAG_NUM_OF_ITEM_TYPES
);
...
...
src/playlist/Print.cxx
View file @
71ce1a25
...
@@ -31,7 +31,7 @@
...
@@ -31,7 +31,7 @@
#include "Instance.hxx"
#include "Instance.hxx"
static
void
static
void
playlist_provider_print
(
Response
&
r
,
Partition
&
partition
,
playlist_provider_print
(
Response
&
r
,
const
SongLoader
&
loader
,
const
SongLoader
&
loader
,
const
char
*
uri
,
const
char
*
uri
,
SongEnumerator
&
e
,
bool
detail
)
SongEnumerator
&
e
,
bool
detail
)
...
@@ -45,11 +45,11 @@ playlist_provider_print(Response &r, Partition &partition,
...
@@ -45,11 +45,11 @@ playlist_provider_print(Response &r, Partition &partition,
if
(
playlist_check_translate_song
(
*
song
,
base_uri
.
c_str
(),
if
(
playlist_check_translate_song
(
*
song
,
base_uri
.
c_str
(),
loader
)
&&
loader
)
&&
detail
)
detail
)
song_print_info
(
r
,
partition
,
*
song
);
song_print_info
(
r
,
*
song
);
else
else
/* fallback if no detail was requested or no
/* fallback if no detail was requested or no
detail was available */
detail was available */
song_print_uri
(
r
,
partition
,
*
song
);
song_print_uri
(
r
,
*
song
);
}
}
}
}
...
@@ -61,6 +61,10 @@ playlist_file_print(Response &r, Partition &partition,
...
@@ -61,6 +61,10 @@ playlist_file_print(Response &r, Partition &partition,
Mutex
mutex
;
Mutex
mutex
;
Cond
cond
;
Cond
cond
;
#ifndef ENABLE_DATABASE
(
void
)
partition
;
#endif
SongEnumerator
*
playlist
=
playlist_open_any
(
uri
,
SongEnumerator
*
playlist
=
playlist_open_any
(
uri
,
#ifdef ENABLE_DATABASE
#ifdef ENABLE_DATABASE
partition
.
instance
.
storage
,
partition
.
instance
.
storage
,
...
@@ -69,7 +73,7 @@ playlist_file_print(Response &r, Partition &partition,
...
@@ -69,7 +73,7 @@ playlist_file_print(Response &r, Partition &partition,
if
(
playlist
==
nullptr
)
if
(
playlist
==
nullptr
)
return
false
;
return
false
;
playlist_provider_print
(
r
,
partition
,
loader
,
uri
,
*
playlist
,
detail
);
playlist_provider_print
(
r
,
loader
,
uri
,
*
playlist
,
detail
);
delete
playlist
;
delete
playlist
;
return
true
;
return
true
;
}
}
src/queue/QueuePrint.cxx
View file @
71ce1a25
...
@@ -33,10 +33,10 @@
...
@@ -33,10 +33,10 @@
* @param end the index of the last song (excluding)
* @param end the index of the last song (excluding)
*/
*/
static
void
static
void
queue_print_song_info
(
Response
&
r
,
Partition
&
partition
,
const
Queue
&
queue
,
queue_print_song_info
(
Response
&
r
,
const
Queue
&
queue
,
unsigned
position
)
unsigned
position
)
{
{
song_print_info
(
r
,
partition
,
queue
.
Get
(
position
));
song_print_info
(
r
,
queue
.
Get
(
position
));
r
.
Format
(
"Pos: %u
\n
Id: %u
\n
"
,
r
.
Format
(
"Pos: %u
\n
Id: %u
\n
"
,
position
,
queue
.
PositionToId
(
position
));
position
,
queue
.
PositionToId
(
position
));
...
@@ -46,18 +46,18 @@ queue_print_song_info(Response &r, Partition &partition, const Queue &queue,
...
@@ -46,18 +46,18 @@ queue_print_song_info(Response &r, Partition &partition, const Queue &queue,
}
}
void
void
queue_print_info
(
Response
&
r
,
Partition
&
partition
,
const
Queue
&
queue
,
queue_print_info
(
Response
&
r
,
const
Queue
&
queue
,
unsigned
start
,
unsigned
end
)
unsigned
start
,
unsigned
end
)
{
{
assert
(
start
<=
end
);
assert
(
start
<=
end
);
assert
(
end
<=
queue
.
GetLength
());
assert
(
end
<=
queue
.
GetLength
());
for
(
unsigned
i
=
start
;
i
<
end
;
++
i
)
for
(
unsigned
i
=
start
;
i
<
end
;
++
i
)
queue_print_song_info
(
r
,
partition
,
queue
,
i
);
queue_print_song_info
(
r
,
queue
,
i
);
}
}
void
void
queue_print_uris
(
Response
&
r
,
Partition
&
partition
,
const
Queue
&
queue
,
queue_print_uris
(
Response
&
r
,
const
Queue
&
queue
,
unsigned
start
,
unsigned
end
)
unsigned
start
,
unsigned
end
)
{
{
assert
(
start
<=
end
);
assert
(
start
<=
end
);
...
@@ -65,12 +65,12 @@ queue_print_uris(Response &r, Partition &partition, const Queue &queue,
...
@@ -65,12 +65,12 @@ queue_print_uris(Response &r, Partition &partition, const Queue &queue,
for
(
unsigned
i
=
start
;
i
<
end
;
++
i
)
{
for
(
unsigned
i
=
start
;
i
<
end
;
++
i
)
{
r
.
Format
(
"%i:"
,
i
);
r
.
Format
(
"%i:"
,
i
);
song_print_uri
(
r
,
partition
,
queue
.
Get
(
i
));
song_print_uri
(
r
,
queue
.
Get
(
i
));
}
}
}
}
void
void
queue_print_changes_info
(
Response
&
r
,
Partition
&
partition
,
const
Queue
&
queue
,
queue_print_changes_info
(
Response
&
r
,
const
Queue
&
queue
,
uint32_t
version
,
uint32_t
version
,
unsigned
start
,
unsigned
end
)
unsigned
start
,
unsigned
end
)
{
{
...
@@ -84,7 +84,7 @@ queue_print_changes_info(Response &r, Partition &partition, const Queue &queue,
...
@@ -84,7 +84,7 @@ queue_print_changes_info(Response &r, Partition &partition, const Queue &queue,
for
(
unsigned
i
=
start
;
i
<
end
;
i
++
)
for
(
unsigned
i
=
start
;
i
<
end
;
i
++
)
if
(
queue
.
IsNewerAtPosition
(
i
,
version
))
if
(
queue
.
IsNewerAtPosition
(
i
,
version
))
queue_print_song_info
(
r
,
partition
,
queue
,
i
);
queue_print_song_info
(
r
,
queue
,
i
);
}
}
void
void
...
@@ -107,13 +107,13 @@ queue_print_changes_position(Response &r, const Queue &queue,
...
@@ -107,13 +107,13 @@ queue_print_changes_position(Response &r, const Queue &queue,
}
}
void
void
queue_find
(
Response
&
r
,
Partition
&
partition
,
const
Queue
&
queue
,
queue_find
(
Response
&
r
,
const
Queue
&
queue
,
const
SongFilter
&
filter
)
const
SongFilter
&
filter
)
{
{
for
(
unsigned
i
=
0
;
i
<
queue
.
GetLength
();
i
++
)
{
for
(
unsigned
i
=
0
;
i
<
queue
.
GetLength
();
i
++
)
{
const
DetachedSong
&
song
=
queue
.
Get
(
i
);
const
DetachedSong
&
song
=
queue
.
Get
(
i
);
if
(
filter
.
Match
(
song
))
if
(
filter
.
Match
(
song
))
queue_print_song_info
(
r
,
partition
,
queue
,
i
);
queue_print_song_info
(
r
,
queue
,
i
);
}
}
}
}
src/queue/QueuePrint.hxx
View file @
71ce1a25
...
@@ -28,20 +28,19 @@
...
@@ -28,20 +28,19 @@
#include <stdint.h>
#include <stdint.h>
struct
Queue
;
struct
Queue
;
struct
Partition
;
class
SongFilter
;
class
SongFilter
;
class
Response
;
class
Response
;
void
void
queue_print_info
(
Response
&
r
,
Partition
&
partition
,
const
Queue
&
queue
,
queue_print_info
(
Response
&
r
,
const
Queue
&
queue
,
unsigned
start
,
unsigned
end
);
unsigned
start
,
unsigned
end
);
void
void
queue_print_uris
(
Response
&
r
,
Partition
&
partition
,
const
Queue
&
queue
,
queue_print_uris
(
Response
&
r
,
const
Queue
&
queue
,
unsigned
start
,
unsigned
end
);
unsigned
start
,
unsigned
end
);
void
void
queue_print_changes_info
(
Response
&
r
,
Partition
&
partition
,
const
Queue
&
queue
,
queue_print_changes_info
(
Response
&
r
,
const
Queue
&
queue
,
uint32_t
version
,
uint32_t
version
,
unsigned
start
,
unsigned
end
);
unsigned
start
,
unsigned
end
);
...
@@ -51,7 +50,7 @@ queue_print_changes_position(Response &r, const Queue &queue,
...
@@ -51,7 +50,7 @@ queue_print_changes_position(Response &r, const Queue &queue,
unsigned
start
,
unsigned
end
);
unsigned
start
,
unsigned
end
);
void
void
queue_find
(
Response
&
response
,
Partition
&
partition
,
const
Queue
&
queue
,
queue_find
(
Response
&
response
,
const
Queue
&
queue
,
const
SongFilter
&
filter
);
const
SongFilter
&
filter
);
#endif
#endif
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