From 8bc5d73b062ec3b7e1e39081786b957fea050ce8 Mon Sep 17 00:00:00 2001 From: Andrzej Rybczak Date: Thu, 13 Aug 2009 01:26:20 +0200 Subject: [PATCH] accept percentage values 0-100 for seeking instead of 1-99 --- src/ncmpcpp.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/ncmpcpp.cpp b/src/ncmpcpp.cpp index fd3b6779..836d38f6 100644 --- a/src/ncmpcpp.cpp +++ b/src/ncmpcpp.cpp @@ -1484,26 +1484,26 @@ int main(int argc, char *argv[]) newpos = StrToInt(position)*60 + StrToInt(position.substr(position.find(':')+1)); } catch (std::out_of_range) { } - if (newpos > 0 && newpos < s->GetTotalLength()) + if (newpos >= 0 && newpos <= s->GetTotalLength()) Mpd.Seek(newpos); else - ShowMessage("Out of bounds, 0:00-%s possible for mm:ss, %d given.", s->GetLength().c_str(), newpos); + ShowMessage("Out of bounds, 0:00-%s possible for mm:ss, %s given.", s->GetLength().c_str(), MPD::Song::ShowTime(newpos).c_str()); } else if (position.find('s') != std::string::npos) // probably position in seconds { newpos = StrToInt(position); - if (newpos > 0 && newpos < s->GetTotalLength()) + if (newpos >= 0 && newpos <= s->GetTotalLength()) Mpd.Seek(newpos); else - ShowMessage("Out of bounds, 1-%d possible for seconds, %d given.", s->GetTotalLength(), newpos); + ShowMessage("Out of bounds, 0-%d possible for seconds, %d given.", s->GetTotalLength(), newpos); } else { newpos = StrToInt(position); - if (newpos > 0 && newpos < 100) + if (newpos >= 0 && newpos <= 100) Mpd.Seek(s->GetTotalLength()*newpos/100.0); else - ShowMessage("Out of bounds, 1-99 possible for %%, %d given.", newpos); + ShowMessage("Out of bounds, 0-100 possible for %%, %d given.", newpos); } UpdateStatusImmediately = 1; }