id3-album.rb: fail early if no .mp3 files found

This commit is contained in:
josh committed 2026-10-22 13:21:14 -04:00
1 parent 343d1277d6
commit 99724786ca
1 file changed
+6 -1
+6 -1
View File
@@ -3,6 +3,12 @@
# Install: kid3-common
$stdout.sync = true
files = Dir.glob("*.mp3").sort
if files.empty?
$stderr.puts "No .mp3 files found"
exit 1
end
$stdout.write("Artist: ")
artist = gets.chomp
@@ -13,7 +19,6 @@ album = gets.chomp
$stdout.write("Year: ")
year = gets.chomp
files = Dir.glob("*.mp3").sort
files.each do |file|
if file =~ /^(\d+)\s*(.*)\.mp3$/
track_number, title = $1.to_i, $2