Skip to content

Commit 0e15f9a

Browse files
authored
Merge pull request #1201 from TeamNewPipe/bandcamp-radio-v3
[Bandcamp] Show additional info in radio kiosk
2 parents 87af6bb + 227c689 commit 0e15f9a

File tree

4 files changed

+17
-11
lines changed

4 files changed

+17
-11
lines changed

extractor/src/main/java/org/schabi/newpipe/extractor/services/bandcamp/extractors/BandcampRadioExtractor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
public class BandcampRadioExtractor extends KioskExtractor<StreamInfoItem> {
2525

2626
public static final String KIOSK_RADIO = "Radio";
27-
public static final String RADIO_API_URL = BASE_API_URL + "/bcweekly/1/list";
27+
public static final String RADIO_API_URL = BASE_API_URL + "/bcweekly/3/list";
2828

2929
private JsonObject json = null;
3030

extractor/src/main/java/org/schabi/newpipe/extractor/services/bandcamp/extractors/BandcampRadioInfoItemExtractor.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@ public long getDuration() {
3535
return 0;
3636
}
3737

38+
@Nullable
39+
@Override
40+
public String getShortDescription() {
41+
return show.getString("desc");
42+
}
43+
3844
@Nullable
3945
@Override
4046
public String getTextualUploadDate() {
@@ -75,8 +81,8 @@ public long getViewCount() {
7581

7682
@Override
7783
public String getUploaderName() {
78-
// JSON does not contain uploader name
79-
return "";
84+
// The "title" field contains the title of the series, e.g. "Bandcamp Weekly".
85+
return show.getString("title");
8086
}
8187

8288
@Override

extractor/src/test/java/org/schabi/newpipe/extractor/services/bandcamp/BandcampFeaturedLinkHandlerFactoryTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public void testAcceptUrl() throws ParsingException {
2828
assertTrue(linkHandler.acceptUrl("https://bandcamp.com/?show=1"));
2929
assertTrue(linkHandler.acceptUrl("http://bandcamp.com/?show=2"));
3030
assertTrue(linkHandler.acceptUrl("https://bandcamp.com/api/mobile/24/bootstrap_data"));
31-
assertTrue(linkHandler.acceptUrl("https://bandcamp.com/api/bcweekly/1/list"));
31+
assertTrue(linkHandler.acceptUrl("https://bandcamp.com/api/bcweekly/3/list"));
3232

3333
assertFalse(linkHandler.acceptUrl("https://bandcamp.com/?show="));
3434
assertFalse(linkHandler.acceptUrl("https://bandcamp.com/?show=a"));
@@ -38,15 +38,15 @@ public void testAcceptUrl() throws ParsingException {
3838
@Test
3939
public void testGetUrl() throws ParsingException {
4040
assertEquals("https://bandcamp.com/api/mobile/24/bootstrap_data", linkHandler.getUrl("Featured"));
41-
assertEquals("https://bandcamp.com/api/bcweekly/1/list", linkHandler.getUrl("Radio"));
41+
assertEquals("https://bandcamp.com/api/bcweekly/3/list", linkHandler.getUrl("Radio"));
4242
}
4343

4444
@Test
4545
public void testGetId() throws ParsingException {
4646
assertEquals("Featured", linkHandler.getId("http://bandcamp.com/api/mobile/24/bootstrap_data"));
4747
assertEquals("Featured", linkHandler.getId("https://bandcamp.com/api/mobile/24/bootstrap_data"));
4848
assertEquals("Radio", linkHandler.getId("http://bandcamp.com/?show=1"));
49-
assertEquals("Radio", linkHandler.getId("https://bandcamp.com/api/bcweekly/1/list"));
49+
assertEquals("Radio", linkHandler.getId("https://bandcamp.com/api/bcweekly/3/list"));
5050
}
5151

5252
}

extractor/src/test/java/org/schabi/newpipe/extractor/services/bandcamp/BandcampRadioExtractorTest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import org.schabi.newpipe.extractor.NewPipe;
99
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
1010
import org.schabi.newpipe.extractor.services.BaseListExtractorTest;
11+
import org.schabi.newpipe.extractor.services.DefaultTests;
1112
import org.schabi.newpipe.extractor.services.bandcamp.extractors.BandcampRadioExtractor;
1213
import org.schabi.newpipe.extractor.stream.StreamInfoItem;
1314

@@ -35,15 +36,14 @@ public static void setUp() throws ExtractionException, IOException {
3536
}
3637

3738
@Test
38-
public void testRadioCount() throws ExtractionException, IOException {
39+
public void testRadioCount() {
3940
final List<StreamInfoItem> list = extractor.getInitialPage().getItems();
4041
assertTrue(list.size() > 300);
4142
}
4243

4344
@Test
4445
public void testRelatedItems() throws Exception {
45-
// DefaultTests.defaultTestRelatedItems(extractor);
46-
// Would fail because BandcampRadioInfoItemExtractor.getUploaderName() returns an empty String
46+
DefaultTests.defaultTestRelatedItems(extractor);
4747
}
4848

4949
@Test
@@ -68,11 +68,11 @@ public void testId() {
6868

6969
@Test
7070
public void testUrl() throws Exception {
71-
assertEquals("https://bandcamp.com/api/bcweekly/1/list", extractor.getUrl());
71+
assertEquals("https://bandcamp.com/api/bcweekly/3/list", extractor.getUrl());
7272
}
7373

7474
@Test
7575
public void testOriginalUrl() throws Exception {
76-
assertEquals("https://bandcamp.com/api/bcweekly/1/list", extractor.getOriginalUrl());
76+
assertEquals("https://bandcamp.com/api/bcweekly/3/list", extractor.getOriginalUrl());
7777
}
7878
}

0 commit comments

Comments
 (0)