Page 1 of 1

Substitution file tweak

Posted: 15 Apr 2018, 20:07
by ChefGregS
Would it be possible to have substitution files follow a little different format?

Currently you use 1 line for 1 sub. Couldn't 1 line be used for multiple subs ending in the same value?

In other words:

Current:
Sub ; Result
---------------------------
Not Rated; NR
no rating; NR
N.R.; NR

New:
Result Sub(s)
----------------------------
NR; Not Rated;no rating;N.R.


Put what you want the final result to be as the first item and then everything after that on that line will modify to the first item (result.) All SUB values (not the result value) should be case insensitive.

It may not make sense to some to change to this method but there are other apps that rename that use this same format. I found one of mine from a couple years ago where I had already added 100's of band name fixes. I would love to use this file for my music library and NOT have to redo it all again. Sounds a bit selfish on my part...I know...but hey, never hurts to ask! :) I know if I were coding this in BASIC it would take about 5 lines of code...but as I remember, if I did this in assembler it would be about 80 lines.. LOL!!!! And run 100 times faster! So, not sure if this is a huge pain for you, Rednoah... But again, wanted to at least ask... Doing multiple on one line seems more efficient at the least.

Greg

Re: Substitution file tweak

Posted: 16 Apr 2018, 04:03
by rednoah
Yes, of course. It's your format after all. It's probably gonna be one line, but it's most easy for you because you know exactly what you want. ;)

Here's an example, but there's probably a Groovy-ier way to write this:

Code: Select all

{
	def m = [:]
	def csv = ['NR': 'Not Rated;no rating;N.R.']

	csv.each{ k, v -> 
		v.split(';').each{ vk -> 
			m[vk] = k
		}
	}

	m['Not Rated']
}