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
df0c26a3
Commit
df0c26a3
authored
Aug 25, 2009
by
Anton Khirnov
Committed by
Max Kellermann
Aug 25, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
command: add "findadd" command.
parent
1e56c7b8
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
69 additions
and
0 deletions
+69
-0
NEWS
NEWS
+1
-0
protocol.xml
doc/protocol.xml
+17
-0
command.c
src/command.c
+25
-0
dbUtils.c
src/dbUtils.c
+22
-0
dbUtils.h
src/dbUtils.h
+4
-0
No files found.
NEWS
View file @
df0c26a3
...
@@ -3,6 +3,7 @@ ver 0.16 (20??/??/??)
...
@@ -3,6 +3,7 @@ ver 0.16 (20??/??/??)
- send song modification time to client
- send song modification time to client
- added "update" idle event
- added "update" idle event
- removed the deprecated "volume" command
- removed the deprecated "volume" command
- added the "findadd" command
* input:
* input:
- lastfm: use metadata
- lastfm: use metadata
* tags:
* tags:
...
...
doc/protocol.xml
View file @
df0c26a3
...
@@ -1100,6 +1100,23 @@ OK
...
@@ -1100,6 +1100,23 @@ OK
</para>
</para>
</listitem>
</listitem>
</varlistentry>
</varlistentry>
<varlistentry
id=
"command_findadd"
>
<term>
<cmdsynopsis>
<command>
findadd
</command>
<arg
choice=
"req"
><replaceable>
TYPE
</replaceable></arg>
<arg
choice=
"req"
><replaceable>
WHAT
</replaceable></arg>
</cmdsynopsis>
</term>
<listitem>
<para>
Finds songs in the db that are exactly
<varname>
WHAT
</varname>
and adds them to current playlist.
<varname>
TYPE
</varname>
can be any tag supported by MPD.
<varname>
WHAT
</varname>
is what to find.
</para>
</listitem>
</varlistentry>
<varlistentry
id=
"command_list"
>
<varlistentry
id=
"command_list"
>
<term>
<term>
<cmdsynopsis>
<cmdsynopsis>
...
...
src/command.c
View file @
df0c26a3
...
@@ -870,6 +870,30 @@ handle_find(struct client *client, int argc, char *argv[])
...
@@ -870,6 +870,30 @@ handle_find(struct client *client, int argc, char *argv[])
}
}
static
enum
command_return
static
enum
command_return
handle_findadd
(
struct
client
*
client
,
int
argc
,
char
*
argv
[])
{
int
ret
;
struct
locate_item_list
*
list
=
locate_item_list_parse
(
argv
+
1
,
argc
-
1
);
if
(
list
==
NULL
||
list
->
length
==
0
)
{
if
(
list
!=
NULL
)
locate_item_list_free
(
list
);
command_error
(
client
,
ACK_ERROR_ARG
,
"incorrect arguments"
);
return
COMMAND_RETURN_ERROR
;
}
ret
=
findAddIn
(
client
,
NULL
,
list
);
if
(
ret
==
-
1
)
command_error
(
client
,
ACK_ERROR_NO_EXIST
,
"directory or file not found"
);
locate_item_list_free
(
list
);
return
ret
;
}
static
enum
command_return
handle_search
(
struct
client
*
client
,
int
argc
,
char
*
argv
[])
handle_search
(
struct
client
*
client
,
int
argc
,
char
*
argv
[])
{
{
int
ret
;
int
ret
;
...
@@ -1671,6 +1695,7 @@ static const struct command commands[] = {
...
@@ -1671,6 +1695,7 @@ static const struct command commands[] = {
{
"disableoutput"
,
PERMISSION_ADMIN
,
1
,
1
,
handle_disableoutput
},
{
"disableoutput"
,
PERMISSION_ADMIN
,
1
,
1
,
handle_disableoutput
},
{
"enableoutput"
,
PERMISSION_ADMIN
,
1
,
1
,
handle_enableoutput
},
{
"enableoutput"
,
PERMISSION_ADMIN
,
1
,
1
,
handle_enableoutput
},
{
"find"
,
PERMISSION_READ
,
2
,
-
1
,
handle_find
},
{
"find"
,
PERMISSION_READ
,
2
,
-
1
,
handle_find
},
{
"findadd"
,
PERMISSION_READ
,
2
,
-
1
,
handle_findadd
},
{
"idle"
,
PERMISSION_READ
,
0
,
-
1
,
handle_idle
},
{
"idle"
,
PERMISSION_READ
,
0
,
-
1
,
handle_idle
},
{
"kill"
,
PERMISSION_ADMIN
,
-
1
,
-
1
,
handle_kill
},
{
"kill"
,
PERMISSION_ADMIN
,
-
1
,
-
1
,
handle_kill
},
{
"list"
,
PERMISSION_READ
,
1
,
-
1
,
handle_list
},
{
"list"
,
PERMISSION_READ
,
1
,
-
1
,
handle_list
},
...
...
src/dbUtils.c
View file @
df0c26a3
...
@@ -200,6 +200,28 @@ int addAllInToStoredPlaylist(const char *name, const char *utf8file)
...
@@ -200,6 +200,28 @@ int addAllInToStoredPlaylist(const char *name, const char *utf8file)
}
}
static
int
static
int
findAddInDirectory
(
struct
song
*
song
,
void
*
_data
)
{
struct
search_data
*
data
=
_data
;
if
(
locate_song_match
(
song
,
data
->
criteria
))
return
directoryAddSongToPlaylist
(
song
,
data
);
return
0
;
}
int
findAddIn
(
struct
client
*
client
,
const
char
*
name
,
const
struct
locate_item_list
*
criteria
)
{
struct
search_data
data
;
data
.
client
=
client
;
data
.
criteria
=
criteria
;
return
db_walk
(
name
,
findAddInDirectory
,
NULL
,
&
data
);
}
static
int
directoryPrintSongInfo
(
struct
song
*
song
,
void
*
data
)
directoryPrintSongInfo
(
struct
song
*
song
,
void
*
data
)
{
{
struct
client
*
client
=
data
;
struct
client
*
client
=
data
;
...
...
src/dbUtils.h
View file @
df0c26a3
...
@@ -40,6 +40,10 @@ findSongsIn(struct client *client, const char *name,
...
@@ -40,6 +40,10 @@ findSongsIn(struct client *client, const char *name,
const
struct
locate_item_list
*
criteria
);
const
struct
locate_item_list
*
criteria
);
int
int
findAddIn
(
struct
client
*
client
,
const
char
*
name
,
const
struct
locate_item_list
*
criteria
);
int
searchStatsForSongsIn
(
struct
client
*
client
,
const
char
*
name
,
searchStatsForSongsIn
(
struct
client
*
client
,
const
char
*
name
,
const
struct
locate_item_list
*
criteria
);
const
struct
locate_item_list
*
criteria
);
...
...
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