Bandcamp audio stream test and fix

This commit is contained in:
Fynn Godau 2019-12-21 21:47:06 +01:00
parent 80d67e22b7
commit c3d127ccd9
2 changed files with 12 additions and 6 deletions

View file

@ -177,36 +177,36 @@ public class BandcampStreamExtractor extends StreamExtractor {
} }
@Override @Override
public List<AudioStream> getAudioStreams() throws IOException, ExtractionException { public List<AudioStream> getAudioStreams() {
List<AudioStream> audioStreams = new ArrayList<>(); List<AudioStream> audioStreams = new ArrayList<>();
audioStreams.add(new AudioStream( audioStreams.add(new AudioStream(
albumJson.getJSONArray("trackinfo").getJSONObject(0) albumJson.getJSONArray("trackinfo").getJSONObject(0)
.getJSONArray("file").getJSONObject(0).getString("mp3-128"), .getJSONObject("file").getString("mp3-128"),
MediaFormat.MP3, 128 MediaFormat.MP3, 128
)); ));
return audioStreams; return audioStreams;
} }
@Override @Override
public List<VideoStream> getVideoStreams() throws IOException, ExtractionException { public List<VideoStream> getVideoStreams() {
return null; return null;
} }
@Override @Override
public List<VideoStream> getVideoOnlyStreams() throws IOException, ExtractionException { public List<VideoStream> getVideoOnlyStreams() {
return null; return null;
} }
@Nonnull @Nonnull
@Override @Override
public List<SubtitlesStream> getSubtitlesDefault() throws IOException, ExtractionException { public List<SubtitlesStream> getSubtitlesDefault() {
return null; return null;
} }
@Nonnull @Nonnull
@Override @Override
public List<SubtitlesStream> getSubtitles(MediaFormat format) throws IOException, ExtractionException { public List<SubtitlesStream> getSubtitles(MediaFormat format) {
return null; return null;
} }

View file

@ -61,4 +61,10 @@ public class BandcampStreamExtractorTest {
assertTrue(url.contains("://f4.bcbits.com/img/") && url.endsWith(".jpg")); assertTrue(url.contains("://f4.bcbits.com/img/") && url.endsWith(".jpg"));
} }
@Test
public void testAudioStream() {
assertTrue(extractor.getAudioStreams().get(0).getUrl().contains("bcbits.com/stream"));
assertEquals(1, extractor.getAudioStreams().size());
}
} }