commit 00cd5ee372ea3b44c10241b1f32026f34b25b754
parent e4bcf8388a5bcd2ea6df0418738b7b46aec668e5
Author: lostd <lostd@2f30.org>
Date: Thu, 8 May 2014 13:42:45 +0000
Sort tracklist before saving release file
Diffstat:
2 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/CHANGELOG b/CHANGELOG
@@ -1,3 +1,4 @@
+* Sort tracklist of output release file in filename order.
* Get artwork from the s.pixogs.com domain.
## 0.1.6
diff --git a/bin/musicfix b/bin/musicfix
@@ -393,6 +393,8 @@ fl.each do |ofname|
fn = mkname n
x = File.extname(ofname).delete('.').downcase
nfname = eval cfg['track']
+ # Add filename to track descriptor
+ trk['file'] = nfname
puts "Copy track to #{nfname}"
unless fake
FileUtils.makedirs(File.dirname nfname)
@@ -424,6 +426,9 @@ end
relfile = eval cfg['rdata']
puts "Save rdata to #{relfile}"
unless fake
+ # Sort tracklist in filename order and delete filenames
+ rel['tracklist'].sort_by! {|s| s['file']}
+ rel['tracklist'].each {|s| s.delete 'file'}
File.open(relfile, 'w') do |f|
f.puts rel.to_yaml
end