Browse Source

Merge pull request #4 from kennyballou/display-file-name

display file name if missing song name metadata
pull/31/head
Damien Cassou 1 year ago
committed by GitHub
parent
commit
e4ae63dd00
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 2 deletions
  1. +5
    -2
      libmpdel.el
  2. +5
    -0
      test/libmpdel-test.el

+ 5
- 2
libmpdel.el View File

@ -247,8 +247,11 @@ message from the server.")
(libmpdel--album-name album))
(cl-defmethod libmpdel-entity-name ((song libmpdel-song))
"Return SONG's name."
(libmpdel--song-name song))
"Return SONG's name.
If the SONG's name is nil, return the filename instead."
(or (libmpdel--song-name song)
(libmpdel--song-file song)))
(cl-defmethod libmpdel-entity-name ((_entity (eql stored-playlists)))
"Return a string describing the `stored-playlists' entity."


+ 5
- 0
test/libmpdel-test.el View File

@ -94,6 +94,11 @@
(should (equal "The song" (libmpdel-entity-name song)))
(should (equal "The playlist" (libmpdel-entity-name stored-playlist)))))
(ert-deftest libmpdel-test-entity-name-song-defaults-file ()
(let ((song (libmpdel--create-song-from-data
'((file . "foo/song.ogg")))))
(should (equal "foo/song.ogg" (libmpdel-entity-name song)))))
(ert-deftest libmpdel-test-entity-parent ()
(let* ((artist (libmpdel--artist-create :name "The Artist"))
(album (libmpdel--album-create :name "The Album" :artist artist))


Loading…
Cancel
Save