コード例 #1
0
ファイル: scene_tv.py プロジェクト: ANewLearner-ali/konka_git
    def __init__(self,
                 name: str,
                 exec_time: int,
                 checker: ck.Checker,
                 channel_list: list,
                 performance_str: str,
                 channel_switch_interval: (int, float) = None,
                 performance_interval: (int, float) = None,
                 check_interval: (int, float) = None,
                 by: int = sc.BY_TIME):
        sc.Scene.__init__(self, name=name, exec_time=exec_time, by=by, checker=checker)
        self.channel_list = channel_list
        self.channel_switch_interval = get_second(channel_switch_interval, 'scene_tv', 'channel_switch_interval')
        self.performance_interval = get_second(performance_interval, 'scene_tv', 'performance_interval')
        self.check_interval = get_second(check_interval, 'scene_tv', 'check_interval')
        logging.debug(
            f'by {"按次数" if self.by == sc.BY_COUNT else "按时间"}\n'
            f'channel_switch_interval {self.channel_switch_interval}\n'
            f'performance_interval {self.performance_interval}\n'
            f'check_interval {self.check_interval}\n')
        self.performance_str = performance_str
        self.performance_process = list()
        self._parse_performance_process(self.performance_str)

        self.performance_thread = None
        self.channel_switch_thread = None

        self.save_in_usb = True
        self.dependent.init(
            usb=self.save_in_usb,
        )
コード例 #2
0
    def __init__(self,
                 name: str,
                 exec_time: int,
                 checker: ck.Checker,
                 mode: int,
                 low_power_mode: bool = False,
                 dc_off_tag: str = '',
                 dc_off_timeout: (int, float) = None,
                 wake_up_timeout: (int, float) = None,
                 by: int = sc.BY_COUNT):
        sc.Scene.__init__(self, name=name, exec_time=exec_time, by=by, checker=checker)
        self.mode = mode
        self.low_power_mode = low_power_mode
        self.dc_off_tag = dc_off_tag
        self.dc_off_timeout = get_second(dc_off_timeout, 'scene_wake', 'dc_off_timeout')
        if self.mode == dk.MODE_NORMAL:
            self.wake_up_timeout = get_second(wake_up_timeout, 'scene_wake', 'wake_up_timeout')
        else:
            self.wake_up_timeout = get_second(wake_up_timeout, 'scene_wake', 'wake_up_timeout_quick')
        self.dk = None

        self.save_in_usb = True
        self.dependent.init(
            usb=self.save_in_usb,
        )
コード例 #3
0
 def __init__(self, device, root):
     super(_MultiMediaThread, self).__init__()
     self.device = device
     self.root = root
     self.r = _parse_media_root(self.device, self.root)
     self.interval = get_second(None, 'scene_monkey_logic', 'multimedia')
     self.wait = get_second(None, 'scene_monkey_logic', 'multimedia_page')
コード例 #4
0
 def base_env_check_body(self):
     """
     自定义一键调试
     :return:
     """
     ir_interval = get_second(None, "scene_on_and_off", "ir_interval")
     bt_interval = get_second(None, "scene_on_and_off", "bt_interval")
     if self.key_set.keys:
         for key in self.key_set.keys:
             mq.ck_queue.put((mq.TAG_MSG, '发送' + key.cn_name))
             if key == _Key.BLUE_VOICE:
                 self.device.mcu.press_blue(key,
                                            mode=keycontrol.MODE_LONG_PRESS)
                 time.sleep(bt_interval)
             else:
                 self.device.mcu.press_ir(key)
                 time.sleep(ir_interval)
     if self.far:
         mq.ck_queue.put((mq.TAG_MSG, '播放小康音频'))
         play_voice.play_normal(constant.WAKE_UP_MP3)
     mq.ck_queue.put((mq.TAG_MSG, self.get_switch_msg(False)))
     self.switch(False)
     mq.ck_queue.put((mq.TAG_MSG, self.get_switch_msg(True)))
     self.switch(True)
     mq.ck_queue.put((mq.TAG_MSG, '等待开机完成...'))
     self.on_wait_rest()
     return True
コード例 #5
0
 def __init__(self,
              name: str,
              exec_time: int,
              checker: ck.Checker,
              key_set: dict,
              far: bool,
              mode: str = sw.MODE_DC,
              on2check_interval: (int, float) = None,
              dc_off_interval: (int, float) = None,
              reboot: bool = False,
              by: int = sc.BY_COUNT,
              ad_root: str = ''):
     checker.launcher = True
     sc.Scene.__init__(self, name, exec_time, by, checker=checker)
     on2check_interval = get_second(on2check_interval, 'scene_on_and_off',
                                    'on2check_interval')
     dc_off_interval = get_second(dc_off_interval, 'scene_on_and_off',
                                  'dc_off_interval')
     sw.Switch.__init__(self,
                        on2check_interval,
                        dc_off_interval,
                        mode=mode,
                        reboot=reboot)
     self.key_set = KeySet(**key_set)
     self.far = far
     self.ad_root = ad_root.strip()
     # 修改日志到U盘
     self.save_in_usb = False
     self.dependent.init(usb=self.save_in_usb, )
     if not reboot or self.key_set.keys:
         self.dependent.muc = True
