|
|
|
|
@ -162,6 +162,7 @@ void NcmpcppStatusChanged(Connection *Mpd, StatusChanges changed, void *) |
|
|
|
|
static size_t playing_song_scroll_begin = 0; |
|
|
|
|
static bool repeat_one_allowed = 0; |
|
|
|
|
static string player_state; |
|
|
|
|
static MPD::Song np; |
|
|
|
|
|
|
|
|
|
int sx, sy; |
|
|
|
|
wFooter->Bold(1); |
|
|
|
|
@ -183,6 +184,8 @@ void NcmpcppStatusChanged(Connection *Mpd, StatusChanges changed, void *) |
|
|
|
|
{ |
|
|
|
|
if (!Playlist::BlockUpdate) |
|
|
|
|
{ |
|
|
|
|
np = Mpd->GetCurrentSong(); |
|
|
|
|
|
|
|
|
|
bool was_filtered = myPlaylist->Main()->isFiltered(); |
|
|
|
|
myPlaylist->Main()->ShowAll(); |
|
|
|
|
SongList list; |
|
|
|
|
@ -347,6 +350,7 @@ void NcmpcppStatusChanged(Connection *Mpd, StatusChanges changed, void *) |
|
|
|
|
myPlaylist->Main()->BoldOption(myPlaylist->OldPlaying, 0); |
|
|
|
|
} |
|
|
|
|
catch (std::out_of_range &) { } |
|
|
|
|
np = Mpd->GetCurrentSong(); |
|
|
|
|
myPlaylist->Main()->BoldOption(myPlaylist->NowPlaying, 1); |
|
|
|
|
if (Config.autocenter_mode && !myPlaylist->Main()->isFiltered()) |
|
|
|
|
myPlaylist->Main()->Highlight(myPlaylist->NowPlaying); |
|
|
|
|
@ -375,26 +379,25 @@ void NcmpcppStatusChanged(Connection *Mpd, StatusChanges changed, void *) |
|
|
|
|
} |
|
|
|
|
if (changed.ElapsedTime) |
|
|
|
|
{ |
|
|
|
|
const Song *s = myPlaylist->NowPlayingSong(); |
|
|
|
|
if (s) |
|
|
|
|
if (!np.Empty()) |
|
|
|
|
{ |
|
|
|
|
int elapsed = Mpd->GetElapsedTime(); |
|
|
|
|
|
|
|
|
|
// 'repeat one' mode check - be sure that we deal with item with known length
|
|
|
|
|
if (s->GetTotalLength() && elapsed == s->GetTotalLength()-1) |
|
|
|
|
if (np.GetTotalLength() && elapsed == np.GetTotalLength()-1) |
|
|
|
|
repeat_one_allowed = 1; |
|
|
|
|
|
|
|
|
|
WindowTitle(utf_to_locale_cpy(s->toString(Config.song_window_title_format))); |
|
|
|
|
WindowTitle(utf_to_locale_cpy(np.toString(Config.song_window_title_format))); |
|
|
|
|
|
|
|
|
|
if (!block_statusbar_update && Config.statusbar_visibility) |
|
|
|
|
{ |
|
|
|
|
string tracklength; |
|
|
|
|
if (s->GetTotalLength()) |
|
|
|
|
if (np.GetTotalLength()) |
|
|
|
|
{ |
|
|
|
|
tracklength = " ["; |
|
|
|
|
tracklength += Song::ShowTime(elapsed); |
|
|
|
|
tracklength += "/"; |
|
|
|
|
tracklength += s->GetLength(); |
|
|
|
|
tracklength += np.GetLength(); |
|
|
|
|
tracklength += "]"; |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
@ -405,17 +408,17 @@ void NcmpcppStatusChanged(Connection *Mpd, StatusChanges changed, void *) |
|
|
|
|
} |
|
|
|
|
*wFooter << XY(0, 1) << wclrtoeol << player_state |
|
|
|
|
<< fmtBoldEnd |
|
|
|
|
<< Scroller(utf_to_locale_cpy(s->toString(Config.song_status_format)), wFooter->GetWidth()-player_state.length()-tracklength.length(), playing_song_scroll_begin) |
|
|
|
|
<< Scroller(utf_to_locale_cpy(np.toString(Config.song_status_format)), wFooter->GetWidth()-player_state.length()-tracklength.length(), playing_song_scroll_begin) |
|
|
|
|
<< fmtBold |
|
|
|
|
<< XY(wFooter->GetWidth()-tracklength.length(), 1) << tracklength; |
|
|
|
|
} |
|
|
|
|
if (!block_progressbar_update) |
|
|
|
|
{ |
|
|
|
|
double progressbar_size = (double)elapsed/(s->GetTotalLength()); |
|
|
|
|
double progressbar_size = (double)elapsed/(np.GetTotalLength()); |
|
|
|
|
int howlong = wFooter->GetWidth()*progressbar_size; |
|
|
|
|
wFooter->SetColor(Config.progressbar_color); |
|
|
|
|
mvwhline(wFooter->Raw(), 0, 0, 0, wFooter->GetWidth()); |
|
|
|
|
if (s->GetTotalLength()) |
|
|
|
|
if (np.GetTotalLength()) |
|
|
|
|
{ |
|
|
|
|
mvwhline(wFooter->Raw(), 0, 0, '=',howlong); |
|
|
|
|
mvwaddch(wFooter->Raw(), 0, howlong, '>'); |
|
|
|
|
|