<span class="label label-default">{{ format_size(file.size) }}</span>
<div class="btn-group">
- <a class="btn btn-default btn-xs" href="{{ file.magnet_link }}" title="{{ _("Magnet Link") }}">
- <span class="glyphicon glyphicon-magnet"></span>
- </a>
- <a class="btn btn-default btn-xs" href="http://tracker.ipfire.org/{{ file.torrent_hash }}/download" title="{{ _("Torrent Download") }}">
- <span class="glyphicon glyphicon-download-alt"></span>
- </a>
+ {% if file.magnet_link %}
+ <a class="btn btn-default btn-xs" href="{{ file.magnet_link }}" title="{{ _("Magnet Link") }}">
+ <span class="glyphicon glyphicon-magnet"></span>
+ </a>
+ {% end %}
+
+ {% if file.torrent_url %}
+ <a class="btn btn-default btn-xs" href="{{ file.torrent_url }}" title="{{ _("Torrent Download") }}">
+ <span class="glyphicon glyphicon-download-alt"></span>
+ </a>
+ {% end %}
</div>
</div>
{% end %}
def torrent_hash(self):
return self.data.get("torrent_hash", None)
+ @property
+ def torrent_url(self):
+ if self.torrent_hash:
+ return "%s.torrent" % self.url
+
@property
def magnet_link(self):
# Don't return anything if we have no torrent hash.