mirror of
https://github.com/YGGverse/YGGtracker.git
synced 2026-03-31 17:15:38 +00:00
replace bencode library to rhilip/bencode, fix files tree builder #11
This commit is contained in:
parent
387acb59b6
commit
86e1455c6b
9 changed files with 175 additions and 130 deletions
|
|
@ -1,3 +1,24 @@
|
|||
{% macro recursive_file_tree(tree) %}
|
||||
{% import _self as self %}
|
||||
{% for key, value in tree %}
|
||||
{% if value is iterable %}
|
||||
<div class="padding-l-8-px cursor-default">
|
||||
<div class="padding-y-4-px">
|
||||
{{ key }}
|
||||
</div>
|
||||
{{ self.recursive_file_tree(value) }}
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="padding-y-4-px padding-l-8-px background-color-hover-night-light cursor-default">
|
||||
{{ key }}
|
||||
<div class="float-right padding-x-8-px">
|
||||
{{ value | format_bytes }}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endmacro %}
|
||||
{% from _self import recursive_file_tree %}
|
||||
{% extends 'default/layout.html.twig' %}
|
||||
{% block title %}{{ 'Torrent'|trans }} #{{ torrent.id }} - {{ name }}{% endblock %}
|
||||
{% block main_content %}
|
||||
|
|
@ -24,7 +45,7 @@
|
|||
</div>
|
||||
<table class="width-100">
|
||||
<tbody>
|
||||
{% if file.info.name is defined %}
|
||||
{% if file.name %}
|
||||
<tr>
|
||||
<td class="padding-y-8-px border-bottom-default text-right" colspan="2">
|
||||
{{ 'Name'|trans }}
|
||||
|
|
@ -32,11 +53,11 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td class="padding-t-16-px font-size-12" colspan="2">
|
||||
{{ file.info.name }}
|
||||
{{ file.name }}
|
||||
</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% if file['creation date'] is defined %}
|
||||
{% if file.created %}
|
||||
<tr>
|
||||
<td class="padding-y-8-px border-bottom-default text-right" colspan="2">
|
||||
{{ 'Created'|trans }}
|
||||
|
|
@ -44,7 +65,31 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td class="padding-t-16-px font-size-12" colspan="2">
|
||||
{{ file['creation date'] | format_date }}
|
||||
{{ file.created | format_date }}
|
||||
</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% if file.hash.v1 %}
|
||||
<tr>
|
||||
<td class="padding-y-8-px border-bottom-default text-right" colspan="2">
|
||||
{{ 'Info hash v1'|trans }}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="padding-t-16-px font-size-12" colspan="2">
|
||||
{{ file.hash.v1 }}
|
||||
</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% if file.hash.v2 %}
|
||||
<tr>
|
||||
<td class="padding-y-8-px border-bottom-default text-right" colspan="2">
|
||||
{{ 'Info hash v2'|trans }}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="padding-t-16-px font-size-12" colspan="2">
|
||||
{{ file.hash.v2 }}
|
||||
</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
|
|
@ -60,18 +105,6 @@
|
|||
</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% if file.encoding is defined %}
|
||||
<tr>
|
||||
<td class="padding-y-8-px border-bottom-default text-right" colspan="2">
|
||||
{{ 'Encoding'|trans }}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="padding-t-16-px font-size-12" colspan="2">
|
||||
{{ file.encoding }}
|
||||
</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% if file.comment is defined %}
|
||||
<tr>
|
||||
<td class="padding-y-8-px border-bottom-default text-right" colspan="2">
|
||||
|
|
@ -89,29 +122,13 @@
|
|||
{{ 'Files'|trans }}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="padding-y-4-px font-size-12" colspan="2">
|
||||
<pre>/..</pre>
|
||||
</td>
|
||||
</tr>
|
||||
{% for info in file.info.files %}
|
||||
{% for tree in file.tree %}
|
||||
<tr>
|
||||
<td class="padding-y-4-px font-size-12">
|
||||
{% for path in info.path %}
|
||||
<pre>../{{ path }}</pre>
|
||||
{% endfor %}
|
||||
</td>
|
||||
<td class="padding-y-4-px font-size-12 text-right">
|
||||
<pre>{{ info.length | format_bytes }}</pre>
|
||||
<td class="padding-y-16-px" colspan="2">
|
||||
{{ recursive_file_tree(tree) }}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
<tr>
|
||||
<td colspan="2"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="padding-y-8-px border-bottom-default text-right" colspan="2">
|
||||
{{ 'Trackers'|trans }}
|
||||
|
|
@ -127,6 +144,7 @@
|
|||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
{#
|
||||
<tr>
|
||||
<td class="padding-y-4-px font-size-12">
|
||||
{{ file.announce }}
|
||||
|
|
@ -141,14 +159,15 @@
|
|||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% for announces in file['announce-list'] %}
|
||||
{% for announce in announces %}
|
||||
#}
|
||||
{% for announces in trackers %}
|
||||
{% for tracker in announces %}
|
||||
<tr>
|
||||
<td class="padding-y-4-px font-size-12">
|
||||
{{ announce }}
|
||||
{{ tracker }}
|
||||
</td>
|
||||
<td class="padding-y-4-px text-right">
|
||||
{% if announce not in trackers %}
|
||||
{% if tracker not in trackers %}
|
||||
<span title="{{ 'Blocked'|trans }}">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" fill="currentColor" viewBox="0 0 16 16">
|
||||
<path d="M1.5 1.5A.5.5 0 0 1 2 1h12a.5.5 0 0 1 .5.5v2a.5.5 0 0 1-.128.334L10 8.692V13.5a.5.5 0 0 1-.342.474l-3 1A.5.5 0 0 1 6 14.5V8.692L1.628 3.834A.5.5 0 0 1 1.5 3.5v-2z"/>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue