{% extends "couchpotato-base.html" %}

{% block couchpotato_content %}

<div id="cp_content" {% if compact_view %}class="compact"{%endif%}>
  {% for item in couchpotato %}
    <div class="movie {{ 'releases' if item.releases }}" id="{{item.library.identifier}}" data-cpid="{{item.id}}">
      <div class="{{item.releases.status}}"></div>
      {% if not compact_view %}
      <div class="image">
        <img class="poster" 
        src="
          {% if item.library.files[0] %}
            {{item.library.files[0].path|cp_img}}
          {% else %}
            {{ url_for('static', filename='images/poster.png') }}
          {% endif %}"
        />
        <span class="profile" title="CouchPotato quality profile">{{item.profile.label}}</span>
      </div>
      {%endif%}
      <span class="title">{{item.library.titles[0].title}} ({{item.library.year}})</span>
      {% if item.library.rating %}<span class="rating text"><h3>Rating: {{item.library.rating}}</h3></span>{% endif %}
      <span class="tagline">{% if item.library.tagline %}{{item.library.tagline}}{% else %}{{item.library.plot|truncate(150)}}{% endif %}</span>
      {%if compact_view %}<span class="quality">{{item.profile.label}}</span>{%endif%}
    </div>
    <div class="options {{item.library.identifier}}" data-imdbid="{{item.library.identifier}}" data-cpid="{{item.library_id}}">
      <img class="delete left_opt" src="{{ url_for('static', filename='images/no.png')}}"/>
      <img class="search left_opt" src="{{ url_for('static', filename='images/search.png')}}"/>
      <a href="http://imdb.com/title/{{item.library.identifier}}" target="_blank">
        <img class="left_opt" src="{{ url_for('static', filename='images/imdb.png')}}" alt="" />
      </a>
      {% if item.releases %}
        <div class="release_list">
          <ul>
            {% for release in item.releases %}
              <li
                data-id="{{ release.id }}"
                data-imdbid="{{item.library.identifier}}"
                title="Provider: {{ release.info.provider }}&#13;Size: {{ release.info.size }}MB"
              >
                <a href="{{ release.info.detail_url }}" target="_blank">
                  {{release.info.name}}
                </a>
                <img
                  id="download"
                  class="release_btn"
                  src="{{ url_for('static', filename='images/download.png') }}"
                  data-action="download"
                />
                <img
                  id="delete"
                  class="release_btn"
                  src="{{ url_for('static', filename='images/no.png') }}"
                  data-action="delete"
                />
              </li>
            {% endfor %}
          </ul>
        </div>
      {% endif %}
    </div>
  {% endfor %}
</div>

{% endblock %}
