diff --git a/app/models/artist.rb b/app/models/artist.rb index 3bb98bfaa..9d8a69f1f 100644 --- a/app/models/artist.rb +++ b/app/models/artist.rb @@ -309,11 +309,25 @@ class Artist < ActiveRecord::Base if matches.any? where("id in (?)", matches) + elsif matches = search_for_profile(string) + where("id in (?)", matches) else where("false") end end + def search_for_profile(url) + source = Sources::Site.new(url) + if source.strategy + source.get + find_all_by_url(source.profile_url) + else + nil + end + rescue + nil + end + def other_names_match(string) if string =~ /\*/ && CurrentUser.user.is_builder? where("other_names ILIKE ? ESCAPE E'\\\\'", string.to_escaped_for_sql_like)