MCPcopy
hub / github.com/TechXueXi/TechXueXi / start_learn

Function start_learn

SourcePackages/pandalearning.py:42–123  ·  view source on GitHub ↗
(uid, name)

Source from the content-addressed store, hash-verified

40
41
42def start_learn(uid, name):
43 # 0 读取版本信息
44 start_time = time.time()
45 nohead, lock, stime, Single = get_argv()
46 print("是否无头模式:{0} {1}".format(nohead, os.getenv('Nohead')))
47 cookies = user.get_cookie(uid)
48 if nohead == True:
49 TechXueXi_mode = "3"
50 else:
51 TechXueXi_mode = str(cfg_get("base.ModeType", 3))
52 print("当前选择模式:" + TechXueXi_mode + "\n" + "=" * 60)
53
54 if not name:
55 user_fullname = user.get_fullname(uid)
56 name = user_fullname.split('_', 1)[1]
57 else:
58 user_fullname = uid+"_"+name
59
60 if not cookies or TechXueXi_mode == "0":
61 msg = ""
62 if name == "新用户":
63 msg = "需要增加新用户,请扫码登录,否则请无视"
64 else:
65 msg = name+" 登录信息失效,请重新扫码"
66 # print(msg)
67 gl.pushprint(msg, chat_id=uid)
68 if gl.pushmode == "6":
69 gl.pushprint("web模式跳过自动获取二维码,请手动点击添加按钮", chat_id=uid)
70 print(color.red("【#️⃣】 若直接退出请运行:webserverListener.py"))
71 return
72 driver_login = Mydriver()
73 cookies = driver_login.login()
74 driver_login.quit()
75 if not cookies:
76 print("登录超时")
77 return
78 user.save_cookies(cookies)
79 uid = user.get_userId(cookies)
80 user_fullname = user.get_fullname(uid)
81 name = user_fullname.split('_', 1)[1]
82 user.update_last_user(uid)
83 output = name + " 登录正常,开始学习...\n"
84
85 article_index = user.get_article_index(uid)
86 video_index = 1 # user.get_video_index(uid)
87
88 total, scores = show_score(cookies)
89 gl.pushprint(output, chat_id=uid)
90 if TechXueXi_mode in ["1", "3"]:
91
92 article_thread = threads.MyThread(
93 "文章学 xi ", article, uid, cookies, article_index, scores, lock=lock)
94 video_thread = threads.MyThread(
95 "视频学 xi ", video, uid, cookies, video_index, scores, lock=lock)
96 article_thread.start()
97 video_thread.start()
98 article_thread.join()
99 video_thread.join()

Callers

nothing calls this directly

Calls 10

loginMethod · 0.95
quitMethod · 0.95
cfg_getFunction · 0.90
MydriverClass · 0.90
show_scoreFunction · 0.90
dailyFunction · 0.90
weeklyFunction · 0.90
zhuanxiangFunction · 0.90
show_scorePushFunction · 0.90
get_argvFunction · 0.85

Tested by

no test coverage detected