diff options
author | Eric Wong <e@80x24.org> | 2017-03-02 04:08:23 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2017-03-02 04:08:43 +0000 |
commit | f4c2ac4825f99ec4af529d65ae98abfaf034fb0f (patch) | |
tree | bbae58219dc4d158c033b892e0a7da67a969ecdc /lib/dtas/source/av_ff_common.rb | |
parent | c2e04a5715d4cfa2b42fa09ba1f641d3ce741685 (diff) | |
download | dtas-f4c2ac4825f99ec4af529d65ae98abfaf034fb0f.tar.gz |
This is faster than relying on eval() for older Rubies. https://bugs.ruby-lang.org/issues/13077 Ruby 2.5 is targetted for release in December 2017.
Diffstat (limited to 'lib/dtas/source/av_ff_common.rb')
-rw-r--r-- | lib/dtas/source/av_ff_common.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/dtas/source/av_ff_common.rb b/lib/dtas/source/av_ff_common.rb index d89ea17..ae654ba 100644 --- a/lib/dtas/source/av_ff_common.rb +++ b/lib/dtas/source/av_ff_common.rb @@ -109,13 +109,17 @@ module DTAS::Source::AvFfCommon # :nodoc: f = $1.dup f =~ /^duration=([\d\.]+)\s*$/nm and @duration = $1.to_f # TODO: multi-line/multi-value/repeated tags - f.gsub!(/^TAG:([^=]+)=(.*)$/ni) { |_| @comments[$1.upcase.freeze] = $2 } + f.gsub!(/^TAG:([^=]+)=(.*)$/ni) { |_| + @comments[DTAS.dedupe_str($1.upcase)] = DTAS.dedupe_str($2) + } end # new avprobe s.scan(%r{^\[format\.tags\]\n(.*?)\n\n}m) do |_| f = $1.dup - f.gsub!(/^([^=]+)=(.*)$/ni) { |_| @comments[$1.upcase.freeze] = $2 } + f.gsub!(/^([^=]+)=(.*)$/ni) { |_| + @comments[DTAS.dedupe_str($1.upcase)] = DTAS.dedupe_str($2) + } end s.scan(%r{^\[format\]\n(.*?)\n\n}m) do |_| f = $1.dup |