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
351ac4a2
Commit
351ac4a2
authored
Mar 06, 2012
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
command: read arbitrary local files with "lsinfo"
Requires UNIX domain socket connection.
parent
36fff59a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
1 deletion
+27
-1
protocol.xml
doc/protocol.xml
+5
-0
command.c
src/command.c
+22
-1
No files found.
doc/protocol.xml
View file @
351ac4a2
...
...
@@ -1556,6 +1556,11 @@ OK
the list of stored playlists. This behavior is
deprecated; use "listplaylists" instead.
</para>
<para>
Clients that are connected via UNIX domain socket may
use this command to read the tags of an arbitrary local
file (URI beginning with "file:///").
</para>
</listitem>
</varlistentry>
<varlistentry
id=
"command_search"
>
...
...
src/command.c
View file @
351ac4a2
...
...
@@ -59,12 +59,13 @@
#include "replay_gain_config.h"
#include "idle.h"
#include "mapper.h"
#include "song.h"
#include "song_print.h"
#ifdef ENABLE_SQLITE
#include "sticker.h"
#include "sticker_print.h"
#include "song_sticker.h"
#include "song_print.h"
#endif
#include <assert.h>
...
...
@@ -664,6 +665,26 @@ handle_lsinfo(struct client *client, int argc, char *argv[])
/* default is root directory */
uri
=
""
;
if
(
strncmp
(
uri
,
"file:///"
,
8
)
==
0
)
{
/* print information about an arbitrary local file */
const
char
*
path
=
uri
+
7
;
GError
*
error
=
NULL
;
if
(
!
client_allow_file
(
client
,
path
,
&
error
))
return
print_error
(
client
,
error
);
struct
song
*
song
=
song_file_load
(
path
,
NULL
);
if
(
song
==
NULL
)
{
command_error
(
client
,
ACK_ERROR_NO_EXIST
,
"No such file"
);
return
COMMAND_RETURN_ERROR
;
}
song_print_info
(
client
,
song
);
song_free
(
song
);
return
COMMAND_RETURN_OK
;
}
struct
db_selection
selection
;
db_selection_init
(
&
selection
,
uri
,
false
);
...
...
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