dtas 0.12.1 → 0.13.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +3 -2
- data/Documentation/.gitignore +2 -2
- data/Documentation/GNUmakefile +2 -2
- data/Documentation/dtas-archive.txt +8 -7
- data/Documentation/dtas-console.txt +6 -3
- data/Documentation/dtas-ctl.txt +2 -2
- data/Documentation/dtas-cueedit.txt +2 -2
- data/Documentation/dtas-enq.txt +2 -2
- data/Documentation/dtas-env.txt +2 -2
- data/Documentation/dtas-msinkctl.txt +2 -2
- data/Documentation/dtas-player.txt +2 -2
- data/Documentation/dtas-player_effects.txt +2 -2
- data/Documentation/dtas-player_protocol.txt +3 -3
- data/Documentation/dtas-player_sink_examples.txt +2 -4
- data/Documentation/dtas-sinkedit.txt +2 -2
- data/Documentation/dtas-sourceedit.txt +2 -2
- data/Documentation/dtas-splitfx.txt +3 -24
- data/Documentation/dtas-tl.txt +7 -6
- data/Documentation/dtas-xdelay.txt +2 -2
- data/Documentation/update-footer.rb +4 -3
- data/GIT-VERSION-GEN +6 -5
- data/GNUmakefile +2 -2
- data/HACKING +2 -2
- data/INSTALL +9 -10
- data/README +5 -5
- data/Rakefile +75 -15
- data/TODO +2 -2
- data/bin/dtas-archive +3 -2
- data/bin/dtas-console +63 -22
- data/bin/dtas-ctl +3 -2
- data/bin/dtas-cueedit +3 -2
- data/bin/dtas-enq +3 -2
- data/bin/dtas-mlib +25 -3
- data/bin/dtas-msinkctl +3 -2
- data/bin/dtas-partstats +3 -2
- data/bin/dtas-player +3 -2
- data/bin/dtas-readahead +6 -5
- data/bin/dtas-sinkedit +3 -2
- data/bin/dtas-sourceedit +3 -2
- data/bin/dtas-splitfx +3 -2
- data/bin/dtas-tl +29 -16
- data/bin/dtas-xdelay +3 -2
- data/dtas-linux.gemspec +3 -3
- data/dtas-mpris.gemspec +4 -4
- data/dtas.gemspec +3 -2
- data/lib/dtas.rb +14 -7
- data/lib/dtas/buffer.rb +3 -2
- data/lib/dtas/buffer/read_write.rb +4 -3
- data/lib/dtas/buffer/splice.rb +3 -2
- data/lib/dtas/command.rb +3 -2
- data/lib/dtas/compat_onenine.rb +2 -2
- data/lib/dtas/cue_index.rb +4 -3
- data/lib/dtas/disclaimer.rb +3 -2
- data/lib/dtas/edit_client.rb +4 -3
- data/lib/dtas/fadefx.rb +4 -3
- data/lib/dtas/format.rb +3 -13
- data/lib/dtas/mlib.rb +19 -10
- data/lib/dtas/mlib/migrations/0001_initial.rb +2 -2
- data/lib/dtas/nonblock.rb +2 -2
- data/lib/dtas/parse_freq.rb +4 -4
- data/lib/dtas/parse_time.rb +4 -3
- data/lib/dtas/partstats.rb +6 -5
- data/lib/dtas/pipe.rb +3 -2
- data/lib/dtas/player.rb +4 -3
- data/lib/dtas/player/client_handler.rb +21 -9
- data/lib/dtas/process.rb +5 -4
- data/lib/dtas/replaygain.rb +7 -6
- data/lib/dtas/rg_state.rb +38 -14
- data/lib/dtas/serialize.rb +3 -2
- data/lib/dtas/sigevent.rb +3 -2
- data/lib/dtas/sigevent/efd.rb +2 -2
- data/lib/dtas/sigevent/pipe.rb +4 -3
- data/lib/dtas/sink.rb +3 -2
- data/lib/dtas/source.rb +3 -2
- data/lib/dtas/source/av.rb +3 -2
- data/lib/dtas/source/av_ff_common.rb +6 -5
- data/lib/dtas/source/cmd.rb +3 -2
- data/lib/dtas/source/common.rb +2 -2
- data/lib/dtas/source/ff.rb +3 -2
- data/lib/dtas/source/file.rb +7 -6
- data/lib/dtas/source/mp3gain.rb +3 -2
- data/lib/dtas/source/sox.rb +7 -5
- data/lib/dtas/source/splitfx.rb +8 -4
- data/lib/dtas/spawn_fix.rb +2 -2
- data/lib/dtas/splitfx.rb +5 -4
- data/lib/dtas/state_file.rb +3 -2
- data/lib/dtas/tfx.rb +6 -5
- data/lib/dtas/track.rb +4 -3
- data/lib/dtas/tracklist.rb +8 -8
- data/lib/dtas/unix_accepted.rb +3 -2
- data/lib/dtas/unix_client.rb +3 -2
- data/lib/dtas/unix_server.rb +3 -2
- data/lib/dtas/util.rb +3 -2
- data/lib/dtas/watchable.rb +10 -8
- data/lib/dtas/writable_iter.rb +3 -2
- data/lib/dtas/xs.rb +3 -2
- data/perl/dtas-graph +2 -2
- data/test/covshow.rb +3 -2
- data/test/helper.rb +3 -2
- data/test/player_integration.rb +3 -2
- data/test/test_buffer.rb +3 -2
- data/test/test_env.rb +3 -2
- data/test/test_fadefx.rb +3 -2
- data/test/test_format.rb +3 -2
- data/test/test_format_change.rb +3 -2
- data/test/test_mlib.rb +3 -2
- data/test/test_parse_freq.rb +3 -3
- data/test/test_player.rb +3 -2
- data/test/test_player_client_handler.rb +4 -3
- data/test/test_player_integration.rb +8 -2
- data/test/test_process.rb +5 -4
- data/test/test_rg_integration.rb +3 -2
- data/test/test_rg_state.rb +3 -2
- data/test/test_sink.rb +3 -2
- data/test/test_sink_pipe_size.rb +3 -2
- data/test/test_sink_tee_integration.rb +3 -2
- data/test/test_source_av.rb +6 -5
- data/test/test_source_sox.rb +7 -6
- data/test/test_splitfx.rb +3 -2
- data/test/test_tfx.rb +3 -2
- data/test/test_tracklist.rb +3 -2
- data/test/test_unixserver.rb +3 -2
- data/test/test_util.rb +3 -2
- metadata +3 -3
data/bin/dtas-tl
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
# Copyright (C) 2013-
|
3
|
-
# License:
|
4
|
-
#
|
2
|
+
# Copyright (C) 2013-2016 all contributors <dtas-all@nongnu.org>
|
3
|
+
# License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt)
|
4
|
+
# frozen_string_literal: true
|
5
5
|
# WARNING: totally unstable API, use dtas-ctl for scripting (but the protocol
|
6
6
|
# itself is also unstable, but better than this one probably).
|
7
7
|
require 'dtas/unix_client'
|
@@ -10,7 +10,7 @@
|
|
10
10
|
def get_track_ids(c)
|
11
11
|
track_ids = c.req("tl tracks")
|
12
12
|
# we could get more, but SEQPACKET limits size...
|
13
|
-
track_ids = track_ids.split(
|
13
|
+
track_ids = track_ids.split(' ')
|
14
14
|
track_ids.shift
|
15
15
|
track_ids
|
16
16
|
end
|
@@ -86,15 +86,30 @@ def do_edit(c)
|
|
86
86
|
orig.each do |track_id|
|
87
87
|
edit_idx[track_id] or c.req("tl remove #{track_id}")
|
88
88
|
end
|
89
|
-
|
89
|
+
|
90
|
+
prev_added_id = last_after_id = nil
|
91
|
+
add.each do |path, after_id|
|
90
92
|
cmd = %W(tl add #{path})
|
91
|
-
|
92
|
-
|
93
|
+
id = after_id == last_after_id ? prev_added_id : after_id
|
94
|
+
cmd << id.to_s if id
|
95
|
+
prev_added_id = c.req(cmd).to_i
|
96
|
+
last_after_id = after_id
|
93
97
|
end
|
94
98
|
ensure
|
95
99
|
tmp.close! if tmp
|
96
100
|
end
|
97
101
|
|
102
|
+
def add_after(c, argv, last_id)
|
103
|
+
argv.each do |path|
|
104
|
+
path = File.expand_path(path)
|
105
|
+
req = %W(tl add #{path})
|
106
|
+
req << last_id.to_s if last_id
|
107
|
+
res = c.req(req)
|
108
|
+
print "#{path} #{res}\n"
|
109
|
+
last_id = res if res =~ /\A\d+\z/
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
98
113
|
c = DTAS::UNIXClient.new
|
99
114
|
case cmd = ARGV[0]
|
100
115
|
when "cat"
|
@@ -103,9 +118,14 @@ def do_edit(c)
|
|
103
118
|
res.sub!(/\A1 /, '')
|
104
119
|
print "#{res}\n"
|
105
120
|
end
|
121
|
+
when 'aac' # add-after-current
|
122
|
+
ARGV.shift
|
123
|
+
rv = c.req(%w(tl current-id))
|
124
|
+
last_id = rv =~ %r{\A\d+\z} ? rv.to_i : nil
|
125
|
+
add_after(c, ARGV, last_id)
|
106
126
|
when "addhead"
|
107
127
|
ARGV.shift
|
108
|
-
ARGV.
|
128
|
+
ARGV.reverse_each do |path|
|
109
129
|
path = File.expand_path(path)
|
110
130
|
res = c.req(%W(tl add #{path}))
|
111
131
|
print "#{path} #{res}\n"
|
@@ -114,14 +134,7 @@ def do_edit(c)
|
|
114
134
|
ARGV.shift
|
115
135
|
track_ids = get_track_ids(c)
|
116
136
|
last_id = track_ids.pop
|
117
|
-
ARGV
|
118
|
-
path = File.expand_path(path)
|
119
|
-
req = %W(tl add #{path})
|
120
|
-
req << last_id.to_s if last_id
|
121
|
-
res = c.req(req)
|
122
|
-
print "#{path} #{res}\n"
|
123
|
-
last_id = res if res =~ /\A\d+\z/
|
124
|
-
end
|
137
|
+
add_after(c, ARGV, last_id)
|
125
138
|
when "reto"
|
126
139
|
fixed = ARGV.delete("-F")
|
127
140
|
ignorecase = ARGV.delete("-i")
|
data/bin/dtas-xdelay
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
# Copyright (C) 2013-
|
3
|
-
# License:
|
2
|
+
# Copyright (C) 2013-2016 all contributors <dtas-all@nongnu.org>
|
3
|
+
# License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt)
|
4
|
+
# frozen_string_literal: true
|
4
5
|
USAGE = "Usage: #$0 [-x FREQ] [-l] /dev/fd/LO /dev/fd/HI DELAY [DELAY ...]"
|
5
6
|
require 'optparse'
|
6
7
|
dryrun = false
|
data/dtas-linux.gemspec
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
# Copyright (C) 2013-
|
2
|
-
# License:
|
1
|
+
# Copyright (C) 2013-2016 all contributors <dtas-all@nongnu.org>
|
2
|
+
# License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt)
|
3
3
|
#
|
4
4
|
# this just declares dependencies to make gem installation a little easier
|
5
5
|
# for Linux users
|
@@ -16,5 +16,5 @@
|
|
16
16
|
s.add_dependency(%q<dtas>)
|
17
17
|
s.add_dependency(%q<io_splice>, '~> 4')
|
18
18
|
s.add_dependency(%q<sleepy_penguin>, '~> 3')
|
19
|
-
s.licenses =
|
19
|
+
s.licenses = 'GPL-3.0+'
|
20
20
|
end
|
data/dtas-mpris.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
# Copyright (C) 2013-
|
2
|
-
# License:
|
3
|
-
# This is
|
1
|
+
# Copyright (C) 2013-2016 all contributors <dtas-all@nongnu.org>
|
2
|
+
# License: GPL-2.0+ or later <http://www.gnu.org/licenses/gpl-2.0.txt>
|
3
|
+
# This is GPL-2.0+ instead of GPL-3.0+ because ruby-dbus is LGPL-2.1 (only)
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = %q{dtas-mpris}
|
6
6
|
s.version = '0.0.0'
|
@@ -14,5 +14,5 @@
|
|
14
14
|
s.homepage = 'http://dtas.80x24.org/'
|
15
15
|
s.add_dependency(%q<dtas>)
|
16
16
|
s.add_dependency(%q<ruby-dbus>)
|
17
|
-
s.licenses =
|
17
|
+
s.licenses = 'GPL-2.0+'
|
18
18
|
end
|
data/dtas.gemspec
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
# Copyright (C) 2013-
|
2
|
-
# License:
|
1
|
+
# Copyright (C) 2013-2016 all contributors <dtas-all@nongnu.org>
|
2
|
+
# License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt)
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
manifest = File.read('.gem-manifest').split(/\n/)
|
5
5
|
s.name = %q{dtas}
|
@@ -12,4 +12,5 @@
|
|
12
12
|
s.files = manifest
|
13
13
|
s.homepage = 'http://dtas.80x24.org/'
|
14
14
|
s.licenses = "GPL-3.0+"
|
15
|
+
s.required_ruby_version = '>= 1.9.3'
|
15
16
|
end
|
data/lib/dtas.rb
CHANGED
@@ -1,23 +1,30 @@
|
|
1
|
-
# Copyright (C) 2013-
|
2
|
-
# License:
|
3
|
-
|
1
|
+
# Copyright (C) 2013-2016 all contributors <dtas-all@nongnu.org>
|
2
|
+
# License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt)
|
3
|
+
# frozen_string_literal: true
|
4
|
+
|
5
|
+
# DTAS currently exposes no public API for Ruby programmers.
|
6
|
+
# See http://dtas.80x24.org/ for more info.
|
7
|
+
module DTAS
|
8
|
+
|
4
9
|
# try to use the monotonic clock in Ruby >= 2.1, it is immune to clock
|
5
10
|
# offset adjustments and generates less garbage (Float vs Time object)
|
11
|
+
# :stopdoc:
|
6
12
|
begin
|
7
13
|
::Process.clock_gettime(::Process::CLOCK_MONOTONIC)
|
8
|
-
def self.now
|
14
|
+
def self.now # :nodoc:
|
9
15
|
::Process.clock_gettime(::Process::CLOCK_MONOTONIC)
|
10
16
|
end
|
11
17
|
rescue NameError, NoMethodError
|
12
|
-
def self.now #
|
13
|
-
Time.now.to_f
|
18
|
+
def self.now # :nodoc:
|
19
|
+
Time.now.to_f # Ruby <= 2.0
|
14
20
|
end
|
15
21
|
end
|
16
22
|
|
17
23
|
@null = nil
|
18
|
-
def self.null
|
24
|
+
def self.null # :nodoc:
|
19
25
|
@null ||= File.open('/dev/null', 'r+')
|
20
26
|
end
|
27
|
+
# :startdoc:
|
21
28
|
end
|
22
29
|
|
23
30
|
require_relative 'dtas/compat_onenine'
|
data/lib/dtas/buffer.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
|
-
# Copyright (C) 2013-
|
2
|
-
# License:
|
1
|
+
# Copyright (C) 2013-2016 all contributors <dtas-all@nongnu.org>
|
2
|
+
# License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt)
|
3
|
+
# frozen_string_literal: true
|
3
4
|
require 'io/wait'
|
4
5
|
require_relative '../dtas'
|
5
6
|
|
@@ -1,5 +1,6 @@
|
|
1
|
-
# Copyright (C) 2013-
|
2
|
-
# License:
|
1
|
+
# Copyright (C) 2013-2016 all contributors <dtas-all@nongnu.org>
|
2
|
+
# License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt)
|
3
|
+
# frozen_string_literal: true
|
3
4
|
require 'io/nonblock'
|
4
5
|
require_relative '../../dtas'
|
5
6
|
require_relative '../pipe'
|
@@ -12,7 +13,7 @@ module DTAS::Buffer::ReadWrite # :nodoc:
|
|
12
13
|
attr_accessor :buffer_size
|
13
14
|
|
14
15
|
def _rbuf
|
15
|
-
Thread.current[:dtas_pbuf] ||=
|
16
|
+
Thread.current[:dtas_pbuf] ||= ''.b
|
16
17
|
end
|
17
18
|
|
18
19
|
# be sure to only call this with nil when all writers to @wr are done
|
data/lib/dtas/buffer/splice.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
|
-
# Copyright (C) 2013-
|
2
|
-
# License:
|
1
|
+
# Copyright (C) 2013-2016 all contributors <dtas-all@nongnu.org>
|
2
|
+
# License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt)
|
3
|
+
# frozen_string_literal: true
|
3
4
|
require 'io/nonblock'
|
4
5
|
require 'io/splice'
|
5
6
|
require_relative '../../dtas'
|
data/lib/dtas/command.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
|
-
# Copyright (C) 2013-
|
2
|
-
# License:
|
1
|
+
# Copyright (C) 2013-2016 all contributors <dtas-all@nongnu.org>
|
2
|
+
# License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt)
|
3
|
+
# frozen_string_literal: true
|
3
4
|
require_relative 'serialize'
|
4
5
|
require 'shellwords'
|
5
6
|
|
data/lib/dtas/compat_onenine.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
# Copyright (C) 2013-
|
2
|
-
# License:
|
1
|
+
# Copyright (C) 2013-2016 all contributors <dtas-all@nongnu.org>
|
2
|
+
# License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt)
|
3
3
|
|
4
4
|
# Make Ruby 1.9.3 look like Ruby 2.0.0 to us
|
5
5
|
# This exists for Debian wheezy users using the stock Ruby 1.9.3 install.
|
data/lib/dtas/cue_index.rb
CHANGED
@@ -1,9 +1,10 @@
|
|
1
|
-
# Copyright (C) 2013-
|
2
|
-
# License:
|
1
|
+
# Copyright (C) 2013-2016 all contributors <dtas-all@nongnu.org>
|
2
|
+
# License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt)
|
3
|
+
# frozen_string_literal: true
|
3
4
|
require_relative '../dtas'
|
4
5
|
|
5
6
|
# embedded CUE sheet representation for -player
|
6
|
-
class DTAS::CueIndex
|
7
|
+
class DTAS::CueIndex # :nodoc:
|
7
8
|
attr_reader :offset
|
8
9
|
attr_reader :index
|
9
10
|
|
data/lib/dtas/disclaimer.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# :enddoc:
|
2
|
-
# Copyright (C) 2013-
|
3
|
-
# License:
|
2
|
+
# Copyright (C) 2013-2016 all contributors <dtas-all@nongnu.org>
|
3
|
+
# License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt)
|
4
|
+
# frozen_string_literal: true
|
4
5
|
DTAS_PROGNAME = File.basename($0)
|
5
6
|
DTAS_DISCLAIMER = <<EOF
|
6
7
|
# WARNING!
|
data/lib/dtas/edit_client.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
|
-
# Copyright (C) 2013-
|
2
|
-
# License:
|
1
|
+
# Copyright (C) 2013-2016 all contributors <dtas-all@nongnu.org>
|
2
|
+
# License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt)
|
3
|
+
# frozen_string_literal: true
|
3
4
|
require 'tempfile'
|
4
5
|
require 'yaml'
|
5
6
|
require_relative 'unix_client'
|
@@ -13,7 +14,7 @@ def editor
|
|
13
14
|
v.empty? and next
|
14
15
|
return v
|
15
16
|
end
|
16
|
-
|
17
|
+
'vi'.freeze
|
17
18
|
end
|
18
19
|
|
19
20
|
def client_socket
|
data/lib/dtas/fadefx.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
|
-
# Copyright (C) 2013-
|
2
|
-
# License:
|
1
|
+
# Copyright (C) 2013-2016 all contributors <dtas-all@nongnu.org>
|
2
|
+
# License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt)
|
3
|
+
# frozen_string_literal: true
|
3
4
|
require_relative '../dtas'
|
4
5
|
require_relative 'parse_time'
|
5
6
|
require_relative 'xs'
|
@@ -94,7 +95,7 @@ def fade_in_next_fx(format, tbeg, tlen)
|
|
94
95
|
def parse!(str)
|
95
96
|
return nil if str.empty?
|
96
97
|
type = "t"
|
97
|
-
str.sub!(/\A([a-z])/, "") and type = $1
|
98
|
+
str.sub!(/\A([a-z])/, "") and type = $1.freeze
|
98
99
|
F.new(type, parse_time(str))
|
99
100
|
end
|
100
101
|
end
|
data/lib/dtas/format.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
|
-
# Copyright (C) 2013-
|
2
|
-
# License:
|
1
|
+
# Copyright (C) 2013-2016 all contributors <dtas-all@nongnu.org>
|
2
|
+
# License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt)
|
3
|
+
# frozen_string_literal: true
|
3
4
|
require_relative '../dtas'
|
4
5
|
require_relative 'process'
|
5
6
|
require_relative 'serialize'
|
@@ -86,16 +87,6 @@ def endian2
|
|
86
87
|
end
|
87
88
|
end
|
88
89
|
|
89
|
-
# returns 1 or 0 depending on endianess
|
90
|
-
def endian_opusenc
|
91
|
-
case e = @endian || NATIVE_ENDIAN
|
92
|
-
when "big" then "1"
|
93
|
-
when "little" then "0"
|
94
|
-
else
|
95
|
-
raise"unsupported endian=#{e}"
|
96
|
-
end
|
97
|
-
end
|
98
|
-
|
99
90
|
def to_eca_arg
|
100
91
|
%W(-f #{@type}_#{endian2},#@channels,#@rate)
|
101
92
|
end
|
@@ -137,7 +128,6 @@ def to_env
|
|
137
128
|
"SOXFMT" => to_sox_arg.join(' '),
|
138
129
|
"ECAFMT" => to_eca_arg.join(' '),
|
139
130
|
"ENDIAN2" => endian2,
|
140
|
-
"ENDIAN_OPUSENC" => endian_opusenc,
|
141
131
|
}
|
142
132
|
begin # don't set these if we can't get them, SOX_FILETYPE may be enough
|
143
133
|
rv["BITS_PER_SAMPLE"] = bits_per_sample.to_s
|
data/lib/dtas/mlib.rb
CHANGED
@@ -1,13 +1,14 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
# Copyright (C) 2015 all contributors <dtas-all@nongnu.org>
|
3
|
-
# License:
|
4
|
-
|
2
|
+
# Copyright (C) 2015-2016 all contributors <dtas-all@nongnu.org>
|
3
|
+
# License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt)
|
4
|
+
# frozen_string_literal: true
|
5
|
+
#
|
5
6
|
require_relative '../dtas'
|
6
7
|
require_relative 'process'
|
7
8
|
require 'socket'
|
8
9
|
|
9
10
|
# For the DTAS Music Library, based on what MPD uses.
|
10
|
-
class DTAS::Mlib
|
11
|
+
class DTAS::Mlib # :nodoc:
|
11
12
|
attr_accessor :follow_outside_symlinks
|
12
13
|
attr_accessor :follow_inside_symlinks
|
13
14
|
attr_accessor :tags
|
@@ -40,6 +41,8 @@ def initialize(db)
|
|
40
41
|
db.transaction_mode = :immediate
|
41
42
|
db.synchronous = :off
|
42
43
|
db.case_sensitive_like = false
|
44
|
+
else
|
45
|
+
warn 'non-SQLite databases may not work in the future'
|
43
46
|
end
|
44
47
|
@db = db
|
45
48
|
@pwd = nil
|
@@ -97,9 +100,9 @@ def worker_work(job)
|
|
97
100
|
return ignore(job) unless String === buf
|
98
101
|
|
99
102
|
# no, we don't support comments with newlines in them
|
100
|
-
buf = buf.split("\n"
|
103
|
+
buf = buf.split("\n")
|
101
104
|
while line = buf.shift
|
102
|
-
tag, value = line.split('='
|
105
|
+
tag, value = line.split('=', 2)
|
103
106
|
tag && value or next
|
104
107
|
tag.downcase!
|
105
108
|
tag_id = @tag_map[tag] or next
|
@@ -213,7 +216,12 @@ def root_node
|
|
213
216
|
parent_id: 1, # self
|
214
217
|
name: '',
|
215
218
|
}
|
216
|
-
node = @db[:nodes][q]
|
219
|
+
node = @db[:nodes][q]
|
220
|
+
if node
|
221
|
+
node[:dirname] = ''
|
222
|
+
@root_node = node
|
223
|
+
return node
|
224
|
+
end
|
217
225
|
begin
|
218
226
|
q[:tlen] = DM_DIR
|
219
227
|
q[:id] = @db[:nodes].insert(q)
|
@@ -378,10 +386,10 @@ def stats
|
|
378
386
|
|
379
387
|
def path_of(node, cache)
|
380
388
|
base = node[:name]
|
381
|
-
return '/' if base == ''
|
389
|
+
return '/' if base == '' # root_node
|
382
390
|
parent_id = node[:parent_id]
|
383
391
|
base += '/' unless node[:tlen] >= 0
|
384
|
-
ppath = cache[parent_id] and return "#{ppath}
|
392
|
+
ppath = cache[parent_id] and return "#{ppath}/#{base}"
|
385
393
|
parts = []
|
386
394
|
begin
|
387
395
|
node = @db[:nodes][id: node[:parent_id]]
|
@@ -389,8 +397,9 @@ def path_of(node, cache)
|
|
389
397
|
parts.unshift node[:name]
|
390
398
|
end while true
|
391
399
|
parts.unshift('')
|
392
|
-
parts << base
|
393
400
|
cache[parent_id] = parts.join('/')
|
401
|
+
parts << base
|
402
|
+
parts.join('/').freeze
|
394
403
|
end
|
395
404
|
|
396
405
|
def emit_recurse(node, cache, cb)
|
@@ -1,5 +1,5 @@
|
|
1
|
-
# Copyright (C) 2015 all contributors <dtas-all@nongnu.org>
|
2
|
-
# License:
|
1
|
+
# Copyright (C) 2015-2016 all contributors <dtas-all@nongnu.org>
|
2
|
+
# License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt)
|
3
3
|
|
4
4
|
Sequel.migration do
|
5
5
|
up do
|
data/lib/dtas/nonblock.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
# Copyright (C) 2015 all contributors <dtas-all@nongnu.org>
|
1
|
+
# Copyright (C) 2015-2016 all contributors <dtas-all@nongnu.org>
|
2
2
|
# License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt)
|
3
3
|
|
4
|
-
class DTAS::Nonblock < IO
|
4
|
+
class DTAS::Nonblock < IO # :nodoc:
|
5
5
|
if RUBY_VERSION.to_f <= 2.0
|
6
6
|
EX = {}.freeze
|
7
7
|
def read_nonblock(len, buf = nil, opts = EX)
|
data/lib/dtas/parse_freq.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
# Copyright (C) 2015 all contributors <dtas-all@nongnu.org>
|
2
|
-
# License:
|
3
|
-
|
1
|
+
# Copyright (C) 2015-2016 all contributors <dtas-all@nongnu.org>
|
2
|
+
# License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt)
|
3
|
+
# frozen_string_literal: true
|
4
4
|
require_relative '../dtas'
|
5
|
-
module DTAS::ParseFreq
|
5
|
+
module DTAS::ParseFreq # :nodoc:
|
6
6
|
|
7
7
|
# may return a negative frequency meaning lowpass
|
8
8
|
def parse_freq(val, round = true)
|