This commit is contained in:
parent
8eab694d02
commit
56ecddedcb
@ -12,4 +12,3 @@ REQUESTS_TIMEOUT=5
|
||||
CACHE_TIMEOUT=3600
|
||||
MYSQL_ROOT_PASSWORD=root
|
||||
BLACKLIST_WORDS=Chris44,Vol.,[zza],.ssa,.ass,Ref:rain
|
||||
CAPTCHA_SOLVER=hcaptcha-solver
|
||||
|
@ -2,13 +2,10 @@ from asyncio import get_event_loop, set_event_loop, SelectorEventLoop
|
||||
from functools import wraps
|
||||
from operator import attrgetter, itemgetter
|
||||
|
||||
import requests
|
||||
from flask import redirect, render_template, request, url_for, abort, json
|
||||
from requests import RequestException
|
||||
from flask import redirect, render_template, request, url_for, abort
|
||||
|
||||
from . import utils
|
||||
from .config import app, auth, logger, ADMIN_USERNAME, ADMIN_PASSWORD, MYSQL_ENABLED, APP_PORT, IS_DEBUG, \
|
||||
CLOUDPROXY_ENDPOINT, TRANSMISSION_ENABLED
|
||||
from .config import app, auth, ADMIN_USERNAME, ADMIN_PASSWORD, MYSQL_ENABLED, APP_PORT, IS_DEBUG, TRANSMISSION_ENABLED
|
||||
from .connectors import get_instance, run_all, Nyaa
|
||||
from .connectors.core import ConnectorLang, ConnectorReturn
|
||||
from .forms import SearchForm, DeleteForm, EditForm, FolderDeleteForm, FolderEditForm
|
||||
@ -120,7 +117,8 @@ def list_animes(url_filters='nyaa,yggtorrent'):
|
||||
else:
|
||||
filters = filters | AnimeLink.link.contains(to_filter)
|
||||
|
||||
titles = db.session.query(AnimeTitle, AnimeLink).join(AnimeLink).filter(filters).order_by(AnimeTitle.name).all()
|
||||
titles = db.session.query(AnimeTitle, AnimeLink).join(
|
||||
AnimeLink).filter(filters).order_by(AnimeTitle.name).all()
|
||||
|
||||
results = {}
|
||||
for title, link in titles:
|
||||
@ -240,7 +238,9 @@ def admin_edit(link_id=None):
|
||||
|
||||
# Title
|
||||
title = AnimeTitle.query.filter_by(id=link.title_id).first()
|
||||
title = title if title else AnimeTitle.query.filter_by(name=form.name.data).first()
|
||||
title = title if title else AnimeTitle.query.filter_by(
|
||||
name=form.name.data
|
||||
).first()
|
||||
title = title if title else AnimeTitle()
|
||||
title.folder_id = form.folder.data
|
||||
title.name = form.name.data
|
||||
|
@ -3,7 +3,6 @@ from os import environ, urandom
|
||||
|
||||
from flask import Flask
|
||||
from flask.cli import load_dotenv
|
||||
from flask_apscheduler import APScheduler
|
||||
from flask_httpauth import HTTPBasicAuth
|
||||
from flask_sqlalchemy import SQLAlchemy
|
||||
from redis import Redis
|
||||
@ -18,7 +17,6 @@ APP_PORT = int(environ.get('FLASK_PORT', 5000))
|
||||
CACHE_TIMEOUT = int(environ.get('CACHE_TIMEOUT', 60 * 60))
|
||||
REQUESTS_TIMEOUT = int(environ.get('REQUESTS_TIMEOUT', 5))
|
||||
BLACKLIST_WORDS = environ.get('BLACKLIST_WORDS', '').split(',') if environ.get('BLACKLIST_WORDS', '') else []
|
||||
CLOUDPROXY_ENDPOINT = environ.get('CLOUDPROXY_ENDPOINT')
|
||||
MYSQL_ENABLED = False
|
||||
REDIS_ENABLED = False
|
||||
TRANSMISSION_ENABLED = False
|
||||
|
@ -4,16 +4,13 @@ from .animeultime import AnimeUltime
|
||||
from .core import Other
|
||||
from .nyaa import Nyaa
|
||||
from .yggtorrent import YggTorrent, YggAnimation
|
||||
from ..config import CLOUDPROXY_ENDPOINT
|
||||
|
||||
|
||||
async def run_all(*args, **kwargs):
|
||||
coroutines = [Nyaa(*args, **kwargs).run(),
|
||||
AnimeUltime(*args, **kwargs).run()]
|
||||
|
||||
if CLOUDPROXY_ENDPOINT:
|
||||
coroutines.extend([YggTorrent(*args, **kwargs).run(),
|
||||
YggAnimation(*args, **kwargs).run()])
|
||||
AnimeUltime(*args, **kwargs).run(),
|
||||
YggTorrent(*args, **kwargs).run(),
|
||||
YggAnimation(*args, **kwargs).run()]
|
||||
|
||||
return list(await gather(*coroutines))
|
||||
|
||||
|
@ -2,13 +2,12 @@ from abc import ABC, abstractmethod
|
||||
from enum import Enum
|
||||
from functools import wraps
|
||||
from json import dumps, loads
|
||||
from urllib.parse import urlencode
|
||||
|
||||
import requests
|
||||
from requests import RequestException
|
||||
from redis.exceptions import RedisError
|
||||
|
||||
from ..config import CACHE_TIMEOUT, REQUESTS_TIMEOUT, CLOUDPROXY_ENDPOINT, logger, REDIS_ENABLED
|
||||
from ..config import CACHE_TIMEOUT, REQUESTS_TIMEOUT, logger, REDIS_ENABLED
|
||||
|
||||
if REDIS_ENABLED:
|
||||
from ..config import cache
|
||||
@ -80,7 +79,8 @@ def curl_content(url, params=None, ajax=False, debug=True):
|
||||
instance = get_instance(url)
|
||||
|
||||
if ajax:
|
||||
headers = {'User-Agent': 'YggRobot', 'X-Requested-With': 'XMLHttpRequest'}
|
||||
headers = {'User-Agent': 'YggRobot',
|
||||
'X-Requested-With': 'XMLHttpRequest'}
|
||||
else:
|
||||
headers = {'User-Agent': 'YggRobot'}
|
||||
|
||||
|
Reference in New Issue
Block a user