silence error

pull/226/head
Aevann 2024-04-01 01:22:27 +02:00
parent 199a6c794f
commit 398bfe9316
2 changed files with 15 additions and 14 deletions

View File

@ -1,11 +1,8 @@
import json
import requests
import gevent
from files.helpers.config.const import *
if SITE == 'watchpeopledie.tv':
import gevent
from rclone_python import rclone
from files.helpers.media import *
CLOUDFLARE_API_URL = "https://api.cloudflare.com/client/v4"
CLOUDFLARE_REQUEST_TIMEOUT_SECS = 5
@ -36,7 +33,7 @@ def purge_files_in_cloudflare_cache(files):
for file in files:
if file.startswith('https://videos.watchpeopledie.tv/'):
filename = file.split('https://videos.watchpeopledie.tv/')[1]
gevent.spawn(rclone.delete, f'no:/videos/{filename}')
gevent.spawn(rclone_delete, f'no:/videos/{filename}')
post_data = {"files": files}
res = None

View File

@ -21,9 +21,6 @@ from files.helpers.settings import get_setting
from .config.const import *
from .regex import badge_name_regex
if SITE == 'watchpeopledie.tv':
from rclone_python import rclone
def remove_image_using_link(link):
if not link or not '/images/' in link:
return
@ -203,7 +200,7 @@ def process_video(file, v):
gevent.spawn(delete_file, new, f'https://videos.{SITE}' + new.split('/videos')[1])
if SITE == 'watchpeopledie.tv':
gevent.spawn(rclone_file, new)
gevent.spawn(rclone_copy, new)
return f'https://videos.{SITE}' + new.split('/videos')[1]
else:
return f"{SITE_FULL}{new}"
@ -280,10 +277,6 @@ def delete_file(filename, url):
os.remove(filename)
purge_files_in_cloudflare_cache(url)
def rclone_file(filename):
rclone.copy(filename, 'no:/videos', ignore_existing=True, show_progress=False)
def process_badge_entry(oldname, v, comment_body):
try:
json_body = '{' + comment_body.split('{')[1].split('}')[0] + '}'
@ -308,3 +301,14 @@ def process_badge_entry(oldname, v, comment_body):
purge_files_in_cloudflare_cache(f"{SITE_FULL_IMAGES}/i/{SITE_NAME}/badges/{badge.id}.webp")
except Exception as e:
abort(400, str(e))
if SITE == 'watchpeopledie.tv':
from rclone_python import rclone
def rclone_copy(filename):
rclone.copy(filename, 'no:/videos', ignore_existing=True, show_progress=False)
def rclone_delete(filename):
try: rclone.delete(filename)
except Exception as e: print(e, flush=True)