same as last commit

master
Aevann1 2022-09-25 06:22:33 +02:00
parent 4212cfa0b2
commit 230b71c19b
2 changed files with 27 additions and 10 deletions

View File

@ -460,15 +460,32 @@ if SITE == 'pcmemes.net':
t = offline_regex.search(text) t = offline_regex.search(text)
y = offline_details_regex.search(text) y = offline_details_regex.search(text)
days = y.group(0) quantity = y.group(0)
modifier = y.group(1) unit = y.group(1)
if modifier == 'weken': modifier = 7
elif modifier == 'maand': modifier = 30 if unit == 'minuten':
elif modifier == 'jaar': modifier = 365 unit = 'minute'
days *= modifier modifier = 1
if unit == 'uur':
unit = 'hour'
modifier = 60
if unit == 'weken':
unit = 'week'
modifier = 10080
elif unit == 'maand':
unit = 'month'
modifier = 43800
elif unit == 'jaar':
unit = 'year'
modifier = 525600
minutes = quantity * modifier
if quantity > 1: unit += 's'
actual = quantity + ' ' + unit
try: try:
return_val = (False, (id, req.url.rstrip('/live'), t.group(2), t.group(1), days, y.group(2))) return_val = (False, (id, req.url.rstrip('/live'), t.group(2), t.group(1), minutes, actual, y.group(2)))
except: except:
print(id, flush=True) print(id, flush=True)
return_val = None return_val = None

View File

@ -74,12 +74,12 @@
<div class="overflow-x-auto"> <div class="overflow-x-auto">
<table class="table table-striped mb-5"> <table class="table table-striped mb-5">
<tbody> <tbody>
{% for id, link, thumb, name in offline %} {% for id, link, thumb, name, minutes, actual, views in offline %}
<tr onclick="go_to(event,'{{link}}')"> <tr onclick="go_to(event,'{{link}}')">
<td width="48"><img loading="lazy" class="thumb" src="{{thumb}}" alt="{{name}} thumbnail" referrerpolicy="no-referrer" width="48"></td> <td width="48"><img loading="lazy" class="thumb" src="{{thumb}}" alt="{{name}} thumbnail" referrerpolicy="no-referrer" width="48"></td>
<td>{{name}}</td> <td>{{name}}</td>
<td></td> <td>{{actual}} ago</td>
<td></td> <td>{{views}} views</td>
{% if v and v.admin_level > 1 %} {% if v and v.admin_level > 1 %}
<td> <td>
<form action="/live/remove" method="post"> <form action="/live/remove" method="post">