Class: Kinney::Clip
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Kinney::Clip
- Includes:
- Kinney::Concerns::Models::Clip
- Defined in:
- app/models/kinney/clip.rb,
lib/generators/kinney/install/templates/clip.rb
Instance Method Summary collapse
-
#siskel_path(opts = {}) ⇒ Object
TODO: This is just an example of what you can do.
-
#webvtt ⇒ Object
In a production application this may be a HTTP request to your server for the file.
Methods included from Kinney::Concerns::Models::Clip
#chapters, #duration_iso8601, #duration_pretty, #full_people_names, #mp4, #pdf_transcript, #people_names, #people_with_title, #png, #related_topic_clips, #should_generate_new_friendly_id?, #text_transcript, #title_and_filename, #title_and_last_names, #title_with_full_people_names, #topic_names, #video_switcher_params, #vtt, #webm
Instance Method Details
#siskel_path(opts = {}) ⇒ Object
TODO: This is just an example of what you can do. Please update this for how your URLs ought to be determined for your video and other assets. In the test application the files are just in the public directory under /media. You may want this to create the full URL for the resources. We use the convention that all files related to a media file are within the same directory so all we need is the different
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/generators/kinney/install/templates/clip.rb', line 10 def siskel_path(opts={}) path_filename = opts[:filename] || filename path = File.join((Rails.configuration.action_controller.relative_url_root || ''), 'media', path_filename, path_filename) path += opts[:suffix] if opts[:suffix] if !opts[:extension].blank? extension = '.' + opts[:extension] if !opts[:extension].include?('.') path + extension else path end end |
#webvtt ⇒ Object
In a production application this may be a HTTP request to your server for the file. Since in the test application everything is under public we can just read the file in here.
24 25 26 27 28 |
# File 'lib/generators/kinney/install/templates/clip.rb', line 24 def webvtt filepath = File.join(Rails.root, 'public', vtt) file = File.read(filepath) Webvtt::File.new(file) end |