command/PlaylistCommands: pass real_uri to LookupRemoteTag()
For querying tags, the real song URI should be used, because if the (display) URI is different, requesting it will not produce a usable response. This is a theoretical problem because none of the existing playlist plugins sets the real_uri. This requires changing the URI comparison in playlist::TagModified(). Closes https://github.com/MusicPlayerDaemon/MPD/issues/1154
This commit is contained in:
@@ -92,7 +92,7 @@ handle_load(Client &client, Request args, [[maybe_unused]] Response &r)
|
|||||||
auto &instance = client.GetInstance();
|
auto &instance = client.GetInstance();
|
||||||
const unsigned new_size = playlist.GetLength();
|
const unsigned new_size = playlist.GetLength();
|
||||||
for (unsigned i = old_size; i < new_size; ++i)
|
for (unsigned i = old_size; i < new_size; ++i)
|
||||||
instance.LookupRemoteTag(playlist.queue.Get(i).GetURI());
|
instance.LookupRemoteTag(playlist.queue.Get(i).GetRealURI());
|
||||||
|
|
||||||
return CommandResult::OK;
|
return CommandResult::OK;
|
||||||
}
|
}
|
||||||
|
@@ -44,13 +44,13 @@ playlist::TagModified(DetachedSong &&song) noexcept
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
playlist::TagModified(const char *uri, const Tag &tag) noexcept
|
playlist::TagModified(const char *real_uri, const Tag &tag) noexcept
|
||||||
{
|
{
|
||||||
bool modified = false;
|
bool modified = false;
|
||||||
|
|
||||||
for (unsigned i = 0; i < queue.length; ++i) {
|
for (unsigned i = 0; i < queue.length; ++i) {
|
||||||
auto &song = *queue.items[i].song;
|
auto &song = *queue.items[i].song;
|
||||||
if (song.IsURI(uri)) {
|
if (song.IsRealURI(real_uri)) {
|
||||||
song.SetTag(tag);
|
song.SetTag(tag);
|
||||||
queue.ModifyAtPosition(i);
|
queue.ModifyAtPosition(i);
|
||||||
modified = true;
|
modified = true;
|
||||||
|
@@ -196,7 +196,12 @@ public:
|
|||||||
* the song matches.
|
* the song matches.
|
||||||
*/
|
*/
|
||||||
void TagModified(DetachedSong &&song) noexcept;
|
void TagModified(DetachedSong &&song) noexcept;
|
||||||
void TagModified(const char *uri, const Tag &tag) noexcept;
|
|
||||||
|
/**
|
||||||
|
* @param real_uri the song's "real uri" (see
|
||||||
|
* DetachedSong::GetRealURI(), DetachedSong::IsRealURI())
|
||||||
|
*/
|
||||||
|
void TagModified(const char *real_uri, const Tag &tag) noexcept;
|
||||||
|
|
||||||
#ifdef ENABLE_DATABASE
|
#ifdef ENABLE_DATABASE
|
||||||
/**
|
/**
|
||||||
|
@@ -162,6 +162,11 @@ public:
|
|||||||
return uri == other_uri;
|
return uri == other_uri;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gcc_pure gcc_nonnull_all
|
||||||
|
bool IsRealURI(const char *other_uri) const noexcept {
|
||||||
|
return (HasRealURI() ? real_uri : uri) == other_uri;
|
||||||
|
}
|
||||||
|
|
||||||
gcc_pure
|
gcc_pure
|
||||||
bool IsRemote() const noexcept;
|
bool IsRemote() const noexcept;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user