commit 7dbca2ee65ee2720723a739a6cb99930c01913bf parent 4a4848953ddf8e73901a8a595adc02d320946d65 Author: lostd <lostd@2f30.org> Date: Thu, 9 Aug 2012 14:48:19 +0000 If more files than entries ask to use only the first n files Diffstat:
M | bin/musicfix | | | 9 | +++++++-- |
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/bin/musicfix b/bin/musicfix @@ -118,9 +118,14 @@ tl = r.tracklist.select {|t| t.position} # Sanity checks if tl.length != fl.length then puts "Found #{tl.length} tracks for #{fl.length} music files." - exit if fl.length > tl.length exit if fl.length == 0 - puts "Use only the first #{fl.length} entries? [y/n] " + if fl.length < tl.length then + print "Use only the first #{fl.length} entries? [N/y] " + else + # Limit files to available tracks + fl = fl.first tl.length + print "Use only the first #{fl.length} files? [N/y] " + end res = STDIN.readline.strip exit unless res == 'y' end