[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/emms fe9b0fffe1 16/42: Use strings instead of vectors f
|
From: |
ELPA Syncer |
|
Subject: |
[elpa] externals/emms fe9b0fffe1 16/42: Use strings instead of vectors for Vorbis comments |
|
Date: |
Wed, 1 Nov 2023 15:58:00 -0400 (EDT) |
branch: externals/emms
commit fe9b0fffe1cf3e49711110fb7a085f77dc970254
Author: Petteri Hintsanen <petterih@iki.fi>
Commit: Petteri Hintsanen <petterih@iki.fi>
Use strings instead of vectors for Vorbis comments
Strings are more memory efficient and also the right thing.
---
emms-info-vorbis.el | 8 ++------
test/emms-info-ogg-tests.el | 14 +++++++-------
test/emms-info-vorbis-tests.el | 14 +++++++-------
3 files changed, 16 insertions(+), 20 deletions(-)
diff --git a/emms-info-vorbis.el b/emms-info-vorbis.el
index 8b64b929c0..f1cae7f4b8 100644
--- a/emms-info-vorbis.el
+++ b/emms-info-vorbis.el
@@ -144,7 +144,7 @@ header.")
'((length u32r)
(eval (when (> last emms-info-vorbis--max-comment-size)
(error "Vorbis comment length %s is too long" last)))
- (user-comment vec (length)))
+ (user-comment str (length)))
"Vorbis comment field specification.")
(defun emms-info-vorbis-extract-comments (user-comments)
@@ -175,11 +175,7 @@ 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."
- (let ((comment-string
- (decode-coding-string (mapconcat #'byte-to-string
- comment
- nil)
- 'utf-8)))
+ (let ((comment-string (decode-coding-string comment 'utf-8)))
(when (string-match "^\\(.+?\\)=\\(.+\\)$" comment-string)
(cons (downcase (match-string 1 comment-string))
(match-string 2 comment-string)))))
diff --git a/test/emms-info-ogg-tests.el b/test/emms-info-ogg-tests.el
index ea1c325eb3..d7d1c1bd9e 100644
--- a/test/emms-info-ogg-tests.el
+++ b/test/emms-info-ogg-tests.el
@@ -38,12 +38,12 @@
"Test `emms-info-ogg--decode-headers' with Vorbis data."
(let ((bytes [1 118 111 114 98 105 115 0 0 0 0 1 68 172 0 0 0 0 0 0 128 56 1
0 0 0 0 0 184 1 3 118 111 114 98 105 115 52 0 0 0 88 105 112 104 46 79 114 103
32 108 105 98 86 111 114 98 105 115 32 73 32 50 48 50 48 48 55 48 52 32 40 82
101 100 117 99 105 110 103 32 69 110 118 105 114 111 110 109 101 110 116 41 2 0
0 0 7 0 0 0 102 111 111 61 98 97 114 27 0 0 0 75 101 121 61 206 159 225 189 144
207 135 225 189 182 32 206 164 206 177 225 189 144 207 132 225 189 176 1]))
(should (equal (emms-info-ogg--decode-headers bytes 'vorbis)
- '((comment-header
+ `((comment-header
(framing-bit . 1)
(user-comments
- ((user-comment . [102 111 111 61 98 97 114])
+ ((user-comment . ,(unibyte-string 102 111 111 61 98 97
114))
(length . 7))
- ((user-comment . [75 101 121 61 206 159 225 189 144 207
135 225 189 182 32 206 164 206 177 225 189 144 207 132 225 189 176])
+ ((user-comment . ,(unibyte-string 75 101 121 61 206 159
225 189 144 207 135 225 189 182 32 206 164 206 177 225 189 144 207 132 225 189
176))
(length . 27)))
(user-comments-list-length . 2)
(vendor-string . [88 105 112 104 46 79 114 103 32 108
105 98 86 111 114 98 105 115 32 73 32 50 48 50 48 48 55 48 52 32 40 82 101 100
117 99 105 110 103 32 69 110 118 105 114 111 110 109 101 110 116 41])
@@ -66,13 +66,13 @@
"Test `emms-info-ogg--decode-headers' with Opus data."
(let ((bytes [79 112 117 115 72 101 97 100 1 1 56 1 68 172 0 0 0 0 0 79 112
117 115 84 97 103 115 13 0 0 0 108 105 98 111 112 117 115 32 49 46 51 46 49 3 0
0 0 38 0 0 0 69 78 67 79 68 69 82 61 111 112 117 115 101 110 99 32 102 114 111
109 32 111 112 117 115 45 116 111 111 108 115 32 48 46 49 46 49 48 7 0 0 0 102
111 111 61 98 97 114 27 0 0 0 75 101 121 61 206 159 225 189 144 207 135 225 189
182 32 206 164 206 177 225 189 144 207 132 225 189 176]))
(should (equal (emms-info-ogg--decode-headers bytes 'opus)
- '((comment-header
+ `((comment-header
(user-comments
- ((user-comment . [69 78 67 79 68 69 82 61 111 112 117
115 101 110 99 32 102 114 111 109 32 111 112 117 115 45 116 111 111 108 115 32
48 46 49 46 49 48])
+ ((user-comment . ,(unibyte-string 69 78 67 79 68 69 82
61 111 112 117 115 101 110 99 32 102 114 111 109 32 111 112 117 115 45 116 111
111 108 115 32 48 46 49 46 49 48))
(length . 38))
- ((user-comment . [102 111 111 61 98 97 114])
+ ((user-comment . ,(unibyte-string 102 111 111 61 98 97
114))
(length . 7))
- ((user-comment . [75 101 121 61 206 159 225 189 144 207
135 225 189 182 32 206 164 206 177 225 189 144 207 132 225 189 176])
+ ((user-comment . ,(unibyte-string 75 101 121 61 206 159
225 189 144 207 135 225 189 182 32 206 164 206 177 225 189 144 207 132 225 189
176))
(length . 27)))
(user-comments-list-length . 3)
(vendor-string . [108 105 98 111 112 117 115 32 49 46 51
46 49])
diff --git a/test/emms-info-vorbis-tests.el b/test/emms-info-vorbis-tests.el
index b36192806f..c5c424a38f 100644
--- a/test/emms-info-vorbis-tests.el
+++ b/test/emms-info-vorbis-tests.el
@@ -27,12 +27,12 @@
(require 'ert)
(ert-deftest emms-vorbis-test-extract-comments ()
- (let ((comments '(((user-comment . [77 85 83 73 67 66 82 65 73 78 90 95 82
69 76 69 65 83 69 71 82 79 85 80 73 68 61 57 98 51 48 55 50 57 51 45 100 50 101
54 45 51 52 97 57 45 97 50 56 57 45 49 54 49 99 53 98 97 102 49 56 55 102])
(length . 63)) ;musicbrainz_releasegroupid
- ((user-comment . [79 82 73 71 73 78 65 76 68 65 84 69 61
49 57 57 55 45 48 51 45 51 49]) (length . 23)) ;originaldate
- ((user-comment . [79 82 73 71 73 78 65 76 89 69 65 82 61
49 57 57 55]) (length . 17)) ;originalyear
- ((user-comment . [82 69 76 69 65 83 69 84 89 80 69 61 97
108 98 117 109]) (length . 17)) ;releasetype
- ((user-comment . [66 65 82 67 79 68 69 61 55 54 57 50 51
51 48 48 52 55 50 55]) (length . 20)) ;barcode
- ((user-comment . [65 76 66 85 77 61 65 32 116 111 100 97
32 67 117 98 97 32 108 101 32 103 117 115 116 97]) (length . 26))))) ;album
+ (let ((comments `(((user-comment . ,(unibyte-string 77 85 83 73 67 66 82 65
73 78 90 95 82 69 76 69 65 83 69 71 82 79 85 80 73 68 61 57 98 51 48 55 50 57
51 45 100 50 101 54 45 51 52 97 57 45 97 50 56 57 45 49 54 49 99 53 98 97 102
49 56 55 102)) (length . 63)) ;musicbrainz_releasegroupid
+ ((user-comment . ,(unibyte-string 79 82 73 71 73 78 65 76
68 65 84 69 61 49 57 57 55 45 48 51 45 51 49)) (length . 23)) ;originaldate
+ ((user-comment . ,(unibyte-string 79 82 73 71 73 78 65 76
89 69 65 82 61 49 57 57 55)) (length . 17)) ;originalyear
+ ((user-comment . ,(unibyte-string 82 69 76 69 65 83 69 84
89 80 69 61 97 108 98 117 109)) (length . 17)) ;releasetype
+ ((user-comment . ,(unibyte-string 66 65 82 67 79 68 69 61
55 54 57 50 51 51 48 48 52 55 50 55)) (length . 20)) ;barcode
+ ((user-comment . ,(unibyte-string 65 76 66 85 77 61 65 32
116 111 100 97 32 67 117 98 97 32 108 101 32 103 117 115 116 97)) (length .
26))))) ;album
(should (equal (emms-info-vorbis-extract-comments comments)
(quote (("album" . "A toda Cuba le gusta")
("originalyear" . "1997")
@@ -47,7 +47,7 @@
(cons "a" "B")))
(should (equal (emms-info-vorbis--split-comment "abc=ABC=123")
(cons "abc" "ABC=123")))
- (let ((comment [75 101 121 61 206 159 225 189 144 207 135 225 189 182 32 206
164 206 177 225 189 144 207 132 225 189 176 10 ])) ;Key=Οὐχὶ Ταὐτὰ
+ (let ((comment (unibyte-string 75 101 121 61 206 159 225 189 144 207 135 225
189 182 32 206 164 206 177 225 189 144 207 132 225 189 176 10))) ;Key=Οὐχὶ Ταὐτὰ
(should (equal (emms-info-vorbis--split-comment comment)
(cons "key" "Οὐχὶ Ταὐτὰ")))))
- [elpa] externals/emms fca5f3e7d5 26/42: Use bindat-type in emms-info-flac, (continued)
- [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, 2023/11/01
- [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 <=
- [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
- [elpa] externals/emms 399dd78230 23/42: Use bindat-type in emms-info-ogg, ELPA Syncer, 2023/11/01
- [elpa] externals/emms e18b579e31 27/42: Use bindat-type in emms-info-mp3, ELPA Syncer, 2023/11/01
- [elpa] externals/emms f6bd021bc9 29/42: Compatibility code ert-resource-file, ELPA Syncer, 2023/11/01