dtas 0.13.0 → 0.13.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ecfd08e9b59d26d7762e9e40709ce4e7a40ed629
4
- data.tar.gz: 6188c723ac2d87daf5e3ef9bdc0f040d8a73ff71
3
+ metadata.gz: 22d6c76202aedaacaf6ed0beb48a801f4d7f5e45
4
+ data.tar.gz: f7f54c79b652b9539f8b639c42ffb89bf041b161
5
5
  SHA512:
6
- metadata.gz: 7756d98e964479361d04d346c3e601196578c9d79967847dddcdb78e109b13237a8ab1832e13f4166adef5ae72745c90ff13927d89a94868e8c4682512282c6a
7
- data.tar.gz: 2450045f4fa44b4897abda0486ee2d0138f1d6b492d6309b3578877870973dfbdcb4e235163aac7bac376e55b1e72c63d6c4b2067fb678ee2029ac960c6e6a5b
6
+ metadata.gz: c47a803a3f398c8ceaddfe17f50ff5a23028688effca8baa3d3c0ecaf71d842b8905a91a25b4a8fb2908af00f32bf908f4850011a0bb529e8e218ccbdfcf36f8
7
+ data.tar.gz: 9fe65caf3eb58e7faefda98952d2ba44f97b10c45f5d6cc5d7a86780d105e4c5b22fc0f04fb55ff4d6ceaa03e77361caca6776e3bf8dd6235701883b52df50b8
@@ -5,7 +5,7 @@
5
5
  CONSTANT = "DTAS::VERSION"
6
6
  RVF = "lib/dtas/version.rb"
7
7
  GVF = "GIT-VERSION-FILE"
8
- DEF_VER = "v0.13.0"
8
+ DEF_VER = "v0.13.1"
9
9
  vn = DEF_VER
10
10
 
11
11
  # First see if there is a version file (included in release tarballs),
data/INSTALL CHANGED
@@ -39,10 +39,10 @@ For future upgrades of dtas (upgrades to dtas-linux will be infrequent)
39
39
 
40
40
  Grab the latest tarball from our HTTP site:
41
41
 
42
- http://dtas.80x24.org/2016/dtas-0.13.0.tar.gz
42
+ http://dtas.80x24.org/2016/dtas-0.13.1.tar.gz
43
43
 
44
- $ tar zxvf dtas-0.13.0.tar.gz
45
- $ cd dtas-0.13.0
44
+ $ tar zxvf dtas-0.13.1.tar.gz
45
+ $ cd dtas-0.13.1
46
46
  $ sudo ruby setup.rb
47
47
 
48
48
  GNU/Linux users may optionally install "io_splice" and
@@ -46,7 +46,7 @@ def mlib(db, migrate = false)
46
46
  when 'dump' # mainly for debugging
47
47
  directory = ARGV.shift || '/'
