13 Commits

Author SHA1 Message Date
  Damien Cassou e26060d213
gitlab ⇒ gitea 1 year ago
  Damien Cassou daf2a6dca6 Merge pull request 'try-arm-silex' (#26) from try-arm-silex into master 1 year ago
  Damien Cassou 704d213ed5
Fix typos 1 year ago
  Damien Cassou 2f4bc7a1a5
Use Silex images 1 year ago
  Damien Cassou b306cc19a3
Update makel to v0.6.0 1 year ago
  Damien Cassou 99cb4c83d0
Merge pull request #3 from kennyballou/use-make-network-process 1 year ago
  Kenny Ballou 942739c55c add libmpdel-family to `libmpdel-profiles` 1 year ago
  Kenny Ballou 9e8f3b0bcb Add missing element to `limbpdel-profiles` docstring 1 year ago
  Kenny Ballou 124e72daf4 Always use `make-network-process` 1 year ago
  Kenny Ballou 5c4f259e71 add custom variable `libmpdel-family` 1 year ago
  Ian Zimmerman ca50b24769
Document the unix socket feature 1 year ago
  Damien Cassou a5ef4807b2
Add the unix socket case to libmpdel--open-stream 1 year ago
  Damien Cassou f6b976aef4
Factor out the lowest level open-stream call 1 year ago
7 changed files with 72 additions and 44 deletions
Split View
  1. +1
    -6
      .drone.yml
  2. +1
    -1
      Makefile
  3. +16
    -16
      README.org
  4. +1
    -1
      libmpdel-directory.el
  5. +51
    -18
      libmpdel.el
  6. +1
    -1
      test/libmpdel-directory-test.el
  7. +1
    -1
      test/libmpdel-test.el

+ 1
- 6
.drone.yml View File

@ -7,13 +7,8 @@ platform:
steps:
- name: check
image: ubuntu:latest
image: silex/emacs:27.1-dev
commands:
- apt-get update
- apt-get install -y software-properties-common coreutils make gnutls-bin curl
- add-apt-repository ppa:kelleyk/emacs -y
- apt-get update
- apt-get install -y emacs26
- emacs --version
- make ci-dependencies
- make check

+ 1
- 1
Makefile View File

@ -15,7 +15,7 @@ makel.mk:
curl \
--fail --silent --show-error --insecure --location \
--retry 9 --retry-delay 9 \
-O https://gitlab.petton.fr/DamienCassou/makel/raw/v0.5.3/makel.mk; \
-O https://gitea.petton.fr/DamienCassou/makel/raw/tag/v0.6.0/makel.mk; \
fi
# Include makel.mk if present


+ 16
- 16
README.org View File

@ -17,7 +17,7 @@
The package libmpdel is an Emacs library client to communicate with
[[https://www.musicpd.org/][Music Player Daemon]] (MPD), a flexible, powerful, server-side
application for playing music. For a user interface, please check the
[[https://gitlab.petton.fr/mpdel/mpdel][mpdel]] project instead (which depends on this one).
[[https://gitea.petton.fr/mpdel/mpdel][mpdel]] project instead (which depends on this one).
** Installing
@ -37,21 +37,21 @@ a look at it.
The library is implemented around a set of entities.
| *Name* | *Type* | *Fields* | *Description* |
|------------------+-----------+----------------------+-------------------------------------------------------|
| song | structure | name, album, file, … | |
| album | structure | name, artist | |
| artist | structure | name | |
| directory | structure | name, path | |
| stored-playlist | structure | name | A named user-specified sequence of songs |
| search-criteria | structure | type, what | Read the [[https://www.musicpd.org/doc/protocol/database.html][protocol documentation]] |
| filter | structure | text | Read the [[https://www.musicpd.org/doc/html/protocol.html#filters][protocol documentation]] |
|------------------+-----------+----------------------+-------------------------------------------------------|
| artists | symbol | /none/ | Represent the set of all artists |
| albums | symbol | /none/ | Represent the set of all albums |
| directories | symbol | /none/ | Represent all directories in ~libmpdel-music-directory~ |
| current-playlist | symbol | /none/ | Represent the currently played sequence of songs |
| stored-playlists | symbol | /none/ | Represent the set of all stored playlists |
| *Name* | *Type* | *Fields* | *Description* |
|------------------+-----------+----------------------+---------------------------------------------------------|
| song | structure | name, album, file, … | |
| album | structure | name, artist | |
| artist | structure | name | |
| directory | structure | name, path | |
| stored-playlist | structure | name | A named user-specified sequence of songs |
| search-criteria | structure | type, what | Read the [[https://www.musicpd.org/doc/protocol/database.html][protocol documentation]] |
| filter | structure | text | Read the [[https://www.musicpd.org/doc/html/protocol.html#filters][protocol documentation]] |
|------------------+-----------+----------------------+---------------------------------------------------------|
| artists | symbol | /none/ | Represent the set of all artists |
| albums | symbol | /none/ | Represent the set of all albums |
| directories | symbol | /none/ | Represent all directories in ~libmpdel-music-directory~ |
| current-playlist | symbol | /none/ | Represent the currently played sequence of songs |
| stored-playlists | symbol | /none/ | Represent the set of all stored playlists |
Many functions in MPDel work on several kinds of entities (e.g.,
~libmpdel-list~). These methods are implemented with ~cl-defgeneric~


+ 1
- 1
libmpdel-directory.el View File

@ -4,7 +4,7 @@
;; Author: Jose A Ortega <jao@gnu.org>
;; Keywords: multimedia
;; Url: https://gitlab.petton.fr/mpdel/libmpdel
;; Url: https://gitea.petton.fr/mpdel/libmpdel
;; Package-requires: ((emacs "25.1"))
;; Version: 1.2.0


+ 51
- 18
libmpdel.el View File

@ -4,7 +4,7 @@
;; Author: Damien Cassou <damien@cassou.me>
;; Keywords: multimedia
;; Url: https://gitlab.petton.fr/mpdel/libmpdel
;; Url: https://gitea.petton.fr/mpdel/libmpdel
;; Package-requires: ((emacs "25.1"))
;; Version: 1.2.0
@ -42,26 +42,42 @@
:group 'comm)
(defcustom libmpdel-hostname "localhost"
"MPD server location to connect to. Also see `libmpdel-port'."
"MPD server location to connect to. Also see `libmpdel-port'.
If this string starts with a slash, it means connect to a local
Unix socket with such absolute filename. Please see the MPD
server documentation for server configuration info.
The advantage of such a setup is that file and/or directory
permission modes can be used to enforce access control,
without the need for a password."
:type 'string)
(defcustom libmpdel-port 6600
"MPD server port to connect to. Also see `libmpdel-hostname'."
:type 'integer)
(defcustom libmpdel-profiles (list (list "Local server" libmpdel-hostname libmpdel-port))
"List of (HOST . PORT) when using several MPD servers."
(defcustom libmpdel-family 'ipv4
"MPD address family when connecting via TCP connections.
For more information see `libmpdel-hostname'."
:type '(choice (const :tag "IPv4" ipv4)
(const :tag "IPv6" ipv6)))
(defcustom libmpdel-profiles (list (list "Local server" libmpdel-hostname libmpdel-port libmpdel-family))
"List of (NAME HOST PORT . FAMILY) when using several MPD servers."
:type '(repeat (list
:tag "Profile"
:value ("Local server" "localhost" 6600)
(string :tag "name")
(string :tag "host")
(integer :tag "port"))))
(integer :tag "port")
(choice (const :tag "IPv4" ipv4)
(const :tag "IPv6" ipv6)))))
(defcustom libmpdel-music-directory "~/Music"
"MPD `music_directory' variable's value.
This is used to map MPD's music files to the filesystem."
This is used to map MPD's music files to the file-system."
:type 'directory)
(defcustom libmpdel-current-playlist-changed-hook nil
@ -91,7 +107,7 @@ See `libmpdel-current-song-id'."
(defvar libmpdel--connection nil
"Current connection to the MPD server.
The logs of this connection are accessible in the *mpd* buffer.")
The logs of this connection are accessible in the `*mpd*' buffer.")
(defconst libmpdel--response-regexp
(rx line-start
@ -134,10 +150,10 @@ notifications in the server. When we want to send a command to
the server (for example to change the current song), we always
have to (1) cancel the IDLE first (with a \"noidle\"
command), (2) send the command we want, and (3) send the IDLE
command again. Cancelling the current \"idle\" command is done
command again. Canceling the current \"idle\" command is done
in `mpdel-send-command'. Sending \"idle\" again is done in the
handler for \"idle\" that will be triggered when the empty answer
for the cancelled \"idle\" arrives.
for the canceled \"idle\" arrives.
Because MPD answers in the order the commands are sent, we know
that the first handler is the one to execute when we receive a
@ -220,7 +236,7 @@ message from the server.")
(libmpdel--song-album song))
(cl-defgeneric libmpdel-entity-name (entity)
"Return basename of ENTITY.")
"Return the name of ENTITY.")
(cl-defmethod libmpdel-entity-name ((artist libmpdel-artist))
"Return ARTIST's name."
@ -353,6 +369,24 @@ message from the server.")
"Return the buffer associated with the connection process."
(process-buffer (libmpdel--process)))
(defsubst libmpdel--connection-address-local-p ()
"Return non-nil if the MPD server address is a local family address."
(eq ?/ (aref libmpdel-hostname 0)))
(defsubst libmpdel--open-stream ()
"Open and return connection to the MPD process."
(if (not (libmpdel--connection-address-local-p))
(make-network-process
:name "mpd"
:buffer "*mpd*"
:host libmpdel-hostname
:service libmpdel-port
:family libmpdel-family
:type nil)
(make-network-process
:name "mpd" :buffer "*mpd*"
:family 'local :service libmpdel-hostname)))
(defun libmpdel--connect ()
"Create a new connection with the MPD server."
;; The *mpd* buffer will contain all the communication logs
@ -362,11 +396,7 @@ message from the server.")
(setq-local buffer-read-only t)
(let ((inhibit-read-only t))
(erase-buffer)))
(setq libmpdel--connection (tq-create (open-network-stream
"mpd" "*mpd*"
libmpdel-hostname
libmpdel-port
:type 'plain)))
(setq libmpdel--connection (tq-create (libmpdel--open-stream)))
(set-process-coding-system (libmpdel--process) 'utf-8-unix 'utf-8-unix)
(set-process-query-on-exit-flag (libmpdel--process) nil)
;; Take care of the initial welcome message from server that we
@ -388,7 +418,8 @@ Interactively, let the user choose PROFILE from `libmpdel-profiles'.
If a connection already exists, terminate it first."
(interactive (list (libmpdel--select-profile)))
(let* ((libmpdel-hostname (cl-second profile))
(libmpdel-port (cl-third profile)))
(libmpdel-port (cl-third profile))
(libmpdel-family (cl-fourth profile)))
(when (libmpdel-connected-p)
(libmpdel-disconnect))
(libmpdel--connect)))
@ -531,7 +562,7 @@ VALUE-DESC is a string describing the kind of value accepted for
this state.
SET-BODY is a list of forms to put in the generated setter
function. During executiong of SET-BODY, a variable NEW-VALUE is
function. During execution of SET-BODY, a variable NEW-VALUE is
bound containing the value to set."
(declare (indent 1))
`(progn
@ -605,7 +636,7 @@ bound containing the value to set."
(t 'never))))
(defun libmpdel-time-to-string (time)
"Return a string represeting TIME, a number in a string."
"Return a string representing TIME, a number in a string."
(if (not time)
"0"
(let* ((time (string-to-number time))
@ -1190,3 +1221,5 @@ not specify it, everything is updated."
;; Local Variables:
;; checkdoc-arguments-in-order-flag: nil
;; End:
; LocalWords: mpd noidle

+ 1
- 1
test/libmpdel-directory-test.el View File

@ -3,7 +3,7 @@
;; Copyright (C) 2019 Damien Cassou
;; Author: Jose A Ortega <jao@gnu.org>
;; Url: https://gitlab.petton.fr/mpdel/mpdel
;; Url: https://gitea.petton.fr/mpdel/mpdel
;; Package-requires: ((emacs "25.1"))
;; Version: 1.2.0


+ 1
- 1
test/libmpdel-test.el View File

@ -3,7 +3,7 @@
;; Copyright (C) 2017 Damien Cassou
;; Author: Damien Cassou <damien@cassou.me>
;; Url: https://gitlab.petton.fr/mpdel/mpdel
;; Url: https://gitea.petton.fr/mpdel/mpdel
;; Package-requires: ((emacs "25.1"))
;; Version: 1.2.0


Loading…
Cancel
Save