This commit is contained in:
parent
e4b00b04e9
commit
3241ed1fe3
@ -28,6 +28,19 @@ def mysql_required(f):
|
|||||||
return decorated_function
|
return decorated_function
|
||||||
|
|
||||||
|
|
||||||
|
def clean_titles():
|
||||||
|
db.engine.execute("""
|
||||||
|
DELETE
|
||||||
|
FROM anime_title
|
||||||
|
WHERE id IN (
|
||||||
|
SELECT anime_title.id
|
||||||
|
FROM anime_title
|
||||||
|
LEFT JOIN anime_link ON anime_title.id = anime_link.title_id
|
||||||
|
WHERE anime_link.id IS NULL
|
||||||
|
)
|
||||||
|
""")
|
||||||
|
|
||||||
|
|
||||||
@auth.verify_password
|
@auth.verify_password
|
||||||
def verify_password(username, password):
|
def verify_password(username, password):
|
||||||
return username == ADMIN_USERNAME and ADMIN_PASSWORD == password
|
return username == ADMIN_USERNAME and ADMIN_PASSWORD == password
|
||||||
@ -71,8 +84,8 @@ def search():
|
|||||||
return redirect(url_for('home'))
|
return redirect(url_for('home'))
|
||||||
|
|
||||||
set_event_loop(SelectorEventLoop())
|
set_event_loop(SelectorEventLoop())
|
||||||
return render_template('search.html', search_form=SearchForm(),
|
torrents = get_event_loop().run_until_complete(run_all(query))
|
||||||
connectors=get_event_loop().run_until_complete(run_all(query)))
|
return render_template('search.html', search_form=SearchForm(), connectors=torrents)
|
||||||
|
|
||||||
|
|
||||||
@app.route('/latest')
|
@app.route('/latest')
|
||||||
@ -227,6 +240,7 @@ def admin_edit(link_id=None):
|
|||||||
# Database
|
# Database
|
||||||
db.session.add(link)
|
db.session.add(link)
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
clean_titles()
|
||||||
|
|
||||||
# Transmission
|
# Transmission
|
||||||
if TRANSMISSION_ENABLED and isinstance(instance, Nyaa):
|
if TRANSMISSION_ENABLED and isinstance(instance, Nyaa):
|
||||||
|
@ -46,7 +46,7 @@ if db_host:
|
|||||||
db_user, db_password, db_host, db_name
|
db_user, db_password, db_host, db_name
|
||||||
)
|
)
|
||||||
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = True
|
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = True
|
||||||
app.config['SQLALCHEMY_ECHO'] = False
|
app.config['SQLALCHEMY_ECHO'] = IS_DEBUG
|
||||||
app.config['SQLALCHEMY_ENGINE_OPTIONS'] = {
|
app.config['SQLALCHEMY_ENGINE_OPTIONS'] = {
|
||||||
'pool_recycle': 200
|
'pool_recycle': 200
|
||||||
}
|
}
|
||||||
|
@ -75,7 +75,6 @@ class Pantsu(ConnectorCore):
|
|||||||
if response['http_code'] == 200:
|
if response['http_code'] == 200:
|
||||||
html = BeautifulSoup(response['output'], 'html.parser')
|
html = BeautifulSoup(response['output'], 'html.parser')
|
||||||
title = html.select('h1.torrent-hr')
|
title = html.select('h1.torrent-hr')
|
||||||
print(title, flush=True)
|
|
||||||
return check_if_vf(title[0].get_text())
|
return check_if_vf(title[0].get_text())
|
||||||
|
|
||||||
return False
|
return False
|
||||||
|
@ -1,6 +1,11 @@
|
|||||||
{% extends "layout.html" %}
|
{% extends "layout.html" %}
|
||||||
{% block title %}- Folder List{% endblock %}
|
{% block title %}- Folder List{% endblock %}
|
||||||
{% block add_button %}
|
{% block add_button %}
|
||||||
|
<a class="navbar-item has-tooltip-bottom has-tooltip-hidden-desktop" data-tooltip="Back"
|
||||||
|
href="{{ url_for('admin') }}">
|
||||||
|
<i class="fa fa-arrow-left"></i><i> </i>
|
||||||
|
<span class="is-hidden-mobile">Back</span>
|
||||||
|
</a>
|
||||||
<a class="navbar-item has-tooltip-bottom has-tooltip-hidden-desktop" data-tooltip="Add folder"
|
<a class="navbar-item has-tooltip-bottom has-tooltip-hidden-desktop" data-tooltip="Add folder"
|
||||||
href="{{ url_for('folder_edit') }}">
|
href="{{ url_for('folder_edit') }}">
|
||||||
<i class="fa fa-plus"></i><i> </i>
|
<i class="fa fa-plus"></i><i> </i>
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=2.0, minimum-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=2.0, minimum-scale=1.0">
|
||||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||||
<meta name="description" content="Xefir's animes search engine (っ^‿^)っ">
|
<meta name="description" content="Xefir's anime search engine (っ^‿^)っ">
|
||||||
<title>PyNyaaTa - {% block title %}{% endblock %}</title>
|
<title>PyNyaaTa - {% block title %}{% endblock %}</title>
|
||||||
<link rel="icon" href="{{ url_for('static', filename='favicons/favicon.ico') }}">
|
<link rel="icon" href="{{ url_for('static', filename='favicons/favicon.ico') }}">
|
||||||
<link rel="stylesheet" href="{{ url_for('static', filename='css/bulma.min.css') }}">
|
<link rel="stylesheet" href="{{ url_for('static', filename='css/bulma.min.css') }}">
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
import re
|
import re
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
from dateparser import parse
|
from dateparser import parse
|
||||||
|
|
||||||
from .config import MYSQL_ENABLED, BLACKLIST_WORDS
|
from .config import MYSQL_ENABLED, BLACKLIST_WORDS
|
||||||
@ -35,16 +34,6 @@ def boldify(str_to_replace, keyword):
|
|||||||
return str_to_replace
|
return str_to_replace
|
||||||
|
|
||||||
|
|
||||||
def clean_model(obj):
|
|
||||||
for attr in dir(obj):
|
|
||||||
if not attr.startswith('_') and getattr(obj, attr) is None:
|
|
||||||
try:
|
|
||||||
setattr(obj, attr, '')
|
|
||||||
except AttributeError:
|
|
||||||
pass
|
|
||||||
return obj
|
|
||||||
|
|
||||||
|
|
||||||
def check_blacklist_words(url):
|
def check_blacklist_words(url):
|
||||||
return any(word.lower() in url.lower() for word in BLACKLIST_WORDS)
|
return any(word.lower() in url.lower() for word in BLACKLIST_WORDS)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user