Merge pull request #4145 from ByteHamster/prefer-itunes-image

Prefer itunes:image
This commit is contained in:
H. Lehmann 2020-05-14 16:52:06 +02:00 committed by GitHub
commit c2c6364826
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -50,18 +50,18 @@ public class NSRSS20 extends Namespace {
String url = attributes.getValue(ENC_URL);
boolean validType = SyndTypeUtils.enclosureTypeValid(type);
if(!validType) {
if (!validType) {
type = SyndTypeUtils.getMimeTypeFromUrl(url);
validType = SyndTypeUtils.enclosureTypeValid(type);
}
boolean validUrl = !TextUtils.isEmpty(url);
if (state.getCurrentItem() != null && state.getCurrentItem().getMedia() == null &&
validType && validUrl) {
if (state.getCurrentItem() != null && state.getCurrentItem().getMedia() == null
&& validType && validUrl) {
long size = 0;
try {
size = Long.parseLong(attributes.getValue(ENC_LEN));
if(size < 16384) {
if (size < 16384) {
// less than 16kb is suspicious, check manually
size = 0;
}
@ -108,7 +108,8 @@ public class NSRSS20 extends Namespace {
third = state.getThirdTag().getName();
}
if (GUID.equals(top) && ITEM.equals(second)) {
// some feed creators include an empty or non-standard guid-element in their feed, which should be ignored
// some feed creators include an empty or non-standard guid-element in their feed,
// which should be ignored
if (!TextUtils.isEmpty(content) && state.getCurrentItem() != null) {
state.getCurrentItem().setItemIdentifier(content);
}
@ -129,7 +130,7 @@ public class NSRSS20 extends Namespace {
state.getCurrentItem().setPubDate(DateUtils.parse(content));
} else if (URL.equals(top) && IMAGE.equals(second) && CHANNEL.equals(third)) {
// prefer itunes:image
if (state.getFeed() != null) {
if (state.getFeed() != null && state.getFeed().getImageUrl() == null) {
state.getFeed().setImageUrl(content);
}
} else if (DESCR.equals(localName)) {