48
48
  mlib(db).dump(directory, {}, lambda do |parent, node, comments|
49
- puts "Path: #{parent[:dirname]}/#{node[:name]}"
49
+ puts "Path: #{parent[:dirname]}#{node[:name]}"
50
50
  puts "Length: #{node[:tlen]}"
51
51
  return if comments.empty?
52
52
  puts 'Comments:'
@@ -2,6 +2,7 @@
2
2
  # Copyright (C) 2013-2016 all contributors <dtas-all@nongnu.org>
3
3
  # License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt)
4
4
  # frozen_string_literal: true
5
+ # encoding: binary
5
6
  # WARNING: totally unstable API, use dtas-ctl for scripting (but the protocol
6
7
  # itself is also unstable, but better than this one probably).
7
8
  require 'dtas/unix_client'
@@ -15,6 +16,11 @@ def get_track_ids(c)
15
16
  track_ids
16
17
  end
17
18
 
19
+ def fix_enc!(str, enc)
20
+ str.force_encoding(enc)
21
+ str.force_encoding(Encoding::ASCII_8BIT) unless str.valid_encoding?
22
+ end
23
+
18
24
  def do_edit(c)
19
25
  require 'dtas/edit_client'
20
26
  require 'yaml'
@@ -25,12 +31,14 @@ def do_edit(c)
25
31
  tmp_path = tmp.path
26
32
  orig = []
27
33
  orig_idx = {}
34
+ enc = Encoding.default_external
28
35
 
29
36
  get_track_ids(c).each_slice(128) do |track_ids|
30
37
  res = c.req("tl get #{track_ids.join(' ')}")
31
38
  res = Shellwords.split(res.sub!(/\A\d+ /, ''))
32
39
  while line = res.shift
33
- line.sub!(/\A(\d+)=/, '') or abort "unexpected line=#{line.inspect}\n"
40
+ line.sub!(/\A(\d+)=/n, '') or abort "unexpected line=#{line.inspect}\n"
41
+ fix_enc!(line, enc)
34
42
  track_id = $1.to_i
35
43
  orig_idx[track_id] = orig.size
36
44
  orig << track_id
@@ -58,18 +66,19 @@ def do_edit(c)
58
66
  add = []
59
67
  # editor may rename/link a new file into place
60
68
  File.open(tmp_path) do |fp|
69
+ fp.binmode
61
70
  while line = fp.gets
62
71
  line.chomp!
63
- if line.sub!(/ =(\d+)\z/, '') # existing tracks
72
+ if line.sub!(/ =(\d+)\z/n, '') # existing tracks
64
73
  track_id = $1.to_i
65
74
  if edit_idx[track_id] # somebody copy+pasted an existing line
66
- add << [ File.expand_path(line), edit.last ]
75
+ add << [ line, edit.last ]
67
76
  else # moved line
68
77
  edit_idx[track_id] = edit.size
69
78
  edit << track_id
70
79
  end
71
80
  else # entirely new line
72
- add << [ File.expand_path(line), edit.last ]
81
+ add << [ line, edit.last ]
73
82
  end
74
83
  end
75
84
  end
@@ -88,12 +97,31 @@ def do_edit(c)
88
97
  end
89
98
 
90
99
  prev_added_id = last_after_id = nil
100
+ non_existent = []
91
101
  add.each do |path, after_id|
92
- cmd = %W(tl add #{path})
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
102
+ orig = path
103
+ path = Shellwords.split(path)[0]
104
+ path = File.expand_path(path)
105
+ unless File.exist?(path)
106
+ path = orig.dup
107
+ fix_enc!(path, enc)
108
+ path = Shellwords.split(path)[0]
109
+ path = File.expand_path(path)
110
+ end
111
+
112
+ if File.exist?(path)
113
+ cmd = %W(tl add #{path})
114
+ id = after_id == last_after_id ? prev_added_id : after_id
115
+ cmd << id.to_s if id
116
+ prev_added_id = c.req(cmd).to_i
117
+ last_after_id = after_id
118
+ else
119
+ non_existent << orig
120
+ end
121
+ end
122
+ if non_existent[0]
123
+ $stderr.puts "Failed to add #{non_existent.size} paths"
124
+ non_existent.each { |path| $stderr.puts path }
97
125
  end
98
126
  ensure
99
127
  tmp.close! if tmp
@@ -113,10 +141,15 @@ def add_after(c, argv, last_id)
113
141
  c = DTAS::UNIXClient.new
114
142
  case cmd = ARGV[0]
115
143
  when "cat"
116
- get_track_ids(c).each do |track_id|
117
- res = c.req("tl get #{track_id}")
118
- res.sub!(/\A1 /, '')
119
- print "#{res}\n"
144
+ enc = Encoding.default_external
145
+ get_track_ids(c).each_slice(128) do |track_ids|
146
+ res = c.req("tl get #{track_ids.join(' ')}")
147
+ res = Shellwords.split(res.sub!(/\A\d+ /, ''))
148
+ while line = res.shift
149
+ line.sub!(/\A(\d+)=/n, '') or abort "unexpected line=#{line.inspect}\n"
150
+ fix_enc!(line, enc)
151
+ print "#{line}\n"
152
+ end
120
153
  end
121
154
  when 'aac' # add-after-current
122
155
  ARGV.shift
@@ -430,15 +430,25 @@ def remove_entry(node)
430
430
  node_id = node[:id]
431
431
  q = { parent_id: node_id }
432
432
  nodes = @db[:nodes]
433
+ comments = @db[:comments]
434
+
435
+ # remove children, step 1
433
436
  nodes.where(q).each do |nd|
434
- next if nd[:id] == root_id
437
+ nd_id = nd[:id]
438
+ next if nd_id == root_id
435
439
  case nd[:tlen]
436
440
  when DM_DIR, DM_IGN
437
441
  remove_entry(nd)
442
+ else
443
+ comments.where(node_id: nd_id).delete
438
444
  end
439
445
  end
446
+
447
+ # remove children, step 2
440
448
  nodes.where(q).delete
441
- @db[:comments].where(node_id: node_id).delete
449
+
450
+ # finally remove ourselves
451
+ comments.where(node_id: node_id).delete
442
452
  nodes.where(id: node_id).delete
443
453
  end
444
454
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dtas
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.0
4
+ version: 0.13.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - dtas hackers
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-07 00:00:00.000000000 Z
11
+ date: 2016-01-17 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: |-
14
14
  Free Software command-line tools for audio playback, mastering, and