Finalize detail page

This commit is contained in:
sqozz 2017-12-29 08:42:22 +01:00
parent e8b46e9763
commit 29300c09b5
4 changed files with 25 additions and 10 deletions

View File

@ -170,6 +170,7 @@ class Metadata():
self.announce_url = self.bcoded.get(b'info', dict()).get(b'', "") self.announce_url = self.bcoded.get(b'info', dict()).get(b'', "")
self.source = self.bcoded.get(b'info', dict()).get(b'source', b"") self.source = self.bcoded.get(b'info', dict()).get(b'source', b"")
self.torrentsize = ((len(self.bcoded.get(b'info', dict()).get(b'pieces', "")) / 20) * self.bcoded.get(b'info', dict()).get(b'piece length')) self.torrentsize = ((len(self.bcoded.get(b'info', dict()).get(b'pieces', "")) / 20) * self.bcoded.get(b'info', dict()).get(b'piece length'))
self.torrentsize_human = size(self.torrentsize)
self.name = self.bcoded.get(b'info', dict()).get(b'name', b"") self.name = self.bcoded.get(b'info', dict()).get(b'name', b"")
self.private = self.bcoded.get(b'info', dict()).get(b'private', b"") self.private = self.bcoded.get(b'info', dict()).get(b'private', b"")
@ -228,6 +229,7 @@ class TorrentFile():
self.description = (base64.b64decode(res["description"])).decode() self.description = (base64.b64decode(res["description"])).decode()
self.audioquality_description = (base64.b64decode(res["audioquality_description"])).decode() self.audioquality_description = (base64.b64decode(res["audioquality_description"])).decode()
self.videoquality_description = (base64.b64decode(res["videoquality_description"])).decode() self.videoquality_description = (base64.b64decode(res["videoquality_description"])).decode()
self.metadata = Metadata(self.fileid)
@babel.localeselector @babel.localeselector
def get_locale(): def get_locale():

View File

@ -1,3 +1,11 @@
#torrent a {
text-decoration: underline;
}
#torrent a:hover {
text-decoration: none;
}
h4 { h4 {
display: flex; display: flex;
justify-content: center; justify-content: center;
@ -13,14 +21,14 @@ h4 {
display: inline; display: inline;
} }
.detailrow :first-child { .detailrow > :first-child {
width: 30%; width: 30%;
font-size: 1.2em; font-size: 1.2em;
font-weight: bold; font-weight: bold;
float: left; float: left;
} }
.detailrow :last-child { .detailrow > :last-child {
display: flex; display: flex;
justify-content: right; justify-content: right;
width: 70%; width: 70%;

View File

@ -8,23 +8,28 @@ vim: ts=2 noexpandtab
<link href="{{ url_for("static", filename="css/details.css") }}" rel="stylesheet"> <link href="{{ url_for("static", filename="css/details.css") }}" rel="stylesheet">
<script src="{{ url_for("static", filename="js/main.js") }}"></script> <script src="{{ url_for("static", filename="js/main.js") }}"></script>
<div id="torrent" class="clearfix"> <div id="torrent" class="clearfix">
<h4>{{ torrent.name }}</h4> <h4>{{ torrent.category }} » {{ torrent.subcategory}} » {{ torrent.name }}</h4>
<div id="details" class="clearfix"> <div id="details" class="clearfix">
<div class="detailrow clearfix"> <div class="detailrow clearfix">
<div>Info Hash:</div> <div>.torrent-file:</div>
<div>{{ torrent.fileid }}</div> <div>
<a href="/download/{{ torrent.fileid }}">
{{ torrent.fileid }}
<span class="glyphicon glyphicon-save" aria-hidden="true"></span>
</a>
</div>
</div> </div>
<div class="detailrow clearfix"> <div class="detailrow clearfix">
<span>Name:</span> <span>Name:</span>
<span>{{ torrent.name }}</span> <span>{{ torrent.name }}</span>
</div> </div>
<div class="detailrow clearfix"> <div class="detailrow clearfix">
<span>Category:</span> <span>Size:</span>
<span>{{ torrent.category }}</span> <span>{{ torrent.metadata.torrentsize_human }}</span>
</div> </div>
<div class="detailrow clearfix"> <div class="detailrow clearfix">
<span>Subcategory:</span> <span>Date:</span>
<span>{{ torrent.subcategory }}</span> <span>{{ torrent.metadata.creation_date }}</span>
</div> </div>
<div class="detailrow clearfix"> <div class="detailrow clearfix">
<span>Description:</span> <span>Description:</span>

View File

@ -17,7 +17,7 @@ vim: ts=2 noexpandtab
</tr> </tr>
{% for result in results %} {% for result in results %}
<tr> <tr>
<td><a href="/download/{{ result[0] }}">{{ result[1] }}</a></td> <td><a href="/details?h={{ result[0] }}">{{ result[1] }}</a></td>
<td>{{ result[2] }}</td> <td>{{ result[2] }}</td>
<td>{{ _("N/A") }}</td> <td>{{ _("N/A") }}</td>
<td>{{ _("N/A") }}</td> <td>{{ _("N/A") }}</td>