From 3e138898fbd85f5af223a13760f0fd5fa0039589 Mon Sep 17 00:00:00 2001 From: Helge Norberg Date: Wed, 25 Jan 2017 11:31:57 +0100 Subject: [PATCH] [AMCP] #517 Fixed bug where CINF only returned the first match --- CHANGELOG | 1 + protocol/amcp/AMCPCommandsImpl.cpp | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 8feb32a35..3d54c092b 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -68,6 +68,7 @@ AMCP to know exactly what asynchronous response matched a specific request. o Added support for listing contents of a specific directory for CLS, TLS, DATA LIST and THUMBNAIL LIST. + o Fixed bug where CINF only returned the first match. diff --git a/protocol/amcp/AMCPCommandsImpl.cpp b/protocol/amcp/AMCPCommandsImpl.cpp index 8ee156363..45382b452 100644 --- a/protocol/amcp/AMCPCommandsImpl.cpp +++ b/protocol/amcp/AMCPCommandsImpl.cpp @@ -2296,15 +2296,16 @@ void cinf_describer(core::help_sink& sink, const core::help_repository& repo) sink.short_description(L"Get information about a media file."); sink.syntax(L"CINF [filename:string]"); sink.para()->text(L"Returns information about a media file."); + sink.para()->text(L"If a file with the same name exist in multiple directories, all of them are returned."); } std::wstring cinf_command(command_context& ctx) { std::wstring info; - for (boost::filesystem::recursive_directory_iterator itr(env::media_folder()), end; itr != end && info.empty(); ++itr) + for (boost::filesystem::recursive_directory_iterator itr(env::media_folder()), end; itr != end; ++itr) { auto path = itr->path(); - auto file = path.replace_extension(L"").filename().wstring(); + auto file = path.stem().wstring(); if (boost::iequals(file, ctx.parameters.at(0))) info += MediaInfo(itr->path(), ctx.media_info_repo); } -- 2.39.2