From 90dcf561fd22c8a53c03d97292f86a82e74ca4a3 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Tue, 15 Dec 2015 01:07:28 +0000 Subject: Revert "dtas-tl: simplify existing addtail/addhead while we're at it" This partially reverts commit 0dde5917fb5135ee3601383c29ffc0490071ea9d. This fixes "addtail" on an empty tracklist and preserves sequential ordering of track IDs, which might make sense for usability. --- bin/dtas-tl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bin/dtas-tl b/bin/dtas-tl index 34fba81..30821a1 100755 --- a/bin/dtas-tl +++ b/bin/dtas-tl @@ -114,11 +114,13 @@ when "addtail" ARGV.shift track_ids = get_track_ids(c) last_id = track_ids.pop - ARGV.reverse_each do |path| + ARGV.each do |path| path = File.expand_path(path) - req = %W(tl add #{path} #{last_id}) + req = %W(tl add #{path}) + req << last_id.to_s if last_id res = c.req(req) print "#{path} #{res}\n" + last_id = res if res =~ /\A\d+\z/ end when "reto" fixed = ARGV.delete("-F") -- cgit v1.2.3-24-ge0c7