Nick Bowler [Fri, 19 Jun 2020 05:01:39 +0000 (01:01 -0400)]
mpdreload: Protocol optimizations.
Try harder to send fewer commands to the MPD server. In particular:
* We can submit commands to batch-load subranges from the target
playlist into the play queue, then move them as a group into the
final location.
* We don't need to send move commands for tracks that are already in
the correct final position, which helps when reloading a playlist
very similar to the current play queue.
* By arranging for all unwanted tracks to be shifted to the end of
the play queue during the consolidation process, these can all be
deleted with a single command.
Nick Bowler [Sat, 23 May 2020 20:33:25 +0000 (16:33 -0400)]
Fix print_usage file handle in the perl scripts.
Due to an off-by-one error all the perl scripts are printing the usage
line to standard error in the --help output, instead of standard output
as expected. Fix that up.
Nick Bowler [Tue, 5 May 2020 04:41:14 +0000 (00:41 -0400)]
Factor out mpd_exec from some of the perl scripts.
The simple mpd_exec function can be easily moved into the MPDHacks
module. Leave out the one in mpdexec.pl as it is more sophisticated
to handle things like binary downloads and probably not needed for
common code.
Nick Bowler [Tue, 5 May 2020 03:01:06 +0000 (23:01 -0400)]
Factor out MPD connection code.
Instead of having three different copies of the MPD connection code in
the perl scripts, let's put it all in one place. Now mpdreload is no
longer the only script that supports UNIX socket connections.
Nick Bowler [Sat, 2 May 2020 15:53:28 +0000 (11:53 -0400)]
Fix quoting of single quotes in MPD protocol.
Single quotes have to be quoted in the protocol, but were forgotten.
This is easy enough to fix but isn't helped by the fact that there
are three different copies of this bug on the perl side, so let's
split out that function into a new module and fix it there.
Nick Bowler [Fri, 20 Dec 2019 06:01:01 +0000 (01:01 -0500)]
mpdreload: New script to refresh MPD play queue from a playlist.
This script implements the effect of clearing the current play queue
and then loading a playlist, except that the play queue is not wiped
during the process which avoids losing playback state unnecessarily.
Nick Bowler [Sun, 30 Jun 2019 14:41:08 +0000 (10:41 -0400)]
mpdmenu: Pass top menu name into submenu generation.
This enables names based on the original menu name to be generated.
Specifically, the KillMenuMPD function is now based on the original
menu name, and the toplevel album menu is now actually the same menu
as the corresponding entry in the artist menu.
Nick Bowler [Sun, 30 Jun 2019 14:17:05 +0000 (10:17 -0400)]
mpdmenu: Use MBIDs for track matching instead of name matching.
Instead of guessing based on titles, match tracks by their work MBID.
This makes the title menu significantly simpler as we remove all the
title-specific special cases. This approach gives results pretty close
to what we got originally (much better in some cases), but currently
things like different symphony movements which used to show up in the
menu are not handled.
Nick Bowler [Sat, 29 Jun 2019 16:04:05 +0000 (12:04 -0400)]
mpdmenu: Use MBIDs for albums instead of name matching.
This enables much more accurate album menus, e.g., fully distinguishing
between multiple versions of the same release that would previously be
merged together into a single display.
This also adjusts the album menu to use modern MPD database query
features, so we can correctly display all tracks from the album
regardless of the state of the play queue.
Nick Bowler [Fri, 28 Jun 2019 04:39:12 +0000 (00:39 -0400)]
mpdmenu: Restructure things a bit.
Restructure the basic program flow and update the top menu generation
using more helper functions and stuff, including a slight change to the
menu layout. More to come.
Nick Bowler [Fri, 28 Jun 2019 03:09:00 +0000 (23:09 -0400)]
mpdmenu: Retrieve cover art from MPD.
Recent versions of MPD support retrieving cover art, which means we
(mostly) don't need to have the music directory mounted to poke around
in it. Augment mpdexec with support for binary transfers in order to
retrieve this cover art, and implement a new thumbnailer script which
makes use of this functionality.
Mostly, because the function to launch geeqie in the scans directory
still requires poking in the music dir. But all the menu images should
be displayed just from the connection to MPD now.
As a bonus, the new script is quite a bit faster than the old one, too.
Nick Bowler [Fri, 28 Jun 2019 00:01:41 +0000 (20:01 -0400)]
mpdmenu: Factor out thumbnail generation.
Prep work for making use of MPD albumart, move all calls to the
thumbnailer into a single function, and adapt the menus to call
the function once to generate an entire list of cover art.
Drop the use of the --image option in the thumbnailer by poking at
the cover art directly, since this will no longer work with MPD
albumart.
Nick Bowler [Thu, 27 Jun 2019 23:02:38 +0000 (19:02 -0400)]
Relicense MPD scripts.
It's the dawn of a new era. I'm separating these scripts from my FVWM
configuration in preparation for some big overhauls. Going forward,
as these are basically standalone programs in their own right we'll
be using the GNU General Public License.
(Leave thumbnail.zsh alone because the first order of business is to
kill it off).
Nick Bowler [Sat, 20 Apr 2019 00:22:32 +0000 (20:22 -0400)]
MPD script updates.
Fix compatibility with latest perl which removes the 'encoding' pragma.
And improve mpdexec.pl to be a bit more flexible: command-line arguments
will be correctly quoted for MPD, and also add a mode to accept commands
on standard input which helps performance with long command sequences.
Nick Bowler [Fri, 20 Oct 2017 01:39:17 +0000 (21:39 -0400)]
thumbnailer: Follow only one level of symbolic link.
Since my music is all in git annex now, the thumbnailer follows the
cover art symlinks all the way to the annex object directory. This is
less than helpful, since the intention was to locate the album scan
directory. Change the --image mode to just read the link once and
then stop.