musicfix

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

commit 11758042265e1f44dcc0843a4dfe2cd1d8d9dd5e
parent 109ecf8b6fdd4dd976d6d12cb5b43a62dbc8c900
Author: lostd <lostd@2f30.org>
Date:   Wed,  8 Nov 2017 14:21:46 +0200

Remove tracks filtering

Can always dump to release.yaml as a template, edit to remove tracks,
and load that instead.

Diffstat:
MCHANGELOG | 2++
MREADME | 9+--------
MTODO | 1-
Mbin/musicfix | 39+--------------------------------------
4 files changed, 4 insertions(+), 47 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG @@ -1,3 +1,5 @@ +* Removed tracks filtering + ## 0.2.1 * Updated license and license identifier in gem. diff --git a/README b/README @@ -17,7 +17,7 @@ to the program. Enjoy! # Usage $ musicfix - Usage: musicfix [fake] relid [tracks] + Usage: musicfix [fake] relid musicfix [fake] dump relid [relfile] musicfix [fake] load [relfile] musicfix [fake] tags [relfile] @@ -26,13 +26,6 @@ The common path is to just give the release id: $ musicfix 1234 -More sophisticated track selection can be performed by providing -a tracks selector command line argument of the form: - - "1--3,5,8" - "A2--A4,B3" - "1-8--1-9,1-10--1-11" - Alternatively, YAML metadata files can be used (`release.yaml` by default) in order to dump information from Discogs.com and/or load the information from file. This way you can generate a base release file, edit to diff --git a/TODO b/TODO @@ -7,4 +7,3 @@ # Bugs * When using the release data, files are assumed to be in order. - * I don't use filtering that much, maybe remove it? diff --git a/bin/musicfix b/bin/musicfix @@ -88,26 +88,6 @@ def getimages rel imgs end -# Construct position list from tracks filter -# The string "1--3,5,8" becomes ["1", "2", "3", "5", "8"] -# The string "A2--A4,B3" becomes ["A2", "A3", "A4", "B3"] -# The string "1-8--1-9,1-10--1-11" becomes ["1-8", "1-9", "1-10", "1-11"] -# Returns nil on error -def mkposlist tracks - pl = tracks.split(",").map do |r| - r = r.split("--") - return nil if r.include? "" - r = case r.length - when 1 then r - when 2 then (r[0] .. r[1]).map {|i| i} - else return nil - end - return nil if r.empty? - r - end - pl.flatten -end - # Formats we care about and their abbreviations # http://www.discogs.com/search/#more_facets_format_exact # Ignore "Vinyl" in favor of "LP"/"EP"/'7"'/'10"'/'12"' descriptions @@ -184,7 +164,7 @@ end # Parse command line usage = '' -usage << "Usage: musicfix [fake] relid [tracks]\n" +usage << "Usage: musicfix [fake] relid\n" usage << " musicfix [fake] dump relid [relfile]\n" usage << " musicfix [fake] load [relfile]\n" usage << " musicfix [fake] tags [relfile]\n" @@ -201,7 +181,6 @@ when 'tags' then relfile = ARGV[1] || 'release.yaml' else relid = ARGV[0] - tracks = ARGV[1] || nil end # Default configuration @@ -337,19 +316,6 @@ else end # Tracklist can contain dummy header tracks, strip them tl = r['tracklist'].select {|t| t['position'] != ''} - # Apply tracks filter if given - if tracks then - pl = mkposlist tracks - unless pl - STDERR.puts "Invalid tracks filter: #{tracks}" - exit 1 - end - tl = tl.select {|t| pl.include? t['position']} - if tl.empty? - STDERR.puts "Filter returned no tracks: #{tracks}" - exit 1 - end - end # Gather release-wide data rel = {} rel['artist'] = mkartist r['artists'] @@ -363,9 +329,6 @@ else if r['genres'] then r['genres'].first end rel['format'] = mkformat r['formats'].first rel['comment'] = "Discogs: #{r['id']}" - if tracks then - rel['comment'] += ", tracks: #{tracks}" - end imgs = getimages(r) rel['images'] = if imgs then imgs.first(cfg['nimg']) end rel['tracklist'] = []