Merge branch 'frost' of https://github.com/Aevann1/rDrama into frost

master
Aevann1 2022-09-22 05:24:43 +00:00
commit b462fac9b7
8 changed files with 137 additions and 13 deletions

View File

@ -3148,13 +3148,6 @@ small, .small {
-webkit-animation: bounce-bot .7s 1 0s;
}
@keyframes upmarsey
{
0% { top: -15px; }
100% { top: 0px; }
}
@keyframes bounce-top {
20% {
transform: translateY(-9px);
@ -6271,3 +6264,13 @@ div.markdown {
.text-brown {
color: #433722;
}
.live-circle {
animation: blinker 1s infinite;
}
@keyframes blinker {
from { color: var(--gray-200) }
50% { color:red }
to { color: var(--gray-200) }
}

View File

@ -211,6 +211,7 @@
{"name":"marseyflagus","class":"Marsey Flags"},
{"name":"marseyflagvietnam","class":"Marsey Flags"},
{"name":"patyl","class":"Platy","tags":["quper","platypus","mersya","wombiezolf","doodle"]},
{"name":"platyaboriginal","class":"Platy"},
{"name":"platyanime","class":"Platy"},
{"name":"platybanana","class":"Platy"},

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

View File

@ -6,6 +6,7 @@ from files.helpers.roulette import spin_roulette_wheel
from files.helpers.get import *
from files.helpers.actions import *
from files.classes import *
from files.__main__ import cache
import files.helpers.lottery as lottery
import files.helpers.offsitementions as offsitementions
@ -29,16 +30,19 @@ def cron(every_5m, every_1h, every_1d, every_1mo):
if every_5m:
lottery.check_if_end_lottery_task()
spin_roulette_wheel()
g.db.commit()
offsitementions.offsite_mentions_task()
if SITE_NAME == 'PCM':
cache.delete_memoized(route_static.live_cached)
route_static.live_cached()
if every_1h:
awards.award_timers_bots_task()
if every_1d:
stats.generate_charts_task(SITE)
route_static.stats_cached()
sub_inactive_purge_task()
cache.delete_memoized(route_static.stats_cached)
route_static.stats_cached()
if every_1mo:
if KOFI_LINK: give_monthly_marseybux_task_kofi()

View File

@ -434,3 +434,65 @@ if not os.path.exists(f'files/templates/donate_{SITE_NAME}.html'):
@auth_required
def donate(v):
return render_template(f'donate_{SITE_NAME}.html', v=v)
if SITE_NAME == 'PCM':
streamers = (
'UCJrqlqe8DBZsfdMu7gGrVRA',
'UCDDrY00FPYwLp9VqRhWiDgg',
'UCdBzv8yzRgvnxV1M95qOsNA',
'UCvRP7CKUHWTJamANqg8NCTQ',
'UCPtDuLhreIEcjJr7WWaNaUw',
'UCS8gM5S889oBPyN6K07ZC6A',
'UCUn24NHjc8asGiYet1P9h5Q',
'UCqdJpVkTPem_iKcoVqoZtAg',
'UCtcVe3ucfS-AZVcNc2GabPw',
'UCDk0PdOMRfknGhVE8R-S_DQ',
'UC0UFeYG5aSGZT2e8lOjQ7oA',
'UC1yC2i8t5ivhh5RsRpGWMlw',
'UCP_YnD-BO8ctnKgUW89Si6Q',
'UCoxFxZirbfLvy9tres71eSA',
'UClf1Wfw54YBjJNlX3NjSOPA',
'UC8X10knH1xD3PTeds8glyNw',
'UCgKTJAN-IrVyX-jIJ5INEhA',
'UCgjAbjJZgBCF3OVGkJV5kCw',
'UC7xWZT4HPMFYzFoijmH8POg',
'UCoBfUpZXvWjS995ZXCPxxVQ',
'UCoOh1fOZBN7uCc3qu-TTAJQ',
'UCo8wWQvRSoKL57vjv4vyXQw'
)
live_regex = re.compile('playerOverlayVideoDetailsRenderer":\{"title":\{"simpleText":"(.*?)"\},"subtitle":\{"runs":\[\{"text":"(.*?)"\},\{"text":""\},\{"text":"(.*?)"\}', flags=re.A)
live_thumb_regex = re.compile('\{"thumbnail":\{"thumbnails":\[\{"url":"(.*?)"', flags=re.A)
offline_regex = re.compile('","title":"(.*?)".*?"width":48,"height":48\},\{"url":"(.*?)"', flags=re.A)
@cache.memoize(timeout=86400)
def live_cached():
live = []
offline = []
for x in streamers:
url = f'https://www.youtube.com/channel/{x}/live'
req = requests.get(url, cookies={'CONSENT': 'YES+1'}, proxies=proxies)
txt = req.text
if '"videoDetails":{"videoId"' in txt:
t = live_thumb_regex.search(txt)
y = live_regex.search(txt)
try:
count = int(y.group(3))
live.append((req.url, t.group(1), y.group(2), y.group(1), count))
except:
offline.append((req.url, t.group(1), y.group(2)))
else:
y = offline_regex.search(txt)
try: offline.append((req.url, y.group(2), y.group(1)))
except: print(x)
live = sorted(live, key=lambda x: x[4], reverse=True)
return live, offline
@app.get('/live')
@app.get('/logged_out/live')
@auth_desired_with_logingate
def live(v):
return render_template(f'live.html', v=v, live=live_cached()[0], offline=live_cached()[1])

View File

@ -101,6 +101,10 @@
<a class="mobile-nav-icon d-md-none" onclick="location.reload()"><i class="fas fa-arrow-rotate-right align-middle text-gray-500 black"></i></a>
{% endif %}
{% if SITE_NAME == 'PCM' %}
<a class="mobile-nav-icon d-md-none" href="/live" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Live"><i class="fas fa-circle align-middle black live-circle"></i></a>
{% endif %}
{% if v %}
{% if v.notifications_count %}
<a class="mobile-nav-icon d-md-none" href="/notifications{% if v.notifications_do %}/{{v.notifications_do}}{% endif %}" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Notifications"><i class="notif-{{v.notifications_do}}-bell fas fa-bell align-middle" style="color: {{v.notifications_color}}"></i><span class="notif-count notif-{{v.notifications_do}} ml-1" style="padding-left: 4.5px;{% if v.notifications_do %}background:{{v.notifications_color}}{% endif %}">{{v.notifications_count}}</span></a>
@ -137,6 +141,12 @@
<div class="collapse navbar-collapse" id="navbarResponsive">
<ul class="navbar-nav ml-auto d-none d-md-flex">
{% if SITE_NAME == 'PCM' %}
<li class="nav-item d-flex align-items-center justify-content-center text-center mx-1">
<a class="nav-link" href="/live" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Live"><i class="fas fa-circle live-circle"></i></a>
</li>
{% endif %}
{% if v %}
{% if v.notifications_count %}
@ -151,7 +161,7 @@
{% if v.admin_level > 1 %}
<li class="nav-item d-flex align-items-center justify-content-center text-center mx-1">
<a class="nav-link" href="/admin" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Admin Tools"><i class="fas fa-crown{% if v.has_report_queue %} text-success{% endif %}"></i></a>
<a class="nav-link" href="/admin" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Admin Tools"><i class="fas fa-crown"></i></a>
</li>
{% endif %}

View File

@ -0,0 +1,44 @@
{% extends "default.html" %}
{% block title %}
<title>{{SITE_NAME}} - Live</title>
{% endblock %}
{% block content %}
<style>
tr:hover {
border: 2.5px solid var(--primary);
}
</style>
<h1 class="py-3"><i class="fas fa-circle mr-3" style="color:red"></i>Live</h1>
<div class="overflow-x-auto">
<table class="table table-striped mb-5">
<tbody>
{% for link, thumb, name, title, viewers in live %}
<tr onclick="window.open('{{link}}', '_blank')">
<td width="48"><img src="{{thumb}}" alt="{{name}} thumbnail" referrerpolicy="no-referrer" width="48"></td>
<td>{{name}}</td>
<td>{{title}}</td>
<td>{{viewers}}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<h1 class="py-3"><i class="fas fa-circle mr-3" style="color:gray"></i>Offline</h1>
<div class="overflow-x-auto">
<table class="table table-striped mb-5">
<tbody>
{% for link, thumb, name in offline %}
<tr onclick="window.open('{{link}}', '_blank')">
<td width="48"><img src="{{thumb}}" alt="{{name}} thumbnail" referrerpolicy="no-referrer" width="48"></td>
<td>{{name}}</td>
<td></td>
<td></td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endblock %}

View File

@ -1,6 +1,6 @@
{%-
set CACHE_VER = {
'css/main.css': 4033,
'css/main.css': 4034,
'css/catalog.css': 4007,
'css/4chan.css': 4007,
'css/classic.css': 4031,