MCPcopy Create free account
hub / github.com/runhey/OnmyojiAutoScript / get_next_task

Method get_next_task

script.py:293–335  ·  view source on GitHub ↗

获取下一个任务的名字, 大驼峰。 :return:

(self)

Source from the content-addressed store, hash-verified

291 return False
292
293 def get_next_task(self) -> str:
294 """
295 获取下一个任务的名字, 大驼峰。
296 :return:
297 """
298 while 1:
299 task = self.config.get_next()
300 self.config.task = task
301 if self.state_queue:
302 self.state_queue.put({"schedule": self.config.get_schedule_data()})
303
304 # from module.base.resource import release_resources
305 # if self.config.task.command != 'Alas':
306 # release_resources(next_task=task.command)
307
308 if task.next_run > datetime.now():
309 logger.info(f'Wait until {task.next_run} for task `{task.command}`')
310 # self.is_first_task = False
311 method = self.config.script.optimization.when_task_queue_empty
312 if method == 'close_game':
313 logger.info('Close game during wait')
314 self.device.app_stop()
315 self.device.release_during_wait()
316 if not self.wait_until(task.next_run):
317 del_cached_property(self, 'config')
318 continue
319 self.run('Restart')
320 elif method == 'goto_main':
321 logger.info('Goto main page during wait')
322 self.run('GotoMain')
323 self.device.release_during_wait()
324 if not self.wait_until(task.next_run):
325 del_cached_property(self, 'config')
326 continue
327 else:
328 logger.warning(f'Invalid Optimization_WhenTaskQueueEmpty: {method}, fallback to stay_there')
329 self.device.release_during_wait()
330 if not self.wait_until(task.next_run):
331 del_cached_property(self, 'config')
332 continue
333 break
334
335 return task.command
336
337 def run(self, command: str) -> bool:
338 """

Callers 1

loopMethod · 0.95

Calls 7

wait_untilMethod · 0.95
runMethod · 0.95
del_cached_propertyFunction · 0.90
get_nextMethod · 0.80
get_schedule_dataMethod · 0.80
release_during_waitMethod · 0.80
app_stopMethod · 0.45

Tested by

no test coverage detected