@@ -94,7 +94,9 @@ def process_course(self, course: Dict[str, Any]) -> None:
9494
9595 if course_info_id :
9696 study_design_list = self .client .study_design_list (course_info_id , course_id )
97- self .study_record_list = self .client .study_record_list (course_info_id , course_id )
97+ self .study_record_list = self .client .study_record_list (
98+ course_info_id , course_id
99+ )
98100 for node in study_design_list :
99101 parent_id = node .get ("id" )
100102 cell_list = self .client .get_cell_list (
@@ -131,20 +133,18 @@ def handle_resource(
131133 source_id = node .get ("id" )
132134 prefix = " " * ((indent + 1 ) * 4 ) # 每层缩进 4 个空格
133135
134- self .logging .info (
135- f"{ prefix } 💭 资源: { resource_name } | 类型: { file_type } "
136- )
136+ self .logging .info (f"{ prefix } 💭 资源: { resource_name } | 类型: { file_type } " )
137137
138138 # 跳过作业
139139 if file_type == "作业" :
140140 self .logging .info (f"{ prefix } ✅ 跳过作业" )
141141 return
142-
142+
143143 # 跳过考试
144144 if file_type == "考试" :
145145 self .logging .info (f"{ prefix } ✅ 跳过考试" )
146146 return
147-
147+
148148 # 跳过测验
149149 if file_type == "测验" :
150150 self .logging .info (f"{ prefix } ✅ 跳过测验" )
@@ -156,20 +156,18 @@ def handle_resource(
156156 return
157157
158158 try :
159- # 默认学习总数1:图片
160- total_num = 1
161- # 获取课件信息
162- # course_content = self.client.course_content(source_id)
163- # 不知道应该学习多久,需要调用接口并转换
164-
159+ # 默认学习总数
160+ total_num = random .randint (1 , 10 )
165161 course_content = json .loads (node .get ("fileUrl" ))
166162 url_short = course_content .get ("url" )
167163 # mp3 时长接口无法查询,本地获取
168- if file_type == "mp3 " :
164+ if file_type == "audio " :
169165 mp3_duration = get_mp3_duration (course_content .get ("ossOriUrl" ))
170166 total_num = int (mp3_duration )
171- if file_type == "zip" :
172- total_num = 1
167+ elif file_type == "zip" :
168+ total_num = random .randint (1 , 10 )
169+ elif file_type == "img" :
170+ total_num = random .randint (1 , 10 )
173171 elif url_short :
174172 file_status = self .client .upload_file_status (url_short )
175173 file_status_args = file_status .get ("args" )
0 commit comments