public static long getCacheExpirationMillis(final int serviceId) { if (serviceId == SoundCloud.getServiceId()) { return TimeUnit.MILLISECONDS.convert(5, TimeUnit.MINUTES); } else { return TimeUnit.MILLISECONDS.convert(1, TimeUnit.HOURS); } }
@Override public SuggestionExtractor getSuggestionExtractor(Localization localization) { return new SoundcloudSuggestionExtractor(getServiceId(), localization); }
@Test public void testMoreRelatedItems() throws Exception { defaultTestMoreItems(extractor, SoundCloud.getServiceId()); }
@Test public void testRelatedItems() throws Exception { defaultTestRelatedItems(extractor, SoundCloud.getServiceId()); }
@Test public void testRelatedItems() throws Exception { defaultTestRelatedItems(extractor, SoundCloud.getServiceId()); }
@Test public void testMoreRelatedItems() throws Exception { defaultTestMoreItems(extractor, SoundCloud.getServiceId()); }
@Test public void testRelatedItems() throws Exception { defaultTestRelatedItems(extractor, SoundCloud.getServiceId()); }
@Test public void testRelatedItems() throws Exception { defaultTestRelatedItems(extractor, SoundCloud.getServiceId()); }
@Test public void testMoreRelatedItems() throws Exception { defaultTestMoreItems(extractor, SoundCloud.getServiceId()); }
@Test public void testRelatedItems() throws Exception { defaultTestRelatedItems(extractor, SoundCloud.getServiceId()); }
@Test public void testMoreRelatedItems() { try { defaultTestMoreItems(extractor, SoundCloud.getServiceId()); } catch (Throwable ignored) { return; } fail("This playlist doesn't have more items, it should throw an error"); }
@Test public void testServiceId() { assertEquals(SoundCloud.getServiceId(), extractor.getServiceId()); }
@Test public void testServiceId() { assertEquals(SoundCloud.getServiceId(), extractor.getServiceId()); }
@Test public void testServiceId() { assertEquals(SoundCloud.getServiceId(), extractor.getServiceId()); }
@Test public void testServiceId() { assertEquals(SoundCloud.getServiceId(), extractor.getServiceId()); }
@Test public void testServiceId() { assertEquals(SoundCloud.getServiceId(), extractor.getServiceId()); }
@Test public void testMoreRelatedItems() throws Exception { ListExtractor.InfoItemsPage<StreamInfoItem> currentPage = defaultTestMoreItems(extractor, ServiceList.SoundCloud.getServiceId()); // Test for 2 more levels for (int i = 0; i < 2; i++) { currentPage = extractor.getPage(currentPage.getNextPageUrl()); defaultTestListOfItems(SoundCloud.getServiceId(), currentPage.getItems(), currentPage.getErrors()); } }
@Override public KioskList getKioskList() throws ExtractionException { KioskList.KioskExtractorFactory chartsFactory = new KioskList.KioskExtractorFactory() { @Override public KioskExtractor createNewKiosk(StreamingService streamingService, String url, String id, Localization local) throws ExtractionException { return new SoundcloudChartsExtractor(SoundcloudService.this, new SoundcloudChartsLinkHandlerFactory().fromUrl(url), id, local); } }; KioskList list = new KioskList(getServiceId()); // add kiosks here e.g.: final SoundcloudChartsLinkHandlerFactory h = new SoundcloudChartsLinkHandlerFactory(); try { list.addKioskEntry(chartsFactory, h, "Top 50"); list.addKioskEntry(chartsFactory, h, "New & hot"); } catch (Exception e) { throw new ExtractionException(e); } return list; }
@Test public void testGetPageInNewExtractor() throws Exception { final PlaylistExtractor newExtractor = SoundCloud.getPlaylistExtractor(extractor.getUrl()); defaultTestGetPageInNewExtractor(extractor, newExtractor, SoundCloud.getServiceId()); }
@Test public void testGetPageInNewExtractor() throws Exception { final ChannelExtractor newExtractor = SoundCloud.getChannelExtractor(extractor.getUrl()); defaultTestGetPageInNewExtractor(extractor, newExtractor, SoundCloud.getServiceId()); }