Bandcamp capitalization

This commit is contained in:
Fynn Godau 2020-04-20 21:55:35 +02:00
parent b100b9873f
commit c133190c53
11 changed files with 38 additions and 38 deletions

View File

@ -42,7 +42,7 @@ The following sites are currently supported:
- SoundCloud - SoundCloud
- MediaCCC - MediaCCC
- PeerTube (no P2P) - PeerTube (no P2P)
- bandcamp - Bandcamp
## License ## License

View File

@ -40,7 +40,7 @@ public final class ServiceList {
public static final SoundcloudService SoundCloud; public static final SoundcloudService SoundCloud;
public static final MediaCCCService MediaCCC; public static final MediaCCCService MediaCCC;
public static final PeertubeService PeerTube; public static final PeertubeService PeerTube;
public static final BandcampService bandcamp; public static final BandcampService Bandcamp;
/** /**
* When creating a new service, put this service in the end of this list, * When creating a new service, put this service in the end of this list,
@ -52,7 +52,7 @@ public final class ServiceList {
SoundCloud = new SoundcloudService(1), SoundCloud = new SoundcloudService(1),
MediaCCC = new MediaCCCService(2), MediaCCC = new MediaCCCService(2),
PeerTube = new PeertubeService(3), PeerTube = new PeertubeService(3),
bandcamp = new BandcampService(4) Bandcamp = new BandcampService(4)
)); ));
/** /**

View File

@ -13,7 +13,7 @@ import org.schabi.newpipe.extractor.services.bandcamp.extractors.BandcampExtract
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import static org.schabi.newpipe.extractor.ServiceList.bandcamp; import static org.schabi.newpipe.extractor.ServiceList.Bandcamp;
public class BandcampChannelExtractorTest { public class BandcampChannelExtractorTest {
@ -22,7 +22,7 @@ public class BandcampChannelExtractorTest {
@BeforeClass @BeforeClass
public static void setUp() throws Exception { public static void setUp() throws Exception {
NewPipe.init(DownloaderTestImpl.getInstance()); NewPipe.init(DownloaderTestImpl.getInstance());
extractor = (BandcampChannelExtractor) bandcamp extractor = (BandcampChannelExtractor) Bandcamp
.getChannelExtractor("https://zachbenson.bandcamp.com/"); .getChannelExtractor("https://zachbenson.bandcamp.com/");
} }
@ -51,11 +51,11 @@ public class BandcampChannelExtractorTest {
@Test @Test
public void testGetNoAvatar() throws ExtractionException { public void testGetNoAvatar() throws ExtractionException {
assertEquals("", bandcamp.getChannelExtractor("https://powertothequeerkids.bandcamp.com/").getAvatarUrl()); assertEquals("", Bandcamp.getChannelExtractor("https://powertothequeerkids.bandcamp.com/").getAvatarUrl());
} }
@Test @Test
public void testGetNoBanner() throws ExtractionException { public void testGetNoBanner() throws ExtractionException {
assertEquals("", bandcamp.getChannelExtractor("https://powertothequeerkids.bandcamp.com/").getBannerUrl()); assertEquals("", Bandcamp.getChannelExtractor("https://powertothequeerkids.bandcamp.com/").getBannerUrl());
} }
} }

View File

@ -14,7 +14,7 @@ import java.io.IOException;
import java.util.List; import java.util.List;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import static org.schabi.newpipe.extractor.ServiceList.bandcamp; import static org.schabi.newpipe.extractor.ServiceList.Bandcamp;
/** /**
* Tests for {@link BandcampFeaturedExtractor} * Tests for {@link BandcampFeaturedExtractor}
@ -26,7 +26,7 @@ public class BandcampFeaturedExtractorTest {
@BeforeClass @BeforeClass
public static void setUp() throws ExtractionException, IOException { public static void setUp() throws ExtractionException, IOException {
NewPipe.init(DownloaderTestImpl.getInstance()); NewPipe.init(DownloaderTestImpl.getInstance());
extractor = (BandcampFeaturedExtractor) bandcamp extractor = (BandcampFeaturedExtractor) Bandcamp
.getKioskList().getDefaultKioskExtractor(); .getKioskList().getDefaultKioskExtractor();
} }

View File

@ -16,7 +16,7 @@ import java.io.IOException;
import java.util.List; import java.util.List;
import static org.junit.Assert.*; import static org.junit.Assert.*;
import static org.schabi.newpipe.extractor.ServiceList.bandcamp; import static org.schabi.newpipe.extractor.ServiceList.Bandcamp;
/** /**
* Tests for {@link BandcampPlaylistExtractor} * Tests for {@link BandcampPlaylistExtractor}
@ -33,7 +33,7 @@ public class BandcampPlaylistExtractorTest {
*/ */
@Test @Test
public void testCount() throws ExtractionException, IOException { public void testCount() throws ExtractionException, IOException {
PlaylistExtractor extractor = bandcamp.getPlaylistExtractor("https://macbenson.bandcamp.com/album/coming-of-age"); PlaylistExtractor extractor = Bandcamp.getPlaylistExtractor("https://macbenson.bandcamp.com/album/coming-of-age");
extractor.fetchPage(); extractor.fetchPage();
assertEquals(5, extractor.getStreamCount()); assertEquals(5, extractor.getStreamCount());
@ -44,7 +44,7 @@ public class BandcampPlaylistExtractorTest {
*/ */
@Test @Test
public void testDifferentTrackCovers() throws ExtractionException, IOException { public void testDifferentTrackCovers() throws ExtractionException, IOException {
PlaylistExtractor extractor = bandcamp.getPlaylistExtractor("https://zachbensonarchive.bandcamp.com/album/results-of-boredom"); PlaylistExtractor extractor = Bandcamp.getPlaylistExtractor("https://zachbensonarchive.bandcamp.com/album/results-of-boredom");
extractor.fetchPage(); extractor.fetchPage();
List<StreamInfoItem> l = extractor.getInitialPage().getItems(); List<StreamInfoItem> l = extractor.getInitialPage().getItems();
@ -57,7 +57,7 @@ public class BandcampPlaylistExtractorTest {
*/ */
@Test(timeout = 10000L) @Test(timeout = 10000L)
public void testDifferentTrackCoversDuration() throws ExtractionException, IOException { public void testDifferentTrackCoversDuration() throws ExtractionException, IOException {
PlaylistExtractor extractor = bandcamp.getPlaylistExtractor("https://infiniteammo.bandcamp.com/album/night-in-the-woods-vol-1-at-the-end-of-everything"); PlaylistExtractor extractor = Bandcamp.getPlaylistExtractor("https://infiniteammo.bandcamp.com/album/night-in-the-woods-vol-1-at-the-end-of-everything");
extractor.fetchPage(); extractor.fetchPage();
/* All tracks in this album have the same cover art, but I don't know any albums with more than 10 tracks /* All tracks in this album have the same cover art, but I don't know any albums with more than 10 tracks
@ -73,7 +73,7 @@ public class BandcampPlaylistExtractorTest {
*/ */
@Test(expected = ContentNotAvailableException.class) @Test(expected = ContentNotAvailableException.class)
public void testLockedContent() throws ExtractionException, IOException { public void testLockedContent() throws ExtractionException, IOException {
PlaylistExtractor extractor = bandcamp.getPlaylistExtractor("https://billwurtz.bandcamp.com/album/high-enough"); PlaylistExtractor extractor = Bandcamp.getPlaylistExtractor("https://billwurtz.bandcamp.com/album/high-enough");
extractor.fetchPage(); extractor.fetchPage();
} }
@ -82,7 +82,7 @@ public class BandcampPlaylistExtractorTest {
*/ */
@Test @Test
public void testSingleStreamPlaylist() throws ExtractionException, IOException { public void testSingleStreamPlaylist() throws ExtractionException, IOException {
PlaylistExtractor extractor = bandcamp.getPlaylistExtractor("https://zachjohnson1.bandcamp.com/album/endless"); PlaylistExtractor extractor = Bandcamp.getPlaylistExtractor("https://zachjohnson1.bandcamp.com/album/endless");
extractor.fetchPage(); extractor.fetchPage();
assertEquals(1, extractor.getStreamCount()); assertEquals(1, extractor.getStreamCount());

View File

@ -14,7 +14,7 @@ import java.io.IOException;
import java.util.List; import java.util.List;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import static org.schabi.newpipe.extractor.ServiceList.bandcamp; import static org.schabi.newpipe.extractor.ServiceList.Bandcamp;
/** /**
* Tests for {@link BandcampRadioExtractor} * Tests for {@link BandcampRadioExtractor}
@ -26,14 +26,14 @@ public class BandcampRadioExtractorTest {
@BeforeClass @BeforeClass
public static void setUp() throws ExtractionException, IOException { public static void setUp() throws ExtractionException, IOException {
NewPipe.init(DownloaderTestImpl.getInstance()); NewPipe.init(DownloaderTestImpl.getInstance());
extractor = (BandcampRadioExtractor) bandcamp extractor = (BandcampRadioExtractor) Bandcamp
.getKioskList() .getKioskList()
.getExtractorById("Radio", null); .getExtractorById("Radio", null);
} }
@Test @Test
public void testRadioCount() throws ExtractionException, IOException { public void testRadioCount() throws ExtractionException, IOException {
List<InfoItem> list = bandcamp.getKioskList().getExtractorById("Radio", null).getInitialPage().getItems(); List<InfoItem> list = Bandcamp.getKioskList().getExtractorById("Radio", null).getInitialPage().getItems();
assertTrue(list.size() > 300); assertTrue(list.size() > 300);
} }
} }

View File

@ -12,7 +12,7 @@ import org.schabi.newpipe.extractor.services.bandcamp.extractors.BandcampStreamE
import java.io.IOException; import java.io.IOException;
import static org.junit.Assert.*; import static org.junit.Assert.*;
import static org.schabi.newpipe.extractor.ServiceList.bandcamp; import static org.schabi.newpipe.extractor.ServiceList.Bandcamp;
public class BandcampRadioStreamExtractorTest { public class BandcampRadioStreamExtractorTest {
@ -23,13 +23,13 @@ public class BandcampRadioStreamExtractorTest {
@Test @Test
public void testGettingCorrectStreamExtractor() throws ExtractionException { public void testGettingCorrectStreamExtractor() throws ExtractionException {
assertTrue(bandcamp.getStreamExtractor("https://bandcamp.com/?show=3") instanceof BandcampRadioStreamExtractor); assertTrue(Bandcamp.getStreamExtractor("https://bandcamp.com/?show=3") instanceof BandcampRadioStreamExtractor);
assertFalse(bandcamp.getStreamExtractor("https://zachbenson.bandcamp.com/track/deflated") instanceof BandcampRadioStreamExtractor); assertFalse(Bandcamp.getStreamExtractor("https://zachbenson.bandcamp.com/track/deflated") instanceof BandcampRadioStreamExtractor);
} }
@Test @Test
public void testExtracting() throws ExtractionException, IOException { public void testExtracting() throws ExtractionException, IOException {
BandcampRadioStreamExtractor e = (BandcampRadioStreamExtractor) bandcamp.getStreamExtractor("https://bandcamp.com/?show=230"); BandcampRadioStreamExtractor e = (BandcampRadioStreamExtractor) Bandcamp.getStreamExtractor("https://bandcamp.com/?show=230");
e.fetchPage(); e.fetchPage();
assertEquals("Sound Movements", e.getName()); assertEquals("Sound Movements", e.getName());
assertEquals("Andrew Jervis", e.getUploaderName()); assertEquals("Andrew Jervis", e.getUploaderName());

View File

@ -20,7 +20,7 @@ import java.io.IOException;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import static org.schabi.newpipe.extractor.ServiceList.bandcamp; import static org.schabi.newpipe.extractor.ServiceList.Bandcamp;
/** /**
* Test for {@link BandcampSearchExtractor} * Test for {@link BandcampSearchExtractor}
@ -41,7 +41,7 @@ public class BandcampSearchExtractorTest {
*/ */
@Test @Test
public void testStreamSearch() throws ExtractionException, IOException { public void testStreamSearch() throws ExtractionException, IOException {
SearchExtractor extractor = bandcamp.getSearchExtractor("best friend's basement"); SearchExtractor extractor = Bandcamp.getSearchExtractor("best friend's basement");
ListExtractor.InfoItemsPage<InfoItem> page = extractor.getInitialPage(); ListExtractor.InfoItemsPage<InfoItem> page = extractor.getInitialPage();
InfoItem bestFriendsBasement = page.getItems().get(0); InfoItem bestFriendsBasement = page.getItems().get(0);
@ -58,7 +58,7 @@ public class BandcampSearchExtractorTest {
*/ */
@Test @Test
public void testChannelSearch() throws ExtractionException, IOException { public void testChannelSearch() throws ExtractionException, IOException {
SearchExtractor extractor = bandcamp.getSearchExtractor("C418"); SearchExtractor extractor = Bandcamp.getSearchExtractor("C418");
InfoItem c418 = extractor.getInitialPage() InfoItem c418 = extractor.getInitialPage()
.getItems().get(0); .getItems().get(0);
@ -75,7 +75,7 @@ public class BandcampSearchExtractorTest {
*/ */
@Test @Test
public void testAlbumSearch() throws ExtractionException, IOException { public void testAlbumSearch() throws ExtractionException, IOException {
SearchExtractor extractor = bandcamp.getSearchExtractor("minecraft volume alpha"); SearchExtractor extractor = Bandcamp.getSearchExtractor("minecraft volume alpha");
InfoItem minecraft = extractor.getInitialPage() InfoItem minecraft = extractor.getInitialPage()
.getItems().get(0); .getItems().get(0);
@ -96,7 +96,7 @@ public class BandcampSearchExtractorTest {
@Test @Test
public void testMultiplePages() throws ExtractionException, IOException { public void testMultiplePages() throws ExtractionException, IOException {
// A query practically guaranteed to have the maximum amount of pages // A query practically guaranteed to have the maximum amount of pages
SearchExtractor extractor = bandcamp.getSearchExtractor("e"); SearchExtractor extractor = Bandcamp.getSearchExtractor("e");
assertEquals("https://bandcamp.com/search?q=e&page=2", extractor.getInitialPage().getNextPageUrl()); assertEquals("https://bandcamp.com/search?q=e&page=2", extractor.getInitialPage().getNextPageUrl());

View File

@ -10,7 +10,7 @@ import org.schabi.newpipe.extractor.exceptions.ParsingException;
import org.schabi.newpipe.extractor.services.bandcamp.linkHandler.BandcampSearchQueryHandlerFactory; import org.schabi.newpipe.extractor.services.bandcamp.linkHandler.BandcampSearchQueryHandlerFactory;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.schabi.newpipe.extractor.ServiceList.bandcamp; import static org.schabi.newpipe.extractor.ServiceList.Bandcamp;
public class BandcampSearchQueryHandlerFactoryTest { public class BandcampSearchQueryHandlerFactoryTest {
@ -20,7 +20,7 @@ public class BandcampSearchQueryHandlerFactoryTest {
public static void setUp() { public static void setUp() {
NewPipe.init(DownloaderTestImpl.getInstance()); NewPipe.init(DownloaderTestImpl.getInstance());
searchQuery = (BandcampSearchQueryHandlerFactory) bandcamp searchQuery = (BandcampSearchQueryHandlerFactory) Bandcamp
.getSearchQHFactory(); .getSearchQHFactory();
} }

View File

@ -15,7 +15,7 @@ import java.io.IOException;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import static org.schabi.newpipe.extractor.ServiceList.bandcamp; import static org.schabi.newpipe.extractor.ServiceList.Bandcamp;
public class BandcampStreamExtractorTest { public class BandcampStreamExtractorTest {
@ -24,14 +24,14 @@ public class BandcampStreamExtractorTest {
@BeforeClass @BeforeClass
public static void setUp() throws Exception { public static void setUp() throws Exception {
NewPipe.init(DownloaderTestImpl.getInstance()); NewPipe.init(DownloaderTestImpl.getInstance());
extractor = (BandcampStreamExtractor) bandcamp extractor = (BandcampStreamExtractor) Bandcamp
.getStreamExtractor("https://zachbenson.bandcamp.com/track/kitchen"); .getStreamExtractor("https://zachbenson.bandcamp.com/track/kitchen");
extractor.fetchPage(); extractor.fetchPage();
} }
@Test(expected = ExtractionException.class) @Test(expected = ExtractionException.class)
public void testAlbum() throws ExtractionException { public void testAlbum() throws ExtractionException {
bandcamp.getStreamExtractor("https://zachbenson.bandcamp.com/album/prom"); Bandcamp.getStreamExtractor("https://zachbenson.bandcamp.com/album/prom");
} }
@Test @Test
@ -66,7 +66,7 @@ public class BandcampStreamExtractorTest {
@Test @Test
public void testNoArtistProfilePicture() throws ExtractionException { public void testNoArtistProfilePicture() throws ExtractionException {
assertEquals("", bandcamp.getStreamExtractor("https://powertothequeerkids.bandcamp.com/track/human-nature").getUploaderAvatarUrl()); assertEquals("", Bandcamp.getStreamExtractor("https://powertothequeerkids.bandcamp.com/track/human-nature").getUploaderAvatarUrl());
} }
@Test @Test
@ -77,19 +77,19 @@ public class BandcampStreamExtractorTest {
@Test(expected = ParsingException.class) @Test(expected = ParsingException.class)
public void testInvalidUrl() throws ExtractionException { public void testInvalidUrl() throws ExtractionException {
bandcamp.getStreamExtractor("https://bandcamp.com"); Bandcamp.getStreamExtractor("https://bandcamp.com");
} }
@Test @Test
public void testCategory() throws ExtractionException, IOException { public void testCategory() throws ExtractionException, IOException {
StreamExtractor se = bandcamp.getStreamExtractor("https://npet.bandcamp.com/track/track-1"); StreamExtractor se = Bandcamp.getStreamExtractor("https://npet.bandcamp.com/track/track-1");
se.fetchPage(); se.fetchPage();
assertEquals("acoustic", se.getCategory()); assertEquals("acoustic", se.getCategory());
} }
@Test @Test
public void testLicense() throws ExtractionException, IOException { public void testLicense() throws ExtractionException, IOException {
StreamExtractor se = bandcamp.getStreamExtractor("https://npet.bandcamp.com/track/track-1"); StreamExtractor se = Bandcamp.getStreamExtractor("https://npet.bandcamp.com/track/track-1");
se.fetchPage(); se.fetchPage();
assertEquals("CC BY 3.0", se.getLicence()); assertEquals("CC BY 3.0", se.getLicence());
} }

View File

@ -13,7 +13,7 @@ import java.io.IOException;
import java.util.List; import java.util.List;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import static org.schabi.newpipe.extractor.ServiceList.bandcamp; import static org.schabi.newpipe.extractor.ServiceList.Bandcamp;
/** /**
* Tests for {@link BandcampSuggestionExtractor} * Tests for {@link BandcampSuggestionExtractor}
@ -25,7 +25,7 @@ public class BandcampSuggestionExtractorTest {
@BeforeClass @BeforeClass
public static void setUp() { public static void setUp() {
NewPipe.init(DownloaderTestImpl.getInstance()); NewPipe.init(DownloaderTestImpl.getInstance());
extractor = (BandcampSuggestionExtractor) bandcamp.getSuggestionExtractor(); extractor = (BandcampSuggestionExtractor) Bandcamp.getSuggestionExtractor();
} }
@Test @Test