~nhanb/pytaku

c247b860197be833eb7b669b2be8b6df47109be8 — Bùi Thành Nhân a month ago 2693211 master
configurable "outdated" threshold for manga
2 files changed, 4 insertions(+), 1 deletions(-)

M src/pytaku/conf.py
M src/pytaku/persistence.py
M src/pytaku/conf.py => src/pytaku/conf.py +2 -0
@@ 8,6 8,8 @@ class Config(GoodConf):
    MANGADEX_PASSWORD = Value()
    FLASK_SECRET_KEY = Value(initial=lambda: token_urlsafe(50))

    MANGA_HOURS_UNTIL_OUTDATED = Value(default=6)

    PROXY_PREFIX = Value(default="")
    # ^ use this to e.g. point to a CDN's domain
    PROXY_CACHE_DIR = Value(default="proxy_cache")

M src/pytaku/persistence.py => src/pytaku/persistence.py +2 -1
@@ 5,6 5,7 @@ from typing import List, Tuple
import apsw
import argon2

from .conf import config
from .database.common import run_sql, run_sql_many




@@ 302,7 303,7 @@ def unread(user_id, site, title_id, chapter_id):
    )


def find_outdated_titles(since="-12 hours"):
def find_outdated_titles(since=f"-{config.MANGA_HOURS_UNTIL_OUTDATED} hours"):
    return run_sql(
        "SELECT id, site FROM title WHERE updated_at <= datetime('now', ?);", (since,)
    )