-
Notifications
You must be signed in to change notification settings - Fork 230
Album artwork via Ueberzug #437
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
I think this PR is clean and feature-complete enough for review now.... |
|
Damn that's cool |
|
a0bc7be updates the configure script to check for e31a33e updates the configure script to check for
Not to mention json has its own problems. Linux doesn't require that filenames be valid unicode. json doesn't support non-unicode strings. We can construct a path that cannot be passed successfully to either ueberzug's simple or json parsers by creating a filename with both tabs and non-unicode characters (please don't do this). $ cp img.jpg "$(printf "\t\xbd\xb2.jpg")" |
There is also the possibility of using Boost.PropertyTree for reading/writing JSON. I would also prefer to work with Boost.JSON, but Boost.PropertyTree has the advantage to be around since Boost 1.41. Edit: I need to try out this PR. :) |
|
@evanc577 Thanks! Would it be a lot of work to use PropertyTree instead? Considering that boost::json is very new. |
|
Easy enough, switched to property_tree and lowered min boost version to 1.64 |
|
Do you think it's worth adding support for fetching covers from the Internet (and storing them in I don't know where it fetches them from though. |
|
Fetching art from the internet might be for another PR, this one's scope is already getting pretty big. I've been playing around with libmpdclient, and even though it doesn't have direct support for the Pros:
Cons:
I've created a new branch https://github.com/evanc577/ncmpcpp/tree/artwork-mpd with a working implementation. It's only been tested with a local MPD server and no password. |
|
I have added support for getting artwork via the mpd protocol and displaying images via the Kitty backend. There is one issue that needs to be addressed for the Kitty backend (and probably any other backend with draws directly to the terminal, rather than create a new X window) which I am currently stuck on.... When displaying the artwork window side by side with a window that can scroll, the artwork also scrolls up and down when scrolling the other window. I believe this is an issue with ncurses scrolling the physical terminal as an optimization, but I can't figure out how to disable this behavior at all times. If the scrollable window has many duplicated lines, sometimes the artwork does not scroll, so I know that "technically" it should be fixable. Whether ncurses has a way to change this behavior or not I don't know. Any ideas are appreciated, thanks. |
|
I have not been working on this PR because I don't know of a solution to the Kitty backend problem I described in my last comment. The Ueberzug backend seems to work fine though. SInce I think this PR is going to be stuck here, how about I hide the Kitty backend by removing it from the docs but otherwise merge it as-is, so we can at least get one functional backend. Then in the future, if I (or someone else) wants to finish the Kitty or Sixel backends, it can go in as a separate PR. Thoughts? |
|
Sounds good 👍 |
|
OK, this should be ready now.
Tested working terminals on my machine (KDE Plasma X11, Arch Linux):
Example configScreenshots |
|
If I've followed correctly, this PR pulls the album art from online sources? Or online in the sense of a remote mpd server? Out of curiosity, how would something like mopidy with the mopidy-spotify plugin work (obviously with mopidy-mpd as well)? Will it work with the current state of the PR, or is this a future PR? In case anyone else wanted to get a taste for this feature before it gets merged, checkout ncmpcpp-ueberzug. I've been using it for a while and it works well. |
Online in the sense of a remote (or local) mpd server. It can also fetch art from the local filesystem (relative to the
I haven't tested with mopidy at all, but if/when mopidy-mpd implements the It doesn't look like mopidy-mpd has support today. mopidy/mopidy-mpd#17 |
|
Thanks for the clarification! It's unfortunate that mopidy doesn't have the support (yet, at least). I suppose as an alternative, it could be possible to extract albumart URLs through mpris (which is exposed through mopidy-mpris), but I have no idea how feasible that would be to include here. |
|
Is there a branch for this I could try out? |
The source branch for this PR is https://github.com/evanc577/ncmpcpp/tree/artwork but review progress seems to have stalled |
|
Just checked out your fork (amazing by the way) and was wondering: Does |
|
@evanc577 Is it possible to use an alternative backend other than ueberzug or kitty? For example, |
There aren't any alternatives implemented, but they shouldn't be difficult to implement. Assuming they play well with ncurses. @arybczak thoughts about merging this PR? |
|
@evanc577 Can't build this PR on Ubuntu 20.04. |
|
@arybczak In the latest commit 80f755e, I've changed the Let me know if you think this is a better solution. |
|
This is fantastic, would love to see it merged :) |

Display album art in terminal with Ueberzug.
Added a new "artwork" screen that can be resized and positioned using existing ncmpcpp functions.
mpd_music_dirconfig value.cover.png,cover.jpg,cover.tiff,cover.bmpalbumart_default_pathif it can't find a suitable image.ueberzugexecutable must be visible in$PATH, ncmpcpp spawns it as a background process.albumart_scaleroption. See Ueberzug documentation.Use
./configure --enable-artworkflag to compile artwork support.PR draft thoughts
Some current limitations:
albumart, libmpdclient has not implemented this functionality yet anyways.Only searches for "cover.jpg" in directory.cover.png,cover.jpg,cover.tiff, andcover.bmp.albumart_default_pathconfig option.albumart_scaleroption to customize look, values corresponding to Ueberzug's scaler options.If using split screens and a popup appears (such as when adding a song to a playlist), the artwork disappears and need to switch/reload screens to make it appear again.Configure script doesn't check whether Ueberzug is installed or not.Dirty hacks that probably need to go away:
Usesposix_spawn()to start ueberzug, kills it on exit withstd::atexit()andkill(). If ncmpcpp crashes and terminates abnormally, the spawned process will not be terminated.Solved by fork-exec ueberzug directly and manually creating a pipe for ueberzug stdin.boost::processwhich abstracts away a lot of the hard stuff...Ueberzug is hardcoded, should refactor so other viable backends can be easily added.Screenshots