diff options
author | Max Kellermann <max@duempel.org> | 2014-01-15 12:05:44 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2014-01-15 12:05:44 +0100 |
commit | 9fb82f9687c10ee8430437a97e263c85f968bddb (patch) | |
tree | 16ee0270c77e1a9662ac6ef3ba4e0959d5488f06 /src/command/OtherCommands.cxx | |
parent | df80deb0708f9abe911dc3533c0d3b310f73650c (diff) | |
download | mpd-9fb82f9687c10ee8430437a97e263c85f968bddb.tar.gz mpd-9fb82f9687c10ee8430437a97e263c85f968bddb.tar.xz mpd-9fb82f9687c10ee8430437a97e263c85f968bddb.zip |
DetachedSong: add method Update()
Don't create an intermediate Song instance when all we want is a
DetachedSong.
Diffstat (limited to 'src/command/OtherCommands.cxx')
-rw-r--r-- | src/command/OtherCommands.cxx | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/command/OtherCommands.cxx b/src/command/OtherCommands.cxx index 7d7853d0f..0daf62c5a 100644 --- a/src/command/OtherCommands.cxx +++ b/src/command/OtherCommands.cxx @@ -23,7 +23,7 @@ #include "CommandError.hxx" #include "UpdateGlue.hxx" #include "Directory.hxx" -#include "Song.hxx" +#include "DetachedSong.hxx" #include "SongPrint.hxx" #include "TagPrint.hxx" #include "TagStream.hxx" @@ -140,15 +140,14 @@ handle_lsinfo(Client &client, int argc, char *argv[]) if (!client_allow_file(client, path_fs, error)) return print_error(client, error); - Song *song = Song::LoadFile(path_utf8, nullptr); - if (song == nullptr) { + DetachedSong song(path_utf8); + if (!song.Update()) { command_error(client, ACK_ERROR_NO_EXIST, "No such file"); return CommandResult::ERROR; } - song_print_info(client, *song); - song->Free(); + song_print_info(client, song); return CommandResult::OK; } |