From 10946330a804afe0fdc5c727b71293d9cc1f1279 Mon Sep 17 00:00:00 2001
From: Antoine Gersant <antoine.gersant@lesforges.org>
Date: Tue, 4 Feb 2025 22:19:05 -0800
Subject: [PATCH] Adds support for multivalue w/ opus files

---
 Cargo.lock                           |   3 +--
 Cargo.toml                           |   3 ++-
 src/app/formats.rs                   |   5 ++++-
 test-data/multivalue/multivalue.opus | Bin 0 -> 8400 bytes
 4 files changed, 7 insertions(+), 4 deletions(-)
 create mode 100644 test-data/multivalue/multivalue.opus

diff --git a/Cargo.lock b/Cargo.lock
index 80f47b0..e1e8403 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1635,8 +1635,7 @@ checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"
 [[package]]
 name = "opus_headers"
 version = "0.1.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "afbb993947f111397c2bc536944f8dac7f54a4e73383d478efe1990b56404b60"
+source = "git+https://github.com/agersant/opus_headers?branch=multivalue#9850b2d369b12794ad62d4c2bf61e4645183ff49"
 
 [[package]]
 name = "orion"
diff --git a/Cargo.toml b/Cargo.toml
index 153c23c..86049c0 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -36,7 +36,8 @@ nohash-hasher = "0.2.0"
 notify = { version = "6.1.1", default-features = false }
 notify-debouncer-full = { version = "0.3.1", default-features = false }
 num_cpus = "1.14.0"
-opus_headers = "0.1.2"
+# TODO upstream PR: https://github.com/yboettcher/opus_headers/pull/7
+opus_headers = { git = "https://github.com/agersant/opus_headers", branch = "multivalue" }
 pbkdf2 = "0.11"
 rand = "0.8"
 rayon = "1.10.0"
diff --git a/src/app/formats.rs b/src/app/formats.rs
index 57fd05f..7e21101 100644
--- a/src/app/formats.rs
+++ b/src/app/formats.rs
@@ -429,7 +429,10 @@ fn reads_multivalue_fields() {
 		expected_with_duration
 	);
 	// TODO Test m4a support (likely working). Pending https://tickets.metabrainz.org/browse/PICARD-3029
-	// TODO Opus support.
+	assert_eq!(
+		read_metadata(Path::new("test-data/multivalue/multivalue.opus")).unwrap(),
+		expected_without_duration
+	);
 	assert_eq!(
 		read_metadata(Path::new("test-data/multivalue/multivalue.ape")).unwrap(),
 		expected_without_duration
diff --git a/test-data/multivalue/multivalue.opus b/test-data/multivalue/multivalue.opus
new file mode 100644
index 0000000000000000000000000000000000000000..e1e8c8cf769fcdf21c9997bf904df8cc6132b9ba
GIT binary patch
literal 8400
zcmeI1T}TvB6oBuvYCryMZCSZl`=A7orW=MmY_Piyx;X3D%t%NQEU4Q<57MUAi`<NY
zz>t0@2#R{BkcytdEbt`?EUT9a2_xzu%D|#0`$0Qr&g@S1)?1wRvdg*m+%xyich8-B
zX71IKNmDEmPWtlnW(Q_RN8hz8KE1mq)!3QnP?S1F-m^_~G|wb7SD<t{zT-;XJf;b}
z#!4hpg`n0Fy<N3+Rl)65HPzKCK(Q45^<hg51*>bed7)s%EKLnrs%Zu6YzgS1V9=l&
zZKO_@>>54ZqMNGW)HtQpcul%Sw;EL=kS<~u4QjLDbYW+gXLMw1D+@qbA2XxPt?>x7
zzjY;)TUsMp%!KBsJ1rbhwN(rB)PP-qbYa7anHE`7-sft`mek0iwHdK!#ynj@mUKSk
zH18PVfLca4+T`404Z?-BNNe2b5wm4!-GY0;ngD6m|6$<V)^8SIkWJYU$d15&Jp#1O
zJBz-+bsl5H#=*gopy#jC?EKt6_;W&89|kaCBYHsYoyk4H3{eItzM~g&0P#j`X%{m@
zG2<fU0%F(82RoS|%3++IG*R<FDnmm7W{9E_rzasU2I(Cu9ASni12{biaS6!#yWTf3
zLljdkBEInVcbMhO5al_10?CWZK>80|s$_;JOnd?fF&||42hUq(h_VQuKtjY1zzNy&
zi5a4J<Ran+<k{XA70eLjQCwumi$x$0Pu=z~Llj|LWC*bs<bfmJ$IKArPZtq4HcFq2
zuzN?ngX<`H5jUZlMgKEyUQFRSN{F~4_IzskIx|GE1=mqR#O*zAPWumLh;rIR#Enqz
zrp+m4h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