local arr = GetAllNode({class="android.widget.TextView",id="edu.www.qsxt:id/branchview_title",index="0",level="15",package="edu.www.qsxt"},"章")
local reslut = RemovePlayCourse(arr,"已学习",nil,nil)
for k,v in pairs(reslut) do
GetParentClick(v)
sleep(rnd(1500,2000))
local ret = nodeLib.findOne({class="android.widget.Image",id="",index="0",level="12",package="edu.www.qsxt"},true)
if ret ~= nil then
print("进入对应的章节")
if ClickNode({class="android.view.View",id="",text="【听讲】"}) then
-- 点击阅读或播放
-- 等待随机5至10分钟时长
-- SleepTime(5,10)
sleep(rnd(2000,2500))
local reslut,time = IfTwoNode({class="android.widget.TextView",id="edu.www.qsxt:id/player_audio_current_time",level="12"},{class="android.widget.TextView",id="edu.www.qsxt:id/player_audio_total_time",level="12"},":")
if reslut then
exec("input keyevent 4 ")
else
-- local m = GetNodeTime({class="android.widget.TextView",id="edu.www.qsxt:id/player_audio_total_time",index="2",level="12",package="edu.www.qsxt"})
SleepTime(time,time+1)
exec("input keyevent 4 ")
end
sleep(rnd(1200,2000))
else
-- 随机等待几分钟 可以自行修改
--SleepTime(5,10)
SleepTime(5,10)
exec("input keyevent 4 ")
--end
sleep(rnd(1200,2000))
end
end
-- 进入可播放课程,找播放按钮
if FindAllNode({class="com.feifanuniv.libplayer.views.TextureRenderView",id=""}) then
if FindNode({class="android.widget.ImageView",id="edu.www.qsxt:id/play_btn_center"}) then
exec("input keyevent 4 ")
sleep(rnd(1200,2000))
else
SleepTime(5,10)
exec("input keyevent 4 ")
--end
sleep(rnd(1200,2000))
end
end
end
end
function RemovePlayCourse(class_tab,findstr1,findstr2,time)
-- 找查节点父节点后找父节点的子节点,获取已学习的章节节点信息,删除已经播放的课程
local nodetab = class_tab
for k,v in pairs(nodetab) do
local ret = nodeLib.findNextNode(v,true)
if ret ~= nil then
if Splitstring(ret.text,findstr1) then
nodetab[k] = nil
--[===[if Split(ret.text,findstr1,findstr2,time) then
nodetab[k] = nil
end]===]
end
end
end
return nodetab
end
function clickPlay(x1,y1,x2,y2,picname,massage)
-- 查找阅览的课程执行播放或阅读
sleep(rnd(100,150)*10)
if FindPic(x1,y1,x2,y2,picname) >1 then
-- 找到播放图标判断当前位置是不是已学习,不行则点击
print(string.format("准备点击%s",massage))
startPlay()
end
end
function clickVideo()
-- 点击视频
-- 目前无调用
sleep(rnd(100,150)*10)
if FindPic(3,220,176,1926,"播放图标") >1 then
-- 找到播放图标判断当前位置是不是已学习,不行则点击
print(string.format("准备点击%s",massage))
startPlay()
else
return
end
end
function clickArticle()
-- 点击文章
-- 目前无调用
sleep(rnd(100,150)*10)
if FindPic(3,220,176,1926,"青书学堂文章图标") >1 then
-- 找到播放图标判断当前位置是不是已学习,不行则点击
print("准备点击文章")
startPlay()
else
return
end
end
function readyPaly()
-- 准备阅读或播放
-- 下拉按钮坐标
sleep(rnd(100,200)*10)
for i=1,10 do
local x,y = FindPic(906,216,1066,1906,"课程子菜单下拉按钮")