From cb5a016bf5e1288e6ec3afea4dc79381576b572e Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 17 Jan 2016 08:23:19 +0000 Subject: dtas-tl: shell-unescape cat output 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. --- bin/dtas-tl | 13 ++++++++----- 1 file 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 -- cgit v1.2.3-24-ge0c7