dtas-all
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 2/3] dtas-tl: add add-tail command


From: Eric Wong
Subject: [PATCH 2/3] dtas-tl: add add-tail command
Date: Mon, 9 Sep 2013 04:39:45 +0000

This adds a bunch of tracks sequentially to the end of the tracklist
---
 bin/dtas-tl | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/bin/dtas-tl b/bin/dtas-tl
index cbe1b83..31a6825 100755
--- a/bin/dtas-tl
+++ b/bin/dtas-tl
@@ -16,9 +16,21 @@ when "cat"
 when "add-all"
   ARGV.shift
   ARGV.reverse.each do |path|
-    res = c.req_ok("tl add #{path}")
+    res = c.req(%W(tl add #{path}))
     puts "#{path} #{res}"
   end
+when "add-tail"
+  ARGV.shift
+  track_ids = c.req("tl tracks")
+  track_ids = track_ids.split(/ /)
+  last_id = track_ids.pop
+  ARGV.each do |path|
+    req = %W(tl add #{path})
+    req << last_id.to_s if last_id
+    res = c.req(req)
+    puts "#{path} #{res}"
+    last_id = res if res =~ /\A\d+\z/
+  end
 else
   # act like dtas-ctl for now...
   puts c.req([ "tl", *ARGV ])
-- 
1.8.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]