new feature: display remaining time of song instead of elapsed time
This commit is contained in:
@@ -209,6 +209,8 @@
|
|||||||
#
|
#
|
||||||
#display_bitrate = "no"
|
#display_bitrate = "no"
|
||||||
#
|
#
|
||||||
|
#display_remaining_time = "no"
|
||||||
|
#
|
||||||
#regular_expressions = "basic" (basic/extended)
|
#regular_expressions = "basic" (basic/extended)
|
||||||
#
|
#
|
||||||
##
|
##
|
||||||
|
|||||||
@@ -198,6 +198,9 @@ If enabled, clock will display time in format hh:mm:ss, otherwise hh:mm.
|
|||||||
.B display_bitrate = yes/no
|
.B display_bitrate = yes/no
|
||||||
If enabled, bitrate of currently playing song will be displayed in statusbar.
|
If enabled, bitrate of currently playing song will be displayed in statusbar.
|
||||||
.TP
|
.TP
|
||||||
|
.B display_remaining_time = yes/no
|
||||||
|
If enabled, remaining time of currently playing song will be be displayed in statusbar instead of elapsed time.
|
||||||
|
.TP
|
||||||
.B ignore_leading_the = yes/no
|
.B ignore_leading_the = yes/no
|
||||||
If enabled, word "the" at the beginning of tags/filenames will be ignored while sorting items.
|
If enabled, word "the" at the beginning of tags/filenames will be ignored while sorting items.
|
||||||
.TP
|
.TP
|
||||||
|
|||||||
@@ -1115,7 +1115,13 @@ int main(int argc, char *argv[])
|
|||||||
*wFooter << fmtBold;
|
*wFooter << fmtBold;
|
||||||
if (Config.new_design)
|
if (Config.new_design)
|
||||||
{
|
{
|
||||||
tracklength = Song::ShowTime(songpos);
|
if (Config.display_remaining_time)
|
||||||
|
{
|
||||||
|
tracklength = "-";
|
||||||
|
tracklength += Song::ShowTime(s->GetTotalLength()-songpos);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
tracklength = Song::ShowTime(songpos);
|
||||||
tracklength += "/";
|
tracklength += "/";
|
||||||
tracklength += s->GetLength();
|
tracklength += s->GetLength();
|
||||||
*wHeader << XY(0, 0) << tracklength << " ";
|
*wHeader << XY(0, 0) << tracklength << " ";
|
||||||
@@ -1123,7 +1129,17 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
tracklength = "[" + Song::ShowTime(songpos) + "/" + s->GetLength() + "]";
|
tracklength = "[";
|
||||||
|
if (Config.display_remaining_time)
|
||||||
|
{
|
||||||
|
tracklength += "-";
|
||||||
|
tracklength += Song::ShowTime(s->GetTotalLength()-songpos);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
tracklength = Song::ShowTime(songpos);
|
||||||
|
tracklength += "/";
|
||||||
|
tracklength += s->GetLength();
|
||||||
|
tracklength += "]";
|
||||||
*wFooter << XY(wFooter->GetWidth()-tracklength.length(), 1) << tracklength;
|
*wFooter << XY(wFooter->GetWidth()-tracklength.length(), 1) << tracklength;
|
||||||
}
|
}
|
||||||
double progressbar_size = songpos/double(s->GetTotalLength());
|
double progressbar_size = songpos/double(s->GetTotalLength());
|
||||||
|
|||||||
@@ -292,6 +292,7 @@ void DefaultConfiguration(ncmpcpp_config &conf)
|
|||||||
conf.jump_to_now_playing_song_at_start = true;
|
conf.jump_to_now_playing_song_at_start = true;
|
||||||
conf.clock_display_seconds = false;
|
conf.clock_display_seconds = false;
|
||||||
conf.display_bitrate = false;
|
conf.display_bitrate = false;
|
||||||
|
conf.display_remaining_time = false;
|
||||||
conf.ignore_leading_the = false;
|
conf.ignore_leading_the = false;
|
||||||
conf.block_search_constraints_change = true;
|
conf.block_search_constraints_change = true;
|
||||||
conf.use_console_editor = false;
|
conf.use_console_editor = false;
|
||||||
@@ -743,6 +744,10 @@ void ReadConfiguration(ncmpcpp_config &conf)
|
|||||||
{
|
{
|
||||||
conf.display_bitrate = v == "yes";
|
conf.display_bitrate = v == "yes";
|
||||||
}
|
}
|
||||||
|
else if (cl.find("display_remaining_time") != std::string::npos)
|
||||||
|
{
|
||||||
|
conf.display_remaining_time = v == "yes";
|
||||||
|
}
|
||||||
else if (cl.find("ignore_leading_the") != std::string::npos)
|
else if (cl.find("ignore_leading_the") != std::string::npos)
|
||||||
{
|
{
|
||||||
conf.ignore_leading_the = v == "yes";
|
conf.ignore_leading_the = v == "yes";
|
||||||
|
|||||||
@@ -190,6 +190,7 @@ struct ncmpcpp_config
|
|||||||
bool jump_to_now_playing_song_at_start;
|
bool jump_to_now_playing_song_at_start;
|
||||||
bool clock_display_seconds;
|
bool clock_display_seconds;
|
||||||
bool display_bitrate;
|
bool display_bitrate;
|
||||||
|
bool display_remaining_time;
|
||||||
bool ignore_leading_the;
|
bool ignore_leading_the;
|
||||||
bool block_search_constraints_change;
|
bool block_search_constraints_change;
|
||||||
bool use_console_editor;
|
bool use_console_editor;
|
||||||
|
|||||||
@@ -415,7 +415,13 @@ void NcmpcppStatusChanged(Connection *, StatusChanges changed, void *)
|
|||||||
std::string tracklength;
|
std::string tracklength;
|
||||||
if (Config.new_design)
|
if (Config.new_design)
|
||||||
{
|
{
|
||||||
tracklength = Song::ShowTime(elapsed);
|
if (Config.display_remaining_time)
|
||||||
|
{
|
||||||
|
tracklength = "-";
|
||||||
|
tracklength += Song::ShowTime(np.GetTotalLength()-elapsed);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
tracklength = Song::ShowTime(elapsed);
|
||||||
if (np.GetTotalLength())
|
if (np.GetTotalLength())
|
||||||
{
|
{
|
||||||
tracklength += "/";
|
tracklength += "/";
|
||||||
@@ -466,7 +472,13 @@ void NcmpcppStatusChanged(Connection *, StatusChanges changed, void *)
|
|||||||
tracklength += " [";
|
tracklength += " [";
|
||||||
if (np.GetTotalLength())
|
if (np.GetTotalLength())
|
||||||
{
|
{
|
||||||
tracklength += Song::ShowTime(elapsed);
|
if (Config.display_remaining_time)
|
||||||
|
{
|
||||||
|
tracklength += "-";
|
||||||
|
tracklength += Song::ShowTime(np.GetTotalLength()-elapsed);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
tracklength += Song::ShowTime(elapsed);
|
||||||
tracklength += "/";
|
tracklength += "/";
|
||||||
tracklength += np.GetLength();
|
tracklength += np.GetLength();
|
||||||
tracklength += "]";
|
tracklength += "]";
|
||||||
|
|||||||
Reference in New Issue
Block a user