diff options
author | Eric Wong <e@80x24.org> | 2015-12-21 05:05:09 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2015-12-25 08:32:06 +0000 |
commit | bc374a76530826e7f701c6643a59423a2c912be1 (patch) | |
tree | f55b48909e265bd49152058ce8f647eb029f6d68 /lib/dtas | |
parent | 9729f457a7ece348f8ae0ab5a9e1e326ffc5638e (diff) | |
download | dtas-bc374a76530826e7f701c6643a59423a2c912be1.tar.gz |
While we're in the area, make a wording change from "GPLv3 or later" to "GPL-3.0+", as the latter is favored by SPDX.org
Diffstat (limited to 'lib/dtas')
49 files changed, 119 insertions, 75 deletions
diff --git a/lib/dtas/buffer.rb b/lib/dtas/buffer.rb index 23b0b77..a6124de 100644 --- a/lib/dtas/buffer.rb +++ b/lib/dtas/buffer.rb @@ -1,5 +1,6 @@ # Copyright (C) 2013-2015 all contributors <dtas-all@nongnu.org> -# License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt) +# License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt) +# frozen_string_literal: true require 'io/wait' require_relative '../dtas' diff --git a/lib/dtas/buffer/read_write.rb b/lib/dtas/buffer/read_write.rb index 76c60b0..5a32e2d 100644 --- a/lib/dtas/buffer/read_write.rb +++ b/lib/dtas/buffer/read_write.rb @@ -1,5 +1,6 @@ # Copyright (C) 2013-2015 all contributors <dtas-all@nongnu.org> -# License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt) +# License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt) +# frozen_string_literal: true require 'io/nonblock' require_relative '../../dtas' require_relative '../pipe' @@ -12,7 +13,7 @@ module DTAS::Buffer::ReadWrite # :nodoc: attr_accessor :buffer_size def _rbuf - Thread.current[:dtas_pbuf] ||= "" + Thread.current[:dtas_pbuf] ||= ''.b end # be sure to only call this with nil when all writers to @wr are done diff --git a/lib/dtas/buffer/splice.rb b/lib/dtas/buffer/splice.rb index be40881..42737a1 100644 --- a/lib/dtas/buffer/splice.rb +++ b/lib/dtas/buffer/splice.rb @@ -1,5 +1,6 @@ # Copyright (C) 2013-2015 all contributors <dtas-all@nongnu.org> -# License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt) +# License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt) +# frozen_string_literal: true require 'io/nonblock' require 'io/splice' require_relative '../../dtas' diff --git a/lib/dtas/command.rb b/lib/dtas/command.rb index 3f27c61..e7df32d 100644 --- a/lib/dtas/command.rb +++ b/lib/dtas/command.rb @@ -1,5 +1,6 @@ # Copyright (C) 2013-2015 all contributors <dtas-all@nongnu.org> -# License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt) +# License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt) +# frozen_string_literal: true require_relative 'serialize' require 'shellwords' diff --git a/lib/dtas/compat_onenine.rb b/lib/dtas/compat_onenine.rb index bd74eee..2755a7f 100644 --- a/lib/dtas/compat_onenine.rb +++ b/lib/dtas/compat_onenine.rb @@ -1,5 +1,5 @@ # Copyright (C) 2013-2015 all contributors <dtas-all@nongnu.org> -# License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt) +# License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt) # Make Ruby 1.9.3 look like Ruby 2.0.0 to us # This exists for Debian wheezy users using the stock Ruby 1.9.3 install. diff --git a/lib/dtas/cue_index.rb b/lib/dtas/cue_index.rb index 9fca5c2..568fd56 100644 --- a/lib/dtas/cue_index.rb +++ b/lib/dtas/cue_index.rb @@ -1,5 +1,6 @@ # Copyright (C) 2013-2015 all contributors <dtas-all@nongnu.org> -# License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt) +# License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt) +# frozen_string_literal: true require_relative '../dtas' # embedded CUE sheet representation for -player diff --git a/lib/dtas/disclaimer.rb b/lib/dtas/disclaimer.rb index 897668b..9211403 100644 --- a/lib/dtas/disclaimer.rb +++ b/lib/dtas/disclaimer.rb @@ -1,6 +1,7 @@ # :enddoc: # Copyright (C) 2013-2015 all contributors <dtas-all@nongnu.org> -# License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt) +# License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt) +# frozen_string_literal: true DTAS_PROGNAME = File.basename($0) DTAS_DISCLAIMER = <<EOF # WARNING! diff --git a/lib/dtas/edit_client.rb b/lib/dtas/edit_client.rb index 21c7662..da34023 100644 --- a/lib/dtas/edit_client.rb +++ b/lib/dtas/edit_client.rb @@ -1,5 +1,6 @@ # Copyright (C) 2013-2015 all contributors <dtas-all@nongnu.org> -# License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt) +# License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt) +# frozen_string_literal: true require 'tempfile' require 'yaml' require_relative 'unix_client' @@ -13,7 +14,7 @@ module DTAS::EditClient # :nodoc: v.empty? and next return v end - "vi" + 'vi'.freeze end def client_socket diff --git a/lib/dtas/fadefx.rb b/lib/dtas/fadefx.rb index 899505b..577d103 100644 --- a/lib/dtas/fadefx.rb +++ b/lib/dtas/fadefx.rb @@ -1,5 +1,6 @@ # Copyright (C) 2013-2015 all contributors <dtas-all@nongnu.org> -# License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt) +# License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt) +# frozen_string_literal: true require_relative '../dtas' require_relative 'parse_time' require_relative 'xs' @@ -94,7 +95,7 @@ class DTAS::FadeFX # :nodoc: def parse!(str) return nil if str.empty? type = "t" - str.sub!(/\A([a-z])/, "") and type = $1 + str.sub!(/\A([a-z])/, "") and type = $1.freeze F.new(type, parse_time(str)) end end diff --git a/lib/dtas/format.rb b/lib/dtas/format.rb index cfcec64..ee456d1 100644 --- a/lib/dtas/format.rb +++ b/lib/dtas/format.rb @@ -1,5 +1,6 @@ # Copyright (C) 2013-2015 all contributors <dtas-all@nongnu.org> -# License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt) +# License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt) +# frozen_string_literal: true require_relative '../dtas' require_relative 'process' require_relative 'serialize' diff --git a/lib/dtas/mlib.rb b/lib/dtas/mlib.rb index 9160567..d883523 100644 --- a/lib/dtas/mlib.rb +++ b/lib/dtas/mlib.rb @@ -1,7 +1,8 @@ # -*- encoding: utf-8 -*- # Copyright (C) 2015 all contributors <dtas-all@nongnu.org> -# License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt) - +# License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt) +# frozen_string_literal: true +# require_relative '../dtas' require_relative 'process' require 'socket' @@ -97,9 +98,9 @@ class DTAS::Mlib # :nodoc: return ignore(job) unless String === buf # no, we don't support comments with newlines in them - buf = buf.split("\n".freeze) + buf = buf.split("\n") while line = buf.shift - tag, value = line.split('='.freeze, 2) + tag, value = line.split('=', 2) tag && value or next tag.downcase! tag_id = @tag_map[tag] or next @@ -396,7 +397,7 @@ class DTAS::Mlib # :nodoc: parts.unshift('') cache[parent_id] = parts.join('/') parts << base - parts.join('/') + parts.join('/').freeze end def emit_recurse(node, cache, cb) diff --git a/lib/dtas/mlib/migrations/0001_initial.rb b/lib/dtas/mlib/migrations/0001_initial.rb index f147cbe..dfab271 100644 --- a/lib/dtas/mlib/migrations/0001_initial.rb +++ b/lib/dtas/mlib/migrations/0001_initial.rb @@ -1,5 +1,5 @@ # Copyright (C) 2015 all contributors <dtas-all@nongnu.org> -# License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt) +# License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt) Sequel.migration do up do diff --git a/lib/dtas/parse_freq.rb b/lib/dtas/parse_freq.rb index db1b33f..1d1e850 100644 --- a/lib/dtas/parse_freq.rb +++ b/lib/dtas/parse_freq.rb @@ -1,6 +1,6 @@ # Copyright (C) 2015 all contributors <dtas-all@nongnu.org> -# License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt) - +# License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt) +# frozen_string_literal: true require_relative '../dtas' module DTAS::ParseFreq # :nodoc: diff --git a/lib/dtas/parse_time.rb b/lib/dtas/parse_time.rb index 5c22baf..f4215cb 100644 --- a/lib/dtas/parse_time.rb +++ b/lib/dtas/parse_time.rb @@ -1,6 +1,7 @@ # frozen_string_literal: true # Copyright (C) 2013-2015 all contributors <dtas-all@nongnu.org> -# License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt) +# License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt) +# frozen_string_literal: true require_relative '../dtas' module DTAS::ParseTime # :nodoc: diff --git a/lib/dtas/partstats.rb b/lib/dtas/partstats.rb index 7019b3d..30be807 100644 --- a/lib/dtas/partstats.rb +++ b/lib/dtas/partstats.rb @@ -1,6 +1,7 @@ # -*- encoding: binary -*- # Copyright (C) 2013-2015 all contributors <dtas-all@nongnu.org> -# License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt) +# License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt) +# frozen_string_literal: true require_relative '../dtas' require_relative 'xs' require_relative 'process' @@ -73,7 +74,7 @@ class DTAS::PartStats # :nodoc: fails = [] do_spawn = lambda do |trim_part| pid, rpipe = partstats_spawn(trim_part, opts) - rset[rpipe] = [ trim_part, "" ] + rset[rpipe] = [ trim_part, ''.b ] pids[pid] = [ trim_part, rpipe ] end diff --git a/lib/dtas/pipe.rb b/lib/dtas/pipe.rb index cc1c3b5..7bb57ed 100644 --- a/lib/dtas/pipe.rb +++ b/lib/dtas/pipe.rb @@ -1,5 +1,6 @@ # Copyright (C) 2013-2015 all contributors <dtas-all@nongnu.org> -# License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt) +# License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt) +# frozen_string_literal: true begin require 'io/splice' rescue LoadError diff --git a/lib/dtas/player.rb b/lib/dtas/player.rb index 554a53f..06300b4 100644 --- a/lib/dtas/player.rb +++ b/lib/dtas/player.rb @@ -1,5 +1,6 @@ # Copyright (C) 2013-2015 all contributors <dtas-all@nongnu.org> -# License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt) +# License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt) +# frozen_string_literal: true require 'yaml' require 'shellwords' require_relative '../dtas' @@ -76,7 +77,7 @@ class DTAS::Player # :nodoc: end end end - $stdout.write(msg << "\n") + $stdout.write("#{msg}\n") end # used for state file diff --git a/lib/dtas/player/client_handler.rb b/lib/dtas/player/client_handler.rb index 498388e..4499259 100644 --- a/lib/dtas/player/client_handler.rb +++ b/lib/dtas/player/client_handler.rb @@ -1,5 +1,6 @@ # Copyright (C) 2013-2015 all contributors <dtas-all@nongnu.org> -# License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt) +# License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt) +# frozen_string_literal: true require_relative '../xs' require_relative '../parse_time' @@ -139,7 +140,7 @@ module DTAS::Player::ClientHandler # :nodoc: # multiple changes may be made at once msg[2..-1].each do |kv| - k, v = kv.split(/=/, 2) + k, v = kv.split('=', 2) case k when %r{\Aenv\.([^=]+)\z} sink.env[$1] = v @@ -244,7 +245,7 @@ module DTAS::Player::ClientHandler # :nodoc: return io.emit(@rg.to_hsh.to_yaml) if msg.empty? before = @rg.to_hsh msg.each do |kv| - k, v = kv.split(/=/, 2) + k, v = kv.split('=', 2) case k when "mode" case v diff --git a/lib/dtas/process.rb b/lib/dtas/process.rb index 8c46d9d..310e0b2 100644 --- a/lib/dtas/process.rb +++ b/lib/dtas/process.rb @@ -1,5 +1,6 @@ # Copyright (C) 2013-2015 all contributors <dtas-all@nongnu.org> -# License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt) +# License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt) +# frozen_string_literal: true require 'io/wait' require 'shellwords' require_relative '../dtas' @@ -87,7 +88,7 @@ module DTAS::Process # :nodoc: cmd, opts = env, cmd env = {} end - buf = '' + buf = ''.b r, w = DTAS::Nonblock.pipe opts = opts.merge(out: w) r.binmode @@ -102,7 +103,7 @@ module DTAS::Process # :nodoc: w.close if err_str we.close - res = "".b + res = ''.b want = { r => res, re => err_str } begin readable = IO.select(want.keys) or next diff --git a/lib/dtas/replaygain.rb b/lib/dtas/replaygain.rb index cc96d54..63eb615 100644 --- a/lib/dtas/replaygain.rb +++ b/lib/dtas/replaygain.rb @@ -1,5 +1,6 @@ # Copyright (C) 2013-2015 all contributors <dtas-all@nongnu.org> -# License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt) +# License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt) +# frozen_string_literal: true # Represents ReplayGain metadata for a DTAS::Source, only used by -player # cleanup/validate values to prevent malicious files from making us diff --git a/lib/dtas/rg_state.rb b/lib/dtas/rg_state.rb index 18f4429..caf1cc7 100644 --- a/lib/dtas/rg_state.rb +++ b/lib/dtas/rg_state.rb @@ -1,5 +1,6 @@ # Copyright (C) 2013-2015 all contributors <dtas-all@nongnu.org> -# License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt) +# License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt) +# frozen_string_literal: true # # provides support for generating appropriate effects for ReplayGain # MAYBE: account for non-standard reference loudness (89.0 dB is standard) @@ -72,7 +73,7 @@ class DTAS::RGState # :nodoc: when -1 then return 'gain -192' when 1 then return 'gain 192' else - sprintf('gain %0.8g', val) + sprintf('gain %0.8g', val).freeze end end diff --git a/lib/dtas/serialize.rb b/lib/dtas/serialize.rb index 1a7d477..f03e244 100644 --- a/lib/dtas/serialize.rb +++ b/lib/dtas/serialize.rb @@ -1,5 +1,6 @@ # Copyright (C) 2013-2015 all contributors <dtas-all@nongnu.org> -# License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt) +# License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt) +# frozen_string_literal: true # used to serialize player state to the state file module DTAS::Serialize # :nodoc: diff --git a/lib/dtas/sigevent.rb b/lib/dtas/sigevent.rb index 303459a..55dc0f0 100644 --- a/lib/dtas/sigevent.rb +++ b/lib/dtas/sigevent.rb @@ -1,5 +1,6 @@ # Copyright (C) 2013-2015 all contributors <dtas-all@nongnu.org> -# License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt) +# License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt) +# frozen_string_literal: true begin raise LoadError, "no eventfd with _DTAS_POSIX" if ENV["_DTAS_POSIX"] require 'sleepy_penguin' diff --git a/lib/dtas/sigevent/efd.rb b/lib/dtas/sigevent/efd.rb index 26c8025..daae4ff 100644 --- a/lib/dtas/sigevent/efd.rb +++ b/lib/dtas/sigevent/efd.rb @@ -1,5 +1,5 @@ # Copyright (C) 2013-2015 all contributors <dtas-all@nongnu.org> -# License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt) +# License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt) # used in various places for safe wakeups from IO.select via signals # This requires a modern Linux system and the "sleepy_penguin" RubyGem diff --git a/lib/dtas/sigevent/pipe.rb b/lib/dtas/sigevent/pipe.rb index 5dd01a6..f30bb5b 100644 --- a/lib/dtas/sigevent/pipe.rb +++ b/lib/dtas/sigevent/pipe.rb @@ -1,5 +1,6 @@ # Copyright (C) 2013-2015 all contributors <dtas-all@nongnu.org> -# License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt) +# License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt) +# frozen_string_literal: true # used in various places for safe wakeups from IO.select via signals # A fallback for non-Linux systems lacking the "sleepy_penguin" RubyGem @@ -9,7 +10,7 @@ class DTAS::Sigevent # :nodoc: def initialize @to_io, @wr = DTAS::Nonblock.pipe - @rbuf = '' + @rbuf = ''.b end def signal diff --git a/lib/dtas/sink.rb b/lib/dtas/sink.rb index 0bf49f4..dce5a59 100644 --- a/lib/dtas/sink.rb +++ b/lib/dtas/sink.rb @@ -1,5 +1,6 @@ # Copyright (C) 2013-2015 all contributors <dtas-all@nongnu.org> -# License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt) +# License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt) +# frozen_string_literal: true require 'yaml' require_relative '../dtas' require_relative 'pipe' diff --git a/lib/dtas/source.rb b/lib/dtas/source.rb index ad8f017..6f3049b 100644 --- a/lib/dtas/source.rb +++ b/lib/dtas/source.rb @@ -1,5 +1,6 @@ # Copyright (C) 2013-2015 all contributors <dtas-all@nongnu.org> -# License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt) +# License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt) +# frozen_string_literal: true require_relative '../dtas' module DTAS::Source # :nodoc: diff --git a/lib/dtas/source/av.rb b/lib/dtas/source/av.rb index c86b5d2..baeaee4 100644 --- a/lib/dtas/source/av.rb +++ b/lib/dtas/source/av.rb @@ -1,5 +1,6 @@ # Copyright (C) 2013-2015 all contributors <dtas-all@nongnu.org> -# License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt) +# License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt) +# frozen_string_literal: true require_relative '../../dtas' require_relative 'av_ff_common' diff --git a/lib/dtas/source/av_ff_common.rb b/lib/dtas/source/av_ff_common.rb index 9f29b02..e1f221b 100644 --- a/lib/dtas/source/av_ff_common.rb +++ b/lib/dtas/source/av_ff_common.rb @@ -1,5 +1,6 @@ # Copyright (C) 2013-2015 all contributors <dtas-all@nongnu.org> -# License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt) +# License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt) +# frozen_string_literal: true require_relative '../../dtas' require_relative '../source' require_relative '../replaygain' @@ -75,7 +76,7 @@ module DTAS::Source::AvFfCommon # :nodoc: cmd.concat(%W(-show_streams -show_format #@infile)) break if cmd == prev_cmd - err = "" + err = "".b s = qx(@env, cmd, err_str: err, no_raise: true) return false unless probe_ok?(s, err) s.scan(%r{^\[STREAM\]\n(.*?)\n\[/STREAM\]\n}mn) do |_| @@ -93,10 +94,10 @@ module DTAS::Source::AvFfCommon # :nodoc: end while incomplete.compact[0] s.scan(%r{^\[FORMAT\]\n(.*?)\n\[/FORMAT\]\n}m) do |_| - f = $1 + 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] = $2 } + f.gsub!(/^TAG:([^=]+)=(.*)$/ni) { |_| @comments[$1.upcase.freeze] = $2 } end ! @astreams.compact.empty? end diff --git a/lib/dtas/source/cmd.rb b/lib/dtas/source/cmd.rb index 4e730ea..46cf1b4 100644 --- a/lib/dtas/source/cmd.rb +++ b/lib/dtas/source/cmd.rb @@ -1,5 +1,6 @@ # Copyright (C) 2013-2015 all contributors <dtas-all@nongnu.org> -# License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt) +# License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt) +# frozen_string_literal: true require_relative '../../dtas' require_relative '../source' require_relative '../command' diff --git a/lib/dtas/source/common.rb b/lib/dtas/source/common.rb index 94cea7d..bb4a40e 100644 --- a/lib/dtas/source/common.rb +++ b/lib/dtas/source/common.rb @@ -1,5 +1,5 @@ # Copyright (C) 2013-2015 all contributors <dtas-all@nongnu.org> -# License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt) +# License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt) module DTAS::Source::Common # :nodoc: attr_reader :dst_zero_byte # first byte this source object saw attr_reader :dst diff --git a/lib/dtas/source/ff.rb b/lib/dtas/source/ff.rb index d5e744c..33b46e9 100644 --- a/lib/dtas/source/ff.rb +++ b/lib/dtas/source/ff.rb @@ -1,5 +1,6 @@ # Copyright (C) 2013-2015 all contributors <dtas-all@nongnu.org> -# License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt) +# License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt) +# frozen_string_literal: true require_relative '../../dtas' require_relative 'av_ff_common' diff --git a/lib/dtas/source/file.rb b/lib/dtas/source/file.rb index 75b4a43..7f99ad0 100644 --- a/lib/dtas/source/file.rb +++ b/lib/dtas/source/file.rb @@ -1,5 +1,6 @@ # Copyright (C) 2013-2015 all contributors <dtas-all@nongnu.org> -# License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt) +# License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt) +# frozen_string_literal: true require_relative '../../dtas' require_relative '../source' require_relative '../command' @@ -67,7 +68,7 @@ module DTAS::Source::File # :nodoc: # creates the effect to fill the TRIMFX env def trimfx return unless @offset || @trim - fx = "trim #{offset_samples}s" + fx = "trim #{offset_samples}s".dup if @trim && @trim[1] fx << sprintf(' =%0.9gs', (@trim[0] + @trim[1]) * format.rate) end diff --git a/lib/dtas/source/mp3gain.rb b/lib/dtas/source/mp3gain.rb index 6637768..0b3d481 100644 --- a/lib/dtas/source/mp3gain.rb +++ b/lib/dtas/source/mp3gain.rb @@ -1,5 +1,6 @@ # Copyright (C) 2013-2015 all contributors <dtas-all@nongnu.org> -# License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt) +# License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt) +# frozen_string_literal: true require_relative '../process' module DTAS::Source::Mp3gain # :nodoc: diff --git a/lib/dtas/source/sox.rb b/lib/dtas/source/sox.rb index 6f02f99..701a36a 100644 --- a/lib/dtas/source/sox.rb +++ b/lib/dtas/source/sox.rb @@ -1,5 +1,7 @@ # Copyright (C) 2013-2015 all contributors <dtas-all@nongnu.org> -# License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt) +# License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt) +# frozen_string_literal: true +# encoding: binary require_relative '../../dtas' require_relative '../source' require_relative '../replaygain' @@ -39,7 +41,7 @@ class DTAS::Source::Sox # :nodoc: end def try(infile, offset = nil, trim = nil) - err = "" + err = "".b cmd = %W(soxi -s #{infile}) s = qx(@env.dup, cmd, err_str: err, no_raise: true) return if err =~ /soxi FAIL formats:/ @@ -65,8 +67,8 @@ class DTAS::Source::Sox # :nodoc: tmp = {} case @infile when String - qx(@env, %W(soxi -a #@infile)).split(/\n/n).each do |line| - key, value = line.split(/=/n, 2) + qx(@env, %W(soxi -a #@infile)).split("\n").each do |line| + key, value = line.split('=', 2) key && value or next # TODO: multi-line/multi-value/repeated tags tmp[key.upcase] = value diff --git a/lib/dtas/source/splitfx.rb b/lib/dtas/source/splitfx.rb index 02c3a9d..fad165f 100644 --- a/lib/dtas/source/splitfx.rb +++ b/lib/dtas/source/splitfx.rb @@ -1,5 +1,6 @@ # Copyright (C) 2014-2015 all contributors <dtas-all@nongnu.org> -# License: GPLv3 or later <https://www.gnu.org/licenses/gpl-3.0.txt> +# License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt> +# frozen_string_literal: true require 'yaml' require_relative 'sox' require_relative '../splitfx' @@ -27,7 +28,7 @@ class DTAS::Source::SplitFX < DTAS::Source::Sox # :nodoc: return false if !st.file? || st.size > MAX_YAML_SIZE # read 4 bytes first to ensure we have a YAML file with a hash: - buf = "" + buf = "".dup File.open(ymlfile, "rb") do |fp| return false if fp.read(4, buf) != "---\n" buf << fp.read diff --git a/lib/dtas/spawn_fix.rb b/lib/dtas/spawn_fix.rb index ebde23c..f02e26f 100644 --- a/lib/dtas/spawn_fix.rb +++ b/lib/dtas/spawn_fix.rb @@ -1,5 +1,5 @@ # Copyright (C) 2013-2015 all contributors <dtas-all@nongnu.org> -# License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt) +# License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt) # workaround for older Rubies: https://bugs.ruby-lang.org/issues/8770 module DTAS::SpawnFix # :nodoc: def spawn(*args) diff --git a/lib/dtas/splitfx.rb b/lib/dtas/splitfx.rb index 3474a6d..4084393 100644 --- a/lib/dtas/splitfx.rb +++ b/lib/dtas/splitfx.rb @@ -1,5 +1,6 @@ # Copyright (C) 2013-2015 all contributors <dtas-all@nongnu.org> -# License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt) +# License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt) +# frozen_string_literal: true require_relative '../dtas' require_relative 'format' require_relative 'process' @@ -35,7 +36,7 @@ class DTAS::SplitFX # :nodoc: class T < Struct.new(:env, :comments, :tbeg, :fade_in, :fade_out) # :nodoc: def commit(advance_track_samples) tlen = advance_track_samples - tbeg - trimfx = "trim #{tbeg}s #{tlen}s" + trimfx = "trim #{tbeg}s #{tlen}s".dup if fade_in trimfx << " #{fade_in}" end diff --git a/lib/dtas/state_file.rb b/lib/dtas/state_file.rb index 26f588f..4eb2a9f 100644 --- a/lib/dtas/state_file.rb +++ b/lib/dtas/state_file.rb @@ -1,5 +1,6 @@ # Copyright (C) 2013-2015 all contributors <dtas-all@nongnu.org> -# License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt) +# License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt) +# frozen_string_literal: true require 'yaml' require 'tempfile' diff --git a/lib/dtas/tfx.rb b/lib/dtas/tfx.rb index ff03819..cc175f4 100644 --- a/lib/dtas/tfx.rb +++ b/lib/dtas/tfx.rb @@ -1,5 +1,6 @@ # Copyright (C) 2013-2015 all contributors <dtas-all@nongnu.org> -# License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt) +# License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt) +# frozen_string_literal: true require_relative '../dtas' require_relative 'parse_time' require_relative 'format' @@ -69,7 +70,7 @@ class DTAS::TFX # :nodoc: def parse_trim!(args) tbeg = parse_time(args.shift) if args[0] =~ /\A=?[\d\.]+\z/ - tlen = args.shift + tlen = args.shift.dup is_stop_time = tlen.sub!(/\A=/, "") ? true : false tlen = parse_time(tlen) tlen = tlen - tbeg if is_stop_time diff --git a/lib/dtas/track.rb b/lib/dtas/track.rb index b69f63f..2a68cd7 100644 --- a/lib/dtas/track.rb +++ b/lib/dtas/track.rb @@ -1,5 +1,6 @@ # Copyright (C) 2015 all contributors <dtas-all@nongnu.org> -# License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt) +# License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt) +# frozen_string_literal: true require_relative '../dtas' class DTAS::Track # :nodoc: diff --git a/lib/dtas/tracklist.rb b/lib/dtas/tracklist.rb index 726a46a..2cc27d2 100644 --- a/lib/dtas/tracklist.rb +++ b/lib/dtas/tracklist.rb @@ -1,5 +1,6 @@ # Copyright (C) 2013-2015 all contributors <dtas-all@nongnu.org> -# License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt) +# License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt) +# frozen_string_literal: true require_relative '../dtas' require_relative 'serialize' require_relative 'track' diff --git a/lib/dtas/unix_accepted.rb b/lib/dtas/unix_accepted.rb index cb7bdda..00b4e2e 100644 --- a/lib/dtas/unix_accepted.rb +++ b/lib/dtas/unix_accepted.rb @@ -1,5 +1,6 @@ # Copyright (C) 2013-2015 all contributors <dtas-all@nongnu.org> -# License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt) +# License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt) +# frozen_string_literal: true require 'socket' require 'io/wait' diff --git a/lib/dtas/unix_client.rb b/lib/dtas/unix_client.rb index 2c8ba43..bdc5524 100644 --- a/lib/dtas/unix_client.rb +++ b/lib/dtas/unix_client.rb @@ -1,5 +1,6 @@ # Copyright (C) 2013-2015 all contributors <dtas-all@nongnu.org> -# License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt) +# License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt) +# frozen_string_literal: true require_relative '../dtas' require_relative 'xs' require 'socket' diff --git a/lib/dtas/unix_server.rb b/lib/dtas/unix_server.rb index e11b0d7..e6fe869 100644 --- a/lib/dtas/unix_server.rb +++ b/lib/dtas/unix_server.rb @@ -1,5 +1,6 @@ # Copyright (C) 2013-2015 all contributors <dtas-all@nongnu.org> -# License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt) +# License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt) +# frozen_string_literal: true require 'socket' require_relative '../dtas' require_relative 'unix_accepted' diff --git a/lib/dtas/util.rb b/lib/dtas/util.rb index 8098cc5..18a2e08 100644 --- a/lib/dtas/util.rb +++ b/lib/dtas/util.rb @@ -1,5 +1,6 @@ # Copyright (C) 2013-2015 all contributors <dtas-all@nongnu.org> -# License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt) +# License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt) +# frozen_string_literal: true require_relative '../dtas' # in case we need to convert DB values to a linear scale diff --git a/lib/dtas/watchable.rb b/lib/dtas/watchable.rb index 60bade0..86ea57c 100644 --- a/lib/dtas/watchable.rb +++ b/lib/dtas/watchable.rb @@ -1,5 +1,6 @@ # Copyright (C) 2013-2015 all contributors <dtas-all@nongnu.org> -# License: GPLv3 or later <https://www.gnu.org/licenses/gpl-3.0.txt> +# License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt> +# frozen_string_literal: true begin require 'sleepy_penguin' diff --git a/lib/dtas/writable_iter.rb b/lib/dtas/writable_iter.rb index 9ddcb30..2026d83 100644 --- a/lib/dtas/writable_iter.rb +++ b/lib/dtas/writable_iter.rb @@ -1,5 +1,6 @@ # Copyright (C) 2013-2015 all contributors <dtas-all@nongnu.org> -# License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt) +# License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt) +# frozen_string_literal: true require_relative '../dtas' # used to manage writable state for -player pipes diff --git a/lib/dtas/xs.rb b/lib/dtas/xs.rb index 7b3a0c2..becbb80 100644 --- a/lib/dtas/xs.rb +++ b/lib/dtas/xs.rb @@ -1,5 +1,6 @@ # Copyright (C) 2013-2015 all contributors <dtas-all@nongnu.org> -# License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt) +# License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt) +# frozen_string_literal: true require_relative '../dtas' require 'shellwords' |