Skip to content

Commit

Permalink
Address issue #5.
Browse files Browse the repository at this point in the history
`mppopmd` can now communicate with the mpd server over a local
(Unix) socket.
  • Loading branch information
sp1ff committed Oct 11, 2021
1 parent 81db210 commit 8584864
Show file tree
Hide file tree
Showing 19 changed files with 540 additions and 148 deletions.
45 changes: 32 additions & 13 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,11 +1,25 @@
2021-03-27 Michael Herstine <[email protected]>
2021-10-11 Michael Herstine <[email protected]>

Address issue #5.
`mppopmd` can now communicate with the mpd server over a local
(Unix) socket.

2021-03-29 Michael Herstine <[email protected]>

Repairing GH workflows

Post rebase checkin.
This commit updates some packaging details after I rebased
the 'filters' branch onto 'master'.

2021-03-28 Michael Herstine <[email protected]>

Documentation commit.
Broke-up the README; most of its content went into a new
user manual in Texinfo format. The process of documenting
filter quoting exposed multiple bugs-- fixed.

2021-03-21 Michael Herstine <[email protected]>
2021-03-28 Michael Herstine <[email protected]>

First true filter implementation.
This commit:
Expand All @@ -20,13 +34,27 @@

4. begins adding unit tests for the evaluator

2021-03-18 Michael Herstine <[email protected]>
2021-03-28 Michael Herstine <[email protected]>

First commit of filter evaluation logic.
The filter evaluator is fully functional; method 'findadd' is
working.

2021-03-03 Michael Herstine <[email protected]>
Adding the `findadd' command.
This commit implements first support for extending MPD filters
to include items managed by mpdpopm.

First commit of the filter parser. Contains just the grammar and some unit tests-- no externally-visible functionality.

2021-03-11 Michael Herstine <[email protected]>

Commented-out the automatic version release now that I've debugged the issue

Fix release workflow.

Fix release workflow.

2021-03-10 Michael Herstine <[email protected]>

Boilerplate update.
This commit updates copyright statements throughout, as well
Expand All @@ -40,15 +68,6 @@
1. addresses issue #3 by providing an Arch package with
releases
2. addresses issue #4 by providing a systemd unit
2020-12-26 Michael Herstine <[email protected]>

First commit of the filter parser. Contains just the grammar and some unit tests-- no externally-visible functionality.

2021-02-24 Michael Herstine <[email protected]>

Adding the `findadd' command.
This commit implements first support for extending MPD filters
to include items managed by mpdpopm.

2020-12-19 Michael Herstine <[email protected]>

Expand Down
10 changes: 0 additions & 10 deletions Dockerfile-arch

This file was deleted.

6 changes: 3 additions & 3 deletions INSTALL
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Installation Instructions
*************************

Copyright (C) 1994-1996, 1999-2002, 2004-2016 Free Software
Foundation, Inc.
Copyright (C) 1994-1996, 1999-2002, 2004-2017, 2020-2021 Free
Software Foundation, Inc.

Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
Expand Down Expand Up @@ -225,7 +225,7 @@ order to use an ANSI C compiler:

and if that doesn't work, install pre-built binaries of GCC for HP-UX.

HP-UX 'make' updates targets which have the same time stamps as their
HP-UX 'make' updates targets which have the same timestamps as their
prerequisites, which makes it generally unusable when shipped generated
files such as 'configure' are involved. Use GNU 'make' instead.

Expand Down
5 changes: 5 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
mpdpopm News -- history of user-visible changes -*- outline -*-

* 0.3.0 build

** Bugfixes

*** Address Issue #5: Cannot connect to mpd unix socket
* 0.2.3 build

** User-visible changes
Expand Down
24 changes: 12 additions & 12 deletions README.org
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#+AUTHOR: Michael Herstine
#+DESCRIPTION: mpdpopm
#+EMAIL: [email protected]
#+DATE: <2021-03-28 Sun 17:44>
#+DATE: <2021-10-11 Mon 12:10>
#+AUTODATE: t

* Introduction
Expand Down Expand Up @@ -56,10 +56,10 @@ Thanks to a suggestion by [[https://github.com/m040601][m040601]], you can down

#+BEGIN_SRC bash
cd /tmp
curl -L --output mpdpopm-0.2.3.tar.gz https://github.com/sp1ff/mpdpopm/releases/download/0.2.3/mpdpopm-0.2.3-x86_64-unknown-linux.tar.gz
tar xf mpdpopm-0.2.3.tar.gz
tree mpdpopm-0.2.3-x86_64-unknown-linux/
mpdpopm-0.2.3-x86_64-unknown-linux/
curl -L --output mpdpopm-0.3.0.tar.gz https://github.com/sp1ff/mpdpopm/releases/download/0.3.0/mpdpopm-0.3.0-x86_64-unknown-linux.tar.gz
tar xf mpdpopm-0.3.0.tar.gz
tree mpdpopm-0.3.0-x86_64-unknown-linux/
mpdpopm-0.3.0-x86_64-unknown-linux/
├── bin
│ ├── mppopm
│ └── mppopmd
Expand Down Expand Up @@ -89,8 +89,8 @@ If you're running on a Debian-based Linux distribution, and you're on an x86_64

#+BEGIN_SRC bash
cd /tmp
curl -L -O https://github.com/sp1ff/mpdpopm/releases/download/0.2.3/mpdpopm_0.2.3_amd64.deb
sudo dpkg -i mpdpopm_0.2.3_amd64.deb
curl -L -O https://github.com/sp1ff/mpdpopm/releases/download/0.3.0/mpdpopm_0.3.0_amd64.deb
sudo dpkg -i mpdpopm_0.3.0_amd64.deb
#+END_SRC

The binaries will be placed in =/usr/local/bin=, and you can proceed to [[#getting_started][Getting Started]], below.
Expand All @@ -101,8 +101,8 @@ If you're running on an Arch-based Linux distribution, and you're on an x86_64 p

#+BEGIN_SRC bash
cd /tmp
curl -L -O https://github.com/sp1ff/mpdpopm/releases/download/0.2.3/mpdpopm_0.2.3-1-x86_64.pkg.tar.zst
sudo pacman -U mpdpopm_0.2.3-1-x86_64.pkg.tar.zst
curl -L -O https://github.com/sp1ff/mpdpopm/releases/download/0.3.0/mpdpopm_0.3.0-1-x86_64.pkg.tar.zst
sudo pacman -U mpdpopm_0.3.0-1-x86_64.pkg.tar.zst
#+END_SRC

The binaries will be placed in =/usr/local/bin=, and you can proceed to [[#getting_started][Getting Started]], below.
Expand All @@ -113,9 +113,9 @@ If you've got the Rust toolchain as well as Autotools installed, you can build f

#+BEGIN_SRC bash
cd /tmp
curl -L -O https://github.com/sp1ff/mpdpopm/releases/download/0.2.3/mpdpopm-0.2.3.tar.xz
tar xf mpdpopm-0.2.3.tar.xz
cd mpdpopm-0.2.3
curl -L -O https://github.com/sp1ff/mpdpopm/releases/download/0.3.0/mpdpopm-0.3.0.tar.xz
tar xf mpdpopm-0.3.0.tar.xz
cd mpdpopm-0.3.0
./configure
make
make check
Expand Down
3 changes: 0 additions & 3 deletions admin/Dockerfile-arch
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,3 @@ USER mgh

ENV PATH="/home/mgh/.cargo/bin:${PATH}"

# RUN cargo install cargo-aur && \
# cargo install cargo-arch

16 changes: 13 additions & 3 deletions admin/Dockerfile-debian
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@ ENV DEBIAN_FRONTEND=${DEBIAN_FRONTEND:-noninteractive}
RUN set -ex && \
apt-get update && \
apt-get install -y --no-install-recommends \
# Wow... \
ca-certificates \
# mpdpopm pre-requisistes \
rustc cargo locales texinfo \
# for my sanity \
less procps gdb sudo info vim && \
# tidy-up \
apt-get clean && \
rm -rf /tmp/* /var/tmp/* && \
rm -rf /tmp/* /var/tmp/* && \
# set the timezone to civilization (i.e. the Pacific) \
ln -fs /usr/share/zoneinfo/US/Pacific /etc/localtime && dpkg-reconfigure -f noninteractive tzdata && \
# Setup the en_US.UTF-8 locale \
Expand All @@ -23,10 +25,18 @@ RUN set -ex && \
locale-gen en_US.UTF-8 && \
update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 && \
# re-include the doc directories \
mkdir /usr/share/man/man1 && \
(test -d /usr/share/man/man1 || mkdir /usr/share/man/man1) && \
echo "path-include /usr/share/doc/scribbu" >> /etc/dpkg/dpkg.cfg.d/docker && \
echo "path-include /usr/share/man/man1/scribbu*" >> /etc/dpkg/dpkg.cfg.d/docker && \
echo "path-include /usr/share/info/scribbu.info" >> /etc/dpkg/dpkg.cfg.d/docker
echo "path-include /usr/share/info/scribbu.info" >> /etc/dpkg/dpkg.cfg.d/docker && \
useradd -ms /bin/bash -G users,sudo mgh && \
echo 'mgh:mgh' | chpasswd

# The test suite won't work if this isn't set:
ENV LANG="en_US.UTF-8"

USER mgh

RUN cargo install cargo-deb

ENV PATH="/home/mgh/.cargo/bin:${PATH}"
15 changes: 8 additions & 7 deletions admin/build-dev-arch-pkg
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
#!/usr/bin/env bash

# This script will bindmount the host mpdpopm project directory and
# invoke `cargo arch|aur' so as to make an Arch package. It's meant
# for use during mpdpopm development, as a check that my latest
# changes won't break anything at release-time when it's time to
# package the latest mpdpopm.
# This script will bindmount the host mpdpopm project directory and invoke
# `makepkg` so as to make an Arch package. It's meant for use during mpdpopm
# development, as a check that my latest changes won't break anything at
# release-time when it's time to package the latest mpdpopm.

# It is presumably run from the root mpdpopm directory.

# Invoke as `admin/build-dev-arch-pkg mpdpopm-${version}.tar.gz

set -ex
docker build -t mpdpopm-arch:latest -f admin/Dockerfile-arch .

Expand All @@ -25,6 +26,6 @@ docker_args="$docker_args --privileged"
docker_args="$docker_args --ulimit core=-1"
docker_args="$docker_args -u mgh"
# Un-comment to just drop into the container & experiment
cmd="docker run ${docker_args} mpdpopm-arch:latest"
# cmd="docker run ${docker_args} scribbu-arch:latest /build-dev-pkg $1"
# cmd="docker run ${docker_args} mpdpopm-arch:latest"
cmd="docker run ${docker_args} mpdpopm-arch:latest /build-dev-pkg $1"
exec $cmd
31 changes: 31 additions & 0 deletions admin/build-dev-debian-pkg
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/usr/bin/env bash

# This script will bindmount the host mpdpopm project directory and invoke
# `cargo deb` so as to make an Debian package. It's meant for use during
# mpdpopm development, as a check that my latest changes won't break anything
# at release-time when it's time to package the latest mpdpopm.

# It is presumably run from the root mpdpopm directory.

# Invoke as `admin/build-dev-arch-pkg mpdpopm-${version}.tar.gz

set -ex
docker build -t mpdpopm-debian:latest -f admin/Dockerfile-debian .

here=$(pwd)
script=${here}/admin/build-dev-debian-pkg-cnt
license=${here}/LICENSE
tarball=${here}/$1

docker_args="-it"
docker_args="$docker_args -v ${script}:/build-dev-pkg:ro"
docker_args="$docker_args -v ${tarball}:/$1:ro"
docker_args="$docker_args -v ${license}:/LICENSE"
docker_args="$docker_args --mount type=bind,source=${here},target=/mpdpopm"
docker_args="$docker_args --privileged"
docker_args="$docker_args --ulimit core=-1"
docker_args="$docker_args -u mgh"
# Un-comment to just drop into the container & experiment
# cmd="docker run ${docker_args} mpdpopm-debian:latest"
cmd="docker run ${docker_args} mpdpopm-debian:latest /build-dev-pkg $1"
exec $cmd
15 changes: 15 additions & 0 deletions admin/build-dev-debian-pkg-cnt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

set -ex
base="$(basename $1 .tar.gz)"
version="${base:8}"
cp -v /"$1" /tmp
cd /tmp
tar -xf "$1"
cd mpdpopm-${version}
cp -v /LICENSE .
./configure
cd mpdpopm
cargo deb
sudo cp -v target/debian/mpdpopm_${version}_amd64.deb /mpdpopm

2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
AC_INIT([mpdpopm], [0.2.3], [[email protected]], [mpdpopm], [https://github.com/sp1ff/mpdpopm])
AC_INIT([mpdpopm], [0.3.0], [[email protected]], [mpdpopm], [https://github.com/sp1ff/mpdpopm])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_SRCDIR([mpdpopm/Cargo.toml.in])
AM_INIT_AUTOMAKE([-Wall -Werror -Wno-portability -Wno-override gnits std-options dist-bzip2 dist-xz])
Expand Down
4 changes: 2 additions & 2 deletions doc/version.texi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@set UPDATED 29 March 2021
@set UPDATED-MONTH March 2021
@set EDITION 0.2.3
@set VERSION 0.2.3
@set EDITION 0.3.0
@set VERSION 0.3.0
8 changes: 5 additions & 3 deletions etc/mppopmd.conf.am.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
;; You will need to edit this to suit your particular installation.
;; In particular, examine the `log' & `local_music_dir' values since those
;; are difficult to guess. Also check the `host' & `port' settings.
((log . "@datadir@/log/mppopmd.log")
(host . "localhost")
(port . 6600)
((version . "1")
(log . "@datadir@/log/mppopmd.log")
(conn TCP (host . "localhost") (port . 6600))
;; Replace the above line with this to use the local socket
;; (conn Local (path . "@datadir@/run/mpd/socket"))
(local_music_dir . "@prefix@/Music")
(playcount_sticker . "unwoundstack.com:playcount")
(lastplayed_sticker . "unwoundstack.com:lastplayed")
Expand Down
1 change: 1 addition & 0 deletions mpdpopm/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ DISTCLEANFILES = $(builddir)/Cargo.toml

common_sources = clients.rs \
commands.rs \
config.rs \
error_from.rs \
lib.rs \
messages.rs \
Expand Down
4 changes: 2 additions & 2 deletions mpdpopm/build.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
extern crate lalrpop;
fn main() {
let mut cfg = lalrpop::Configuration::new();
cfg.emit_comments(true)
lalrpop::Configuration::new()
.emit_comments(true)
.emit_whitespace(true)
.log_verbose()
.process_current_dir()
Expand Down
12 changes: 7 additions & 5 deletions mpdpopm/src/bin/mppopmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,11 @@
//! the sticker database, by invoking external commands to keep your tags up-to-date (something
//! along the lines of [mpdcron](https://alip.github.io/mpdcron)).
use mpdpopm::config;
use mpdpopm::config::Config;
use mpdpopm::error_from;
use mpdpopm::mpdpopm;
use mpdpopm::vars::LOCALSTATEDIR;
use mpdpopm::Config;

use clap::{App, Arg};
use errno::errno;
Expand Down Expand Up @@ -126,6 +127,7 @@ impl fmt::Debug for Error {

error_from!(log::SetLoggerError);
error_from!(mpdpopm::Error);
error_from!(mpdpopm::config::Error);
error_from!(serde_lexpr::error::Error);
error_from!(std::ffi::NulError);
error_from!(std::io::Error);
Expand All @@ -140,11 +142,11 @@ type Result = std::result::Result<(), Error>;
///
/// After spending a bit of time digging around the world of TTYs, process groups & sessions, I'm
/// beginning to understand what "daemon" means and how to create one. The first step is to
/// dissaasociate this process from it's controlling terminal & make sure it cannot acquire a new
/// dissassociate this process from it's controlling terminal & make sure it cannot acquire a new
/// one. This, AFAIK, is to disconnect us from any job control associated with that terminal, and in
/// particular to prevent us from being disturbed when & if that terminal is closed (I'm still hazy
/// on the details, but at least the session leader (and perhaps it's descendants) will be sent a
/// SIGHUP in that eventuality.
/// SIGHUP in that eventuality).
///
/// After that, the rest of the work seems to consist of shedding all the things we (may have)
/// inherited from our creator. Things such as:
Expand Down Expand Up @@ -286,7 +288,7 @@ fn main() -> Result {
"
`mppopmd' is a companion daemon for `mpd' that maintains playcounts & ratings,
as well as implementing some handy functions. It maintains ratings & playcounts in the sticker
databae, but it allows you to keep that information in your tags, as well, by invoking external
database, but it allows you to keep that information in your tags, as well, by invoking external
commands to keep your tags up-to-date.",
)
.arg(
Expand Down Expand Up @@ -322,7 +324,7 @@ commands to keep your tags up-to-date.",
let cfg = match std::fs::read_to_string(cfgpth) {
// The config file (defaulted or not) existed & we were able to read its contents-- parse
// em!
Ok(text) => serde_lexpr::from_str(&text)?,
Ok(text) => config::from_str(&text)?,
// The config file (defaulted or not) either didn't exist, or we were unable to read its
// contents...
Err(err) => match (err.kind(), matches.occurrences_of("config")) {
Expand Down
Loading

0 comments on commit 8584864

Please sign in to comment.