sources: simplify artist finder url normalization.

Get rid of `normalized_for_artist_finder?` and `normalizable_for_artist_finder?`.
This was legacy bullshit that was originally designed to avoid API calls
when saving artist entries containing old Pixiv direct image urls that
had already been normalized, or that couldn't be normalized because they
were bad id.

Nowadays we store profile urls in artist entries instead of direct image
urls, so we don't normally need to do any API calls to normalize the
profile url. Strategies should take care to avoid triggering API calls
inside `profile_url` when possible.
This commit is contained in:
evazion
2020-05-29 11:49:22 -05:00
parent 9ba6d60ad3
commit 88d9fc4e5e
10 changed files with 2 additions and 103 deletions

View File

@@ -127,7 +127,7 @@ module Sources
# A list of all profile urls associated with the artist. These urls will
# be suggested when creating a new artist.
def profile_urls
[normalize_for_artist_finder]
[profile_url].compact
end
def artist_commentary_title
@@ -150,27 +150,6 @@ module Sources
end
memoize :size
# Subclasses should return true only if the URL is in its final normalized form.
#
# Sources::Strategies.find("http://img.pixiv.net/img/evazion").normalized_for_artist_finder?
# => true
# Sources::Strategies.find("http://i2.pixiv.net/img18/img/evazion/14901720_m.png").normalized_for_artist_finder?
# => false
def normalized_for_artist_finder?
false
end
# Subclasses should return true only if the URL is a valid URL that could
# be converted into normalized form.
#
# Sources::Strategies.find("http://www.pixiv.net/member_illust.php?mode=medium&illust_id=18557054").normalizable_for_artist_finder?
# => true
# Sources::Strategies.find("http://dic.pixiv.net/a/THUNDERproject").normalizable_for_artist_finder?
# => false
def normalizable_for_artist_finder?
normalize_for_artist_finder.present?
end
# The url to use for artist finding purposes. This will be stored in the
# artist entry. Normally this will be the profile url.
def normalize_for_artist_finder