コード例 #6
0
    def __init__(self,
                 name: str,
                 exec_time: int,
                 inner: bool,
                 third: bool,
                 tv: bool,
                 by: int = sc.BY_COUNT,
                 checker: ck.Checker = None,
                 on2check_interval=None,
                 dc_off_interval=None,
                 mode=sw.MODE_DC,
                 reboot=True):
        sc.Scene.__init__(self,
                          name=name,
                          exec_time=exec_time,
                          by=by,
                          checker=checker)
        on2check_interval = get_second(on2check_interval, 'scene_boot_enter',
                                       'on2check_interval')
        dc_off_interval = get_second(dc_off_interval, 'scene_boot_enter',
                                     'dc_off_interval')
        sw.Switch.__init__(self,
                           on2check_interval=on2check_interval,
                           dc_off_interval=dc_off_interval,
                           mode=mode,
                           reboot=reboot)
        checker.window_assert = True
        checker.launcher = True
        self.inner = inner
        self.third = third
        self.tv = tv

        self.app_list_sp = '/data/data/com.konka.tvmanager/shared_prefs/share_data.xml'
        self.boot_enter_sp = '/data/data/com.konka.tvmanager/shared_prefs/boot_enter.xml'
        self.tv_manager_main = 'com.konka.tvmanager/com.konka.tvmanager.HomeActivity'
        self.tv_manager_boot_enter = 'com.konka.tvmanager/com.konka.tvmanager.bootenter.BootEnterActivity'
        self.app_list = dict()
        self.inner_app = list()
        self.third_app = list()
        self.selected_app = dict()
        self.index = 0
コード例 #7
0
    def __init__(self,
                 name: str,
                 exec_time: int,
                 checker: ck.Checker,
                 mode: int,
                 packages: str = '',
                 switch_interval: (int, float) = None,
                 check_interval: (int, float) = None,
                 by: int = sc.BY_TIME):
        sc.Scene.__init__(self,
                          name=name,
                          exec_time=exec_time,
                          by=by,
                          checker=checker)
        if mode not in [MODE_DEFAULT, MODE_CUSTOMIZATION]:
            raise ValueError('mode must in {!r}'.format(
                [MODE_DEFAULT, MODE_CUSTOMIZATION]))
        self.mode = mode
        self.packages_str = packages
        self.packages = [i.strip() for i in packages.split(';') if i.strip()]
        if self.mode == MODE_CUSTOMIZATION and not self.packages:
            raise ValueError('MODE_CUSTOMIZATION monkey, but packages is null')

        self.profile = constant.MONKEY_DEFAULT

        self.check_interval = get_second(check_interval, 'scene_monkey_logic',
                                         'check_interval')
        self.switch_interval = get_second(switch_interval,
                                          'scene_monkey_logic',
                                          'switch_interval')

        self.handle_thread = None
        self.monkey_thread = None

        self.save_in_usb = True
        self.dependent.init(usb=self.save_in_usb, monkey_tool=True)
コード例 #8
0
    def __init__(self,
                 name: str,
                 exec_time: int,
                 checker: ck.Checker,
                 brand_list: list,
                 performance_str: str,
                 profile: str = None,
                 performance_interval: (int, float) = None,
                 brand_switch_interval: (int, float) = None,
                 check_interval: (int, float) = None,
                 local_video: dict = None,
                 by: int = sc.BY_TIME):
        sc.Scene.__init__(self, name=name, exec_time=exec_time, by=by, checker=checker)
        self.brand_list = brand_list
        self.profile = profile
        self._profile = constant.VIDEO_BRAND if self.profile is None or not profile.strip() else self.profile
        self.config_list += [self._profile]
        self.brand_switch_interval = get_second(brand_switch_interval, 'scene_media', 'brand_switch_interval')
        self.performance_interval = get_second(performance_interval, 'scene_media', 'performance_interval')
        self.check_interval = get_second(check_interval, 'scene_media', 'check_interval')

        self.performance_str = performance_str
        self.performance_process = list()
        self._parse_performance_process(self.performance_str)

        self.local_video = {'本地视频_大码率': '', '本地视频_混合编解码': ''}
        if local_video is not None:
            self.local_video = local_video

        self.performance_thread = None
        self.brand_switch_thread = None

        self.save_in_usb = True
        self.dependent.init(
            usb=self.save_in_usb,
        )
コード例 #9
0
    def __init__(self,
                 name: str,
                 exec_time: int,
                 checker: ck.Checker,
                 cmd: str,
                 check_interval: (int, float) = None,
                 by: int = sc.BY_TIME):
        sc.Scene.__init__(self,
                          name=name,
                          exec_time=exec_time,
                          by=by,
                          checker=checker)
        self.cmd = cmd
        self.check_interval = get_second(check_interval, 'scene_monkey_global',
                                         'check_interval')

        self.save_in_usb = True
        self.dependent.init(usb=self.save_in_usb, monkey_tool=True)