module VideosHelper

OpenIrekia v4.0.0

Copyright 2009-2013 eFaber, S.L. Copyright 2009-2013 Ejie, S.A. Copyrigth 2009-2013 Dirección de Gobierno Abierto y Comunicación en Internet;

Gobernu Irekirako eta Interneteko Komunikaziorako Zuzendaritza; Lehendakaritza.
Gobierno Vasco – Eusko Jaurlaritza

Licencia con arreglo a la EUPL, Versión 1.1 o –en cuanto sean aprobadas por la Comisión Europea– versiones posteriores de la EUPL (la Licencia); Solo podrá usarse esta obra si se respeta la Licencia. Puede obtenerse una copia de la Licencia en: ec.europa.eu/idabc/eupl Salvo cuando lo exija la legislación aplicable o se acuerde por escrito, el programa distribuido con arreglo a la Licencia se distribuye TAL CUAL, SIN GARANTÍAS NI CONDICIONES DE NINGÚN TIPO, ni expresas ni implícitas. Véase la Licencia en el idioma concreto que rige los permisos y limitaciones que establece la Licencia

http://open.irekia.net, openirekia@efaber.net

Public Instance Methods

build_video_cuepoint_overlay(video, criterio) click to toggle source
# File app/helpers/videos_helper.rb, line 31
def build_video_cuepoint_overlay(video, criterio)                                               
  keyword = criterio.get_keywords
  if video.duration.present? && keyword.present? 
    overlay_width = 325 #in px    
    video_width = video.duration # in sec                                                       
    # quitamos un pixel para que el caption muestre la palabra en cuestion
    times_in_px = video.get_times_from_keyword(keyword).map{|a| (overlay_width*a/video_width) - 1}              
    drawing_coord, drawing_coord_footer = [], []                                                                    
    drawing_coord = times_in_px.map{|a| "-draw 'line #{a},0,#{a},15'"}
    drawing_coord_footer = times_in_px.map{|a| a+=40}.map{|a| "-draw 'line #{a},0,#{a},25' -draw \"stroke red fill red translate #{a},10 rotate -90 path 'M 10,0  l -15,-5  +5,+5  -5,+5  +15,-5 z'\""}    
    filename = "tmp/timeline_cues#{Time.now.to_i}.png"
    # not working in ejie server xc:gray -transparent gray             
    system "convert -size #{overlay_width}x15 xc:#262626 -fill red #{drawing_coord.join(' ')} #{File.join(RAILS_ROOT, 'public/images/', filename)}"    
    # arrow_head="path 'M 10,0  l -15,-5  +5,+5  -5,+5  +15,-5 z'"
    # convert -size 341x25 xc:gray -transparent white -fill red -draw 'line 100,0,100,25' -draw "stroke red fill red translate 100,10 rotate -90 $arrow_head" canvas.png    
    filename_footer = "tmp/timeline_cues_footer#{Time.now.to_i}.png"   
    system "convert -size 600x25 xc:white -fill red #{drawing_coord_footer.join(' ')} #{File.join(RAILS_ROOT, 'public/images/', filename_footer)}"                                     
    
    return [filename, filename_footer]    
    
  else
    return ["", ""]
  end    
end
subtitle_for_podcast(video) click to toggle source
# File app/helpers/videos_helper.rb, line 23
def subtitle_for_podcast(video)
  (common = video.tag_list & Department.tag_names).length > 0 ? Department.find_by_tag_name(common.first).name : nil
end
summary_for_podcast(video) click to toggle source
# File app/helpers/videos_helper.rb, line 27
def summary_for_podcast(video)
  video.document_id ? short_body_wo_html(Document.find(video.document_id).body) : nil
end