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
8f9ba96c
Commit
8f9ba96c
authored
Jan 08, 2014
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SongUpdate: move code to handle_lsinfo()
Don't create a temporary Song object in handle_lsinfo(). Instead, print all tags while parsing the remote file.
parent
10406c73
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
30 additions
and
20 deletions
+30
-20
Song.hxx
src/Song.hxx
+0
-1
SongUpdate.cxx
src/SongUpdate.cxx
+0
-14
TagPrint.cxx
src/TagPrint.cxx
+6
-0
TagPrint.hxx
src/TagPrint.hxx
+7
-0
OtherCommands.cxx
src/command/OtherCommands.cxx
+17
-5
No files found.
src/Song.hxx
View file @
8f9ba96c
...
...
@@ -130,7 +130,6 @@ struct Song {
bool
UpdateFile
();
bool
UpdateFileInArchive
();
bool
UpdateStream
();
/**
* Returns the URI of the song in UTF-8 encoding, including its
...
...
src/SongUpdate.cxx
View file @
8f9ba96c
...
...
@@ -132,17 +132,3 @@ Song::UpdateFileInArchive()
tag
=
tag_builder
.
CommitNew
();
return
true
;
}
bool
Song
::
UpdateStream
()
{
assert
(
!
IsFile
());
TagBuilder
tag_builder
;
if
(
!
tag_stream_scan
(
uri
,
full_tag_handler
,
&
tag_builder
))
return
false
;
delete
tag
;
tag
=
tag_builder
.
CommitNew
();
return
true
;
}
src/TagPrint.cxx
View file @
8f9ba96c
...
...
@@ -35,6 +35,12 @@ void tag_print_types(Client &client)
}
}
void
tag_print
(
Client
&
client
,
TagType
type
,
const
char
*
value
)
{
client_printf
(
client
,
"%s: %s
\n
"
,
tag_item_names
[
type
],
value
);
}
void
tag_print
(
Client
&
client
,
const
Tag
&
tag
)
{
if
(
tag
.
time
>=
0
)
...
...
src/TagPrint.hxx
View file @
8f9ba96c
...
...
@@ -20,12 +20,19 @@
#ifndef MPD_TAG_PRINT_HXX
#define MPD_TAG_PRINT_HXX
#include <stdint.h>
enum
TagType
:
uint8_t
;
struct
Tag
;
class
Client
;
void
tag_print_types
(
Client
&
client
);
void
tag_print
(
Client
&
client
,
TagType
type
,
const
char
*
value
);
void
tag_print
(
Client
&
client
,
const
Tag
&
tag
);
#endif
src/command/OtherCommands.cxx
View file @
8f9ba96c
...
...
@@ -26,6 +26,8 @@
#include "Song.hxx"
#include "SongPrint.hxx"
#include "TagPrint.hxx"
#include "TagStream.hxx"
#include "tag/TagHandler.hxx"
#include "TimePrint.hxx"
#include "Mapper.hxx"
#include "DecoderPrint.hxx"
...
...
@@ -98,6 +100,20 @@ handle_close(gcc_unused Client &client,
return
CommandResult
::
FINISH
;
}
static
void
print_tag
(
TagType
type
,
const
char
*
value
,
void
*
ctx
)
{
Client
&
client
=
*
(
Client
*
)
ctx
;
tag_print
(
client
,
type
,
value
);
}
static
constexpr
tag_handler
print_tag_handler
=
{
nullptr
,
print_tag
,
nullptr
,
};
CommandResult
handle_lsinfo
(
Client
&
client
,
int
argc
,
char
*
argv
[])
{
...
...
@@ -143,16 +159,12 @@ handle_lsinfo(Client &client, int argc, char *argv[])
return
CommandResult
::
ERROR
;
}
Song
*
song
=
Song
::
NewRemote
(
uri
);
if
(
!
song
->
UpdateStream
())
{
song
->
Free
();
if
(
!
tag_stream_scan
(
uri
,
print_tag_handler
,
&
client
))
{
command_error
(
client
,
ACK_ERROR_NO_EXIST
,
"No such file"
);
return
CommandResult
::
ERROR
;
}
song_print_info
(
client
,
*
song
);
song
->
Free
();
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