From 4705f6e8cbb991f1292bed22919804a25244f386 Mon Sep 17 00:00:00 2001 From: BK Bolisetty Date: Sun, 22 Jan 2017 15:45:22 -0800 Subject: [PATCH 001/204] Add a README, showing enable visualizer --- README.md | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 000000000..e65cc5ebe --- /dev/null +++ b/README.md @@ -0,0 +1,61 @@ +# NCurses Music Player Client (Plus Plus) + +## ncmpcpp – featureful ncurses based MPD client inspired by ncmpc + +### Main features: + +* tag editor +* playlist editor +* easy to use search engine +* media library +* music visualizer +* ability to fetch artist info from last.fm +* new display mode +* alternative user interface +* ability to browse and add files from outside of MPD music directory +…and a lot more minor functions. + +### Dependencies: + +* boost library +* ncurses library +* readline library +* curl library (optional, required for fetching lyrics and last.fm data) +* fftw library (optional, required for frequency spectrum music visualization mode) +* tag library (optional, required for tag editing) + + +### Known issues: +* No full support for handling encodings other than UTF-8. + +### Installation: + +The simplest way to compile this package is: + + 1. `cd` to the directory containing the package's source code. + + For the next two commands, `csh` users will need to prefix them with + `sh `. + + 2. Run `./autogen.sh` to generate the `configure` script. + + 3. Run `./configure` to configure the package for your system. This + will take a while. While running, it prints some messages + telling which features it is checking for. + + 4. Run `make` to compile the package. + + 5. Type `make install` to install the programs and any data files + and documentation. + + 6. You can remove the program binaries and object files from the + source code directory by typing `make clean`. + +Detailed intallation instructions can be found in the `INSTALL` file. + +### Optional features: + +Optional features can be enable by specifying them during configure. For +example, to enable visualizer run `./configure --enable-visualizer`. + +Additional details can be found in the INSTALL file. From f4a6189e2fba6fbe65853cac8fb59ffa2d398fb5 Mon Sep 17 00:00:00 2001 From: BK Bolisetty Date: Sat, 28 Jan 2017 10:52:34 -0800 Subject: [PATCH 002/204] Add link to project page. --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index e65cc5ebe..2bf016f0d 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # NCurses Music Player Client (Plus Plus) +Project page - http://rybczak.net/ncmpcpp/ + ## ncmpcpp – featureful ncurses based MPD client inspired by ncmpc ### Main features: From a22cd2c68c71481c653d9f6547f2e7b46ce57106 Mon Sep 17 00:00:00 2001 From: Hugh Wang Date: Thu, 8 Jun 2017 00:26:02 +0800 Subject: [PATCH 003/204] Fix crash when colors are disabled --- src/curses/window.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/curses/window.cpp b/src/curses/window.cpp index 5a83b59c3..0222888de 100644 --- a/src/curses/window.cpp +++ b/src/curses/window.cpp @@ -214,6 +214,10 @@ Color Color::End(0, 0, false, true); int Color::pairNumber() const { + // If colors are disabled, return default pair value. + if (color_pair_map.empty()) + return 0; + int result = 0; if (isEnd()) throw std::logic_error("'end' doesn't have a corresponding pair number"); From 4f72330bb8d04aa14fa380f969013675882b7c1b Mon Sep 17 00:00:00 2001 From: Andrzej Rybczak Date: Sat, 24 Jun 2017 16:06:50 +0200 Subject: [PATCH 004/204] config: change default value of show_duplicate_tags from 'true' to 'yes' --- doc/config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/config b/doc/config index 37d716e37..5aca3e37b 100644 --- a/doc/config +++ b/doc/config @@ -301,7 +301,7 @@ # #discard_colors_if_item_is_selected = yes # -#show_duplicate_tags = true +#show_duplicate_tags = yes # #incremental_seeking = yes # From 29a90de777879822ebee3e282e71d28cd5242070 Mon Sep 17 00:00:00 2001 From: Polochon-street Date: Mon, 7 Aug 2017 00:42:07 +0200 Subject: [PATCH 005/204] Added a fully working 'Album-only' view --- src/screens/media_library.cpp | 90 +++++++++++++++++++++++++---------- 1 file changed, 65 insertions(+), 25 deletions(-) diff --git a/src/screens/media_library.cpp b/src/screens/media_library.cpp index aad516eb5..6751dee72 100644 --- a/src/screens/media_library.cpp +++ b/src/screens/media_library.cpp @@ -53,6 +53,7 @@ MediaLibrary *myLibrary; namespace { bool hasTwoColumns; +bool isAlbumOnly; size_t itsLeftColStartX; size_t itsLeftColWidth; size_t itsMiddleColWidth; @@ -73,12 +74,15 @@ std::string Date_(std::string date) MPD::SongIterator getSongsFromAlbum(const AlbumEntry &album) { Mpd.StartSearch(true); - Mpd.AddSearch(Config.media_lib_primary_tag, album.entry().tag()); + if (!isAlbumOnly) + Mpd.AddSearch(Config.media_lib_primary_tag, album.entry().tag()); if (!album.isAllTracksEntry()) { Mpd.AddSearch(MPD_TAG_ALBUM, album.entry().album()); - if (Config.media_library_albums_split_by_date) - Mpd.AddSearch(MPD_TAG_DATE, album.entry().date()); + if(!isAlbumOnly) { + if (Config.media_library_albums_split_by_date) + Mpd.AddSearch(MPD_TAG_DATE, album.entry().date()); + } } return Mpd.CommitSearchSongs(); } @@ -135,14 +139,14 @@ class SortAlbumEntries { typedef MediaLibrary::Album Album; LocaleStringComparison m_cmp; - + public: SortAlbumEntries() : m_cmp(std::locale(), Config.ignore_leading_the) { } bool operator()(const AlbumEntry &a, const AlbumEntry &b) const { return (*this)(a.entry(), b.entry()); } - + bool operator()(const Album &a, const Album &b) const { if (Config.media_library_sort_by_mtime) return a.mtime() > b.mtime(); @@ -182,6 +186,7 @@ MediaLibrary::MediaLibrary() , m_fetching_delay(boost::posix_time::milliseconds(Config.data_fetching_delay ? 250 : -1)) { hasTwoColumns = 0; + isAlbumOnly = 0; itsLeftColWidth = COLS/3-1; itsMiddleColWidth = COLS/3; itsMiddleColStartX = itsLeftColWidth+1; @@ -299,15 +304,28 @@ void MediaLibrary::update() unsigned idx = 0; while (!(tag = s->get(Config.media_lib_primary_tag, idx++)).empty()) { - auto key = std::make_tuple( - std::move(tag), - s->getAlbum(), - Date_(s->getDate())); - auto it = albums.find(key); - if (it == albums.end()) - albums[std::move(key)] = s->getMTime(); - else - it->second = s->getMTime(); + if (isAlbumOnly) { + auto key = std::make_tuple( + "", + s->getAlbum(), + ""); + auto it = albums.find(key); + if (it == albums.end()) + albums[std::move(key)] = s->getMTime(); + else + it->second = s->getMTime(); + } + else { + auto key = std::make_tuple( + std::move(tag), + s->getAlbum(), + Date_(s->getDate())); + auto it = albums.find(key); + if (it == albums.end()) + albums[std::move(key)] = s->getMTime(); + else + it->second = s->getMTime(); + } } } size_t idx = 0; @@ -873,7 +891,15 @@ void MediaLibrary::updateTimer() void MediaLibrary::toggleColumnsMode() { - hasTwoColumns = !hasTwoColumns; + if (isAlbumOnly) { + hasTwoColumns = 0; + isAlbumOnly = 0; + } + else if (hasTwoColumns) + isAlbumOnly = 1; + else + hasTwoColumns = 1; + Tags.clear(); Albums.clear(); Albums.reset(); @@ -886,8 +912,14 @@ void MediaLibrary::toggleColumnsMode() { std::string item_type = boost::locale::to_lower( tagTypeToString(Config.media_lib_primary_tag)); - std::string and_mtime = Config.media_library_sort_by_mtime ? " and mtime" : ""; - Albums.setTitle("Albums (sorted by " + item_type + and_mtime + ")"); + if(!isAlbumOnly) { + std::string and_mtime = Config.media_library_sort_by_mtime ? " and mtime" : ""; + Albums.setTitle("Albums (sorted by " + item_type + and_mtime + ")"); + } + else { + std::string and_mtime = Config.media_library_sort_by_mtime ? " (sorted by mtime)" : ""; + Albums.setTitle("Albums" + and_mtime); + } } } else @@ -918,8 +950,14 @@ void MediaLibrary::toggleSortMode() { std::string item_type = boost::locale::to_lower( tagTypeToString(Config.media_lib_primary_tag)); - std::string and_mtime = Config.media_library_sort_by_mtime ? (" " "and mtime") : ""; - Albums.setTitle("Albums (sorted by " + item_type + and_mtime + ")"); + if(!isAlbumOnly) { + std::string and_mtime = Config.media_library_sort_by_mtime ? (" " "and mtime") : ""; + Albums.setTitle("Albums (sorted by " + item_type + and_mtime + ")"); + } + else { + std::string and_mtime = Config.media_library_sort_by_mtime ? " (sorted by mtime)" : ""; + Albums.setTitle("Albums" + and_mtime); + } } } else @@ -1064,13 +1102,15 @@ std::string AlbumToString(const AlbumEntry &ae) { if (hasTwoColumns) { - if (ae.entry().tag().empty()) - result += Config.empty_tag; - else - result += ae.entry().tag(); - result += " - "; + if(!isAlbumOnly) { + if (ae.entry().tag().empty()) + result += Config.empty_tag; + else + result += ae.entry().tag(); + result += " - "; + } } - if (Config.media_lib_primary_tag != MPD_TAG_DATE && !ae.entry().date().empty()) + if (Config.media_lib_primary_tag != MPD_TAG_DATE && !ae.entry().date().empty() && !isAlbumOnly) result += "(" + ae.entry().date() + ") "; result += ae.entry().album().empty() ? "" : ae.entry().album(); } From d14426ffd13f2b93f2e14cf71db6cf1a5d45c2a2 Mon Sep 17 00:00:00 2001 From: Andrzej Rybczak Date: Thu, 31 Aug 2017 09:14:44 +0200 Subject: [PATCH 006/204] Change version to 0.8.1_dev --- NEWS | 3 +++ configure.ac | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 4107e6eb2..401ba8baa 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,6 @@ +ncmpcpp-0.8.1 (????-??-??) +* Setting 'colors_enabled' to 'no' no longer results in a crash. + ncmpcpp-0.8 (2017-05-21) * Configuration variable 'execute_on_player_state_change' was added. * Support for controlling whether ncmpcpp should display multiple tags as-is or make an effort to hide duplicate values (show_duplicate_tags configuration variable, enabled by default). diff --git a/configure.ac b/configure.ac index 16c4116d0..29985f210 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT([ncmpcpp], [0.8]) +AC_INIT([ncmpcpp], [0.8.1_dev]) AC_CONFIG_SRCDIR([configure.ac]) AC_CONFIG_HEADERS(config.h) AM_INIT_AUTOMAKE([subdir-objects]) From 5733c4482619567103b6d72b9f93b6e335f47db9 Mon Sep 17 00:00:00 2001 From: Arseny Maslennikov Date: Tue, 1 Aug 2017 00:38:43 +0300 Subject: [PATCH 007/204] tag_editor.cpp: Fix misleading indentation Prior to this commit GCC6 throws 2 warnings on lines 1062 and 1161 if the project is compiled with -Wmisleading-indentation. The code blocks mentioned in the related notes seem to be indented one tab too much. --- src/screens/tag_editor.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/screens/tag_editor.cpp b/src/screens/tag_editor.cpp index 571d9f5e7..3311131c1 100644 --- a/src/screens/tag_editor.cpp +++ b/src/screens/tag_editor.cpp @@ -1062,7 +1062,7 @@ void GetPatternList() while (std::getline(input, line)) if (!line.empty()) Patterns.push_back(line); - input.close(); + input.close(); } } } @@ -1164,14 +1164,14 @@ std::string ParseFilename(MPD::MutableSong &s, std::string mask, bool preview) if (*j == '_') *j = ' '; - if (!preview) - { - MPD::MutableSong::SetFunction set = IntoSetFunction(it->first); - if (set) - s.setTags(set, it->second); - } - else - result << "%" << it->first << ": " << it->second << "\n"; + if (!preview) + { + MPD::MutableSong::SetFunction set = IntoSetFunction(it->first); + if (set) + s.setTags(set, it->second); + } + else + result << "%" << it->first << ": " << it->second << "\n"; } return result.str(); } From a960e5c43989b7d6a11401498f18c43d6ad20ee5 Mon Sep 17 00:00:00 2001 From: Arseny Maslennikov Date: Tue, 1 Aug 2017 01:25:56 +0300 Subject: [PATCH 008/204] ncmpcpp.1: Fix indentation The whole man page content from the "CONFIGURATION" header to the end happens to be indented by an extraneous tab due to a random .TP. --- doc/ncmpcpp.1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/ncmpcpp.1 b/doc/ncmpcpp.1 index 2cc5f25d0..22d5dfb11 100644 --- a/doc/ncmpcpp.1 +++ b/doc/ncmpcpp.1 @@ -41,7 +41,7 @@ Display help. .TP .B \-v, \-\-version Display version information. -.TP + .SH "CONFIGURATION" When ncmpcpp starts, it tries to read user's settings from $HOME/.ncmpcpp/config and $XDG_CONFIG_HOME/ncmpcpp/config files. If no configuration is found, ncmpcpp uses its default configuration. An example configuration file containing all default values is provided with ncmpcpp and can be usually found in /usr/share/doc/ncmpcpp (exact location may depend on used distribution or configure prefix). From db28618929b9ec11e831d5a44437757f6195497d Mon Sep 17 00:00:00 2001 From: Andrzej Rybczak Date: Thu, 31 Aug 2017 09:23:11 +0200 Subject: [PATCH 009/204] Fix intermittent failures when using --quiet --- NEWS | 1 + src/configuration.cpp | 6 +----- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/NEWS b/NEWS index 401ba8baa..e1a675563 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,6 @@ ncmpcpp-0.8.1 (????-??-??) * Setting 'colors_enabled' to 'no' no longer results in a crash. +* Using '--quiet' command line argument no longer results in a crash. ncmpcpp-0.8 (2017-05-21) * Configuration variable 'execute_on_player_state_change' was added. diff --git a/src/configuration.cpp b/src/configuration.cpp index 5673c218a..005b27ee5 100644 --- a/src/configuration.cpp +++ b/src/configuration.cpp @@ -105,11 +105,7 @@ bool configure(int argc, char **argv) // suppress messages from std::clog if (vm.count("quiet")) - { - std::ofstream null_stream; - null_stream.open("/dev/null"); - std::clog.rdbuf(null_stream.rdbuf()); - } + std::clog.rdbuf(nullptr); if (vm.count("help")) { From def5c46225896373adb8a7d749cfa4a019b1c1fd Mon Sep 17 00:00:00 2001 From: Andrzej Rybczak Date: Thu, 31 Aug 2017 09:41:20 +0200 Subject: [PATCH 010/204] Media library: sort songs by name if there are no track numbers --- NEWS | 1 + src/screens/media_library.cpp | 19 +++++++++++++------ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/NEWS b/NEWS index e1a675563..eaa766b89 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,7 @@ ncmpcpp-0.8.1 (????-??-??) * Setting 'colors_enabled' to 'no' no longer results in a crash. * Using '--quiet' command line argument no longer results in a crash. +* If songs in media library have no track numbers, sort them by name. ncmpcpp-0.8 (2017-05-21) * Configuration variable 'execute_on_player_state_change' was added. diff --git a/src/screens/media_library.cpp b/src/screens/media_library.cpp index aad516eb5..33fba24ea 100644 --- a/src/screens/media_library.cpp +++ b/src/screens/media_library.cpp @@ -109,19 +109,26 @@ struct SortSongs { return (*this)(a.value(), b.value()); } bool operator()(const MPD::Song &a, const MPD::Song &b) { + int ret; for (auto get = GetFuns.begin()+m_offset; get != GetFuns.end(); ++get) { - int ret = m_cmp(a.getTags(*get), - b.getTags(*get)); + ret = m_cmp(a.getTags(*get), + b.getTags(*get)); if (ret != 0) return ret < 0; } + + // Sort by track numbers. try { - int ret = boost::lexical_cast(a.getTags(&MPD::Song::getTrackNumber)) - - boost::lexical_cast(b.getTags(&MPD::Song::getTrackNumber)); - return ret < 0; + ret = boost::lexical_cast(a.getTags(&MPD::Song::getTrackNumber)) + - boost::lexical_cast(b.getTags(&MPD::Song::getTrackNumber)); } catch (boost::bad_lexical_cast &) { - return a.getTrackNumber() < b.getTrackNumber(); + ret = a.getTrackNumber().compare(b.getTrackNumber()); } + if (ret != 0) + return ret < 0; + + // If there are no track numbers, sort by name. + return a.getName() < b.getName(); } }; From c340a6ba9a322985b8d50ab477631689b6b8f55a Mon Sep 17 00:00:00 2001 From: Andrzej Rybczak Date: Thu, 31 Aug 2017 10:19:13 +0200 Subject: [PATCH 011/204] Mark songs as added to playlist immediately (media library / playlist editor) --- NEWS | 1 + src/status.cpp | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/NEWS b/NEWS index eaa766b89..02e5efa2d 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,7 @@ ncmpcpp-0.8.1 (????-??-??) * Setting 'colors_enabled' to 'no' no longer results in a crash. * Using '--quiet' command line argument no longer results in a crash. * If songs in media library have no track numbers, sort them by name. +* Fixed a situation in which songs added to playlist from media library or playlist editor screens would not be immediately marked as such. ncmpcpp-0.8 (2017-05-21) * Configuration variable 'execute_on_player_state_change' was added. diff --git a/src/status.cpp b/src/status.cpp index 85246a17e..cd1850ca2 100644 --- a/src/status.cpp +++ b/src/status.cpp @@ -439,6 +439,17 @@ void Status::Changes::playlist(unsigned previous_version) myPlaylist->reloadTotalLength(); myPlaylist->reloadRemaining(); + + // When we're in multi-column screens, it might happen that songs visible on + // the screen are added, but they will not be immediately marked as such + // because the window that contains them is not the active one at the moment, + // so we need to refresh them manually. + if (isVisible(myLibrary) + && !myLibrary->isActiveWindow(myLibrary->Songs)) + myLibrary->Songs.refresh(); + if (isVisible(myPlaylistEditor) + && !myPlaylistEditor->isActiveWindow(myPlaylistEditor->Content)) + myPlaylistEditor->Content.refresh(); } void Status::Changes::storedPlaylists() From 4a6e7d305b0b5a8ab101ff05f541f527f2d2bc42 Mon Sep 17 00:00:00 2001 From: Andrzej Rybczak Date: Fri, 1 Sep 2017 11:02:43 +0200 Subject: [PATCH 012/204] Default to sorting songs in media library by their display format instead of name --- NEWS | 2 +- src/screens/media_library.cpp | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index 02e5efa2d..1652e7f59 100644 --- a/NEWS +++ b/NEWS @@ -1,7 +1,7 @@ ncmpcpp-0.8.1 (????-??-??) * Setting 'colors_enabled' to 'no' no longer results in a crash. * Using '--quiet' command line argument no longer results in a crash. -* If songs in media library have no track numbers, sort them by name. +* If songs in media library have no track numbers, sort them by their display format. * Fixed a situation in which songs added to playlist from media library or playlist editor screens would not be immediately marked as such. ncmpcpp-0.8 (2017-05-21) diff --git a/src/screens/media_library.cpp b/src/screens/media_library.cpp index 33fba24ea..06f4081c7 100644 --- a/src/screens/media_library.cpp +++ b/src/screens/media_library.cpp @@ -127,8 +127,9 @@ struct SortSongs { if (ret != 0) return ret < 0; - // If there are no track numbers, sort by name. - return a.getName() < b.getName(); + // If track numbers are equal, sort by the display format. + return Format::stringify(Config.song_library_format, &a) + < Format::stringify(Config.song_library_format, &b); } }; From 2cd5de9141db31d6102ae26d699de0a3db1f7035 Mon Sep 17 00:00:00 2001 From: Yagmur Oymak Date: Fri, 22 Sep 2017 15:21:09 +0300 Subject: [PATCH 013/204] ncmpcpp.1: Show option arguments more clearly and improve formatting slightly --- doc/ncmpcpp.1 | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/doc/ncmpcpp.1 b/doc/ncmpcpp.1 index 22d5dfb11..aeedd1bd8 100644 --- a/doc/ncmpcpp.1 +++ b/doc/ncmpcpp.1 @@ -9,37 +9,39 @@ ncmpcpp is an ncurses client for MPD (Music Player Daemon), inspired by ncmpc. Read more about MPD at http://www.musicpd.org .SH "OPTIONS" -.B \-h, \-\-host +Mandatory arguments to long options are mandatory for short options too. +.TP +\fB\-h\fR, \fB\-\-host\fR=\fIHOST\fR Connect to server at host [localhost] .TP -.B \-p, \-\-port +\fB\-p\fR, \fB\-\-port\fR=\fIPORT\fR Connect to server at port [6600] .TP -.B \-\-current-song +\fB\-\-current-song\fR[=\fIFORMAT\fR] Print current song using given format and exit .TP -.B \-c, \-\-config +\fB\-c\fR, \fB\-\-config\fR=\fIFILE\fR Specify configuration file(s) .TP -.B \-\-ignore-config-errors +\fB\-\-ignore-config-errors\fR Ignore unknown and invalid options in configuration files .TP -.B \-c, \-\-bindings +\fB\-c\fR, \fB\-\-bindings\fR=\fIFILE\fR Specify bindings file(s) .TP -.B \-s, \-\-screen +\fB\-s\fR, \fB\-\-screen \fR Specify the startup screen ( may be: help, playlist, browser, search_engine, media_library, playlist_editor, tag_editor, outputs, visualizer, clock) .TP -.B \-S, \-\-slave-screen +\fB\-S\fR, \fB\-\-slave-screen \fR Specify the startup slave screen ( may be: help, playlist, browser, search_engine, media_library, playlist_editor, tag_editor, outputs, visualizer, clock) .TP -.B \-q, \-\-quiet +\fB\-q\fR, \fB\-\-quiet\fR Suppress logs and excess output .TP -.B \-?, \-\-help +\fB\-?\fR, \fB\-\-help\fR Display help. .TP -.B \-v, \-\-version +\fB\-v\fR, \fB\-\-version\fR Display version information. .SH "CONFIGURATION" @@ -277,10 +279,10 @@ If set to yes, filenames generated by ncmpcpp (with tag editor, for lyrics, arti If set to yes, it will be possible to physically delete files and directories from the disk in the browser. .TP .B lastfm_preferred_language = ISO 639 alpha-2 language code -If set, ncmpcpp will try to get info from last.fm in language you set and if it fails, it will fall back to english. Otherwise it will use english the first time. +If set, ncmpcpp will try to get info from last.fm in language you set and if it fails, it will fall back to English. Otherwise it will use English the first time. .TP .B space_add_mode = add_remove/always_add -If set to add_remove, attepting to add files that are already in playlist will remove them. Otherwise they can be added multiple times. +If set to add_remove, attempting to add files that are already in playlist will remove them. Otherwise they can be added multiple times. .TP .B show_hidden_files_in_local_browser = yes/no Trigger for displaying in local browser files and directories that begin with '.' From 464fd318c3943dffaa9077273118d1a72e658922 Mon Sep 17 00:00:00 2001 From: Andrzej Rybczak Date: Wed, 11 Oct 2017 19:20:55 +0200 Subject: [PATCH 014/204] Media library: remove argument to SortSongs contructor to simplify sorting --- src/screens/media_library.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/screens/media_library.cpp b/src/screens/media_library.cpp index 06f4081c7..24045b4ae 100644 --- a/src/screens/media_library.cpp +++ b/src/screens/media_library.cpp @@ -99,20 +99,18 @@ struct SortSongs { static const std::array GetFuns; LocaleStringComparison m_cmp; - std::ptrdiff_t m_offset; - + public: - SortSongs(bool disc_only = false) - : m_cmp(std::locale(), Config.ignore_leading_the), m_offset(disc_only ? 2 : 0) { } + SortSongs() + : m_cmp(std::locale(), Config.ignore_leading_the) { } bool operator()(const SongItem &a, const SongItem &b) { return (*this)(a.value(), b.value()); } bool operator()(const MPD::Song &a, const MPD::Song &b) { int ret; - for (auto get = GetFuns.begin()+m_offset; get != GetFuns.end(); ++get) { - ret = m_cmp(a.getTags(*get), - b.getTags(*get)); + for (auto get : GetFuns) { + ret = m_cmp(a.getTags(get), b.getTags(get)); if (ret != 0) return ret < 0; } @@ -453,7 +451,7 @@ void MediaLibrary::update() }; if (idx < Songs.size()) Songs.resizeList(idx); - std::sort(Songs.begin(), Songs.end(), SortSongs(!album.isAllTracksEntry())); + std::sort(Songs.begin(), Songs.end(), SortSongs()); } } From fa9838efb28cb17a81a6dde07d91233a2260c4f5 Mon Sep 17 00:00:00 2001 From: Andrzej Rybczak Date: Wed, 11 Oct 2017 19:34:30 +0200 Subject: [PATCH 015/204] Do not start prompt with the current search constraint when applying a new one --- NEWS | 1 + src/actions.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 1652e7f59..67d2999c1 100644 --- a/NEWS +++ b/NEWS @@ -3,6 +3,7 @@ ncmpcpp-0.8.1 (????-??-??) * Using '--quiet' command line argument no longer results in a crash. * If songs in media library have no track numbers, sort them by their display format. * Fixed a situation in which songs added to playlist from media library or playlist editor screens would not be immediately marked as such. +* Do not start prompt with the current search constraint when applying a new one. ncmpcpp-0.8 (2017-05-21) * Configuration variable 'execute_on_player_state_change' was added. diff --git a/src/actions.cpp b/src/actions.cpp index e4d1d5106..e21501376 100644 --- a/src/actions.cpp +++ b/src/actions.cpp @@ -3020,7 +3020,7 @@ void findItem(const SearchDirection direction) assert(w != nullptr); assert(w->allowsSearching()); - std::string constraint = w->searchConstraint(); + std::string constraint; try { ScopedValue disabled_autocenter_mode(Config.autocenter_mode, false); From 58bb6b5a4398fc4fb7cdfd174a20464926e472d1 Mon Sep 17 00:00:00 2001 From: Andrzej Rybczak Date: Wed, 11 Oct 2017 19:37:11 +0200 Subject: [PATCH 016/204] Change version to 0.8.1 --- NEWS | 2 +- configure.ac | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 67d2999c1..951597d24 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,4 @@ -ncmpcpp-0.8.1 (????-??-??) +ncmpcpp-0.8.1 (2017-10-11) * Setting 'colors_enabled' to 'no' no longer results in a crash. * Using '--quiet' command line argument no longer results in a crash. * If songs in media library have no track numbers, sort them by their display format. diff --git a/configure.ac b/configure.ac index 29985f210..9fb827226 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT([ncmpcpp], [0.8.1_dev]) +AC_INIT([ncmpcpp], [0.8.1]) AC_CONFIG_SRCDIR([configure.ac]) AC_CONFIG_HEADERS(config.h) AM_INIT_AUTOMAKE([subdir-objects]) From b7da5d1b9af1f3b0022c1f7daa0c7d12ae72a21d Mon Sep 17 00:00:00 2001 From: Andrzej Rybczak Date: Thu, 12 Oct 2017 13:29:51 +0200 Subject: [PATCH 017/204] Curl: re-enable verification of the SSL certificate against host --- src/curl_handle.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/curl_handle.cpp b/src/curl_handle.cpp index 7be15675b..dfe2c4958 100644 --- a/src/curl_handle.cpp +++ b/src/curl_handle.cpp @@ -41,8 +41,6 @@ CURLcode Curl::perform(std::string &data, const std::string &URL, const std::str curl_easy_setopt(c, CURLOPT_WRITEDATA, &data); curl_easy_setopt(c, CURLOPT_CONNECTTIMEOUT, timeout); curl_easy_setopt(c, CURLOPT_NOSIGNAL, 1); - // Workaround last.fm SSL certificate problems. - curl_easy_setopt(c, CURLOPT_SSL_VERIFYHOST, 0); curl_easy_setopt(c, CURLOPT_USERAGENT, "ncmpcpp " VERSION); if (follow_redirect) curl_easy_setopt(c, CURLOPT_FOLLOWLOCATION, 1L); From 77f39d4979fb5e8264b9462569276179a5534155 Mon Sep 17 00:00:00 2001 From: Dima Gerasimov Date: Sun, 17 Dec 2017 15:28:59 +0000 Subject: [PATCH 018/204] Add support for starting playback in stopped state --- src/actions.cpp | 11 +++++++++++ src/actions.h | 10 ++++++++++ 2 files changed, 21 insertions(+) diff --git a/src/actions.cpp b/src/actions.cpp index e21501376..14b8185a9 100644 --- a/src/actions.cpp +++ b/src/actions.cpp @@ -804,6 +804,11 @@ void NextSong::run() Mpd.Next(); } +bool Pause::canBeRun() +{ + return Status::State::player() != MPD::psStop; +} + void Pause::run() { Mpd.Toggle(); @@ -845,6 +850,11 @@ void Stop::run() Mpd.Stop(); } +void Play::run() +{ + Mpd.Play(); +} + void ExecuteCommand::run() { using Global::wFooter; @@ -2734,6 +2744,7 @@ void populateActions() insert_action(new Actions::NextSong()); insert_action(new Actions::Pause()); insert_action(new Actions::Stop()); + insert_action(new Actions::Play()); insert_action(new Actions::ExecuteCommand()); insert_action(new Actions::SavePlaylist()); insert_action(new Actions::MoveSortOrderUp()); diff --git a/src/actions.h b/src/actions.h index 9d01d6327..c5548e905 100644 --- a/src/actions.h +++ b/src/actions.h @@ -68,6 +68,7 @@ enum class Type Next, Pause, Stop, + Play, ExecuteCommand, SavePlaylist, MoveSortOrderUp, @@ -515,6 +516,7 @@ struct Pause: BaseAction Pause(): BaseAction(Type::Pause, "pause") { } private: + virtual bool canBeRun() override; virtual void run() override; }; @@ -526,6 +528,14 @@ struct Stop: BaseAction virtual void run() override; }; +struct Play: BaseAction +{ + Play(): BaseAction(Type::Play, "play") { } + +private: + virtual void run() override; +}; + struct ExecuteCommand: BaseAction { ExecuteCommand(): BaseAction(Type::ExecuteCommand, "execute_command") { } From 0b04d9ec35a8327f5ee734dc70e8b6b8ffa50152 Mon Sep 17 00:00:00 2001 From: Andrzej Rybczak Date: Sun, 18 Mar 2018 09:26:28 +0100 Subject: [PATCH 019/204] Help: display EoF properly --- src/bindings.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/bindings.cpp b/src/bindings.cpp index 51360bdbd..831a2f593 100644 --- a/src/bindings.cpp +++ b/src/bindings.cpp @@ -314,6 +314,8 @@ std::wstring keyToWString(const NC::Key::Type key) result += L"Left"; else if (key == NC::Key::Right) result += L"Right"; + else if (key == NC::Key::EoF) + result += L"EoF"; else if (key >= NC::Key::F1 && key <= NC::Key::F9) { result += L"F"; From db619c6159061d5abd50c18fc2873d66e2452c87 Mon Sep 17 00:00:00 2001 From: Andrzej Rybczak Date: Sun, 18 Mar 2018 10:31:08 +0100 Subject: [PATCH 020/204] Make it impossible for MainHeight to overflow --- src/actions.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/actions.cpp b/src/actions.cpp index e21501376..581413df8 100644 --- a/src/actions.cpp +++ b/src/actions.cpp @@ -219,7 +219,7 @@ void resizeScreen(bool reload_main_window) getch(); } - MainHeight = LINES-(Config.design == Design::Alternative ? 7 : 4); + MainHeight = std::max(LINES-(Config.design == Design::Alternative ? 7 : 4), 0); validateScreenSize(); @@ -258,7 +258,7 @@ void setWindowsDimensions() using Global::MainHeight; MainStartY = Config.design == Design::Alternative ? 5 : 2; - MainHeight = LINES-(Config.design == Design::Alternative ? 7 : 4); + MainHeight = std::max(LINES-(Config.design == Design::Alternative ? 7 : 4), 0); if (!Config.header_visibility) { From 10ac22a70f2d1633efac28560e1b17b8b331d2fd Mon Sep 17 00:00:00 2001 From: Andrzej Rybczak Date: Sun, 18 Mar 2018 10:32:58 +0100 Subject: [PATCH 021/204] Update NEWS and bump version to 0.8.2_dev --- NEWS | 4 ++++ configure.ac | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 951597d24..b9d1b8153 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,7 @@ +ncmpcpp-0.8.2 (????-??-??) +* Help screen: fixed display of EoF keycode +* Fixed possible integer overflow when resizing screen + ncmpcpp-0.8.1 (2017-10-11) * Setting 'colors_enabled' to 'no' no longer results in a crash. * Using '--quiet' command line argument no longer results in a crash. diff --git a/configure.ac b/configure.ac index 9fb827226..245af1aa8 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT([ncmpcpp], [0.8.1]) +AC_INIT([ncmpcpp], [0.8.2_dev]) AC_CONFIG_SRCDIR([configure.ac]) AC_CONFIG_HEADERS(config.h) AM_INIT_AUTOMAKE([subdir-objects]) From 1b98dd71e15734c35f67148c88d7dfd114692afc Mon Sep 17 00:00:00 2001 From: Andrzej Rybczak Date: Sun, 18 Mar 2018 10:52:14 +0100 Subject: [PATCH 022/204] Lyrics fetcher: fix lyricsmania.com and sing365.com fetchers --- NEWS | 1 + src/lyrics_fetcher.h | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index b9d1b8153..c82b5f5d2 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,7 @@ ncmpcpp-0.8.2 (????-??-??) * Help screen: fixed display of EoF keycode * Fixed possible integer overflow when resizing screen +* Fixed fetching lyrics from lyricsmania.com and sing365.com ncmpcpp-0.8.1 (2017-10-11) * Setting 'colors_enabled' to 'no' no longer results in a crash. diff --git a/src/lyrics_fetcher.h b/src/lyrics_fetcher.h index 15079f5c3..94850a74a 100644 --- a/src/lyrics_fetcher.h +++ b/src/lyrics_fetcher.h @@ -98,7 +98,7 @@ struct LyricsmaniaFetcher : public GoogleLyricsFetcher virtual const char *name() const override { return "lyricsmania.com"; } protected: - virtual const char *regex() const override { return "
(.*?)
"; } + virtual const char *regex() const override { return "
(.*?)
"; } }; struct Sing365Fetcher : public GoogleLyricsFetcher @@ -106,7 +106,7 @@ struct Sing365Fetcher : public GoogleLyricsFetcher virtual const char *name() const override { return "sing365.com"; } protected: - virtual const char *regex() const override { return "
.*?(.*?)
(.*?)(.*?)