id3-album.rb: fail early if no .mp3 files found
This commit is contained in:
1 parent
343d1277d6
commit
99724786ca
1 file changed
+6
-1
+6
-1
@@ -3,6 +3,12 @@
|
|||||||
# Install: kid3-common
|
# Install: kid3-common
|
||||||
|
|
||||||
$stdout.sync = true
|
$stdout.sync = true
|
||||||
|
files = Dir.glob("*.mp3").sort
|
||||||
|
|
||||||
|
if files.empty?
|
||||||
|
$stderr.puts "No .mp3 files found"
|
||||||
|
exit 1
|
||||||
|
end
|
||||||
|
|
||||||
$stdout.write("Artist: ")
|
$stdout.write("Artist: ")
|
||||||
artist = gets.chomp
|
artist = gets.chomp
|
||||||
@@ -13,7 +19,6 @@ album = gets.chomp
|
|||||||
$stdout.write("Year: ")
|
$stdout.write("Year: ")
|
||||||
year = gets.chomp
|
year = gets.chomp
|
||||||
|
|
||||||
files = Dir.glob("*.mp3").sort
|
|
||||||
files.each do |file|
|
files.each do |file|
|
||||||
if file =~ /^(\d+)\s*(.*)\.mp3$/
|
if file =~ /^(\d+)\s*(.*)\.mp3$/
|
||||||
track_number, title = $1.to_i, $2
|
track_number, title = $1.to_i, $2
|
||||||
|
|||||||
Reference in new issue
Block a user