This repository has been archived by the owner on Dec 11, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
plugin.py
73 lines (58 loc) · 2.18 KB
/
plugin.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
from pathlib import Path
# third-party
from flask import Blueprint
# pylint: disable=import-error
from framework import app, path_data
from framework.util import Util
from framework.logger import get_logger
from framework.common.plugin import get_model_setting, Logic, default_route_single_module
class PlugIn:
package_name = __name__.split(".", maxsplit=1)[0]
logger = get_logger(package_name)
ModelSetting = get_model_setting(package_name, logger, table_name=f"plugin_{package_name}_setting")
blueprint = Blueprint(
package_name,
package_name,
url_prefix=f"/{package_name}",
template_folder=Path(__file__).parent.joinpath("templates"),
)
plugin_info = {
"category_name": "torrent",
"version": "0.1.1",
"name": "tf_viewer",
"home": "https://github.com/wiserain/tf_viewer",
"more": "https://github.com/wiserain/tf_viewer",
"description": "TF 실시간 정보를 보여주는 플러그인",
"developer": "wiserain",
"zip": "https://github.com/wiserain/tf_viewer/archive/main.zip",
"icon": "",
}
menu = {
"main": [package_name, "티프리카"],
"sub": [
["setting", "설정"],
["tmovie", "영화"],
["tdrama", "드라마"],
["tent", "예능"],
["tv", "TV"],
["tani", "애니"],
["tmusic", "음악"],
["adult", "성인"],
["log", "로그"],
],
"category": "torrent",
}
home_module = "tmovie"
module_list = None
logic = None
def __init__(self):
db_file = Path(path_data).joinpath("db", f"{self.package_name}.db")
app.config["SQLALCHEMY_BINDS"][self.package_name] = f"sqlite:///{db_file}"
Util.save_from_dict_to_json(self.plugin_info, Path(__file__).parent.joinpath("info.json"))
plugin = PlugIn()
from .logic import LogicMain
plugin.module_list = [LogicMain(plugin)]
# (logger, package_name, module_list, ModelSetting) required for Logic
plugin.logic = Logic(plugin)
# (;ogger, package_name, module_list, ModelSetting, blueprint, logic) required for default_route
default_route_single_module(plugin)