aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjwansek <eddie.atten.ea29@gmail.com>2022-08-25 14:19:10 +0000
committerjwansek <eddie.atten.ea29@gmail.com>2022-08-25 14:19:10 +0000
commit787a9421d1a61229b838dcbf17734c42172800f7 (patch)
tree014297140526a59232dbc5a23e5d89e374289a59
parenta86a5fa2f075ec455aa5101acff9c3fda290294d (diff)
downloadboymoder.blog-787a9421d1a61229b838dcbf17734c42172800f7.tar.gz
boymoder.blog-787a9421d1a61229b838dcbf17734c42172800f7.zip
Renamed template files, added active for torrents
-rwxr-xr-xapp.py21
-rwxr-xr-xservices.py11
-rwxr-xr-xtemplates/discord.html.j2 (renamed from templates/discord.jinja)2
-rwxr-xr-xtemplates/index.html.j2 (renamed from templates/index.jinja)2
-rwxr-xr-xtemplates/isocd.html.j2 (renamed from templates/isocd.jinja)2
-rwxr-xr-xtemplates/isocd_confirmation.html.j2 (renamed from templates/isocd_confirmation.jinja)2
-rwxr-xr-xtemplates/nhdl.html.j2 (renamed from templates/nhdl.jinja)2
-rwxr-xr-xtemplates/random.html.j2 (renamed from templates/random.jinja)2
-rwxr-xr-xtemplates/services.html.j2 (renamed from templates/services.jinja)10
-rwxr-xr-xtemplates/template.html.j2 (renamed from templates/template.jinja)0
-rwxr-xr-xtemplates/thought.html.j2 (renamed from templates/thought.jinja)2
-rwxr-xr-xtemplates/thoughts.html.j2 (renamed from templates/thoughts.jinja)2
12 files changed, 30 insertions, 28 deletions
diff --git a/app.py b/app.py
index bc99d03..e06ac8e 100755
--- a/app.py
+++ b/app.py
@@ -55,7 +55,7 @@ def index():
with database.Database() as db:
with open(os.path.join("static", "index.md"), "r") as f:
return flask.render_template(
- "index.jinja",
+ "index.html.j2",
**get_template_items("eden's site :3", db),
markdown = parser.parse_text(f.read())[0],
featured_thoughts = db.get_featured_thoughts(),
@@ -71,7 +71,7 @@ def robots():
def discord():
with database.Database() as db:
return flask.render_template(
- "discord.jinja",
+ "discord.html.j2",
**get_template_items("discord", db),
discord = CONFIG["discord"]["username"]
)
@@ -80,10 +80,9 @@ def discord():
def serve_services():
with database.Database() as db:
return flask.render_template(
- "services.jinja",
+ "services.html.j2",
**get_template_items("services", db),
docker = services.get_docker_stats(),
- qbit = services.get_qbit_stats(),
trans = services.get_trans_stats(),
pihole = services.get_pihole_stats()
)
@@ -99,7 +98,7 @@ def get_thought():
flask.abort(404)
return
return flask.render_template(
- "thought.jinja",
+ "thought.html.j2",
**get_template_items(title, db),
md_html = parsed,
contents_html = headers,
@@ -121,7 +120,7 @@ def get_thoughts():
tree[category].append((id_, title, str(dt)))
return flask.render_template(
- "thoughts.jinja",
+ "thoughts.html.j2",
**get_template_items("thoughts", db),
tree = tree
)
@@ -155,7 +154,7 @@ def serve_nhdl():
except (KeyError, ValueError):
return flask.render_template(
- "nhdl.jinja",
+ "nhdl.html.j2",
**get_template_items("Hentai Downloader", db)
)
@@ -163,7 +162,7 @@ def serve_nhdl():
def serve_iso_form():
with database.Database() as db:
return flask.render_template(
- "isocd.jinja",
+ "isocd.html.j2",
**get_template_items("Get a GNU/Linux install CD", db),
iso_options = db.get_iso_cd_options()
)
@@ -188,7 +187,7 @@ def get_iso_cd():
id_ = db.append_cd_orders(**req)
print(id_)
return flask.render_template(
- "isocd_confirmation.jinja",
+ "isocd_confirmation.html.j2",
**get_template_items("Get a GNU/Linux install CD", db),
email = req["email"],
req = req,
@@ -210,7 +209,7 @@ def serve_random():
with database.Database() as db:
return flask.render_template(
- "random.jinja",
+ "random.html.j2",
**get_template_items("random image", db),
sbi = sbi,
localimg = "/img/random.jpg?seed=%i" % random.randint(0, 9999)
@@ -222,7 +221,7 @@ def preview():
if "PREVIEW" in os.environ:
with database.Database() as db:
return flask.render_template_string(
- '{% extends "template.jinja" %}\n{% block content %}\n' + os.environ["PREVIEW"] + '\n{% endblock %}',
+ '{% extends "template.html.j2" %}\n{% block content %}\n' + os.environ["PREVIEW"] + '\n{% endblock %}',
**get_template_items(os.environ["PREVIEW_TITLE"], db),
thought = True,
dt = "preview rendered: " + str(datetime.datetime.now()),
diff --git a/services.py b/services.py
index 681c82a..3680216 100755
--- a/services.py
+++ b/services.py
@@ -70,6 +70,7 @@ def get_docker_stats():
for container in client.containers.list(all = True)
}
+# currently unused
@timeout
def get_qbit_stats():
numtorrents = 0
@@ -98,11 +99,13 @@ def get_trans_stats():
# password = app.CONFIG["transmission"]["passwd"]
)
stats = json.loads(client.session.stats().json())
+ active_for = datetime.timedelta(seconds = stats["arguments"]["cumulative_stats"]["seconds_active"])
return {
"bytes_dl": humanbytes(stats["arguments"]["cumulative_stats"]["downloaded_bytes"]),
"bytes_up": humanbytes(stats["arguments"]["cumulative_stats"]["uploaded_bytes"]),
"num": stats["arguments"]["torrent_count"],
- "ratio": "%.3f" % (float(stats["arguments"]["cumulative_stats"]["uploaded_bytes"]) / float(stats["arguments"]["cumulative_stats"]["downloaded_bytes"]))
+ "ratio": "%.3f" % (float(stats["arguments"]["cumulative_stats"]["uploaded_bytes"]) / float(stats["arguments"]["cumulative_stats"]["downloaded_bytes"])),
+ "active_for": str(active_for)
}
@timeout
@@ -228,8 +231,4 @@ def link_deleted(url):
return text[text.find("<title>") + 7 : text.find("</title>")] in ["Error | nitter", "イラストコミュニケーションサービス[pixiv]"]
if __name__ == "__main__":
- sbi = get_random_image(["lio_fotia", "promare"])
- print(sbi.tags)
- print(sbi.source)
- print(sbi.imurl)
- print(sbi.remove_tag("promare"))
+ print(get_trans_stats())
diff --git a/templates/discord.jinja b/templates/discord.html.j2
index 73d6ea3..597fb4b 100755
--- a/templates/discord.jinja
+++ b/templates/discord.html.j2
@@ -1,4 +1,4 @@
-{% extends "template.jinja" %}
+{% extends "template.html.j2" %}
{% block content %}
<p>You can contact me on discord (telegram preferred):</p>
<h1>{{discord}}</h1>
diff --git a/templates/index.jinja b/templates/index.html.j2
index 5a2acb7..31c6207 100755
--- a/templates/index.jinja
+++ b/templates/index.html.j2
@@ -1,4 +1,4 @@
-{% extends "template.jinja" %}
+{% extends "template.html.j2" %}
{% block content %}
<aside>
<section id="recent_thoughts">
diff --git a/templates/isocd.jinja b/templates/isocd.html.j2
index ee8ac61..3c532c0 100755
--- a/templates/isocd.jinja
+++ b/templates/isocd.html.j2
@@ -1,4 +1,4 @@
-{% extends "template.jinja" %}
+{% extends "template.html.j2" %}
{% block content %}
<p>As discussed <a href="https://nitter.eda.gay/estrogenizedboy/status/1490322471215636480#m">here</a>, I will post a GNU/Linux install CD to you for free (provided you live in the United Kingdom). Just fill out the form below:</p>
<form action="/getisocd" method="POST">
diff --git a/templates/isocd_confirmation.jinja b/templates/isocd_confirmation.html.j2
index bed09d6..81045a8 100755
--- a/templates/isocd_confirmation.jinja
+++ b/templates/isocd_confirmation.html.j2
@@ -1,4 +1,4 @@
-{% extends "template.jinja" %}
+{% extends "template.html.j2" %}
{% block content %}
<p>Your order has been placed. Expect a confirmation email to {{ email }} when I can be bothered to sort it out.</p>
<br>
diff --git a/templates/nhdl.jinja b/templates/nhdl.html.j2
index a4e4d56..5ab62c2 100755
--- a/templates/nhdl.jinja
+++ b/templates/nhdl.html.j2
@@ -1,4 +1,4 @@
-{% extends "template.jinja" %}
+{% extends "template.html.j2" %}
{% block content %}
<form action="/nhdlredirect" method="POST">
<label for="nhentai">nHentai.net number:</label>
diff --git a/templates/random.jinja b/templates/random.html.j2
index 1bc7eb8..76b433b 100755
--- a/templates/random.jinja
+++ b/templates/random.html.j2
@@ -1,4 +1,4 @@
-{% extends "template.jinja" %}
+{% extends "template.html.j2" %}
{% block content %}
<aside id="tags">
<h1>current search tags: (click to remove)</h1>
diff --git a/templates/services.jinja b/templates/services.html.j2
index 310d148..35d47ae 100755
--- a/templates/services.jinja
+++ b/templates/services.html.j2
@@ -1,4 +1,4 @@
-{% extends "template.jinja" %}
+{% extends "template.html.j2" %}
{% block content %}
<article id=statusTables>
<section id=docker>
@@ -42,13 +42,17 @@
<td>ratio</td>
<td>{{trans["ratio"]}}</td>
</tr>
+ <tr>
+ <td>active for</td>
+ <td>{{trans["active_for"]}}</td>
+ </tr>
</table>
{% endif %}
<br>
+ <a href="https://nitter.eda.gay/estrogenizedboy/status/1520464127516422144#m">statistics of my two old torrent clients which were shut down recently ;_;</a>
+ <br>
<img src="https://nitter.eda.gay/pic/media%2FFRnF3kcXwAAHE6v.png%3Fname%3Dorig">
<img src="https://nitter.eda.gay/pic/media%2FFRnF6I0WUAEq4FD.png%3Fname%3Dorig">
- <br>
- <a href="https://nitter.eda.gay/estrogenizedboy/status/1520464127516422144#m">statistics of my two old torrent clients which were shut down recently ;_;</a>
</section>
<section id=pihole>
<h2>pihole</h2>
diff --git a/templates/template.jinja b/templates/template.html.j2
index 2fd86f9..2fd86f9 100755
--- a/templates/template.jinja
+++ b/templates/template.html.j2
diff --git a/templates/thought.jinja b/templates/thought.html.j2
index df6fe7a..2a5b519 100755
--- a/templates/thought.jinja
+++ b/templates/thought.html.j2
@@ -1,4 +1,4 @@
-{% extends "template.jinja" %}
+{% extends "template.html.j2" %}
{% block content %}
<aside>
<h4>{{ dt }}</h4>
diff --git a/templates/thoughts.jinja b/templates/thoughts.html.j2
index 0a1e4de..bf06f57 100755
--- a/templates/thoughts.jinja
+++ b/templates/thoughts.html.j2
@@ -1,4 +1,4 @@
-{% extends "template.jinja" %}
+{% extends "template.html.j2" %}
{% block content %}
{% for category_name, thoughts in tree.items() %}
<h3 id="{{category_name.replace(' ', '_')}}">{{category_name}}</h3>