Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
b9a40c7
Artwork: Album art proof of concert
evanc577 Jan 3, 2021
73403d6
Artwork: Use POSIX_SPAWN_SETPGROUP rather than setsid
evanc577 Jan 4, 2021
8c2f9e8
Artwork: exec ueberzug directly without bash
evanc577 Jan 5, 2021
a05b7d5
Artwork: albumart_default_path and albumart_scaler config options
evanc577 Jan 5, 2021
6c832ee
Artwork: modular backend, fix artwork after popup
evanc577 Jan 6, 2021
3f9ebbf
Artwork: update config, bindings, and manpage
evanc577 Jan 6, 2021
08b2c5e
Artwork: reap forked process if exec() ueberzug fails
evanc577 Jan 6, 2021
81bab0d
Artwork: Use boost::process instead of fork/exec
evanc577 Jan 6, 2021
5ff50a0
Artwork: Minor fixes
evanc577 Jan 7, 2021
c988e3e
Configure: check for boost::process
evanc577 Jan 10, 2021
ce5f363
Artwork: Use boost::json
evanc577 Jan 10, 2021
ba32da6
Artwork: Use boost::property_tree rather than boost::json
evanc577 Jan 21, 2021
bc72fe5
Artwork: Various style fixes
evanc577 Jan 24, 2021
83e08c5
Artwork: Use MPD albumart API
evanc577 Jan 24, 2021
4a3bb59
Artwork: Add readpicture support for embedded art
evanc577 Jan 25, 2021
23f94ab
Artwork: Use queue of std::functions for worker
evanc577 Jan 28, 2021
693bf38
Artwork: Don't send too many requests to MPD
evanc577 Jan 29, 2021
6a50de8
Artwork: re-support local artwork
evanc577 Feb 26, 2021
f4332c0
Artwork: Allow configuration of album artwork sources
evanc577 Feb 26, 2021
3d7d7a7
Artwork: Proof of concept Kitty backend
evanc577 Feb 28, 2021
6a446d4
Artwork: Find Magick++ library and headers
evanc577 Feb 28, 2021
5349334
Artwork: Usable kitty backend
evanc577 Mar 7, 2021
098e208
Artwork: Optimize kitty backend
evanc577 Mar 7, 2021
f75bffa
Artwork: Postproccess all images
evanc577 Mar 7, 2021
536ac3e
Artwork: Support artwork alignment
evanc577 Mar 7, 2021
9fd6036
Artwork: clean up some code
evanc577 Mar 7, 2021
cc08ef9
Artwork: Fix checking wrong buffer after getting artwork from mpd
evanc577 Mar 11, 2021
540bb6a
Artwork: Fix wrong positioning with some images
evanc577 May 4, 2021
b3bd9fb
Artwork: Remove Kitty backend from docs
evanc577 May 5, 2021
90183f2
Artwork: Tidy up for merge
evanc577 May 5, 2021
0c353a7
Artwork: Don't allow empty albumart_sources config
evanc577 May 5, 2021
3e306ce
Artwork: Allow manual font size and image offset
evanc577 May 5, 2021
5e77b9c
Artwork: Fix compilation with artwork disabled
evanc577 May 5, 2021
f2e283d
Artwork: Workaround for <IM6 Blob::base64() being non-const
evanc577 Jun 28, 2022
13ae2f3
Artwork: Fix scrolling art off screen when user scrolls
evanc577 Sep 27, 2022
12d1166
Artwork: Change static functions to methods
evanc577 Feb 7, 2023
f6e3509
Artwork: Fix screen switching data races
evanc577 Feb 7, 2023
6c28c4b
Artwork: allow setting custom local files
evanc577 May 30, 2023
c5f4e0b
Artwork: Allow globs in albumart_filenames
evanc577 May 30, 2023
a74d041
Artwork: Re-order includes to fix compilation on some systems
evanc577 Jun 2, 2023
e55a565
Artwork: Add small LRU cache for rendered PNG images
evanc577 Jun 7, 2023
78cf8b4
Artwork: Remove unused includes, fix comment typo
evanc577 Jul 26, 2024
df758f0
Artwork: Add EscapedArtworkBackend
evanc577 Jul 26, 2024
b430b3d
Artwork: Use std::string for EscapedArtworkBackend
evanc577 Jul 26, 2024
59ff62a
Artwork: Add support for ueberzugpp
evanc577 Jul 27, 2024
5326836
Artwork: takeOutput return reference instead of copying
evanc577 Jul 27, 2024
ce94376
Add albumart_backend to example config
evanc577 Aug 21, 2024
e13a860
Artwork: Add magick++ dependency to readme
evanc577 Aug 21, 2024
a32d56e
Artwork: Fix new warnings
evanc577 Aug 21, 2024
4aabbe1
Artwork: Add slave screen example config to manpage
evanc577 Aug 22, 2024
641df18
Artwork: address PR comments
evanc577 Aug 28, 2024
7db66ce
Artwork: Use std::format
evanc577 Sep 8, 2024
49fed34
Artwork: Add a comment to Artwork::resetArtworkPosition
evanc577 Sep 25, 2024
b7d8f0b
Artwork: Read screen dimensions in main thread
evanc577 Sep 25, 2024
2b01a4c
Artwork: Remove typedefs
evanc577 Sep 25, 2024
63bb62a
Artwork: Update magick++ in configure script
evanc577 Sep 25, 2024
6710856
Artwork: Revert to boost::format
evanc577 Sep 25, 2024
4b29c5d
Artwork: Add artwork build to CI
evanc577 Oct 5, 2024
75fc943
Artwork: Add libmagick++ to CI
evanc577 Oct 6, 2024
80f755e
Artwork: Call resetArtworkPosition() if characters are printed via
evanc577 Oct 6, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ jobs:
libboost-thread-dev
libcurl4-gnutls-dev
libfftw3-dev
libmagick++-dev
libmpdclient-dev
libncurses-dev
libreadline-dev
Expand Down Expand Up @@ -60,6 +61,7 @@ jobs:
--disable-outputs \
--disable-visualizer \
--disable-clock \
--disable-artwork \
--without-fftw \
--without-taglib \
--with-lto=$(nproc)
Expand All @@ -73,6 +75,7 @@ jobs:
--enable-outputs \
--enable-visualizer \
--enable-clock \
--enable-artwork \
--with-fftw \
--with-taglib \
--with-lto=$(nproc)
Expand Down
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Darby Payne <darby.payne@gmail.com>
David Coppa <dcoppa@gmail.com>
Dmitriy Kusterskiy <dimykus@gmail.com>
Eric Izoita <ericizoita@gmail.com>
Evan Chang <evanc577@gmail.com>
Frank Blendinger <fb@intoxicatedmind.net>
greenbagels <greenbagels@teknik.io>
Hamuko <hamuko@burakku.com>
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ new, incompatible versions of dependencies, it will be fixed.
#### Optional libraries
* [fftw](http://www.fftw.org), for frequency spectrum music visualization mode
* [taglib](https://taglib.org/), for tag editing
* [magick++](https://www.imagemagick.org/Magick++/), for album artwork display

### Known issues:
* No full support for handling encodings other than UTF-8.
Expand All @@ -58,7 +59,7 @@ The simplest way to compile this package is:
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.
Detailed installation instructions can be found in the `INSTALL` file.

### Optional features:
Optional features can be enable by specifying them during configure. For
Expand Down
21 changes: 20 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ LT_INIT
AC_ARG_ENABLE(outputs, AS_HELP_STRING([--enable-outputs], [Enable outputs screen @<:@default=no@:>@]), [outputs=$enableval], [outputs=no])
AC_ARG_ENABLE(visualizer, AS_HELP_STRING([--enable-visualizer], [Enable music visualizer screen @<:@default=no@:>@]), [visualizer=$enableval], [visualizer=no])
AC_ARG_ENABLE(clock, AS_HELP_STRING([--enable-clock], [Enable clock screen @<:@default=no@:>@]), [clock=$enableval], [clock=no])
AC_ARG_ENABLE(artwork, AS_HELP_STRING([--enable-artwork], [Enable artwork screen @<:@default=no@:>@]), [artwork=$enableval], [artwork=no])

AC_ARG_WITH(fftw, AS_HELP_STRING([--with-fftw], [Enable fftw support (required for frequency spectrum vizualization) @<:@default=auto@:>@]), [fftw=$withval], [fftw=auto])
AC_ARG_WITH(taglib, AS_HELP_STRING([--with-taglib], [Enable tag editor @<:@default=auto@:>@]), [taglib=$withval], [taglib=auto])
Expand Down Expand Up @@ -94,7 +95,7 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[auto f = [](auto n) { return n*n; }; f(
CXXFLAGS="$CXXFLAGS -Wall -Wextra -Wshadow -Wimplicit-fallthrough"

# boost
BOOST_REQUIRE([1.60])
BOOST_REQUIRE([1.64])
AC_SUBST(BOOST_CPPFLAGS)
CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"

Expand All @@ -108,6 +109,8 @@ BOOST_RANGE
BOOST_TOKENIZER
BOOST_TUPLE
BOOST_VARIANT
BOOST_PROCESS
BOOST_PROPERTY_TREE

BOOST_DATE_TIME
AC_SUBST(BOOST_DATE_TIME_LDFLAGS)
Expand Down Expand Up @@ -287,5 +290,21 @@ if test "$taglib" != "no" ; then
fi
fi

if test "$artwork" = "yes" ; then
PKG_CHECK_MODULES([magick], [Magick++ >= 6], [
AC_SUBST(magick_CFLAGS)
AC_SUBST(magick_LIBS)
CPPFLAGS="$CPPFLAGS $magick_CFLAGS"
AC_CHECK_HEADERS([Magick++.h],
LIBS="$LIBS $magick_LIBS",
AC_MSG_ERROR([missing Magick++.h header])
)
AC_DEFINE([ENABLE_ARTWORK], [1], [enables album artwork screen])
],
AC_MSG_ERROR([ImageMagick is required!])
)
fi


AC_CONFIG_FILES([Makefile src/Makefile doc/Makefile])
AC_OUTPUT
3 changes: 3 additions & 0 deletions doc/bindings
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,9 @@
#def_key "8"
# show_visualizer
#
#def_key "9"
# show_artwork
#
#def_key "="
# show_clock
#
Expand Down
45 changes: 45 additions & 0 deletions doc/config
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,51 @@
#visualizer_spectrum_log_scale_x = yes
#visualizer_spectrum_log_scale_y = yes
#
##### in-terminal artwork #####
##
## ncmpcpp can display artwork in the terminal. The artwork is shown in the
## "artwork" screen, which can be optionally be displayed side-by-side with
## another screen via ncmpcpp's slave screen functionality.
## Ueberzug must be installed and visible in PATH for artwork to be displayed.
##
#
## Enable album art display
#
#albumart = no
#
## List of sources of album art, highest priority sources first. "local" scans
## mpd_music_dir on the local machine and attempt to display an image named
## "cover.png", "cover.jpg", "cover.tiff", or "cover.bmp". "mpd_albumart" and
## "mpd_readpicture" query MPD with the albumart and readpicture commands
## respectively. May be empty, in which case the albumart_default_path fallback
## will be used.
#
#albumart_sources = local, mpd_dir, mpd_embed
#
## Method to draw album artwork to terminal. One of "ueberzug", "kitty".
#
#albumart_backend = "ueberzug"
#
## Fallback to this image if no album cover art is found in the music library.
#
#albumart_default_path = ""
#
## Alignment of album artwork within window. One of "N", "NE", "E", "SE", "S",
## "SW", "W", "NW", "center".
#
#albumart_align = "center"
#
## Manually set font width/height in pixels. Set to 0 to try auto detection,
## support depends on terminal emulator. Check error log if no image appears.
#
#font_width = 0
#font_height = 0
#
## Move album artwork horizontally/vertically by specified number of characters.
#
#albumart_xoffset = 0
#albumart_yoffset = 0
#
##### system encoding #####
##
## ncmpcpp should detect your charset encoding but if it failed to do so, you
Expand Down
46 changes: 46 additions & 0 deletions doc/ncmpcpp.1
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,36 @@ For spectrum visualizer, left-most frequency of visualizer, must be less than HZ
.B visualizer_spectrum_hz_max = Hz
For spectrum visualizer, right-most frequency of visualizer, must be greater than HZ MIN.
.TP
.B albumart = yes/no
Enable album art display
.TP
.B albumart_sources = SOURCES
List of sources of album art, highest priority sources first. "local" scans mpd_music_dir on the local machine and attempt to display an image named "cover.png", "cover.jpg", "cover.tiff", or "cover.bmp". "mpd_albumart" and "mpd_readpicture" query MPD with the albumart and readpicture commands respectively. May be empty, in which case the albumart_default_path fallback will be used.
.TP
.B albumart_backend = BACKEND
Method to display artwork image. One of "ueberzug", "kitty".
.TP
.B albumart_filenames = PATHS
List of file names of artwork to display when using "local" source in order of priority. Globs are allowed.
.TP
.B albumart_default_path = PATH
Fallback to this image if no album cover art is found in the music library.
.TP
.B albumart_align = ALIGN
Alignment of album artwork within window. One of "N", "NE", "E", "SE", "S", "SW", "W", "NW", "center".
.TP
.B font_width = pixels
Manually set font width in pixels. Set to 0 to try auto detection, support depends on terminal emulator. Check error log if no image appears.
.TP
.B font_height = pixels
Same as font_width, but for height.
.TP
.B albumart_xoffset = chars
Move album artwork horizontally by specified number of characters.
.TP
.B albumart_yoffset = chars
Same as albumart_xoffset, but move vertically.
.TP
.B system_encoding = ENCODING
If you use encoding other than utf8, set it in order to handle utf8 encoded strings properly.
.TP
Expand Down Expand Up @@ -519,6 +549,22 @@ Available values for colors:

\fBNote\fR: colors can be nested, so if you write $2some$5text$9, it'll disable only usage of blue color and make red the current one.

.SH "ALBUM ARTWORK"

ncmpcpp can display album artwork, either from a local file or from the MPD protocol.
The supported terminal image protocols are ueberzug(pp) and kitty terminal graphics protocol.

Album artwork in ncmppcpp is implemented as a screen; to have artwork shown side-by-side with the regular ncmpcpp UI, use ncmpcpp's slave screen functionality.

\fBExample side-by-side artwork configuration\fR:

albumart = yes
albumart_backend = kitty
startup_screen = artwork
startup_slave_screen = playlist
startup_slave_screen_focus = yes
locked_screen_width_part = 25

.SH "BUGS"
Report bugs on https://github.com/arybczak/ncmpcpp/issues
.SH "NOTE"
Expand Down
25 changes: 25 additions & 0 deletions m4/boost.m4
Original file line number Diff line number Diff line change
Expand Up @@ -856,6 +856,17 @@ BOOST_DEFUN([Hash],
[BOOST_FIND_HEADER([boost/functional/hash.hpp])])


# BOOST_JSON([PREFERRED-RT-OPT])
# -----------------------------------
# Look for Boost.JSON. For the documentation of PREFERRED-RT-OPT, see the
# documentation of BOOST_FIND_LIB above.
BOOST_DEFUN([JSON],
[BOOST_FIND_LIB([json], [$1],
[boost/json.hpp],
[boost::json::value v;])
])# BOOST_JSON


# BOOST_LAMBDA()
# --------------
# Look for Boost.Lambda
Expand Down Expand Up @@ -996,6 +1007,20 @@ BOOST_DEFUN([Preprocessor],
[BOOST_FIND_HEADER([boost/preprocessor/repeat.hpp])])


# BOOST_PROCESS()
# ------------
# Look for Boost.Process
BOOST_DEFUN([Process],
[BOOST_FIND_HEADER([boost/process.hpp])])


# BOOST_PROPERTY_TREE()
# ------------
# Look for Boost.PropertyTree
BOOST_DEFUN([Property_Tree],
[BOOST_FIND_HEADER([boost/property_tree/ptree.hpp])])


# BOOST_RANGE()
# --------------------
# Look for Boost.Range
Expand Down
2 changes: 2 additions & 0 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ ncmpcpp_SOURCES = \
screens/tag_editor.cpp \
screens/tiny_tag_editor.cpp \
screens/visualizer.cpp \
screens/artwork.cpp \
utility/comparators.cpp \
utility/html.cpp \
utility/option_parser.cpp \
Expand Down Expand Up @@ -84,6 +85,7 @@ noinst_HEADERS = \
screens/tag_editor.h \
screens/tiny_tag_editor.h \
screens/visualizer.h \
screens/artwork.h \
utility/comparators.h \
utility/const.h \
utility/conversion.h \
Expand Down
31 changes: 30 additions & 1 deletion src/actions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
#include "screens/tag_editor.h"
#include "screens/tiny_tag_editor.h"
#include "screens/visualizer.h"
#include "screens/artwork.h"
#include "title.h"
#include "tags.h"

Expand Down Expand Up @@ -147,6 +148,10 @@ void initializeScreens()
# ifdef ENABLE_VISUALIZER
myVisualizer = new Visualizer;
# endif // ENABLE_VISUALIZER

# ifdef ENABLE_ARTWORK
myArtwork = new Artwork;
# endif // ENABLE_ARTWORK

# ifdef ENABLE_OUTPUTS
myOutputs = new Outputs;
Expand Down Expand Up @@ -182,6 +187,10 @@ void setResizeFlags()
myVisualizer->hasToBeResized = 1;
# endif // ENABLE_VISUALIZER

# ifdef ENABLE_ARTWORK
myArtwork->hasToBeResized = 1;
# endif // ENABLE_ARTWORK

# ifdef ENABLE_OUTPUTS
myOutputs->hasToBeResized = 1;
# endif // ENABLE_OUTPUTS
Expand Down Expand Up @@ -228,7 +237,7 @@ void resizeScreen(bool reload_main_window)
applyToVisibleWindows(&BaseScreen::refresh);

Status::Changes::elapsedTime(false);
Status::Changes::playerState();
Status::Changes::playerState(false);
// Note: routines for drawing separator if alternative user
// interface is active and header is hidden are placed in
// NcmpcppStatusChanges.StatusFlags
Expand Down Expand Up @@ -346,6 +355,10 @@ void UpdateEnvironment::run(bool update_timer, bool refresh_window, bool mpd_syn
if (flags)
Status::update(flags);
}

# ifdef ENABLE_ARTWORK
myArtwork->updatedVisibility();
# endif
}

void UpdateEnvironment::run()
Expand Down Expand Up @@ -2745,6 +2758,21 @@ void ShowServerInfo::run()
myServerInfo->switchTo();
}

bool ShowArtwork::canBeRun()
{
#ifdef ENABLE_ARTWORK
return myScreen != myArtwork;
#else
return false;
#endif // ENABLE_ARTWORK
}

void ShowArtwork::run() {
#ifdef ENABLE_ARTWORK
myArtwork->switchTo();
#endif // ENABLE_ARTWORK
}

}

namespace {
Expand Down Expand Up @@ -2883,6 +2911,7 @@ void populateActions()
insert_action(new Actions::ShowVisualizer());
insert_action(new Actions::ShowClock());
insert_action(new Actions::ShowServerInfo());
insert_action(new Actions::ShowArtwork());
for (size_t i = 0; i < AvailableActions.size(); ++i)
{
if (AvailableActions[i] == nullptr)
Expand Down
10 changes: 10 additions & 0 deletions src/actions.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ enum class Type
ShowVisualizer,
ShowClock,
ShowServerInfo,
ShowArtwork,
_numberOfActions // needed to dynamically calculate size of action array
};

Expand Down Expand Up @@ -1425,6 +1426,15 @@ struct ShowServerInfo: BaseAction
virtual void run() override;
};

struct ShowArtwork: BaseAction
{
ShowArtwork(): BaseAction(Type::ShowArtwork, "show_artwork") { }

private:
virtual bool canBeRun() override;
virtual void run() override;
};

}

#endif // NCMPCPP_ACTIONS_H
2 changes: 2 additions & 0 deletions src/bindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -589,6 +589,8 @@ void BindingsConfiguration::generateDefaults()
bind(k, Actions::Type::ShowOutputs);
if (notBound(k = stringToKey("8")))
bind(k, Actions::Type::ShowVisualizer);
if (notBound(k = stringToKey("9")))
bind(k, Actions::Type::ShowArtwork);
if (notBound(k = stringToKey("=")))
bind(k, Actions::Type::ShowClock);
if (notBound(k = stringToKey("@")))
Expand Down
1 change: 1 addition & 0 deletions src/curses/menu_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#define NCMPCPP_MENU_IMPL_H

#include "menu.h"
#include "screens/artwork.h"

namespace NC {

Expand Down
Loading