<div id="recently_added" class="module" data-module="recently_added" data-episode_offset="{{ episode_offset }}">

  <div class="module_settings"><span>Settings</span></div>
  <div class="module_remove"><span>Remove</span></div>

  <h2>Recently Added Episodes</h2>

  {% if recently_added_episodes %}
    {% if using_db %}
      <p class="problem">There was a problem connecting to the XBMC server. Showing last known results.</p>
    {% endif %}

    {% if compact_view %}
    <div class="compact">
    {% endif %}
      <ul class="episodes listfix">
        {% for episode in recently_added_episodes %}
          {% if using_db %}
            <li title="{{ episode.showtitle }} - {{ episode.title }}" {% if episode.playcount %} class="watched"{% endif %}>
          {% elif view_info %}
            <li id="info_episode" data-episodeid="{{ episode.episodeid }}" title="Information for {{ episode.showtitle }} - {{ episode.title }}" {% if episode.playcount %} class="watched"{% endif %}>
          {% else %}
            <li id="play_episode" data-episodeid="{{ episode.episodeid }}" title="Play {{ episode.showtitle }} - {{ episode.title }}" {% if episode.playcount %} class="watched"{% endif %}>
          {% endif %}

            {% if episode.thumbnail %}
              <div class="thumbnail">
                <img src="{{ episode.thumbnail }}" alt="">
              </div>
            {% endif %}

            <div class="inner">
              {% if compact_view %}
              <p><b>{{ episode.showtitle }}</b> <span class="extra">Season {{ "%02d"|format(episode.season) }}, Episode {{ "%02d"|format(episode.episode) }}</span></p>
              {% else %}
              <h3 class="first">{{ episode.showtitle }}</h3>
              <p class="second">Season {{ episode.season }}, Episode {{ episode.episode }}</p>
              <p class="third">"{{ episode.title }}"</p>
              {% endif %}
            </div>
          </li>
        {% endfor %}
      </ul>

    {% if compact_view %}
    </div>
    {% endif %}

    <div class="clearfix">
      {% if episode_offset + recently_added_episodes|length < total_episodes %}
        <a class="view_older" title="Older">&raquo;</a>
      {% endif %}
      {% if episode_offset > 0 %}
        <a class="view_newer" title="Newer">&laquo;</a>
      {% endif %}
    </div>

  {% else %}
    <p class="problem">There was a problem connecting to the XBMC server.</p>
  {% endif %}
</div>
