ソースを参照

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 2ヶ月前
コミット
7f7e1fd39c
2個のファイルの変更11行の追加3行の削除
  1. +5
    -1
      libmpdel.el
  2. +6
    -2
      test/libmpdel-test.el

+ 5
- 1
libmpdel.el ファイルの表示

@@ -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 ファイルの表示

@@ -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))


読み込み中…
キャンセル
保存