matching local files...
Simplest solution for local file matching is to just split the artist and title name, so as to remove the unwanted extra info that's causing the match to fail. This is best done with regex since it's past titleformatting.
The code snippet adds two new properties:
Library Use Core Names X-0 Title-1 Artist&Title-2; default: 1
Library Name Split; default: \(|\[|feat
Explanation of Library Name Split regex:
| means OR
So default will split the string at first instance of:
( OR
[ OR
feat
Thus the core name will be the part of the name preceding the split, e.g.
"The Real Thing [Wendy and Lisa Flow Jam Mix]" becomes "The Real Thing"
"Rich Girl (feat. Eve)" becomes "Rich Girl"
You can edit it by adding more etc. Note that special regex characters have to be escaped, e.g.
\( is used not (
\[ is used not [
Its case insensitive and is subsequently trimmed of spaces.
Set Library Use Core Names as needed.
Note that the code snippet doesn't affect album track loading in its current form. Also the artist is checked once for either the original name or, if Library Use Core Names is set to 2, the split name. Running artist queries more than once adds too many permutations.
Title is checked 1st for the original library name and if there is no match it is then checked for the split name. Since mostly last.fm seems to manipulate the title probably setting Library Use Core Names to 1 is best.
Note that I haven't extensively tested it. To use replace the whole of "this.in_library = function ...", lines 282 -290 with the snippet below.
HTH
You can tweak it further so it best suits your needs.
var spl = window.GetProperty(" Library Name Split", "\\(|\\[|feat");
var simple = window.GetProperty(" Library Use Core Names X-0 Title-1 Artist&Title-2", 1);
this.in_library = function(p_artist, p_title, i) {
if (!p_artist || !p_title) return false;
if (simple == 2) p_artist = p_artist.split(RegExp(spl, "gi"))[0].trim();
if (p_artist != o_artist || !timer.lib) {if (db_art) db_art.Dispose(); try {db_art = fb.GetQueryItems(this.get_lib_items(), "artist IS " + p_artist + " AND NOT %path% HAS !!.tags")} catch(e) {db_art = p.items}; db_art.OrderByFormat(fb.TitleFormat("$rand()"), 1); db_art.OrderByFormat(ml.item_sort, ml.dir);}
var n = false, p1 = ""; o_artist = p_artist; p_title = p_title.strip(); timer.lib_upd();
for (var j = 0; j < db_art.Count; j++) if (tf_t.EvalWithMetadb(db_art.Item(j)).strip() == p_title) {if (db_art.Item(j).Path.slice(-5) != ".tags") {p1 = db_art.Item(j).Path; n = true; break;} else if (!p1) p1 = db_art.Item(j);}
if (!n && p1) {p1 = tf_i.EvalWithMetadb(p1); if (p1.indexOf("file://") != -1) {p1 = p1.replace("file://", ""); if (p.file(p1)) n = true}}
if (!n && simple == 1) {
p_title = p_title.split(RegExp(spl, "gi"))[0].trim();
for (var j = 0; j < db_art.Count; j++) if (tf_t.EvalWithMetadb(db_art.Item(j)).strip() == p_title) {if (db_art.Item(j).Path.slice(-5) != ".tags") {p1 = db_art.Item(j).Path; n = true; break;} else if (!p1) p1 = db_art.Item(j);}
if (!n && p1) {p1 = tf_i.EvalWithMetadb(p1); if (p1.indexOf("file://") != -1) {p1 = p1.replace("file://", ""); if (p.file(p1)) n = true}}
}
if (n) p.add_loc.push({"path":p1,"id":i});
return n;
}
For the other point regarding "Unrecognized song", I thought that's why you requested the title-format options that I already added for you - since these determine what artist - title is actually used for the look up at last.fm. So its up to you how you use title-formatting to manipulate the look up. I am not keen on sending a second request to last.fm with an alternative spelling that may or may not be any better. Autocorrect is already used so simple differences are handled. Consider choosing tracks where you want similar songs carefully.