admin
2025-03-28 304962635c8c08702c0c6feae8d9e671c9a7d10b
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
import json
from configparser import ConfigParser
 
 
# 读取设置
def __read_setting():
    cp = ConfigParser()
    cp.read("res/setting.conf")
    return cp
 
 
# 写入配置
def __write_setting(cp):
    cp.write(open("res/setting.conf", "w", encoding="gbk"))
 
 
def __get_setting(cp, type, key):
    try:
        return cp.get(type, key)
    except:
        return None
 
 
# ------------------------------浏览器位置-----------------------------
def set_chrome_path(_path):
    # 设置是否置顶
    cp = __read_setting()
    cp.set("config", "chrome_path", _path)
    __write_setting(cp)
 
 
# 获取是否置顶
def get_chrome_path():
    cp = __read_setting()
    return cp.get("config", "chrome_path")
 
 
# -------------------------------浏览器驱动--------------------------
def set_chromedriver_path(_path):
    # 设置是否置顶
    cp = __read_setting()
    cp.set("config", "chromedriver_path", _path)
    __write_setting(cp)
 
 
# 获取是否置顶
def get_chromedriver_path():
    cp = __read_setting()
    return cp.get("config", "chromedriver_path")
 
 
# --------------------------------是否点赞--------------------------------
 
def set_click_like(enable):
    # 设置是否置顶
    cp = __read_setting()
    if enable:
        enable = 1
    else:
        enable = 0
    cp.set("config", "click_like", f"{enable}")
    __write_setting(cp)
 
 
# 获取是否置顶
def is_click_like():
    cp = __read_setting()
    return int(cp.get("config", "click_like"))
 
 
# --------------------------------是否回复评论--------------------------------
def set_reply_comment(enable):
    cp = __read_setting()
    if enable:
        enable = 1
    else:
        enable = 0
    cp.set("config", "reply_comment", f"{enable}")
    __write_setting(cp)
 
 
 
def is_reply_comment():
    cp = __read_setting()
    val = __get_setting(cp, "config", "reply_comment")
    if val:
        return int(val)
    else:
        return 0
 
# -------------------------------评论内容--------------------------
def set_comment_templates(content):
    # 设置是否置顶
    cp = __read_setting()
    cp.set("config", "comment_templates", content)
    __write_setting(cp)
 
 
# 获取是否置顶
def get_comment_templates():
    cp = __read_setting()
    return cp.get("config", "comment_templates")
 
 
if __name__ == "__main__":
    pass