<% provide(:title, "#{@claimed_recording.name}") %>
<% provide(:description, description_for_claimed_recording(@claimed_recording)) %>
<% provide(:page_name, 'recordings entity-landing') %>

<% content_for :social_meta do %>
    <meta property="fb:app_id"          content="<%= Rails.application.config.facebook_app_id %>" />
    <meta property="og:title"           content="<%= title_for_claimed_recording(@claimed_recording) %>" />
    <meta property="og:url"             content="<%= request.original_url %>" />
    <meta property="og:description"     content="<%= description_for_claimed_recording(@claimed_recording) %>" />
    <meta property="og:image"           content="<%= facebook_image_for_claimed_recording(@claimed_recording) %>" />
    <meta property="og:image:width"     content="<%= facebook_image_size_for_claimed_recording(@claimed_recording) %>" />
    <meta property="og:image:height"    content="<%= facebook_image_size_for_claimed_recording(@claimed_recording) %>" />
    <meta property="og:type"            content="website" />

    <meta name="twitter:card"           content="summary">
    <meta name="twitter:site"           content="@jamkazam">
    <meta name="twitter:title"          content="<%= title_for_claimed_recording(@claimed_recording) %>" />
    <meta name="twitter:description"    content="<%= description_for_claimed_recording(@claimed_recording) %>" />
<% end %>

<div class="recordings-page">
<% if !@claimed_recording.recording.deleted && (@claimed_recording.is_public || @claimed_recording.recording.has_access?(current_user)) %>
<div class="landing-band">
  <% unless @claimed_recording.recording.band.blank? %>
    <div class="landing-avatar">
      <% unless @claimed_recording.recording.band.photo_url.blank? %>
        <%= image_tag "#{@claimed_recording.recording.band.photo_url}", {:alt => ""} %>
      <% else %>
        <%= image_tag "shared/avatar_generic_band.png", {:alt => ""} %>
      <% end %>
    </div>
    <%= @claimed_recording.recording.band.name %>
  <% else %>
    <div class="landing-avatar">
      <% unless @claimed_recording.recording.owner.photo_url.blank? %>
        <%= image_tag "#{@claimed_recording.recording.owner.photo_url}", {:alt => ""} %>
      <% else %>
        <%= image_tag "shared/avatar_generic.png", {:alt => ""} %>
      <% end %>
    </div>
    <%= @claimed_recording.recording.owner.name %>
  <% end %>
</div>

<div class="landing-details">
  <div class="left f20 orange"><strong>RECORDING</strong></div>
  <div class="right f14 grey"><%= timeago(@claimed_recording.recording.created_at) %></div>
  <br clear="all" /><br />
  <h2 class="left"><%= @claimed_recording.name %></h2>
  <div class="right">
    <a id="btnLike"><%= image_tag "content/icon_like.png", {:width => 12, :height => 12, :alt => ""} %>&nbsp;LIKE</a>&nbsp;&nbsp;&nbsp;
    <a id="btnShare"><%= image_tag "content/icon_share.png", {:width => 13, :height => 15, :alt => ""} %>&nbsp;SHARE</a>
  </div>
  <br clear="all" /><%= @claimed_recording.description %><br /><br />
  <div class="w100">
    <div class="recording-controls <%= @claimed_recording.has_mix? ? 'has-mix' : 'no-mix' %>">
      <a class="play-button left">
        <%= image_tag "content/icon_playbutton.png", {:id => "imgPlayPause", :width => 20, :height => 20, :alt => ""} %>
        <% if @claimed_recording.has_mix? %>
          <audio controls preload="none" style="display:none;">
            <source src="<%= claimed_recording_download_url(@claimed_recording.id, 'mp3') %>" type="audio/mpeg">
            <source src="<%= claimed_recording_download_url(@claimed_recording.id, 'ogg') %>" type="audio/ogg">
          </audio>
        <% end %>
      </a>
      <div class="recording-status">
        <span class="status-text">STILL MIXING</span>
        <div class="recording-duration">
          <%= recording_duration(@claimed_recording.recording) %>
        </div>
      </div>
      <div class="recording-position">
        <div class="recording-time">0:00</div>
        <div class="recording-playback">
          <div class="recording-slider"><%= image_tag "content/slider_playcontrols.png", {:width => 5, :height => 16, :alt => ""} %></div>
        </div>
        <div id="recordingDuration" class="recording-time"></div>
      </div>
      <div class="recording-current">0:00</div>
    </div>
    <div class="left white"><%= recording_genre(@claimed_recording.recording) %></div>
    <div class="right white">
      <span id="spnPlayCount"><%= @claimed_recording.recording.play_count %></span>
      <%= image_tag "content/icon_arrow.png", {:width => 7, :height => 12, :align => "absmiddle", :alt => ""} %>&nbsp;&nbsp;&nbsp;&nbsp;
      <span id="spnCommentCount"><%= @claimed_recording.recording.comment_count %></span>
      <%= image_tag "content/icon_comment.png", {:width => 13, :height => 12, :align => "absmiddle", :alt => ""} %>&nbsp;&nbsp;&nbsp;&nbsp;
      <span id="spnLikeCount"><%= @claimed_recording.recording.like_count %></span>
      <%= image_tag "content/icon_like.png", {:width => 12, :height => 12, :align => "absmiddle", :alt => ""} %>
    </div>
  </div>
  <br clear="all" /><br />
  <%= render :partial => "shared/track_details", :locals => {:tracks => @claimed_recording.recording.grouped_tracks} %>
</div>

  <% else %>
    <div class="left f20 orange"><strong>RECORDING NOT FOUND</strong></div>
  <% end %>
</div>

<% if !@claimed_recording.recording.deleted && (@claimed_recording.is_public || @claimed_recording.recording.has_access?(current_user)) %>
  <% if signed_in? %>
    <% unless @claimed_recording.recording.band.nil? %>
      <%= render :partial => "shared/landing_sidebar", :locals => {:user => @claimed_recording.recording.band, :recent_history => @claimed_recording.recording.band.recent_history(nil, @claimed_recording.id)} %>
    <% else %>
      <%= render :partial => "shared/landing_sidebar", :locals => {:user => @claimed_recording.recording.owner, :recent_history => @claimed_recording.recording.owner.recent_history(nil, @claimed_recording.id)} %>
    <% end %>
  <% else %>
    <%= render :partial => "shared/cta_sidebar" %>
  <% end %>

  <% content_for :after_black_bar do %>
    <br />
    <%= render :partial => "shared/comments", :locals => {:comments => @claimed_recording.recording.comments, :id => "txtRecordingComment", :info_page => false} %>
  <% end %>

  <% content_for :extra_js do %>
      <script type="text/javascript">
        $(function () {
            var showRecording = new JK.ShowRecording(JK.app);
            showRecording.initialize("<%= @claimed_recording.id %>", "<%= @claimed_recording.recording_id %>");
        });
      </script>
  <% end %>
<% end %>

