コード例 #1
0
ファイル: turbine.py プロジェクト: timothyrenner/turbine-py
 def run(self, seq: Iterable) -> None:
     queue_sizes = " | ".join(
         [f"{q}: {n}" for q, n in self._channel_names.items()])
     num_tasks = " | ".join(
         [f"{q}: {n}" for q, n in self._channel_num_tasks.items()])
     logger.debug(f"Queue sizes: {queue_sizes}.")
     logger.debug(f"Task concurrencies: {num_tasks}.")
     async_run(self._run_tasks(seq), debug=True)
コード例 #2
0
def run_instace(
    instance_name: str,
    args_to_instance: List[str],
    wait: bool,
    dry_run: bool,
    debug_bwrap_args: List[List[str]],
    debug_shell: bool,
    debug_log_dbus: bool,
    debug_helper_script: Optional[Path],
) -> None:
    instance = BubblejailDirectories.instance_get(instance_name)

    if instance.is_running():
        if dry_run:
            print('Found helper socket.')
            print('Args to be sent: ', args_to_instance)
            return

        command_return_text = async_run(
            instance.send_run_rpc(
                args_to_run=args_to_instance,
                wait_for_response=wait,
            ))
        if wait:
            print(command_return_text)
    else:
        extra_args: Optional[List[str]]
        if debug_bwrap_args is not None:
            extra_args = []
            for x in debug_bwrap_args:
                extra_args.extend(_extra_args_converter(x))
        else:
            extra_args = None

        async_run(
            instance.async_run_init(
                args_to_run=args_to_instance,
                debug_shell=debug_shell,
                debug_helper_script=debug_helper_script,
                debug_log_dbus=debug_log_dbus,
                dry_run=dry_run,
                extra_bwrap_args=extra_args,
            ))
コード例 #3
0
    def fetch_info(self):
        session = async_run(self.get_session())

        data = {}
        data["song_title"] = async_run(self.get_song_title(session))
        data["song_duration"] = round(
            (session.get_timeline_properties().end_time.duration) / 10**7)
        data["playback_status"] = "Paused" if session.get_playback_info(
        ).playback_status == 5 else "Playing"
        #print(f"Current Media Info:{current_media_info}")
        #
        #print(f"Playback Info: {playback_info}")
        #controls_info = self.__class__.convert_to_dict(playback_info['controls'])
        #print(f"Playback Controls Info: {controls_info}")
        #
        #position_info = self.__class__.convert_to_dict(timeline_info['position'])
        #print(f"Position Info: {position_info}")
        del session
        gc_collect()
        return data
コード例 #4
0
def run_bjail(args: Namespace) -> None:
    instance_name = args.instance_name

    instance = BubblejailDirectories.instance_get(instance_name)

    if instance.is_running():
        args_to_run = list(instance.rewrite_arguments(args.args_to_instance))

        if args.dry_run:
            print('Found helper socket.')
            print('Args to be sent: ', args_to_run)
            return

        command_return_text = async_run(
            instance.send_run_rpc(
                args_to_run=args_to_run,
                wait_for_response=args.wait,
            ))
        if args.wait:
            print(command_return_text)
    else:
        extra_args: Optional[List[str]]
        if args.debug_bwrap_args is not None:
            extra_args_not_flat: List[List[str]] = args.debug_bwrap_args
            extra_args = []
            for x in extra_args_not_flat:
                extra_args.extend(_extra_args_converter(x))
        else:
            extra_args = None

        async_run(
            instance.async_run_init(
                args_to_run=args.args_to_instance,
                debug_shell=args.debug_shell,
                debug_helper_script=args.debug_helper_script,
                debug_log_dbus=args.debug_log_dbus,
                dry_run=args.dry_run,
                extra_bwrap_args=extra_args,
            ))
コード例 #5
0
def bjail_edit(args: Namespace) -> None:
    instance = BubblejailDirectories.instance_get(args.instance_name)
    async_run(instance.edit_config_in_editor())