예제 #1
0
파일: support.py 프로젝트: ssmart88/Medusa
def update_viewed(media_id, elapsed=None, delete=False):
    try:
        database = Database()

        try:
            info = database.select_media(int(media_id))

        except Exception:
            info = {}

        if info.get("category") in config.getlist("viewed", "no_history"):
            return "0"

        if elapsed:
            database.update_viewed(media_id, elapsed)

        elif delete:
            database.delete_viewed(media_id)

        else:
            database.insert_viewed(media_id)

        return "0"

    except Exception as excp:
        log.error("Update viewed failed: %s", excp)

        return "1"
예제 #2
0
def update_viewed(media_id, elapsed=None, delete=False):
    try:
        database = Database()

        try:
            info = database.select_media(int(media_id))

        except Exception:
            info = {}

        if info.get("category") in config.getlist("viewed", "no_history"):
            return "0"

        if elapsed:
            database.update_viewed(media_id, elapsed)

        elif delete:
            database.delete_viewed(media_id)

        else:
            database.insert_viewed(media_id)

        return "0"

    except Exception as excp:
        log.error("Update viewed failed: %s", excp)

        return "1"