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
e720b5bd
Commit
e720b5bd
authored
Apr 01, 2009
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
command: added command "sticker find"
This command allows clients to search for stickers with a specified name.
parent
c95fa4b4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
60 additions
and
0 deletions
+60
-0
protocol.xml
doc/protocol.xml
+19
-0
command.c
src/command.c
+41
-0
No files found.
doc/protocol.xml
View file @
e720b5bd
...
...
@@ -1288,6 +1288,25 @@ OK
</para>
</listitem>
</varlistentry>
<varlistentry
id=
"command_sticker_find"
>
<term>
<cmdsynopsis>
<command>
sticker
</command>
<arg
choice=
"plain"
>
find
</arg>
<arg
choice=
"req"
><replaceable>
TYPE
</replaceable></arg>
<arg
choice=
"req"
><replaceable>
URI
</replaceable></arg>
<arg
choice=
"req"
><replaceable>
NAME
</replaceable></arg>
</cmdsynopsis>
</term>
<listitem>
<para>
Searches the sticker database for stickers with the
specified name, below the specified directory (URI).
For each matching song, it prints the URI and that one
sticker's value.
</para>
</listitem>
</varlistentry>
</variablelist>
</section>
...
...
src/command.c
View file @
e720b5bd
...
...
@@ -50,6 +50,7 @@
#include "sticker.h"
#include "sticker_print.h"
#include "song_sticker.h"
#include "song_print.h"
#endif
#include <assert.h>
...
...
@@ -1507,6 +1508,21 @@ handle_idle(struct client *client,
}
#ifdef ENABLE_SQLITE
struct
sticker_song_find_data
{
struct
client
*
client
;
const
char
*
name
;
};
static
void
sticker_song_find_print_cb
(
struct
song
*
song
,
const
char
*
value
,
gpointer
user_data
)
{
struct
sticker_song_find_data
*
data
=
user_data
;
song_print_url
(
data
->
client
,
song
);
sticker_print_value
(
data
->
client
,
data
->
name
,
value
);
}
static
enum
command_return
handle_sticker_song
(
struct
client
*
client
,
int
argc
,
char
*
argv
[])
{
...
...
@@ -1573,6 +1589,31 @@ handle_sticker_song(struct client *client, int argc, char *argv[])
}
return
COMMAND_RETURN_OK
;
}
else
if
(
argc
==
5
&&
strcmp
(
argv
[
1
],
"find"
)
==
0
)
{
/* "sticker find song a/directory name" */
struct
directory
*
directory
;
bool
success
;
struct
sticker_song_find_data
data
=
{
.
client
=
client
,
.
name
=
argv
[
4
],
};
directory
=
db_get_directory
(
argv
[
3
]);
if
(
directory
==
NULL
)
{
command_error
(
client
,
ACK_ERROR_NO_EXIST
,
"no such directory"
);
return
COMMAND_RETURN_ERROR
;
}
success
=
sticker_song_find
(
directory
,
data
.
name
,
sticker_song_find_print_cb
,
&
data
);
if
(
!
success
)
{
command_error
(
client
,
ACK_ERROR_SYSTEM
,
"failed to set search sticker database"
);
return
COMMAND_RETURN_ERROR
;
}
return
COMMAND_RETURN_OK
;
}
else
{
command_error
(
client
,
ACK_ERROR_ARG
,
"bad request"
);
return
COMMAND_RETURN_ERROR
;
...
...
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