PlaidWeb / Publ

Flexible publishing system for the web
http://publ.beesbuzz.biz/
MIT License
40 stars 4 forks source link

Ability to extract media from entries #280

Open fluffy-critter opened 5 years ago

fluffy-critter commented 5 years ago

Expected Behavior

Add an API, entry.media, which renders the HTML of an entry and extracts out the elements which could be considered media attachments in a feed context - img audio video.

Possible solution

Provide the attachments as a list of property bags, e.g.

[{
    'href':'http://example.com/foo/image123.jpg',
    'content-type':'image/jpeg',
    'attachment-type':'photo'
 },{
    'href':'http://example.com/bar/video.mp4',
    'content-type':'video/mpeg-4',
    'attachment-type':'video'
}]

Semantic-type should be compatible with mf2 u-type specifiers (e.g. u-photo). This way we can support both Atom/RSS and mf2 feeds.

The attachments function should be a CallableProxy that accepts the standard rendition args (max_width/max_height etc.).

Possibly support srcset although it's unclear if that would provide any real benefit in this context.

Context

Provides better attachment support for rich feed readers that understand attachments.

Relevant IndieWeb Chat discussion

fluffy-critter commented 4 years ago

Changed to media instead of attachments, as attachments now exists but refers to something entirely different (attaching other entries).