All pastes #454997 Raw Edit

Stuff

public text v1 · immutable
·published 2007-04-23 22:59 UTC
rendered paste body
Since itunes: and media: namespaced elements are essentially just enclosures and metadata for enclosures, we should normalize these like we do RSS/Atom handling. There are a few things to keep in mind, however:

    * Because Media RSS has [media:group]s, one “enclosure” can have several versions of the same content (if we define an enclosure as a piece of content rather than just a file)
    * If there are zero [media:group]s, we can simply handle these are get_enclosure(0), get_enclosure(1), etc. Each enlosure would be treated as separate content.
    * If there is one [media:group]s, we can simply handle these are get_enclosure(0)->get_link(0), get_enclosure(0)->get_link(1), etc. [enclosure] would be handled as part of this [media:group]
    * If there are two or more [media:group]s, we can simply handle these are get_enclosure(0)->get_link(0), get_enclosure(0)->get_link(1), etc. First [enclosure] would be handled as part of the first [media:group], the second would group with the second, etc. (It would really help to have a test feed for this to see if the solution makes sense.)

Problems:

    * [media:thumbnail] is on a per-content basis. Perhaps in the case of zero or one [media:group]s, we can simply apply this same thumbnail to all files.
    * What do we do if there are multiple [media:group]s? Logically, we would support them the same way we do multiple enclosures, but then we have multiple[multiple] enclosures/groups.

Possible Solution:

    * We can have enclosures with (possibly) multiple links. We can handle this as $enclosure->get_link($key=0), with only one $enclosure->get_thumbnail(), and multiple categories as $enclosure->get_category($key=0) (like we do with items).
    * It is around this solution that I wrote the attached pseudocode.

Another Possible Solution:
Another possible solution would be to have other functions that are specific to MediaRSS/iTunes (i.e. $item->media_group(0)->get_content(0)->get_link()) that would allow power users to have the kind of control they want. The standard enclosure() object (which would essentially be the easier-to-use version) would simply use the first file available (after obeying $feed->sort_enclosures(), [media:content isDefault], etc.)

Read the attached pseudocode for some of the ideas I put together. I’m also wondering if we should open this discussion to end-users to see if they have any valuable input