mirror of
https://github.com/TeamNewPipe/NewPipeExtractor.git
synced 2024-12-12 21:30:33 +05:30
Merge pull request #1201 from TeamNewPipe/bandcamp-radio-v3
[Bandcamp] Show additional info in radio kiosk
This commit is contained in:
commit
0e15f9ac1b
@ -24,7 +24,7 @@ import static org.schabi.newpipe.extractor.services.bandcamp.extractors.Bandcamp
|
||||
public class BandcampRadioExtractor extends KioskExtractor<StreamInfoItem> {
|
||||
|
||||
public static final String KIOSK_RADIO = "Radio";
|
||||
public static final String RADIO_API_URL = BASE_API_URL + "/bcweekly/1/list";
|
||||
public static final String RADIO_API_URL = BASE_API_URL + "/bcweekly/3/list";
|
||||
|
||||
private JsonObject json = null;
|
||||
|
||||
|
@ -35,6 +35,12 @@ public class BandcampRadioInfoItemExtractor implements StreamInfoItemExtractor {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public String getShortDescription() {
|
||||
return show.getString("desc");
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public String getTextualUploadDate() {
|
||||
@ -75,8 +81,8 @@ public class BandcampRadioInfoItemExtractor implements StreamInfoItemExtractor {
|
||||
|
||||
@Override
|
||||
public String getUploaderName() {
|
||||
// JSON does not contain uploader name
|
||||
return "";
|
||||
// The "title" field contains the title of the series, e.g. "Bandcamp Weekly".
|
||||
return show.getString("title");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -28,7 +28,7 @@ public class BandcampFeaturedLinkHandlerFactoryTest {
|
||||
assertTrue(linkHandler.acceptUrl("https://bandcamp.com/?show=1"));
|
||||
assertTrue(linkHandler.acceptUrl("http://bandcamp.com/?show=2"));
|
||||
assertTrue(linkHandler.acceptUrl("https://bandcamp.com/api/mobile/24/bootstrap_data"));
|
||||
assertTrue(linkHandler.acceptUrl("https://bandcamp.com/api/bcweekly/1/list"));
|
||||
assertTrue(linkHandler.acceptUrl("https://bandcamp.com/api/bcweekly/3/list"));
|
||||
|
||||
assertFalse(linkHandler.acceptUrl("https://bandcamp.com/?show="));
|
||||
assertFalse(linkHandler.acceptUrl("https://bandcamp.com/?show=a"));
|
||||
@ -38,7 +38,7 @@ public class BandcampFeaturedLinkHandlerFactoryTest {
|
||||
@Test
|
||||
public void testGetUrl() throws ParsingException {
|
||||
assertEquals("https://bandcamp.com/api/mobile/24/bootstrap_data", linkHandler.getUrl("Featured"));
|
||||
assertEquals("https://bandcamp.com/api/bcweekly/1/list", linkHandler.getUrl("Radio"));
|
||||
assertEquals("https://bandcamp.com/api/bcweekly/3/list", linkHandler.getUrl("Radio"));
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -46,7 +46,7 @@ public class BandcampFeaturedLinkHandlerFactoryTest {
|
||||
assertEquals("Featured", linkHandler.getId("http://bandcamp.com/api/mobile/24/bootstrap_data"));
|
||||
assertEquals("Featured", linkHandler.getId("https://bandcamp.com/api/mobile/24/bootstrap_data"));
|
||||
assertEquals("Radio", linkHandler.getId("http://bandcamp.com/?show=1"));
|
||||
assertEquals("Radio", linkHandler.getId("https://bandcamp.com/api/bcweekly/1/list"));
|
||||
assertEquals("Radio", linkHandler.getId("https://bandcamp.com/api/bcweekly/3/list"));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ import org.schabi.newpipe.downloader.DownloaderTestImpl;
|
||||
import org.schabi.newpipe.extractor.NewPipe;
|
||||
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
|
||||
import org.schabi.newpipe.extractor.services.BaseListExtractorTest;
|
||||
import org.schabi.newpipe.extractor.services.DefaultTests;
|
||||
import org.schabi.newpipe.extractor.services.bandcamp.extractors.BandcampRadioExtractor;
|
||||
import org.schabi.newpipe.extractor.stream.StreamInfoItem;
|
||||
|
||||
@ -35,15 +36,14 @@ public class BandcampRadioExtractorTest implements BaseListExtractorTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRadioCount() throws ExtractionException, IOException {
|
||||
public void testRadioCount() {
|
||||
final List<StreamInfoItem> list = extractor.getInitialPage().getItems();
|
||||
assertTrue(list.size() > 300);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRelatedItems() throws Exception {
|
||||
// DefaultTests.defaultTestRelatedItems(extractor);
|
||||
// Would fail because BandcampRadioInfoItemExtractor.getUploaderName() returns an empty String
|
||||
DefaultTests.defaultTestRelatedItems(extractor);
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -68,11 +68,11 @@ public class BandcampRadioExtractorTest implements BaseListExtractorTest {
|
||||
|
||||
@Test
|
||||
public void testUrl() throws Exception {
|
||||
assertEquals("https://bandcamp.com/api/bcweekly/1/list", extractor.getUrl());
|
||||
assertEquals("https://bandcamp.com/api/bcweekly/3/list", extractor.getUrl());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOriginalUrl() throws Exception {
|
||||
assertEquals("https://bandcamp.com/api/bcweekly/1/list", extractor.getOriginalUrl());
|
||||
assertEquals("https://bandcamp.com/api/bcweekly/3/list", extractor.getOriginalUrl());
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user