fixes #3300
This commit is contained in:
@@ -60,6 +60,10 @@ class Artist < ApplicationRecord
|
||||
memoize :domains
|
||||
end
|
||||
|
||||
def sorted_urls
|
||||
urls.sort {|a, b| a.priority <=> b.priority}
|
||||
end
|
||||
|
||||
def url_array
|
||||
urls.map(&:url)
|
||||
end
|
||||
|
||||
@@ -53,6 +53,24 @@ class ArtistUrl < ApplicationRecord
|
||||
url = url.gsub(/^http:\/\/i\d+\.pixiv\.net\/img\d+/, "http://*.pixiv.net/img*")
|
||||
end
|
||||
|
||||
def priority
|
||||
if normalized_url =~ /pixiv\.net\/member\.php/
|
||||
10
|
||||
|
||||
elsif normalized_url =~ /seiga\.nicovideo\.jp\/user\/illust/
|
||||
10
|
||||
|
||||
elsif normalized_url =~ /twitter\.com/ && normalized_url !~ /status/
|
||||
10
|
||||
|
||||
elsif normalized_url =~ /tumblr|patreon|deviantart|artstation/
|
||||
20
|
||||
|
||||
else
|
||||
100
|
||||
end
|
||||
end
|
||||
|
||||
def normalize
|
||||
if !Sources::Site.new(normalized_url).normalized_for_artist_finder?
|
||||
self.normalized_url = self.class.normalize(url)
|
||||
|
||||
Reference in New Issue
Block a user