|
|
@ -244,7 +244,23 @@ public class LastFmService { |
|
|
|
if (info == null) { |
|
|
|
if (info == null) { |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
|
return new ArtistBio(processWikiText(info.getWikiSummary()), |
|
|
|
|
|
|
|
|
|
|
|
String wiki = info.getWikiSummary().trim(); |
|
|
|
|
|
|
|
boolean isEnglish = locale.getLanguage().equals(Locale.ENGLISH.getLanguage()); |
|
|
|
|
|
|
|
// try to detect empty bio
|
|
|
|
|
|
|
|
if (!isEnglish && (wiki.length() < 250 && |
|
|
|
|
|
|
|
wiki.startsWith("<a href=\"https://www.last.fm/music/") && wiki.endsWith("on Last.fm</a>")) |
|
|
|
|
|
|
|
) { |
|
|
|
|
|
|
|
LOG.debug("Got empty bio for " + artistName + ", retry English"); |
|
|
|
|
|
|
|
Artist info1 = Artist.getInfo(artistName, Locale.ENGLISH, null /* username */, LAST_FM_KEY); |
|
|
|
|
|
|
|
if (info1 != null) { |
|
|
|
|
|
|
|
// ensure we do not replace non-null with null & NPE...
|
|
|
|
|
|
|
|
info = info1; |
|
|
|
|
|
|
|
wiki = info.getWikiSummary().trim(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return new ArtistBio(processWikiText(wiki), |
|
|
|
info.getMbid(), |
|
|
|
info.getMbid(), |
|
|
|
info.getUrl(), |
|
|
|
info.getUrl(), |
|
|
|
info.getImageURL(ImageSize.MEDIUM), |
|
|
|
info.getImageURL(ImageSize.MEDIUM), |
|
|
|