diff --git a/files/assets/css/main.css b/files/assets/css/main.css index 6be4b3756..767600d1d 100644 --- a/files/assets/css/main.css +++ b/files/assets/css/main.css @@ -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); @@ -6270,4 +6263,14 @@ 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) } } \ No newline at end of file diff --git a/files/assets/emojis.json b/files/assets/emojis.json index 397e6237d..6f4bb0a8c 100644 --- a/files/assets/emojis.json +++ b/files/assets/emojis.json @@ -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"}, @@ -850,4 +851,4 @@ {"name":"kippy","class":"Misc"}, {"name":"onerat","class":"Misc"}, {"name":"gunt","class":"Misc"} -] +] \ No newline at end of file diff --git a/files/assets/images/emojis/patyl.webp b/files/assets/images/emojis/patyl.webp new file mode 100644 index 000000000..0c4c1e42e Binary files /dev/null and b/files/assets/images/emojis/patyl.webp differ diff --git a/files/helpers/cron.py b/files/helpers/cron.py index 5b22796ea..16a6b8fad 100644 --- a/files/helpers/cron.py +++ b/files/helpers/cron.py @@ -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() diff --git a/files/routes/static.py b/files/routes/static.py index 6f79af7aa..54dfb0c03 100644 --- a/files/routes/static.py +++ b/files/routes/static.py @@ -433,4 +433,66 @@ if not os.path.exists(f'files/templates/donate_{SITE_NAME}.html'): @app.get('/donate') @auth_required def donate(v): - return render_template(f'donate_{SITE_NAME}.html', v=v) \ No newline at end of file + 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]) \ No newline at end of file diff --git a/files/templates/header.html b/files/templates/header.html index 225c9eedd..2d5fbfd44 100644 --- a/files/templates/header.html +++ b/files/templates/header.html @@ -100,6 +100,10 @@ {% if g.webview %} {% endif %} + + {% if SITE_NAME == 'PCM' %} + + {% endif %} {% if v %} {% if v.notifications_count %} @@ -137,6 +141,12 @@