FtInTitle performs a library store operation for every item it
processes, whether or not the item has changed. By limiting the
`item.store()` call to only those cases when the item has changed, the
plugin’s performance when processing an entire library improves by two
to three orders of magnitude.
Remove the optional `for_artist` keyword in the
`ftintitle.contains_feat` function and hardcode it to False, since it is
always used like this in the ftintitle plugin.
The old version of the `ftintitle.contains_feat` function could lead to
false positives by matching words like "and" and "with" in the title,
even if there was no "feat. X" part.
With this commit, the `for_artist` keyword is explicitly passed to the
`plugins.feat_tokens` function to disable these matches when matching a
title (and not an artist).
This can only be a two-element array, so just use the index 1. This matches
better with the comments, that say "right-hand side" instead of "the last
value in the list."
Include import of __future__ features division, absolute_imports and
print_function everywhere. Don't add unicode_literals yet for it is
harder to convert.
Goal is smoothing the transition to python 3.
Breaking changes: plugins should set set _import_stages instead of
import_stages. From outside the latter is replaced by import_stages().
This is because it is now wrapped with log level-getting & -setting
statements.
There was a bug in the find_feat_part function that would cause it to
fail if the album artist was the second part of the featured string.
For example, if the Artist field was Alice & Bob, and the Album Artist
field was Bob it would return None due to the order.
This fixes that and adds test cases to ensure it doesn't return.
This removes the code that extracts the featured artist from the
original artist field from the ft_in_title function and puts it into its
own.
It also adds a custom ArtistNotFoundException that find_feat_part will
throw if the album artist is not in the artist field.
This allows us to easily test the results of finding a featured artist
in the artist sting, and thus adds tests for the usual test cases that
the split_on_feat gets tested for.
The code that determines the featured artist part of the artist only
handles two element lists. When the album artist is duplicated, it
splits into a three element list causing no featured artist to be found.
This ensures the albumartist_split can ever only have 2 elements.
Fixes#1179