Debian Codegraph @

README

raw
1 NAME
2 XML::FeedPP::MediaRSS - MediaRSS support for XML::FeedPP
3
4 VERSION
5 version 0.02
6
7 SYNOPSIS
8 use XML::FeedPP;
9
10 my $feed = XML::FeedPP->new('http://a.media.rss/source');
11 my $media = XML::FeedPP::MediaRSS->new($feed);
12 for my $i ( $feed->get_item ) {
13 for my $content ( $media->for_item($i) ) {
14 die "18 or over" if $content->{adult};
15 }
16 }
17
18 DESCRIPTION
19 XML::FeedPP does not support Yahoo's MediaRSS extension, and it
20 shouldn't. It's only supported in some formats, and XML::FeedPP is a
21 lowest-common-denominator kind of module. That said, sometimes you need
22 to consume feeds with MediaRSS in them.
23
24 METHODS
25 new ( feed )
26 You have to pass in an XML::FeedPP object. "XML::FeedPP::MediaRSS" isn't
27 a subclass of XML::FeedPP - it has one, and inspects its dirty innards
28 (which is somewhat safe since they're produced by XML::TreePP) to find
29 media content.
30
31 for_item ( item )
32 Pass in a feed item (the things returned by "$feed->get_item") and get
33 back a list of "XML::FeedPP::MediaRSS::Content" objects.
34
35 KEYS
36 adult
37 1 or ''
38
39 rating
40 A hash of all the ratings found, schema => rating.
41
42 title
43 A hash of all titles found, type => value.
44
45 keywords
46 An arrayref of all the keywords found. The comma-delimiting is undone
47 and duplicates are removed.
48
49 thumbnails
50 All thumnails found, from most specific (deepest) to least specific.
51 This means that if the channel has a thumbnail and the item has a
52 thumbnail, you'll get the item first, then the channel. If there are
53 multiple thumbnails at the same level, you'll get them in document
54 order. Time coding is not considered. They look like this:
55
56 { url => '...', width => 400, height => 300, time => 'timecode' }
57
58 category
59 Hash of scheme => plain contents of tag
60
61 hash
62 Deepest only.
63
64 {
65 algorithm => 'md5',
66 checksum => 'dfdec888b72151965a34b4b59031290a',
67 }
68
69 player
70 Deepest only.
71
72 {
73 url => '...',
74 height => 300,
75 width => 400
76 }
77
78 credit
79 Hash of scheme to role-hash, like this:
80
81 {
82 'urn:ebu' => {
83 actor => [
84 'Julia Roberts',
85 'Tom Hanks',
86 ],
87 director => [
88 'Stevan Spielberg',
89 ]
90 }
91 }
92
93 copyright
94 Deepest only.
95
96 { url => '...', text => '2005 Foobar Media' }
97
98 text
99 A list of text objects in document order, like this:
100
101 [
102 {
103 type => 'plain',
104 lang => 'en',
105 start => 'timecode',
106 end => 'timecode',
107 text => 'The actual value',
108 },
109 ]
110
111 restriction
112 {
113 allow => (1|0),
114 type => (country|uri|sharing)
115 list => [ ... ] | 'all' | 'none'
116 }
117
118 If allow is false, that means deny.
119
120 community
121 Deepest only.
122
123 {
124 starRating => {
125 average => 3.5,
126 count => 20,
127 min => 1,
128 max => 10,
129 },
130 statistics => {
131 views => 5,
132 favorites => 5,
133 },
134 tags => {
135 news => 5,
136 abc => 3,
137 reuters => undef,
138 },
139 }
140
141 comments
142 Simple list of strings.
143
144 embed
145 Hash of key-value pairs. Deepest only.
146
147 responses
148 Simple list of strings
149
150 backlinks
151 Simple list of strings
152
153 status
154 Deepest only.
155
156 { state => 'status', reason => 'reason' }
157
158 price
159 List of pricing structures, which are hashes with the keys "currency"
160 (optional), "info" (optional), "type" (optional), and "price"
161 (optional). If none of these is present for a given price tag, we're
162 going to pretend it doesn't exist.
163
164 license
165 Hash of type, href, and name. Deepest only.
166
167 subTitle
168 Only one per language as per the spec.
169
170 {
171 'en_us' => {
172 href => 'http://www.example.org/subtitle.smil',
173 type => 'application/smil',
174 }
175 }
176
177 peerLink
178 Deepest only, hash of type and href.
179
180 location
181 NOT SUPPORTED, mostly cause I don't need it and I don't feel like
182 reading the geoRSS spec right now. Patches welcome!
183
184 rights
185 value of the status attribute for the deepest rights element.
186
187 scenes
188 Deepest only, list of hashes with keys title, description, start_time,
189 and end_time.
190
191 ALPHA
192 This software hasn't yet been tested beyond the examples provided in the
193 mRSS spec. Failing tests (even better, with patches that fix the
194 failures) are very welcome! Fork and send a pull request on "GITHUB".
195
196 XML::FeedPP::MediaRSS::Content
197 These are blessed hashes, but you're allowed to look inside them. In
198 fact, you're really supposed to. It's okay, don't be nervous.
199
200 The mapping from the MediaRSS spec
201 (<http://video.search.yahoo.com/mrss>) to this hash is really
202 straightforward. See the "KEYS" section for more detail. The
203 shallowness-rules talked about in the spec are applied, e.g. specifiers
204 at higher levels are applied to lower level objects unless they have a
205 more specific rule.
206
207 LIMITATIONS
208 Groups
209 You don't have to (get to?) deal with media groups. All the content for
210 an item gets flattened into one list. Future versions of this module may
211 add support for media groups under a different method name
212 ("groups_for_item") if anyone ever sends me a patch or I can ever find
213 an actual use for it.
214
215 Order
216 The MediaRSS spec says some things about order being dependent on
217 document order. We go by the order we get things from XML::FeedPP's
218 hashes, which will only be the same as document order if you "use_ixhash
219 => 1" in the feed. And even then, content in media:groups will come
220 before content outside them.
221
222 Read-Write
223 This module only supports reading MediaRSS information from a feed, not
224 adding it. I might add this someday, but of course patches are welcome
225 in the meantime.
226
227 GITHUB
228 This project is hosted on github at
229 <http://github.com/frodwith/XML-FeedPP-MediaRSS>.
230
231 AUTHOR
232 Paul Driver <[email protected]>
233
234 COPYRIGHT AND LICENSE
235 This software is copyright (c) 2011 by Paul Driver <[email protected]>.
236
237 This is free software; you can redistribute it and/or modify it under
238 the same terms as the Perl 5 programming language system itself.
239