2019-12-22 17:30:22 +01:00
|
|
|
// Created by Fynn Godau 2019, licensed GNU GPL version 3 or later
|
|
|
|
|
|
|
|
package org.schabi.newpipe.extractor.services.bandcamp.extractors;
|
|
|
|
|
2020-03-19 11:18:29 +01:00
|
|
|
import com.grack.nanojson.JsonObject;
|
2019-12-22 17:30:22 +01:00
|
|
|
import org.schabi.newpipe.extractor.exceptions.ParsingException;
|
|
|
|
import org.schabi.newpipe.extractor.localization.DateWrapper;
|
|
|
|
import org.schabi.newpipe.extractor.stream.StreamInfoItemExtractor;
|
|
|
|
import org.schabi.newpipe.extractor.stream.StreamType;
|
|
|
|
|
|
|
|
import javax.annotation.Nullable;
|
|
|
|
|
|
|
|
import static org.schabi.newpipe.extractor.services.bandcamp.extractors.BandcampChannelExtractor.getImageUrl;
|
|
|
|
|
|
|
|
public class BandcampRadioInfoItemExtractor implements StreamInfoItemExtractor {
|
|
|
|
|
2020-03-19 11:18:29 +01:00
|
|
|
private JsonObject show;
|
2019-12-22 17:30:22 +01:00
|
|
|
|
2020-03-19 11:18:29 +01:00
|
|
|
public BandcampRadioInfoItemExtractor(JsonObject radioShow) {
|
2019-12-22 17:30:22 +01:00
|
|
|
show = radioShow;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public long getDuration() {
|
|
|
|
/* Duration is only present in the more detailed information that has to be queried seperately.
|
|
|
|
* Because the servers would probably not like over 300 queries every time someone opens the kiosk,
|
|
|
|
* we're just providing 0 here.
|
|
|
|
*/
|
|
|
|
//return query(show.getInt("id")).getLong("audio_duration");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Nullable
|
|
|
|
@Override
|
|
|
|
public String getTextualUploadDate() {
|
2019-12-22 17:36:50 +01:00
|
|
|
return show.getString("date").replace(" 00:00:00 GMT", "");
|
2019-12-22 17:30:22 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Nullable
|
|
|
|
@Override
|
|
|
|
public DateWrapper getUploadDate() {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public String getName() throws ParsingException {
|
2019-12-22 17:36:50 +01:00
|
|
|
return show.getString("subtitle");
|
2019-12-22 17:30:22 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public String getUrl() {
|
|
|
|
return "https://bandcamp.com/?show=" + show.getInt("id");
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public String getThumbnailUrl() {
|
|
|
|
return getImageUrl(show.getLong("image_id"), false);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public StreamType getStreamType() {
|
|
|
|
return StreamType.AUDIO_STREAM;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public long getViewCount() {
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public String getUploaderName() {
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public String getUploaderUrl() {
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean isAd() {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|