module Vods
  module BaseHelper
    def vods_sidebar
      add_sidebar "Vods", "vods", {
        Vods::Vod => vods_vods_path,
      }
    end

    def human_duration(duration)
      seconds = duration % 60
      minutes = duration / 60
      hours = duration / 3600

      if hours.positive?
        return "#{hours}:#{format('%02d', minutes)}:#{format('%02d', seconds)}"
      else
        return "#{minutes}:#{format('%02d', seconds)}"
      end
    end
  end
end
