commit b2f2bb22e4c2a4a730ac5defe9752af6850d1a12
parent 98fd9214ac4aabd9bb41a9435b73fc78a514f82f
Author: lostd <lostd@2f30.org>
Date: Sun, 6 Oct 2013 21:22:46 +0000
More format abbreviations, use a single gsub
Diffstat:
1 file changed, 24 insertions(+), 10 deletions(-)
diff --git a/bin/musicfix b/bin/musicfix
@@ -111,16 +111,30 @@ end
# Shorten certain common words that appear in format strings
def mkshort n
- n = n.gsub "Mini-Album", "MiniLP"
- n = n.gsub '12"', '12inch'
- n = n.gsub '7"', '7inch'
- n = n.gsub "Cassette", "Cass"
- n = n.gsub "Limited Edition", "Ltd"
- n = n.gsub "Compilation", "Comp"
- n = n.gsub "Reissue", "RE"
- n = n.gsub "Enhanced", "Enh"
- n = n.gsub "Unofficial Release", "Unofficial"
- n = n.gsub "Single Sided", "SSided"
+ ft = {
+ 'Cassette' => 'Cass',
+ '12"' => '12inch',
+ '7"' => '7inch',
+ 'Mini-Album' => 'MiniAlbum',
+ 'Maxi-Single' => 'Maxi',
+ 'Picture Disc' => 'Pic',
+ 'Reissue' => 'RE',
+ 'Remaster' => 'RM',
+ 'Repress' => 'RP',
+ 'Mispress' => 'MP',
+ 'Test Pressing' => 'TP',
+ 'Enhanced' => 'Enh',
+ 'Digipak ' => 'Dig',
+ 'Box Set' => 'Box',
+ 'Limited Edition' => 'Ltd',
+ 'Club Edition' => 'Club',
+ 'Compilation' => 'Comp',
+ 'Unofficial Release' => 'Unofficial',
+ 'Single Sided' => 'S/Sided',
+ }
+ # Note that prefix substitution is broken
+ ftre = /(#{ft.keys.join('|')})/
+ n.gsub(ftre, ft)
end
# Parse command line