media library: fix adding songs with fetch delay enabled
This commit is contained in:
1
NEWS
1
NEWS
@@ -3,6 +3,7 @@ ncmpcpp-0.6.1 (????-??-??)
|
|||||||
* Comment tag is now properly written to mp3 files.
|
* Comment tag is now properly written to mp3 files.
|
||||||
* Only ID3v2.4 tags are now saved to mp3 files.
|
* Only ID3v2.4 tags are now saved to mp3 files.
|
||||||
* Mouse scrolling with newer ncurses API now works properly.
|
* Mouse scrolling with newer ncurses API now works properly.
|
||||||
|
* Adding songs from an album in media library now works properly with fetch delay.
|
||||||
|
|
||||||
ncmpcpp-0.6 (2014-10-25)
|
ncmpcpp-0.6 (2014-10-25)
|
||||||
|
|
||||||
|
|||||||
@@ -58,6 +58,19 @@ size_t itsRightColStartX;
|
|||||||
|
|
||||||
typedef MediaLibrary::AlbumEntry AlbumEntry;
|
typedef MediaLibrary::AlbumEntry AlbumEntry;
|
||||||
|
|
||||||
|
template <typename FunT>
|
||||||
|
void withSongsFromAlbum(const AlbumEntry &album, FunT &&f)
|
||||||
|
{
|
||||||
|
Mpd.StartSearch(true);
|
||||||
|
Mpd.AddSearch(Config.media_lib_primary_tag, album.entry().tag());
|
||||||
|
if (!album.isAllTracksEntry())
|
||||||
|
{
|
||||||
|
Mpd.AddSearch(MPD_TAG_ALBUM, album.entry().album());
|
||||||
|
Mpd.AddSearch(MPD_TAG_DATE, album.entry().date());
|
||||||
|
}
|
||||||
|
Mpd.CommitSearchSongs(std::forward<FunT>(f));
|
||||||
|
}
|
||||||
|
|
||||||
std::string AlbumToString(const AlbumEntry &ae);
|
std::string AlbumToString(const AlbumEntry &ae);
|
||||||
std::string SongToString(const MPD::Song &s);
|
std::string SongToString(const MPD::Song &s);
|
||||||
|
|
||||||
@@ -778,9 +791,9 @@ MPD::SongList MediaLibrary::getSelectedSongs()
|
|||||||
// if no item is selected, add songs from right column
|
// if no item is selected, add songs from right column
|
||||||
if (!any_selected && !Albums.empty())
|
if (!any_selected && !Albums.empty())
|
||||||
{
|
{
|
||||||
withUnfilteredMenu(Songs, [this, &result]() {
|
size_t begin = result.size();
|
||||||
result.insert(result.end(), Songs.beginV(), Songs.endV());
|
withSongsFromAlbum(Albums.current().value().entry(), vectorMoveInserter(result));
|
||||||
});
|
std::sort(result.begin()+begin, result.end(), SortSongs(false));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (isActiveWindow(Songs))
|
else if (isActiveWindow(Songs))
|
||||||
@@ -1059,10 +1072,9 @@ void MediaLibrary::AddToPlaylist(bool add_n_play)
|
|||||||
}
|
}
|
||||||
else if (isActiveWindow(Albums))
|
else if (isActiveWindow(Albums))
|
||||||
{
|
{
|
||||||
bool success;
|
MPD::SongList list;
|
||||||
withUnfilteredMenu(Songs, [&]() {
|
withSongsFromAlbum(Albums.current().value(), vectorMoveInserter(list));
|
||||||
success = addSongsToPlaylist(Songs.beginV(), Songs.endV(), add_n_play, -1);
|
bool success = addSongsToPlaylist(list.begin(), list.end(), add_n_play, -1);
|
||||||
});
|
|
||||||
Statusbar::printf("Songs from album \"%1%\" added%2%",
|
Statusbar::printf("Songs from album \"%1%\" added%2%",
|
||||||
Albums.current().value().entry().album(), withErrors(success)
|
Albums.current().value().entry().album(), withErrors(success)
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user