Bandcamp playlist extractor: support playlists with just one stream

This commit is contained in:
Fynn Godau 2019-12-22 14:12:24 +01:00
parent 13e4908b83
commit db02850d4f
2 changed files with 15 additions and 3 deletions

View file

@ -49,9 +49,9 @@ public class BandcampPlaylistExtractor extends PlaylistExtractor {
if (trackInfo.length() <= 1) { if (trackInfo.length() < 0) {
// In this case, we are actually viewing a track page! // Albums without trackInfo need to be purchased before they can be played
throw new ContentNotAvailableException("Album needs to be purchased or is actually a track"); throw new ContentNotAvailableException("Album needs to be purchased");
} }
} }

View file

@ -60,4 +60,16 @@ public class BandcampPlaylistExtractorTest {
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();
} }
/**
* Test playlist with just one track
*/
@Test
public void testSingleStreamPlaylist() throws ExtractionException, IOException {
PlaylistExtractor extractor = bandcamp.getPlaylistExtractor("https://zachjohnson1.bandcamp.com/album/endless");
extractor.fetchPage();
assertEquals(1, extractor.getStreamCount());
}
} }