# -*- coding: utf-8 -*-
# PY引擎最小测试源 —— 不联网，纯硬编码
# 用法：ext 指向本文件。若绿豆UI里能看到"引擎测试"字样 → 引擎正常，问题在路径/脚本名；
#       若依然空白 → 绿豆UI未带金字塔Python运行时，需换壳（如TVBox_py版/影视仓py版）

import sys
sys.path.append('..')
from base.spider import Spider


class Spider(Spider):
    def init(self, extend=""):
        pass

    def homeContent(self, filter):
        return {
            "class": [
                {"type_id": "1", "type_name": "测试分类A"},
                {"type_id": "2", "type_name": "测试分类B"}
            ],
            "list": [{
                "vod_id": "1",
                "vod_name": "引擎测试-看到这条说明PY引擎正常",
                "vod_pic": "",
                "vod_remarks": "测试OK"
            }],
            "filters": {}
        }

    def homeVideoContent(self):
        return {"list": [{
            "vod_id": "1",
            "vod_name": "引擎测试-看到这条说明PY引擎正常",
            "vod_pic": "",
            "vod_remarks": "测试OK"
        }]}

    def categoryContent(self, tid, pg, filter, extend):
        return {
            "list": [{
                "vod_id": "1",
                "vod_name": "测试影片" + str(tid),
                "vod_pic": "",
                "vod_remarks": "第1集"
            }],
            "page": 1, "pagecount": 1, "limit": 20, "total": 1
        }

    def detailContent(self, ids):
        return {"list": [{
            "vod_id": "1",
            "vod_name": "测试影片",
            "vod_pic": "",
            "vod_content": "这是PY引擎测试数据，无需联网。能看到说明壳子的Python运行时正常工作。",
            "vod_play_from": "测试线路",
            "vod_play_url": "第1集$1#第2集$2"
        }]}

    def searchContent(self, key, quick):
        return {"list": [{
            "vod_id": "1",
            "vod_name": "搜索测试:" + key,
            "vod_pic": "",
            "vod_remarks": "测试"
        }]}

    def playerContent(self, flag, id, vipFlags):
        return {"parse": 0, "url": "https://example.com/test.m3u8", "header": ""}
