about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2023-10-12 09:22:47 +0000
committerEric Wong <e@80x24.org>2023-10-12 09:24:01 +0000
commit958102f24071f114e0e1671aa6cbe519c69c7d07 (patch)
tree8a927650be26a86a2652fc958471bb9a25580a86
parentfda2a448452165b33eeee06f2b646d68749e5f00 (diff)
downloaddtas-958102f24071f114e0e1671aa6cbe519c69c7d07.tar.gz
ffprobe aways says `track' instead of `TRACKNUMBER'; but
the rest of our code follows FLAC metadata conventions;
so use `TRACKNUMBER'.

(avprobe is untested since the libav project is dead)
-rw-r--r--lib/dtas/source/av_ff_common.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/dtas/source/av_ff_common.rb b/lib/dtas/source/av_ff_common.rb
index 5299fdb..20c9d19 100644
--- a/lib/dtas/source/av_ff_common.rb
+++ b/lib/dtas/source/av_ff_common.rb
@@ -126,6 +126,11 @@ module DTAS::Source::AvFfCommon # :nodoc:
       f =~ /^duration=([\d\.]+)\s*$/nm and @duration = $1.to_f
     end
 
+    # ffprobe always uses "track", favor FLAC convention "TRACKNUMBER":
+    if @comments['TRACK'] && !@comments['TRACKNUMBER']
+      @comments['TRACKNUMBER'] = @comments.delete('TRACK')
+    end
+
     ! @astreams.compact.empty?
   end