command/playlist: invoke the RemoteTagScanner on all newly added songs

Closes https://github.com/MusicPlayerDaemon/MPD/issues/234
This commit is contained in:
Max Kellermann 2019-03-29 17:01:31 +01:00
parent 0d8942e64a
commit 976731ab6c
2 changed files with 15 additions and 1 deletions

2
NEWS
View File

@ -1,4 +1,6 @@
ver 0.21.7 (not yet released) ver 0.21.7 (not yet released)
* input
- qobuz/tidal: scan tags when loading a playlist
* require Meson 0.49.0 for native libgcrypt-config support * require Meson 0.49.0 for native libgcrypt-config support
* fix build failure with -Dlocal_socket=false * fix build failure with -Dlocal_socket=false
* Haiku * Haiku

View File

@ -20,6 +20,7 @@
#include "config.h" #include "config.h"
#include "PlaylistCommands.hxx" #include "PlaylistCommands.hxx"
#include "Request.hxx" #include "Request.hxx"
#include "Instance.hxx"
#include "db/DatabasePlaylist.hxx" #include "db/DatabasePlaylist.hxx"
#include "CommandError.hxx" #include "CommandError.hxx"
#include "PlaylistSave.hxx" #include "PlaylistSave.hxx"
@ -27,6 +28,7 @@
#include "PlaylistError.hxx" #include "PlaylistError.hxx"
#include "db/PlaylistVector.hxx" #include "db/PlaylistVector.hxx"
#include "SongLoader.hxx" #include "SongLoader.hxx"
#include "song/DetachedSong.hxx"
#include "BulkEdit.hxx" #include "BulkEdit.hxx"
#include "playlist/PlaylistQueue.hxx" #include "playlist/PlaylistQueue.hxx"
#include "playlist/Print.hxx" #include "playlist/Print.hxx"
@ -76,11 +78,21 @@ handle_load(Client &client, Request args, gcc_unused Response &r)
const ScopeBulkEdit bulk_edit(client.GetPartition()); const ScopeBulkEdit bulk_edit(client.GetPartition());
auto &playlist = client.GetPlaylist();
const unsigned old_size = playlist.GetLength();
const SongLoader loader(client); const SongLoader loader(client);
playlist_open_into_queue(uri, playlist_open_into_queue(uri,
range.start, range.end, range.start, range.end,
client.GetPlaylist(), playlist,
client.GetPlayerControl(), loader); client.GetPlayerControl(), loader);
/* invoke the RemoteTagScanner on all newly added songs */
auto &instance = client.GetInstance();
const unsigned new_size = playlist.GetLength();
for (unsigned i = old_size; i < new_size; ++i)
instance.LookupRemoteTag(playlist.queue.Get(i).GetURI());
return CommandResult::OK; return CommandResult::OK;
} }