summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/actions.cpp4
-rw-r--r--src/display.cpp4
-rw-r--r--src/mpdpp.cpp9
-rw-r--r--src/mpdpp.h1
-rw-r--r--src/playlist.cpp2
-rw-r--r--src/sel_items_adder.cpp4
-rw-r--r--src/status.cpp2
7 files changed, 10 insertions, 16 deletions
diff --git a/src/actions.cpp b/src/actions.cpp
index f89e9798..e62dca58 100644
--- a/src/actions.cpp
+++ b/src/actions.cpp
@@ -1200,7 +1200,7 @@ void TogglePlayingSongCentering::Run()
Config.autocenter_mode = !Config.autocenter_mode;
Statusbar::msg("Centering playing song: %s", Config.autocenter_mode ? "On" : "Off");
if (Config.autocenter_mode && Mpd.isPlaying() && !myPlaylist->main().isFiltered())
- myPlaylist->main().highlight(Mpd.GetCurrentlyPlayingSongPos());
+ myPlaylist->main().highlight(Mpd.GetCurrentSongPos());
}
void UpdateDatabase::Run()
@@ -1226,7 +1226,7 @@ bool JumpToPlayingSong::canBeRun() const
void JumpToPlayingSong::Run()
{
if (myScreen == myPlaylist)
- myPlaylist->main().highlight(Mpd.GetCurrentlyPlayingSongPos());
+ myPlaylist->main().highlight(Mpd.GetCurrentSongPos());
else if (myScreen == myBrowser)
{
myBrowser->LocateSong(myPlaylist->nowPlayingSong());
diff --git a/src/display.cpp b/src/display.cpp
index 8a4ba8ed..835d15c7 100644
--- a/src/display.cpp
+++ b/src/display.cpp
@@ -95,8 +95,8 @@ void setProperties(NC::Menu<T> &menu, const MPD::Song &s, const ProxySongList &p
discard_colors = Config.discard_colors_if_item_is_selected && is_selected;
int song_pos = menu.isFiltered() ? s.getPosition() : drawn_pos;
- is_now_playing = &menu == myPlaylist->activeWindow()
- && song_pos == Mpd.GetCurrentlyPlayingSongPos();
+ is_now_playing = Mpd.isPlaying() && myPlaylist->isActiveWindow(menu)
+ && song_pos == Mpd.GetCurrentSongPos();
if (is_now_playing)
menu << Config.now_playing_prefix;
}
diff --git a/src/mpdpp.cpp b/src/mpdpp.cpp
index f137c280..71233bef 100644
--- a/src/mpdpp.cpp
+++ b/src/mpdpp.cpp
@@ -551,12 +551,12 @@ void Connection::Seek(unsigned where)
if (!isCommandsListEnabled)
{
GoBusy();
- mpd_run_seek_pos(itsConnection, Mpd.GetCurrentlyPlayingSongPos(), where);
+ mpd_run_seek_pos(itsConnection, Mpd.GetCurrentSongPos(), where);
}
else
{
assert(!isIdle);
- mpd_send_seek_pos(itsConnection, Mpd.GetCurrentlyPlayingSongPos(), where);
+ mpd_send_seek_pos(itsConnection, Mpd.GetCurrentSongPos(), where);
}
}
@@ -695,11 +695,6 @@ int Connection::GetCurrentSongPos() const
return itsCurrentStatus ? mpd_status_get_song_pos(itsCurrentStatus) : -1;
}
-int Connection::GetCurrentlyPlayingSongPos() const
-{
- return isPlaying() ? GetCurrentSongPos() : -1;
-}
-
Song Connection::GetCurrentlyPlayingSong()
{
assert(!isCommandsListEnabled);
diff --git a/src/mpdpp.h b/src/mpdpp.h
index c6af960b..1ed0966a 100644
--- a/src/mpdpp.h
+++ b/src/mpdpp.h
@@ -173,7 +173,6 @@ public:
const std::string &GetErrorMessage() const { return itsErrorMessage; }
Song GetCurrentlyPlayingSong();
- int GetCurrentlyPlayingSongPos() const;
int GetCurrentSongPos() const;
Song GetSong(const std::string &);
SongList GetPlaylistContent(const std::string &);
diff --git a/src/playlist.cpp b/src/playlist.cpp
index 086959fb..1ee4a531 100644
--- a/src/playlist.cpp
+++ b/src/playlist.cpp
@@ -258,7 +258,7 @@ std::string Playlist::TotalLength()
if (Config.playlist_show_remaining_time && ReloadRemaining && !w.isFiltered())
{
itsRemainingTime = 0;
- for (size_t i = Mpd.GetCurrentlyPlayingSongPos(); i < w.size(); ++i)
+ for (size_t i = Mpd.GetCurrentSongPos(); i < w.size(); ++i)
itsRemainingTime += w[i].value().getDuration();
ReloadRemaining = false;
}
diff --git a/src/sel_items_adder.cpp b/src/sel_items_adder.cpp
index 0c8d0abf..a667e390 100644
--- a/src/sel_items_adder.cpp
+++ b/src/sel_items_adder.cpp
@@ -261,7 +261,7 @@ void SelectedItemsAdder::addAfterCurrentSong() const
{
if (!Mpd.isPlaying())
return;
- size_t pos = Mpd.GetCurrentlyPlayingSongPos();
+ size_t pos = Mpd.GetCurrentSongPos();
++pos;
bool success = addSongsToPlaylist(m_selected_items, false, pos);
if (success)
@@ -273,7 +273,7 @@ void SelectedItemsAdder::addAfterCurrentAlbum() const
if (!Mpd.isPlaying())
return;
auto &pl = myPlaylist->main();
- size_t pos = Mpd.GetCurrentlyPlayingSongPos();
+ size_t pos = Mpd.GetCurrentSongPos();
withUnfilteredMenu(pl, [&pos, &pl]() {
std::string album = pl[pos].value().getAlbum();
while (pos < pl.size() && pl[pos].value().getAlbum() == album)
diff --git a/src/status.cpp b/src/status.cpp
index d98325f6..53f1e3be 100644
--- a/src/status.cpp
+++ b/src/status.cpp
@@ -288,7 +288,7 @@ void Status::Changes::songID()
drawTitle(myPlaylist->nowPlayingSong());
if (Config.autocenter_mode && !myPlaylist->main().isFiltered())
- myPlaylist->main().highlight(Mpd.GetCurrentlyPlayingSongPos());
+ myPlaylist->main().highlight(Mpd.GetCurrentSongPos());
if (Config.now_playing_lyrics && isVisible(myLyrics) && myLyrics->previousScreen() == myPlaylist)
myLyrics->ReloadNP = 1;