forked from MarseyWorld/MarseyWorld
fix PCM /live list
parent
3ccd035b79
commit
a63d4940ae
|
@ -32,8 +32,7 @@ def cron(every_5m, every_1h, every_1d, every_1mo):
|
|||
spin_roulette_wheel()
|
||||
offsitementions.offsite_mentions_task()
|
||||
if SITE_NAME == 'PCM':
|
||||
cache.delete_memoized(route_static.live_cached)
|
||||
route_static.live_cached()
|
||||
cache.set('live_cached', route_static.live_cached())
|
||||
|
||||
if every_1h:
|
||||
awards.award_timers_bots_task()
|
||||
|
|
|
@ -443,7 +443,6 @@ if SITE == 'pcmemes.net':
|
|||
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 = []
|
||||
|
@ -475,15 +474,19 @@ if SITE == 'pcmemes.net':
|
|||
@app.get('/logged_out/live')
|
||||
@auth_desired_with_logingate
|
||||
def live(v):
|
||||
return render_template('live.html', v=v, live=live_cached()[0], offline=live_cached()[1])
|
||||
live_cached = cache.get('live_cached')
|
||||
|
||||
return render_template('live.html', v=v, live=live_cached[0], offline=live_cached[1])
|
||||
|
||||
@app.post('/live/add')
|
||||
@admin_level_required(2)
|
||||
def live_add(v):
|
||||
id = request.values.get('id')
|
||||
|
||||
live_cached = cache.get('live_cached')
|
||||
|
||||
if not id or len(id) != 24:
|
||||
return render_template('live.html', v=v, live=live_cached()[0], offline=live_cached()[1], error="Invalid ID")
|
||||
return render_template('live.html', v=v, live=live_cached[0], offline=live_cached[1], error="Invalid ID")
|
||||
|
||||
existing = g.db.get(Streamer, id)
|
||||
if not existing:
|
||||
|
@ -493,7 +496,7 @@ if SITE == 'pcmemes.net':
|
|||
if v.id != KIPPY_ID:
|
||||
send_repeatable_notification(KIPPY_ID, f"@{v.username} has added a [new YouTube channel](https://www.youtube.com/channel/{streamer.id})")
|
||||
|
||||
return render_template('live.html', v=v, live=live_cached()[0], offline=live_cached()[1], msg="Channel added successfuly!")
|
||||
return render_template('live.html', v=v, live=live_cached[0], offline=live_cached[1], msg="Channel added successfuly!")
|
||||
|
||||
@app.post('/live/remove')
|
||||
@admin_level_required(2)
|
||||
|
@ -505,5 +508,6 @@ if SITE == 'pcmemes.net':
|
|||
if v.id != KIPPY_ID:
|
||||
send_repeatable_notification(KIPPY_ID, f"@{v.username} has removed a [YouTube channel](https://www.youtube.com/channel/{streamer.id})")
|
||||
g.db.delete(streamer)
|
||||
|
||||
|
||||
live_cached = cache.get('live_cached')
|
||||
return render_template('live.html', v=v, live=live_cached()[0], offline=live_cached()[1], msg="Channel removed successfuly!")
|
Loading…
Reference in New Issue