emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/emms 60c9304 32/80: Trim trailing whitespace from all i


From: Stefan Monnier
Subject: [elpa] externals/emms 60c9304 32/80: Trim trailing whitespace from all info-fields
Date: Wed, 17 Mar 2021 18:42:25 -0400 (EDT)

branch: externals/emms
commit 60c93048ee2acd557f4c102323b779b5092f6662
Author: Petteri Hintsanen <petterih@iki.fi>
Commit: Petteri Hintsanen <petterih@iki.fi>

    Trim trailing whitespace from all info-fields
---
 emms-info-native.el | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/emms-info-native.el b/emms-info-native.el
index 76e6c0e..d0c9777 100644
--- a/emms-info-native.el
+++ b/emms-info-native.el
@@ -728,17 +728,16 @@ If there is no such identifier, return nil."
 
 (defun emms-info-native--decode-id3v2-string (bytes)
   "Decode id3v2 text information from BYTES.
-Remove the terminating null byte, if any, and trim trailing
-whitespace.
+Remove the terminating null byte, if any.
 
 Return the text as string."
   (let* ((encoding (emms-info-native--id3v2-text-encoding bytes))
          (string (mapconcat #'byte-to-string (seq-rest bytes) ""))
          (decoded (decode-coding-string string encoding)))
     (when (> (length decoded) 0)
-      (string-trim-right (if (equal (substring decoded -1) "\0")
-                             (substring decoded 0 -1)
-                           decoded)))))
+      (if (equal (substring decoded -1) "\0")
+          (substring decoded 0 -1)
+        decoded))))
 
 (defun emms-info-native--id3v2-text-encoding (bytes)
   "Return the encoding for text information BYTES."
@@ -754,7 +753,7 @@ Supports Ogg Vorbis/Opus, FLAC, and MP3 files."
          (info-fields (emms-info-native--decode-info-fields filename)))
     (dolist (field info-fields)
       (let ((name (intern (concat "info-" (car field))))
-            (value (cdr field)))
+            (value (string-trim-right (cdr field))))
         (emms-track-set track
                         name
                         (if (eq name 'info-playing-time)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]