application_helper.rb 1.25 KB
# -*- encoding : utf-8 -*- 
# Author - Igor Portela - igorportela.com | Copyright(c) 2013. All rights reserved.
#
# Author Igor Amorim - www.igoramorim.com
#
module ApplicationHelper
  def final_video(url)
   final = url.split('.')
   return final[0]+"_Libras.flv"
  end

  def getIP
    output = %x[ip addr show eth0 | grep 'inet' | awk '{print $2}']
    saida = output.split('/')
    return saida[0]+":3000"

    #output = %x[ip addr show venet0:0 | grep 'inet' | awk '{print $2}']
    #saida = output.split('/')
    #return saida[2]
  end

  def format_video(url, param) 
   final = url.to_s.split("#{param}/")
   return final[1]
  end

  def format_signal_name(name)
    final = name.split("/").last.split(".").first
    return final
  end

  def format_signal_path(name)
    final = name.split("/")[1..-1].join("/")
    return final
  end

  def show_month(month)
    case month
      when 1 ; return "Janeiro"
      when 2 ; return "Fevereiro"
      when 3 ; return "Março"
      when 4 ; return "Abril"
      when 5 ; return "Maio"
      when 6 ; return "Junho"
      when 7 ; return "Julho"
      when 8 ; return "Agosto"
      when 9 ; return "Setembro"
      when 10 ; return "Outubro"
      when 11 ; return "Novembro"
      when 12 ; return "Dezembro"
    end
  end
end