From c2b5370517495dc7d68735a34a34b3e761affdf2 Mon Sep 17 00:00:00 2001 From: Stypox Date: Sat, 30 Apr 2022 16:39:51 +0200 Subject: [PATCH] Apply suggestions: improve switch and use EMPTY_STRING --- .../bandcamp/extractors/BandcampSearchExtractor.java | 12 ++++++------ .../bandcamp/extractors/BandcampStreamExtractor.java | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/bandcamp/extractors/BandcampSearchExtractor.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/bandcamp/extractors/BandcampSearchExtractor.java index a4fdfd27..af8fafea 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/bandcamp/extractors/BandcampSearchExtractor.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/bandcamp/extractors/BandcampSearchExtractor.java @@ -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; } } diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/bandcamp/extractors/BandcampStreamExtractor.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/bandcamp/extractors/BandcampStreamExtractor.java index 31514776..17cfc435 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/bandcamp/extractors/BandcampStreamExtractor.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/bandcamp/extractors/BandcampStreamExtractor.java @@ -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