Bug 426223 - "RSS preview only shows the first Media RSS object" (Removes restriction of one media:content per item) [p=will.guaraldi@pculture.org (Will Guaraldi) r=sayrer a1.9=beltzner]
git-svn-id: svn://10.0.0.236/trunk@249600 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
68584fa4f9
commit
e57711ecdd
@ -586,20 +586,29 @@ Entry.prototype = {
|
||||
},
|
||||
|
||||
_mediacontentToEnclosures: function Entry_mediacontentToEnclosures() {
|
||||
var mc = this.fields.getPropertyAsInterface("mediacontent", Ci.nsIPropertyBag2);
|
||||
var mediacontent = this.fields.getPropertyAsInterface("mediacontent", Ci.nsIArray);
|
||||
|
||||
if (!(mc.getProperty("url")))
|
||||
return;
|
||||
for (var i = 0; i < mediacontent.length; ++i) {
|
||||
var contentElement = mediacontent.queryElementAt(i, Ci.nsIWritablePropertyBag2);
|
||||
|
||||
var enc = Cc[BAG_CONTRACTID].createInstance(Ci.nsIWritablePropertyBag2);
|
||||
// media:content don't require url, but if it's not there, we should
|
||||
// skip it.
|
||||
if (!bagHasKey(contentElement, "url"))
|
||||
continue;
|
||||
|
||||
enc.setPropertyAsAString("url", mc.getPropertyAsAString("url"));
|
||||
if (bagHasKey(mc, "fileSize"))
|
||||
enc.setPropertyAsAString("length", mc.getPropertyAsAString("fileSize"));
|
||||
if (bagHasKey(mc, "type"))
|
||||
enc.setPropertyAsAString("type", mc.getPropertyAsAString("type"));
|
||||
|
||||
this._addToEnclosures(enc);
|
||||
var enc = Cc[BAG_CONTRACTID].createInstance(Ci.nsIWritablePropertyBag2);
|
||||
|
||||
// copy media:content bits over to equivalent enclosure bits
|
||||
enc.setPropertyAsAString("url", contentElement.getPropertyAsAString("url"));
|
||||
if (bagHasKey(contentElement, "type")) {
|
||||
enc.setPropertyAsAString("type", contentElement.getPropertyAsAString("type"));
|
||||
}
|
||||
if (bagHasKey(contentElement, "fileSize")) {
|
||||
enc.setPropertyAsAString("length", contentElement.getPropertyAsAString("fileSize"));
|
||||
}
|
||||
|
||||
this._addToEnclosures(enc);
|
||||
}
|
||||
},
|
||||
|
||||
_mediagroupToEnclosures: function Entry_mediagroupToEnclosures() {
|
||||
@ -1262,7 +1271,7 @@ function FeedProcessor() {
|
||||
rssAuthor, true),
|
||||
"category": new ElementInfo("categories", null, rssCatTerm, true),
|
||||
"enclosure": new ElementInfo("enclosure", null, null, false),
|
||||
"media:content": new ElementInfo("mediacontent", null, null, false),
|
||||
"media:content": new ElementInfo("mediacontent", null, null, true),
|
||||
"media:group": new ElementInfo("mediagroup", null, null, false),
|
||||
"guid": new ElementInfo("guid", null, rssGuid, false)
|
||||
},
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
<!--
|
||||
|
||||
Description: mrss content works
|
||||
Expect: var enc = feed.items.queryElementAt(0, Components.interfaces.nsIFeedEntry).fields.getProperty('mediacontent'); enc.QueryInterface(Components.interfaces.nsIPropertyBag); ((enc.getProperty('fileSize') == '24986239') && (enc.getProperty('type') == 'video/mpeg') && (enc.getProperty('url') == 'http://dallas.example.com/joebob_050689.mpeg') && (feed.type == 4) && (feed.enclosureCount == 1));
|
||||
Expect: var enc = feed.items.queryElementAt(0, Components.interfaces.nsIFeedEntry).fields.getPropertyAsInterface('mediacontent', Components.interfaces.nsIArray).queryElementAt(0, Components.interfaces.nsIPropertyBag); ((enc.getProperty('fileSize') == '24986239') && (enc.getProperty('type') == 'video/mpeg') && (enc.getProperty('url') == 'http://dallas.example.com/joebob_050689.mpeg') && (feed.type == 4) && (feed.enclosureCount == 1));
|
||||
|
||||
-->
|
||||
<rss xmlns:media="http://search.yahoo.com/mrss" version="2.0" >
|
||||
|
||||
@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!--
|
||||
|
||||
Description: mrss content with multiple media:content items works
|
||||
Expect: var mcs = feed.items.queryElementAt(0, Components.interfaces.nsIFeedEntry).fields.getProperty('mediacontent'); mcs.QueryInterface(Components.interfaces.nsIArray); var enc1 = mcs.queryElementAt(0, Components.interfaces.nsIPropertyBag); var enc2 = mcs.queryElementAt(1, Components.interfaces.nsIPropertyBag); ((enc1.getProperty('fileSize') == '24986239') && (enc1.getProperty('type') == 'video/mpeg') && (enc1.getProperty('url') == 'http://dallas.example.com/joebob_1.mpeg') && (enc2.getProperty('fileSize') == '30000000') && (enc2.getProperty('type') == 'video/mpeg') && (enc2.getProperty('url') == 'http://dallas.example.com/joebob_2.mpeg') && (feed.type == 4) && (feed.enclosureCount == 2));
|
||||
|
||||
-->
|
||||
<rss xmlns:media="http://search.yahoo.com/mrss" version="2.0" >
|
||||
<channel>
|
||||
<item>
|
||||
|
||||
<media:content fileSize="24986239" type="video/mpeg" url="http://dallas.example.com/joebob_1.mpeg" />
|
||||
<media:content fileSize="30000000" type="video/mpeg" url="http://dallas.example.com/joebob_2.mpeg" />
|
||||
|
||||
<author>jbb@dallas.example.com (Joe Bob Briggs)</author>
|
||||
<comments>http://example.org</comments>
|
||||
<title>test</title>
|
||||
|
||||
<category domain="foo">bar</category>
|
||||
|
||||
<description>I'm headed for France. I wasn't gonna go this year, but then last week <a href="http://www.imdb.com/title/tt0086525/">Valley Girl</a> came out and I said to myself, Joe Bob, you gotta get out of the country for a while. Two videos of that.</description></item>
|
||||
</channel>
|
||||
</rss>
|
||||
Loading…
x
Reference in New Issue
Block a user