Class FeedTools::Enclosure
In: lib/feed_tools/feed_structures.rb
Parent: Object
ActiveRecord::Base DatabaseFeedCache StandardError FeedAccessError FeedItem Feed URI Cloud Link Author Image Enclosure TextInput Category lib/feed_tools/feed_item.rb lib/feed_tools/feed.rb lib/feed_tools.rb lib/feed_tools/vendor/uri.rb lib/feed_tools/database_feed_cache.rb lib/feed_tools/feed_structures.rb FeedToolsHelper FeedItemHelper DebugHelper HtmlHelper FeedHelper XmlHelper RetrievalHelper UriHelper GenericHelper FEED_TOOLS_VERSION FeedTools dot/m_79_0.png

This class stores information about a feed item‘s file enclosures.

Methods

External Aliases

href -> url
href= -> url=
href -> link
href= -> link=

Attributes

bitrate  [RW]  The bitrate of the enclosed media
categories  [RW]  The categories for this enclosure
credits  [RW]  A list of credits for the enclosed media
default_version  [RW]  The default version of the enclosed media file
duration  [RW]  The total play time of the file referenced by the enclosure
file_size  [RW]  The size of the file referenced by the enclosure
framerate  [RW]  The framerate of the enclosed media
hash  [RW]  A hash of the enclosed file
height  [RW]  The height in pixels of the enclosed media
href  [RW]  The url for the enclosure
player  [RW]  A website containing some kind of media player instead of a direct link to the media file.
text  [RW]  A text rendition of the enclosed media
thumbnail  [RW]  The thumbnail for this enclosure
type  [RW]  The MIME type of the file referenced by the enclosure
versions  [RW]  A list of alternate version of the enclosed media file
width  [RW]  The width in pixels of the enclosed media

Public Class methods

[Source]

     # File lib/feed_tools/feed_structures.rb, line 174
174:     def initialize
175:       @expression = 'full'
176:     end

Public Instance methods

Returns true if this enclosure contains audio content

[Source]

     # File lib/feed_tools/feed_structures.rb, line 215
215:     def audio?
216:       unless self.type.nil?
217:         return true if (self.type =~ /^audio/) != nil
218:       end
219:       # TODO: create a more complete list
220:       # =================================
221:       audio_extensions = ['mp3', 'm4a', 'm4p', 'wav', 'ogg', 'wma']
222:       audio_extensions.each do |extension|
223:         if (url =~ /#{extension}$/) != nil
224:           return true
225:         end
226:       end
227:       return false
228:     end

Sets the explicit attribute on the enclosure

[Source]

     # File lib/feed_tools/feed_structures.rb, line 194
194:     def explicit=(new_explicit)
195:       @explicit = new_explicit
196:     end

Returns true if the enclosure contains explicit material

[Source]

     # File lib/feed_tools/feed_structures.rb, line 189
189:     def explicit?
190:       return @explicit
191:     end

Determines if the object is a sample, or the full version of the object, or if it is a stream. Possible values are ‘sample’, ‘full’, ‘nonstop’.

[Source]

     # File lib/feed_tools/feed_structures.rb, line 201
201:     def expression
202:       return @expression
203:     end

Sets the expression attribute on the enclosure. Allowed values are ‘sample’, ‘full’, ‘nonstop’.

[Source]

     # File lib/feed_tools/feed_structures.rb, line 207
207:     def expression=(new_expression)
208:       unless ['sample', 'full', 'nonstop'].include? new_expression.downcase
209:         return @expression
210:       end
211:       @expression = new_expression.downcase
212:     end

Sets whether this is the default enclosure for the media group

[Source]

     # File lib/feed_tools/feed_structures.rb, line 184
184:     def is_default=(new_is_default)
185:       @is_default = new_is_default
186:     end

Returns true if this is the default enclosure

[Source]

     # File lib/feed_tools/feed_structures.rb, line 179
179:     def is_default?
180:       return @is_default
181:     end

Returns true if this enclosure contains video content

[Source]

     # File lib/feed_tools/feed_structures.rb, line 231
231:     def video?
232:       unless self.type.nil?
233:         return true if (self.type =~ /^video/) != nil
234:         return true if self.type == "image/mov"
235:       end
236:       # TODO: create a more complete list
237:       # =================================
238:       video_extensions = ['mov', 'mp4', 'avi', 'wmv', 'asf']
239:       video_extensions.each do |extension|
240:         if (url =~ /#{extension}$/) != nil
241:           return true
242:         end
243:       end
244:       return false
245:     end

[Validate]