[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/emms 8a55be19ba 06/42: Ignore empty Vorbis comments
|
From: |
ELPA Syncer |
|
Subject: |
[elpa] externals/emms 8a55be19ba 06/42: Ignore empty Vorbis comments |
|
Date: |
Wed, 1 Nov 2023 15:57:59 -0400 (EDT) |
branch: externals/emms
commit 8a55be19baee7975c49f5ca84b4a72d80e120d84
Author: Petteri Hintsanen <petterih@iki.fi>
Commit: Petteri Hintsanen <petterih@iki.fi>
Ignore empty Vorbis comments
---
emms-info-native.el | 11 ++++-------
test/emms-info-native-tests.el | 6 +++++-
2 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/emms-info-native.el b/emms-info-native.el
index bbcbe494dc..a5d5219149 100644
--- a/emms-info-native.el
+++ b/emms-info-native.el
@@ -238,6 +238,7 @@ FIELDs that are listed in
Vorbis comments are of form `FIELD=VALUE'. FIELD is a
case-insensitive field name with a restricted set of ASCII
characters. VALUE is an arbitrary UTF-8 encoded octet stream.
+Comments with empty FIELD or VALUE are ignored.
Return a cons cell (FIELD . VALUE), where FIELD is converted to
lower case and VALUE is the decoded value."
@@ -246,7 +247,7 @@ lower case and VALUE is the decoded value."
comment
nil)
'utf-8)))
- (when (string-match "^\\(.+?\\)=\\(.+?\\)$" comment-string)
+ (when (string-match "^\\(.+?\\)=\\(.+\\)$" comment-string)
(cons (downcase (match-string 1 comment-string))
(match-string 2 comment-string)))))
@@ -1081,12 +1082,8 @@ Supports Ogg Vorbis/Opus, FLAC, and MP3 files."
(dolist (field info-fields)
(let ((name (intern (concat "info-" (car field))))
(value (cdr field)))
- (unless (zerop (length value))
- (emms-track-set track
- name
- (if (eq name 'info-playing-time)
- (string-to-number value)
- (string-trim-right value)))))))
+ (when (stringp value) (setq value (string-trim-right value)))
+ (emms-track-set track name value))))
(error (message "emms-info-native error processing %s: %s"
(emms-track-name track) env))))
diff --git a/test/emms-info-native-tests.el b/test/emms-info-native-tests.el
index 318d966fea..952624c4d1 100644
--- a/test/emms-info-native-tests.el
+++ b/test/emms-info-native-tests.el
@@ -1,5 +1,6 @@
;; -*- lexical-binding: t; -*-
+(require 'emms-info-native)
(require 'ert)
(ert-deftest emms-test-extract-vorbis-comments ()
@@ -20,7 +21,10 @@
(should (equal (emms-info-native--split-vorbis-comment "x") nil))
(should (equal (emms-info-native--split-vorbis-comment "x=") nil))
(should (equal (emms-info-native--split-vorbis-comment "=x") nil))
- (should (equal (emms-info-native--split-vorbis-comment "a=B") (cons "a"
"B")))
+ (should (equal (emms-info-native--split-vorbis-comment "a=B")
+ (cons "a" "B")))
+ (should (equal (emms-info-native--split-vorbis-comment "abc=ABC=123")
+ (cons "abc" "ABC=123")))
(should (equal (emms-info-native--split-vorbis-comment utf-8-comment)
(cons "key" "Οὐχὶ Ταὐτὰ")))))
- [elpa] externals/emms 3a7341f660 17/42: Avoid some copying in emms-info-vorbis-extract-comments, (continued)
- [elpa] externals/emms 3a7341f660 17/42: Avoid some copying in emms-info-vorbis-extract-comments, ELPA Syncer, 2023/11/01
- [elpa] externals/emms a6d2bbe484 18/42: Remove useless mapconcat, ELPA Syncer, 2023/11/01
- [elpa] externals/emms 68a0dfa9b8 19/42: Add Unicode character to metadata in test files, ELPA Syncer, 2023/11/01
- [elpa] externals/emms fca5f3e7d5 26/42: Use bindat-type in emms-info-flac, ELPA Syncer, 2023/11/01
- [elpa] externals/emms a0c4d715f4 12/42: Use fixed sample rate when decoding Opus granule position, ELPA Syncer, 2023/11/01
- [elpa] externals/emms 813c0058bd 28/42: Use bindat-type in emms-info-spc, ELPA Syncer, 2023/11/01
- [elpa] externals/emms 32b394b2b1 34/42: Change tests to use unibyte strings, ELPA Syncer, 2023/11/01
- [elpa] externals/emms c9dce6b305 36/42: Fix tests, ELPA Syncer, 2023/11/01
- [elpa] externals/emms 93c614dc24 32/42: Fix byte compilation errors, ELPA Syncer, 2023/11/01
- [elpa] externals/emms 83490a7218 38/42: Change all tests to use emms-test- prefix, ELPA Syncer, 2023/11/01
- [elpa] externals/emms 8a55be19ba 06/42: Ignore empty Vorbis comments,
ELPA Syncer <=
- [elpa] externals/emms 9d71a515f7 09/42: Split emms-info-native to several files, ELPA Syncer, 2023/11/01
- [elpa] externals/emms 29260a991a 11/42: Replace emms-info-native test files, ELPA Syncer, 2023/11/01
- [elpa] externals/emms fe9b0fffe1 16/42: Use strings instead of vectors for Vorbis comments, ELPA Syncer, 2023/11/01
- [elpa] externals/emms 75f1ee292e 20/42: Add copyright information, ELPA Syncer, 2023/11/01
- [elpa] externals/emms 5014dfa5f3 21/42: Ignore empty tags, ELPA Syncer, 2023/11/01
- [elpa] externals/emms 16f107b583 24/42: Use bindat-type in emms-info-vorbis, ELPA Syncer, 2023/11/01
- [elpa] externals/emms 6c3f1d6ab2 25/42: Use bindat-type in emms-info-opus, ELPA Syncer, 2023/11/01
- [elpa] externals/emms 59e999a259 05/42: Fix error reporting from emms-info-native--ogg-page-bindat-spec, ELPA Syncer, 2023/11/01
- [elpa] externals/emms b512ed7331 03/42: Change magic arrays to patterns, ELPA Syncer, 2023/11/01
- [elpa] externals/emms 5a52c1b129 22/42: Remove dependency on cl-lib, ELPA Syncer, 2023/11/01