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
8fd8f23a
Commit
8fd8f23a
authored
Feb 07, 2014
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
FileCommands: move code to read_file_comments()
parent
f2250513
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
15 deletions
+22
-15
FileCommands.cxx
src/command/FileCommands.cxx
+22
-15
No files found.
src/command/FileCommands.cxx
View file @
8fd8f23a
...
...
@@ -101,6 +101,22 @@ read_stream_comments(Client &client, const char *uri)
}
static
CommandResult
read_file_comments
(
Client
&
client
,
const
Path
path_fs
)
{
if
(
!
tag_file_scan
(
path_fs
,
print_comment_handler
,
&
client
))
{
command_error
(
client
,
ACK_ERROR_NO_EXIST
,
"Failed to load file"
);
return
CommandResult
::
ERROR
;
}
tag_ape_scan2
(
path_fs
,
&
print_comment_handler
,
&
client
);
tag_id3_scan
(
path_fs
,
&
print_comment_handler
,
&
client
);
return
CommandResult
::
OK
;
}
CommandResult
handle_read_comments
(
Client
&
client
,
gcc_unused
int
argc
,
char
*
argv
[])
{
...
...
@@ -108,12 +124,10 @@ handle_read_comments(Client &client, gcc_unused int argc, char *argv[])
const
char
*
const
uri
=
argv
[
1
];
AllocatedPath
path_fs
=
AllocatedPath
::
Null
();
if
(
memcmp
(
uri
,
"file:///"
,
8
)
==
0
)
{
/* read comments from arbitrary local file */
const
char
*
path_utf8
=
uri
+
7
;
path_fs
=
AllocatedPath
::
FromUTF8
(
path_utf8
);
AllocatedPath
path_fs
=
AllocatedPath
::
FromUTF8
(
path_utf8
);
if
(
path_fs
.
IsNull
())
{
command_error
(
client
,
ACK_ERROR_NO_EXIST
,
"unsupported file name"
);
...
...
@@ -123,16 +137,20 @@ handle_read_comments(Client &client, gcc_unused int argc, char *argv[])
Error
error
;
if
(
!
client
.
AllowFile
(
path_fs
,
error
))
return
print_error
(
client
,
error
);
return
read_file_comments
(
client
,
path_fs
);
}
else
if
(
uri_has_scheme
(
uri
))
{
return
read_stream_comments
(
client
,
uri
);
}
else
if
(
!
PathTraitsUTF8
::
IsAbsolute
(
uri
))
{
#ifdef ENABLE_DATABASE
path_fs
=
map_uri_fs
(
uri
);
AllocatedPath
path_fs
=
map_uri_fs
(
uri
);
if
(
path_fs
.
IsNull
())
{
command_error
(
client
,
ACK_ERROR_NO_EXIST
,
"No such file"
);
return
CommandResult
::
ERROR
;
}
return
read_file_comments
(
client
,
path_fs
);
#else
command_error
(
client
,
ACK_ERROR_NO_EXIST
,
"No database"
);
return
CommandResult
::
ERROR
;
...
...
@@ -141,15 +159,4 @@ handle_read_comments(Client &client, gcc_unused int argc, char *argv[])
command_error
(
client
,
ACK_ERROR_NO_EXIST
,
"No such file"
);
return
CommandResult
::
ERROR
;
}
if
(
!
tag_file_scan
(
path_fs
,
print_comment_handler
,
&
client
))
{
command_error
(
client
,
ACK_ERROR_NO_EXIST
,
"Failed to load file"
);
return
CommandResult
::
ERROR
;
}
tag_ape_scan2
(
path_fs
,
&
print_comment_handler
,
&
client
);
tag_id3_scan
(
path_fs
,
&
print_comment_handler
,
&
client
);
return
CommandResult
::
OK
;
}
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