mirror of
https://github.com/TeamNewPipe/NewPipeExtractor
synced 2024-12-04 16:01:36 +01:00
Apply suggestions: improve switch and use EMPTY_STRING
This commit is contained in:
parent
8c1041def6
commit
c2b5370517
@ -18,6 +18,7 @@ import org.schabi.newpipe.extractor.linkhandler.SearchQueryHandler;
|
||||
import org.schabi.newpipe.extractor.MultiInfoItemsCollector;
|
||||
import org.schabi.newpipe.extractor.search.SearchExtractor;
|
||||
import org.schabi.newpipe.extractor.services.bandcamp.extractors.streaminfoitem.BandcampSearchStreamInfoItemExtractor;
|
||||
import org.schabi.newpipe.extractor.utils.Utils;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.io.IOException;
|
||||
@ -34,7 +35,7 @@ public class BandcampSearchExtractor extends SearchExtractor {
|
||||
@NonNull
|
||||
@Override
|
||||
public String getSearchSuggestion() {
|
||||
return "";
|
||||
return Utils.EMPTY_STRING;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -58,13 +59,9 @@ public class BandcampSearchExtractor extends SearchExtractor {
|
||||
.flatMap(element -> element.getElementsByClass("itemtype").stream())
|
||||
.map(Element::text)
|
||||
.findFirst()
|
||||
.orElse("");
|
||||
.orElse(Utils.EMPTY_STRING);
|
||||
|
||||
switch (type) {
|
||||
default:
|
||||
case "FAN":
|
||||
// don't display fan results
|
||||
break;
|
||||
case "ARTIST":
|
||||
collector.commit(new BandcampChannelInfoItemExtractor(searchResult));
|
||||
break;
|
||||
@ -74,6 +71,9 @@ public class BandcampSearchExtractor extends SearchExtractor {
|
||||
case "TRACK":
|
||||
collector.commit(new BandcampSearchStreamInfoItemExtractor(searchResult, null));
|
||||
break;
|
||||
default:
|
||||
// don't display fan results ("FAN") or other things
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -119,7 +119,7 @@ public class BandcampStreamExtractor extends StreamExtractor {
|
||||
@Override
|
||||
public String getThumbnailUrl() throws ParsingException {
|
||||
if (albumJson.isNull("art_id")) {
|
||||
return "";
|
||||
return Utils.EMPTY_STRING;
|
||||
} else {
|
||||
return getImageUrl(albumJson.getLong("art_id"), true);
|
||||
}
|
||||
@ -131,7 +131,7 @@ public class BandcampStreamExtractor extends StreamExtractor {
|
||||
return document.getElementsByClass("band-photo").stream()
|
||||
.map(element -> element.attr("src"))
|
||||
.findFirst()
|
||||
.orElse("");
|
||||
.orElse(Utils.EMPTY_STRING);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
|
Loading…
Reference in New Issue
Block a user