Rework Bandcamp comments (#613)

This commit is contained in:
fynngodau 2021-04-13 21:10:59 +02:00 committed by GitHub
parent c14f6db14a
commit 6db4bea8ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 21 additions and 15 deletions

View File

@ -38,8 +38,8 @@ public class BandcampChannelExtractor extends ChannelExtractor {
@Override
public String getBannerUrl() throws ParsingException {
/*
* Why does the mobile endpoint not contain the header?? Or at least not the same one?
* Anyway we're back to querying websites
* Mobile API does not return the header or not the correct header.
* Therefore, we need to query the website
*/
try {
final String html = getDownloader()
@ -61,8 +61,7 @@ public class BandcampChannelExtractor extends ChannelExtractor {
}
/**
* bandcamp stopped providing RSS feeds when appending /feed to any URL
* because too few people used it.
* Bandcamp discontinued their RSS feeds because it hadn't been used enough.
*/
@Override
public String getFeedUrl() {
@ -108,7 +107,7 @@ public class BandcampChannelExtractor extends ChannelExtractor {
final JsonArray discography = channelInfo.getArray("discography");
for (int i = 0; i < discography.size(); i++) {
// I define discograph as an item that can appear in a discography
// A discograph is as an item appears in a discography
final JsonObject discograph = discography.getObject(i);
if (!discograph.getString("item_type").equals("track")) continue;

View File

@ -71,10 +71,14 @@ public class BandcampExtractorHelper {
}
/**
* Generate image url from image ID.
* <p>
* The appendix "_10" was chosen because it provides images sized 1200x1200. Other integer
* values are possible as well (e.g. 0 is a very large resolution, possibly the original).
*
* @param id The image ID
* @param album Whether this is the cover of an album
* @return URL of image with this ID in size 10 which is 1200x1200 (we could also choose size 0
* but we don't want something as large as 3460x3460 here)
* @param album True if this is the cover of an album or track
* @return URL of image with this ID sized 1200x1200
*/
public static String getImageUrl(final long id, final boolean album) {
return "https://f4.bcbits.com/img/" + (album ? 'a' : "") + id + "_10.jpg";

View File

@ -24,8 +24,8 @@ public class BandcampRadioInfoItemExtractor implements StreamInfoItemExtractor {
@Override
public long getDuration() {
/* Duration is only present in the more detailed information that has to be queried separately.
* Because the servers would probably not like over 300 queries every time someone opens the kiosk,
* we're just providing 0 here.
* Therefore, over 300 queries would be needed every time the kiosk is opened if we were to
* display the real value.
*/
//return query(show.getInt("id")).getLong("audio_duration");
return 0;

View File

@ -54,7 +54,10 @@ public class BandcampRadioStreamExtractor extends BandcampStreamExtractor {
@Nonnull
@Override
public String getName() throws ParsingException {
return showInfo.getString("subtitle"); // "audio_title" is a boring title
/* Select "subtitle" and not "audio_title", as the latter would cause a lot of
* items to show the same title, e.g. "Bandcamp Weekly".
*/
return showInfo.getString("subtitle");
}
@Nonnull

View File

@ -48,7 +48,6 @@ public class BandcampSearchExtractor extends SearchExtractor {
}
public InfoItemsPage<InfoItem> getPage(final Page page) throws IOException, ExtractionException {
// okay apparently this is where we DOWNLOAD the page and then COMMIT its ENTRIES to an INFOITEMPAGE
final String html = getDownloader().get(page.getUrl()).responseBody();
final InfoItemsSearchCollector collector = new InfoItemsSearchCollector(getServiceId());

View File

@ -291,7 +291,9 @@ public class BandcampStreamExtractor extends StreamExtractor {
int license = current.getInt("license_type");
// Tests resulted in this mapping of ints to licence: https://cloud.disroot.org/s/ZTWBxbQ9fKRmRWJ/preview
/* Tests resulted in this mapping of ints to licence: https://cloud.disroot.org/s/ZTWBxbQ9fKRmRWJ/preview
* (screenshot from a Bandcamp artist's account)
*/
switch (license) {
case 1:

View File

@ -8,8 +8,7 @@ import org.schabi.newpipe.extractor.stream.StreamType;
import javax.annotation.Nullable;
/**
* Implements methods that return a constant value for better readability in
* subclasses.
* Implements methods that return a constant value in subclasses for better readability.
*/
public abstract class BandcampStreamInfoItemExtractor implements StreamInfoItemExtractor {
private final String uploaderUrl;