about summary refs log tree commit homepage
path: root/bin
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2016-01-17 08:23:19 +0000
committerEric Wong <e@80x24.org>2016-01-17 08:27:47 +0000
commitcb5a016bf5e1288e6ec3afea4dc79381576b572e (patch)
treeb50fcacfaca9068885bdcb36220163728e167a1a /bin
parent88687f5a271f59cd842ad36cf6e20ea64c86f45c (diff)
downloaddtas-cb5a016bf5e1288e6ec3afea4dc79381576b572e.tar.gz
We do the same with edit and this makes tracklists look nicer with
non-7-bit-ASCII characters.  While we're at it, use each_slice to
request more info from the tracklist to reduce syscalls on both
ends.
Diffstat (limited to 'bin')
-rwxr-xr-xbin/dtas-tl13
1 files changed, 8 insertions, 5 deletions
diff --git a/bin/dtas-tl b/bin/dtas-tl
index 4d9b6fe..7333a06 100755
--- a/bin/dtas-tl
+++ b/bin/dtas-tl
@@ -142,11 +142,14 @@ c = DTAS::UNIXClient.new
 case cmd = ARGV[0]
 when "cat"
   enc = Encoding.default_external
-  get_track_ids(c).each do |track_id|
-    res = c.req("tl get #{track_id}")
-    res.sub!(/\A1 /n, '')
-    fix_enc!(res, enc)
-    print "#{res}\n"
+  get_track_ids(c).each_slice(128) do |track_ids|
+    res = c.req("tl get #{track_ids.join(' ')}")
+    res = Shellwords.split(res.sub!(/\A\d+ /, ''))
+    while line = res.shift
+      line.sub!(/\A(\d+)=/n, '') or abort "unexpected line=#{line.inspect}\n"
+      fix_enc!(line, enc)
+      print "#{line}\n"
+    end
   end
 when 'aac' # add-after-current
   ARGV.shift