your-diary / ympd

A customized `ympd` with many new features like dark mode and cover art display.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ympd++

This project is a fork of the original ympd. It seems the original has been abandoned; the last commit dates back to 2018 and numerous pull requests are ignored.

comparison
Fig: Comparison between the original ympd (left) and this ympd++ (right).

Development

Branches

We use customized branch as the main branch and keep master branch untouched.

References

Build

Without Installation

This builds the project and starts ympd in the foreground.

$ ./build.sh

With Installation

This builds the project and installs ympd.

$ ./build.sh --install

Requirements

See README_original.md.

Tested Environments

Build Environments

  • Raspbian Buster on Raspberry Pi 3

Server Environments

  • Raspbian Buster on Raspberry Pi 3

Client Environments

  • Firefox on Arch Linux

  • Firefox on Android

New Features

0. Index

  • Backward-Incompatible Changes

  • Keyboard Seek

  • Dark Mode

  • Informative Page Title

  • Cover Art Display

1. Backward-Incompatible Changes

  • and were used to go to the previous/next song, but now the keyboard bindings are changed to h and l respectively.

2. Keyboard Seek

You can seek the current song for seek_length seconds

  • with and keys

  • or by clicking / buttons (see the figure below).

The default value of seek_length is 5 and it can be increased/decreased

  • with and keys

  • or by clicking the button in which the value of seek_length is displayed (see the figure below).

seek buttons
Fig: Buttons for seeking. The numbered buttons are newly added.

3. Dark Mode

Dark mode is implemented and is enabled by default. You can toggle it by pressing D (i.e. Shift + d).

non dark mode dark mode
Fig. Non dark mode. Fig. Dark mode.

4. Informative Page Title

Now the page title is dynamically updated to the information of the current song. This is related to Issue 128.

informative page title
Fig: Page title with song information.

5. Cover Art Display

5.1. Explanation of This Feature

If cover_ympd.jpg file exists under the same directory in which the current song resides, it is displayed as a cover art. When you move to a different song, of course, the cover art display is automatically updated. See the figure below.

5.2. Requirements

  • The feature is disabled by default since it isn't very stable now. To enable it, change the value of SHOULD_ENABLE_COVER_ART macro to 1 in src/mpd_client.c.

  • The mpd's music_directory, which is normally set in /etc/mpd.conf, shall be /media/MUSIC/. If you'd like to use another directory, change the value of the macro __MPD_MUSIC_DIRECTORY in src/mpd_client.h and rebuild. This limitation comes from the fact that mpd_song_get_uri() returns a path relative to music_directory.

  • As described above, the name of cover arts shall be cover_ympd.jpg. And it is recommended they are small in size (e.g. <= 1MB) for a speedy operation. We supply helper_scripts/create_cover_art.sh script to recursively create cover_ympd.jpg files from cover.jpg and cover.png in the specified directory. Note it needs imagemagick. Usage:

$ cd helper_scripts && ./create_cover_art.sh <directory>

5.3. Implementation Details

ympd server communicates with a browser using WebSockets. To update information such as a song's title, the artist's name, etc., they are sent as a JSON string. We extend this implementation to incorporate a base64-encoded image file into the string.

cover art 1 dark mode
Fig. Cover art display. Fig. Another example of cover art display.

Known Bugs

  • Cover art display is unstable when ympd is accessed from multiple browsers at the same time. We cannot identify the cause yet. Current workaround: just reload the page.

About

A customized `ympd` with many new features like dark mode and cover art display.

License:GNU General Public License v2.0


Languages

Language:C 58.8%Language:JavaScript 33.2%Language:HTML 4.2%Language:Shell 1.2%Language:CMake 0.9%Language:CSS 0.8%Language:Perl 0.4%Language:Roff 0.3%Language:Dockerfile 0.1%