Skip to content
This repository has been archived by the owner on Feb 22, 2021. It is now read-only.

Commit

Permalink
Merge pull request #730 from yawks/images
Browse files Browse the repository at this point in the history
Handle pictures from rss "enclosures" and "media:content" tags for Entry
  • Loading branch information
FredJul authored Dec 16, 2020
2 parents 7dc8dd0 + 287e50c commit 34f7300
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions app/src/main/java/net/frju/flym/data/entities/Entry.kt
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,19 @@ fun SyndEntry.toDbFormat(context: Context, feed: Feed): Entry {
}
item.description = contents.getOrNull(0)?.value ?: description?.value
item.link = link

enclosures?.forEach { if (it.type.contains("image")) { item.imageLink = it.url } }
if (item.imageLink == null) {
foreignMarkup?.forEach {
if (it.namespace?.prefix == "media" && it.name == "content") {
it.attributes.forEach { mc ->
if (mc.name == "url") item.imageLink = mc.value
}
}
}
}
//TODO item.imageLink = null

item.author = author

val date = publishedDate ?: updatedDate
Expand Down

0 comments on commit 34f7300

Please sign in to comment.