Explorar el Código

Bug fix: set a default parent for albums without artist

In the 'albums children view, all entries may have empty artists, in
which case the corresponding parent defaults to the top level.
master
jao hace 2 meses
padre
commit
7f7e1fd39c
Se han modificado 2 ficheros con 11 adiciones y 3 borrados
  1. +5
    -1
      libmpdel.el
  2. +6
    -2
      test/libmpdel-test.el

+ 5
- 1
libmpdel.el Ver fichero

@@ -198,7 +198,11 @@ message from the server.")

(cl-defmethod libmpdel-artist ((album libmpdel-album))
"Return the ALBUM's artist."
(libmpdel--album-artist album))
(let ((artist (libmpdel--album-artist album)))
(if (or (null artist)
(string= "" (libmpdel--artist-name artist)))
'albums
artist)))

(cl-defmethod libmpdel-artist ((song libmpdel-song))
"Return the SONG's artist."


+ 6
- 2
test/libmpdel-test.el Ver fichero

@@ -1,6 +1,6 @@
;;; libmpdel-test.el --- Tests for libmpdel.el -*- lexical-binding: t; -*-

;; Copyright (C) 2017 Damien Cassou
;; Copyright (C) 2017, 2020 Damien Cassou

;; Author: Damien Cassou <damien@cassou.me>
;; Url: https://gitlab.petton.fr/mpdel/mpdel
@@ -98,10 +98,14 @@
(let* ((artist (libmpdel--artist-create :name "The Artist"))
(album (libmpdel--album-create :name "The Album" :artist artist))
(song (libmpdel--song-create :name "The song" :album album))
(stored-playlist (libmpdel--stored-playlist-create :name "The playlist")))
(stored-playlist (libmpdel--stored-playlist-create :name "The playlist"))
(empty-artist (libmpdel--artist-create :name ""))
(album-sans-artist (libmpdel--album-create :name "No Art"
:artist empty-artist)))
(should (equal 'artists (libmpdel-entity-parent artist)))
(should (equal artist (libmpdel-entity-parent album)))
(should (equal album (libmpdel-entity-parent song)))
(should (equal 'albums (libmpdel-entity-parent album-sans-artist)))
(should (equal 'stored-playlists (libmpdel-entity-parent stored-playlist)))
(should-not (libmpdel-entity-parent 'stored-playlists))
(should-not (libmpdel-entity-parent 'artists))


Cargando…
Cancelar
Guardar