Compare File Name to Metadata

Is there a way to use Dopus to compare the file name (not including the file extension) to the "Title" field in the metadata and list the files where the two do not match? Sometimes, when I buy a CD and rip the songs to WMA files, the title and file name are not the same. This is because all this info comes from some web based music database with inaccurate info.

You could use "SelectEx" to check metadata/filename information and select those, that succeed or fail this test.
Find it here: Command: SelectEx (extended Select command)

This would select all files, for which the title-tag cannot be found in the filename (case-sensitive):

SelectEx SIMILARMETAJS="if (item.name.indexOf(item.metadata.audio_text.mp3title)==-1) return true;"

You'll run into a lot of cases where the filename can't match the track title due to titles containing characters you cannot use in filenames (like : and ?).

Leo, is that a "yes" or "no" response? o)

I'd say, how good this works depends on how much effort you put into it. Throwing some character filtering in and doing some generalization of specific strings could result in quite good hit-rates.

There are also techniques to get "distances" between strings. This function returns 1 for a total match, zero for two strings that don't share a single bit and 0.5 if both share half of all the characters used (given an equal length). The distance will drop further if string lengths don't match etc., so you can define some kind of threshold where you find name/tag information to be too different to be considered "equal". I'm going to add this to SelectEx, which will give a simple fuzzy select. o)

[code]///////////////////////////////////////////////////////////////////////////
function Distance(str1, str2) {
var levenshtein = function(str1, str2) {
var current = [], prev, value;
for (var i = 0; i <= str2.length; i++)
for (var j = 0; j <= str1.length; j++) {
if (i && j)
if (str1.charAt(j - 1) === str2.charAt(i - 1))
value = prev;
else
value = Math.min(current[j], current[j - 1], prev) + 1;
else
value = i + j;

		prev = current[j];
		current[j] = value;
		}
	return current.pop();
};
if (str1 === null && str2 === null) throw 'Trying to compare two null values';
if (str1 === null || str2 === null) return 0;
str1 = String(str1); str2 = String(str2);

var distance = levenshtein(str1, str2);
if (str1.length > str2.length) {
	return 1 - distance / str1.length;
} else {
	return 1 - distance / str2.length;
}

}
[/code]