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
0505cb8f
Commit
0505cb8f
authored
Jul 25, 2018
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
db/Print: move code to PrintSongUris()
parent
2cfccc1c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
16 deletions
+30
-16
DatabaseCommands.cxx
src/command/DatabaseCommands.cxx
+5
-2
DatabasePrint.cxx
src/db/DatabasePrint.cxx
+21
-14
DatabasePrint.hxx
src/db/DatabasePrint.hxx
+4
-0
No files found.
src/command/DatabaseCommands.cxx
View file @
0505cb8f
...
...
@@ -285,8 +285,11 @@ handle_list(Client &client, Request args, Response &r)
return
CommandResult
::
ERROR
;
}
PrintUniqueTags
(
r
,
client
.
GetPartition
(),
tagType
,
group_mask
,
filter
.
get
());
if
(
tagType
==
LOCATE_TAG_FILE_TYPE
)
PrintSongUris
(
r
,
client
.
GetPartition
(),
filter
.
get
());
else
PrintUniqueTags
(
r
,
client
.
GetPartition
(),
tagType
,
group_mask
,
filter
.
get
());
return
CommandResult
::
OK
;
}
...
...
src/db/DatabasePrint.cxx
View file @
0505cb8f
...
...
@@ -273,6 +273,20 @@ PrintSongURIVisitor(Response &r, const LightSong &song) noexcept
song_print_uri
(
r
,
song
);
}
void
PrintSongUris
(
Response
&
r
,
Partition
&
partition
,
const
SongFilter
*
filter
)
{
const
Database
&
db
=
partition
.
GetDatabaseOrThrow
();
const
DatabaseSelection
selection
(
""
,
true
,
filter
);
using
namespace
std
::
placeholders
;
const
auto
f
=
std
::
bind
(
PrintSongURIVisitor
,
std
::
ref
(
r
),
_1
);
db
.
Visit
(
selection
,
f
);
}
static
void
PrintUniqueTag
(
Response
&
r
,
TagType
tag_type
,
const
Tag
&
tag
)
noexcept
...
...
@@ -292,22 +306,15 @@ PrintUniqueTags(Response &r, Partition &partition,
unsigned
type
,
TagMask
group_mask
,
const
SongFilter
*
filter
)
{
assert
(
type
<
TAG_NUM_OF_ITEM_TYPES
);
const
Database
&
db
=
partition
.
GetDatabaseOrThrow
();
const
DatabaseSelection
selection
(
""
,
true
,
filter
);
if
(
type
==
LOCATE_TAG_FILE_TYPE
)
{
using
namespace
std
::
placeholders
;
const
auto
f
=
std
::
bind
(
PrintSongURIVisitor
,
std
::
ref
(
r
),
_1
);
db
.
Visit
(
selection
,
f
);
}
else
{
assert
(
type
<
TAG_NUM_OF_ITEM_TYPES
);
using
namespace
std
::
placeholders
;
const
auto
f
=
std
::
bind
(
PrintUniqueTag
,
std
::
ref
(
r
),
(
TagType
)
type
,
_1
);
db
.
VisitUniqueTags
(
selection
,
(
TagType
)
type
,
group_mask
,
f
);
}
using
namespace
std
::
placeholders
;
const
auto
f
=
std
::
bind
(
PrintUniqueTag
,
std
::
ref
(
r
),
(
TagType
)
type
,
_1
);
db
.
VisitUniqueTags
(
selection
,
(
TagType
)
type
,
group_mask
,
f
);
}
src/db/DatabasePrint.hxx
View file @
0505cb8f
...
...
@@ -50,6 +50,10 @@ db_selection_print(Response &r, Partition &partition,
unsigned
window_start
,
unsigned
window_end
);
void
PrintSongUris
(
Response
&
r
,
Partition
&
partition
,
const
SongFilter
*
filter
);
void
PrintUniqueTags
(
Response
&
r
,
Partition
&
partition
,
unsigned
type
,
TagMask
group_mask
,
const
SongFilter
*
filter
);
...
...
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