Sfoglia il codice sorgente

Merge branch 'mpd-filter' of mpdel/libmpdel into master

tags/v1.1.2
Damien Cassou Gitea 5 mesi fa
parent
commit
983c27d11b
2 ha cambiato i file con 15 aggiunte e 0 eliminazioni
  1. +1
    -0
      README.org
  2. +14
    -0
      libmpdel.el

+ 1
- 0
README.org Vedi File

@@ -49,6 +49,7 @@ The library is implemented around a set of entities.
| artist | structure | name | |
| 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 |


+ 14
- 0
libmpdel.el Vedi File

@@ -179,6 +179,11 @@ message from the server.")
(type nil :read-only t)
(what nil :read-only t))

(cl-defstruct (libmpdel-filter
(:constructor libmpdel-filter-create)
(:conc-name libmpdel--filter-))
(text nil :read-only t))

(defun libmpdel-artist-name (entity)
"Return artist name of ENTITY."
(libmpdel--artist-name (libmpdel-artist entity)))
@@ -234,6 +239,9 @@ message from the server.")
(libmpdel--search-criteria-type search-criteria)
(libmpdel--search-criteria-what search-criteria)))

(cl-defmethod libmpdel-entity-name ((filter libmpdel-filter))
(format "filter %s" (libmpdel--filter-text filter)))

(cl-defgeneric libmpdel-entity-parent (_entity)
"Return parent of ENTITY."
nil)
@@ -866,6 +874,12 @@ If HANDLER is nil, ignore response."
(lambda (data)
(funcall function (libmpdel--create-songs-from-data data)))))

(cl-defmethod libmpdel-list-songs ((filter libmpdel-filter) function)
(libmpdel-send-command
`("search %S" ,(libmpdel--filter-text filter))
(lambda (data)
(funcall function (libmpdel--create-songs-from-data data)))))

(cl-defmethod libmpdel-list-songs ((song libmpdel-song) function)
(funcall function (list song)))



Loading…
Annulla
Salva