musicfix

music file renamer and tagger
git clone git://git.2f30.org/musicfix.git
Log | Files | Refs | README | LICENSE

commit 6d154a5e8b6af1e70895da4517ecb23cf73919b1
parent bad8c76f8f914e8300b5977a872e0b052908f1d5
Author: lostd <lostd@2f30.org>
Date:   Tue,  1 Jan 2013 09:53:48 +0000

Control and error checking

Diffstat:
bin/musicfix | 29++++++++++++++++++-----------
1 file changed, 18 insertions(+), 11 deletions(-)

diff --git a/bin/musicfix b/bin/musicfix @@ -139,23 +139,29 @@ else tracks = ARGV[2] || nil end -# Construct file list -fl = Dir['*'].select {|f| File.extname(f).match /mp3|ogg|mpc|flac|wv/i}.sort -if fl.empty? then - puts 'No music files found!' - exit +unless cmd == 'dump' then + # Construct file list + fl = Dir['*'].select {|f| File.extname(f).match /mp3|ogg|mpc|flac|wv/i}.sort + if fl.empty? then + puts 'No music files found!' + exit + end + # Output file list + puts 'Files to process:' + puts fl end -# Output file list -puts 'Files to process:' -puts fl # Initialize release info -rel = {} if cmd == 'load' then # Load release data from file - puts "Loading release data..." - rel = YAML.load File.open(relfile, 'r') + if File.exists? relfile then + puts "Loading release data..." + rel = YAML.load File.open(relfile, 'r') + else + puts "Release file #{relfile} not found." + exit + end else # Get release data from Discogs puts "Geting release data..." @@ -171,6 +177,7 @@ else tl = tl.select {|t| pl.include? t.position} end # Gather release-wide data + rel = {} rel['artist'] = mkartist r.artists rel['album'] = r.title rel['year'] = r.released