コード例 #1
0
ファイル: example.py プロジェクト: Sukelluskello/MIDAS
    def __init__(self):
        self.data = {}
        self.pre_changed_files = []
        self.post_changed_files = []
        self.pre_new_files = []
        self.post_new_files = []
        self.check_keys = Config.get("plist_check_keys")
        self.check_keys_hash = Config.get("plist_check_keys_hash")
        self.hashes = self.gather_hashes()
        self.files = list_launch_agents() + list_launch_daemons() + \
            list_app_info_plist() + list_plugin_info_plist() + \
            list_current_host_pref_files()
        self.changed_files, self.new_files, \
        self.same_files = self.bucket_files(
            self.files,
            self.hashes,
        )
        self.plist_name = None
        self.plist_file = None

        if self.changed_files:
            self.analyze_changed_files()

        if self.new_files:
            self.analyze_new_files()
コード例 #2
0
def webhook_listener():
    if request.method == 'POST':
        bot = Config.instance().bot
        update = Update.de_json(request.get_json(force=True), bot)
        dispatcher = Config.instance().dispatcher
        dispatcher.process_update(update)
    return 'ok'
コード例 #3
0
def train(dataset: PreppedDataset, config: Config)\
        -> keras.Sequential:
    # determine model type and get respective function
    model_type = config.get('model.type')
    try:
        build_model = getattr(ml_models, model_type)
    except AttributeError:
        # raise Exception with more explicit error message
        raise AttributeError('Could not find model function '
                             f'"{model_type}" in lib.models')
    # build
    model = build_model(config, dataset.normalizer)
    # compile
    learning_rate = config.get('model.hyperparameters.learning_rate')
    loss = config.get('model.hyperparameters.loss')
    model.compile(optimizer=tf.optimizers.Adam(learning_rate=learning_rate),
                  loss=loss)
    # train
    epochs = config.get('model.hyperparameters.epochs')
    validation_split = config.get('model.hyperparameters.validation_split')
    model.fit(dataset.training_set,
              dataset.training_labels,
              epochs=epochs,
              validation_split=validation_split,
              verbose=0)
    return model
コード例 #4
0
ファイル: tcpavsource.py プロジェクト: h01ger/voctomix
    def on_accepted(self, conn, addr):
        deinterlacer = self.build_deinterlacer()
        pipeline = """
            fdsrc fd={fd} blocksize=1048576 !
            queue !
            matroskademux name=demux
        """.format(
            fd=conn.fileno()
        )

        if deinterlacer:
            pipeline += """
                demux. !
                    video/x-raw !
                    {deinterlacer}
            """.format(
                deinterlacer=self.build_deinterlacer()
            )
            self.build_pipeline(pipeline)

        else:
            self.build_pipeline(pipeline)

        self.audio_caps = Gst.Caps.from_string(Config.get('mix', 'audiocaps'))
        self.video_caps = Gst.Caps.from_string(Config.get('mix', 'videocaps'))

        demux = self.pipeline.get_by_name('demux')
        demux.connect('pad-added', self.on_pad_added)

        self.pipeline.set_state(Gst.State.PLAYING)
コード例 #5
0
ファイル: commands.py プロジェクト: froztbyte/voctomix
    def __init__(self, pipeline):
        self.log = logging.getLogger('ControlServerCommands')

        self.pipeline = pipeline

        self.sources = Config.getlist('mix', 'sources')
        self.blankerSources = Config.getlist('stream-blanker', 'sources')
コード例 #6
0
    def test_audiosource_together_with_per_source_volumes_for_different_sources_raises_an_error(
            self):
        Config.given("mix", "audiosource", "cam2")
        Config.given("source.cam1", "volume", "0.23")

        with self.assertRaises(ConfigurationError):
            audiomixer = AudioMix()
コード例 #7
0
    def authenticate(self, impartus: Impartus, event=None):  # noqa
        """
        Callback function for 'Show Videos' button.
        Fetch video/lectures available to the user and display on the UI.
        """

        creds_conf = Config.load(ConfigType.CREDENTIALS)
        if self.save_credentials_var.get():
            creds_conf['login_email'] = self.user_box.get()
            creds_conf['password'] = self.pass_box.get()
        else:
            creds_conf['login_email'] = ''
            creds_conf['password'] = ''
        Config.save(ConfigType.CREDENTIALS)

        self.show_videos_button.config(state='disabled')

        username = self.user_box.get()
        password = self.pass_box.get()
        root_url = self.url_box.get()
        if username == '' or password == '' or root_url == '':
            return

        if not impartus.session:
            success = impartus.authenticate(username, password, root_url)
            if not success:
                tkinter.messagebox.showerror(
                    'Error',
                    'Error authenticating, see console logs for details.')
                self.show_videos_button.config(state='normal')
                return

        # hide the authentication frame.
        self.frame_auth.grid_forget()
コード例 #8
0
    def __init__(self):
        self.data = {}
        self.pre_changed_files = []
        self.post_changed_files = []
        self.pre_new_files = []
        self.post_new_files = []
        self.check_keys = Config.get("plist_check_keys")
        self.check_keys_hash = Config.get("plist_check_keys_hash")
        self.hashes = self.gather_hashes()
        self.files = list_launch_agents() + list_launch_daemons() + \
            list_app_info_plist() + list_plugin_info_plist() + \
            list_current_host_pref_files()
        self.changed_files, self.new_files, \
        self.same_files = self.bucket_files(
            self.files,
            self.hashes,
        )
        self.plist_name = None
        self.plist_file = None

        if self.changed_files:
            self.analyze_changed_files()

        if self.new_files:
            self.analyze_new_files()
コード例 #9
0
    def test_audiosource_sets_source_volume_to_full(self):
        Config.given("mix", "audiosource", "cam2")

        audiomixer = AudioMix()

        self.assertListEqual(audiomixer.names, ["cam1", "cam2", "grabber"])
        self.assertListEqual(audiomixer.volumes, [0.0, 1.0, 0.0])
コード例 #10
0
def main():
    args = parse_args()
    cfg = Config(args.cfg)
    dataset = cfg.get_dataset('test')
    height, width = cfg['datasets']['test']['parameters']['img_size']
    print('Using resolution {}x{}'.format(width, height))
    if not args.view:
        video = create_video(args.out, width, height)
    # add_cover_img(video, args.cover)
    with open(args.pred, "rb") as pred_file:
        predictions = pickle.load(pred_file)

    for idx, pred in tqdm(zip(range(len(dataset)), predictions),
                          total=len(dataset)):
        if idx < 2200: continue
        if idx > 3000: break
        det_pred, cls_pred = pred
        assert det_pred.shape[0] == 1  # batch size == 1
        frame = dataset.draw_annotation(idx,
                                        pred=det_pred[0].cpu().numpy(),
                                        cls_pred=cls_pred[0].cpu().numpy()
                                        if cls_pred is not None else None)
        assert frame.shape[:2] == (height, width)
        if args.view:
            cv2.imshow('frame', frame)
            cv2.waitKey(0)
        else:
            video.write(frame)

    if not args.view:
        video.release()
        print('Video saved as {}'.format(args.out))
コード例 #11
0
ファイル: commands.py プロジェクト: joeladdison/voctomix
    def __init__(self, pipeline):
        self.log = logging.getLogger("ControlServerCommands")

        self.pipeline = pipeline

        self.sources = Config.getlist("mix", "sources")
        self.blankerSources = Config.getlist("stream-blanker", "sources")
コード例 #12
0
ファイル: source.py プロジェクト: voc/multiview-monitor
	def start(self):
		w, h = self.caps.get_int('width')[1], self.caps.get_int('height')[1]

		if w < 640 or h < 480:
			raise RuntimeError('ebur128 video output-size must be at least 640x480')

		# subprocess -> pipe
		process = Config.get('input', 'command').format(
			url=self.url,
			w=w,
			h=h
		)

		self.log.debug('Starting Source-Process:\n%s', process)
		self.process = subprocess.Popen(shlex.split(process),
			stdout=self.pipe[1])

		# pipe -> this process -> intervideosink
		pipeline = """
			fdsrc fd={fd} !
			queue !
			matroskademux !
			{caps} !
			intervideosink channel=in_{name}
		""".format(
			fd=self.pipe[0],
			caps=Config.get('input', 'caps'),
			name=self.name
		)

		self.log.debug('Starting Source-Pipeline:\n%s', pipeline)
		self.pipeline = Gst.parse_launch(pipeline)
		self.pipeline.set_state(Gst.State.PLAYING)
コード例 #13
0
ファイル: __init__.py プロジェクト: escapewindow/build-runner
def main():
    parser = make_argument_parser()
    args = parser.parse_args()
    logging.basicConfig(format="%(asctime)s - %(levelname)s - %(message)s", level=args.loglevel)
    config = Config()

    if sys.platform in ('linux2', 'darwin') and args.syslog:
        from logging.handlers import SysLogHandler
        handler = SysLogHandler(address=get_syslog_address())
        log.addHandler(handler)

    if args.config_file:
        config.load_config(args.config_file)

    if args.get:
        log.debug("getting %s", args.get)
        section, option = args.get.split(".", 1)
        v = config.get(section, option)
        if v is not None:
            print v
        exit(0)
    elif not args.taskdir:
        parser.error("taskdir required")

    if not os.path.exists(args.taskdir):
        log.error("%s doesn't exist", args.taskdir)
        exit(1)

    runner(config, args.taskdir, args.times)
    if args.halt_after and config.halt_task:
        halt_cmd = os.path.join(args.taskdir, config.halt_task)
        log.info("finishing run with halt task: %s" % halt_cmd)
        run_task(halt_cmd, os.environ, config.max_time)
コード例 #14
0
 def setUp(self):
     config = Config()
     config.pkgdir = 'test/data/res/packages'
     config.schema = 'res/itemschema.json'
     config.localedir = 'test/data/res'
     self.app = Application()
     self.app.setup(config)
コード例 #15
0
 def __init__(self, dhcp_leases_file, port_type, config_path=None):
     self.log = logger.getlogger()
     self.cfg = Config(config_path)
     self.dhcp_leases_file = dhcp_leases_file
     self.port_type = port_type
     self.inv = Inventory(cfg_file=config_path)
     self.log.debug('Add ports, port type: {}'.format(self.port_type))
コード例 #16
0
    def __init__(self, config_path=None, name=None):
        self.log = logger.getlogger()
        self.cfg = Config(config_path)

        self.cont_package_path = gen.get_container_package_path()
        self.cont_id_file = gen.get_container_id_file()
        self.cont_venv_path = gen.get_container_venv_path()
        self.cont_scripts_path = gen.get_container_scripts_path()
        self.cont_python_path = gen.get_container_python_path()
        self.cont_os_images_path = gen.get_container_os_images_path()
        self.cont_playbooks_path = gen.get_container_playbooks_path()
        self.depl_package_path = gen.get_package_path()
        self.depl_python_path = gen.get_python_path()
        self.depl_playbooks_path = gen.get_playbooks_path()

        if name is True or name is None:
            for vlan in self.cfg.yield_depl_netw_client_vlan('pxe'):
                break
            self.name = '{}-pxe{}'.format(self.DEFAULT_CONTAINER_NAME, vlan)
        else:
            self.name = name

        self.client = docker.from_env()

        try:
            self.image = self.client.images.get('power-up')
        except docker.errors.ImageNotFound:
            self.image = None

        try:
            self.cont = self.client.containers.get(self.name)
        except docker.errors.NotFound:
            self.cont = None
コード例 #17
0
    def test_set_composite_mode_sets_default_b_source(self):
        Config.given('side-by-side-preview', 'default-b', 'cam2')

        self.videomixer.setCompositeMode(CompositeModes.side_by_side_preview)

        self.videomixer.setVideoSourceA.assert_not_called()
        self.videomixer.setVideoSourceB.assert_called_with(1)
コード例 #18
0
ファイル: glacier.py プロジェクト: vagifzeynalov/glaciersync
def inventory(argOption=None, argLocation=None, argVault=None, argRegion=None, argConfigFile=None):
    if argLocation is None:
        argLocation = 'ALL'
    argOption = str.upper(argOption)
    print "### %s INVENTORY for '%s' location(s)" % (argOption, argLocation)
 
    config = Config(argConfigFile)
    locations = config.getLocations()
    for location, locationConfig in locations.iteritems():
        if argLocation != 'ALL' and location != argLocation:
            continue # SKIP
        if argRegion is not None and argRegion != locationConfig['region']:
            continue # SKIP
        if argVault is not None and argVault != locationConfig['vault']:
            continue # SKIP
          
        print "Processing %s" % location
        glacierJob = GlacierJob(
                             locationConfig['region'], 
                             locationConfig['vault'], 
                             awsCredentials = config.getAWScredentials())
        
        if 'SHOW' == argOption:
            glacierJob.showInventory()
        else:
            glacierJob.requestInventory()
コード例 #19
0
    def on_accepted(self, conn, addr):
        deinterlacer = self.build_deinterlacer()
        pipeline = """
            fdsrc fd={fd} blocksize=1048576 !
            queue !
            matroskademux name=demux
        """.format(fd=conn.fileno())

        if deinterlacer:
            pipeline += """
                demux. !
                    video/x-raw !
                    {deinterlacer}
            """.format(deinterlacer=self.build_deinterlacer())
            self.build_pipeline(pipeline)

        else:
            self.build_pipeline(pipeline)

        self.audio_caps = Gst.Caps.from_string(Config.get('mix', 'audiocaps'))
        self.video_caps = Gst.Caps.from_string(Config.get('mix', 'videocaps'))

        demux = self.pipeline.get_by_name('demux')
        demux.connect('pad-added', self.on_pad_added)

        self.pipeline.set_state(Gst.State.PLAYING)
コード例 #20
0
ファイル: testlight.py プロジェクト: CarlFK/voctomix-outcasts
def main():
    parser = ArgumentParser(
        description='Test program for testing tallylight plugins')
    parser.add_argument(
        '-c', '--config', type=FileType('r'), help='Use a specific config file')
    args = parser.parse_args()
    config = Config(cmd_line_config=args.config)

    plugin_cls = PLUGINS.get(config.get('light', 'plugin'), None)
    if plugin_cls is None:
        print('No plugin selected, control will not work!')
        exit(1)

    plugin = plugin_cls(config)

    try:
        while True:
            print('Tally light on. Press ENTER to turn off, ^C to stop.')
            plugin.tally_on()
            input()
            print('Tally light off. Press ENTER to turn on, ^C to stop.')
            plugin.tally_off()
            input()
    except KeyboardInterrupt:
        pass
コード例 #21
0
    def setUp(self):
        super().setUp()

        Config.given("mix", "videocaps", "video/x-raw")

        self.source = TCPAVSource('cam1', 42, ['test_mixer', 'test_preview'], has_audio=True, has_video=True)
        self.mock_fp = MagicMock(spec=io.IOBase)
コード例 #22
0
def download_os_images(config_path=None):
    """Download OS installation images"""

    log = logger.getlogger()
    os_images_path = get_os_images_path() + "/"
    os_image_urls_yaml_path = os_images_path + OS_IMAGES_URLS_FILENAME

    cfg = Config(config_path)
    os_image_urls = yaml.load(open(os_image_urls_yaml_path),
                              Loader=AttrDictYAMLLoader).os_image_urls

    for os_profile in cfg.yield_ntmpl_os_profile():
        for os_image_url in os_image_urls:
            if check_os_profile(os_profile) in os_image_url.name:
                for image in os_image_url.images:
                    dest = os_images_path
                    if 'filename' in image:
                        dest += image.filename
                    else:
                        dest += image.url.split("/")[-1]
                    if not os.path.isfile(dest):
                        log.info('Downloading OS image: %s' % image.url)
                        wget.download(image.url, out=dest)
                        print('')
                        sys.stdout.flush()
                    log.info('Verifying OS image sha1sum: %s' % dest)
                    sha1sum = _sha1sum(dest)
                    if image.sha1sum != sha1sum:
                        msg = ('OS image sha1sum verification failed: %s' %
                               dest)
                        log.error(msg)
                        raise UserException(msg)
コード例 #23
0
ファイル: test_config.py プロジェクト: danic85/mojo_home_bot
    def test_set_config(self):
        b = Config()
        b.db = Mock()
        b.db.insert = Mock(return_value=1234)

        self.assertEquals(b.set('configItem', 'value'), 'Config set: configItem = value')
        b.db.insert.assert_called_with('config', {'key': 'configItem', 'value': 'value'})
コード例 #24
0
def download_os_images(config_path=None):
    """Download OS installation images"""

    log = logger.getlogger()
    cfg = Config(config_path)
    os_images_path = get_os_images_path() + "/"
    os_image_urls = get_os_image_urls()

    for os_profile in cfg.yield_ntmpl_os_profile():
        for os_image_url in os_image_urls:
            if check_os_profile(os_profile) in os_image_url['name']:
                for image in os_image_url['images']:
                    dest = os_images_path
                    if 'filename' in image:
                        dest += image['filename']
                    else:
                        dest += image['url'].split("/")[-1]
                    if not os.path.isfile(dest):
                        log.info(f"Downloading OS image: {image['url']}")
                        wget.download(image['url'], out=dest)
                        print('')
                        sys.stdout.flush()
                    log.info('Verifying OS image sha1sum: %s' % dest)
                    if image['sha1sum'] != sha1sum(dest):
                        msg = ('OS image sha1sum verification failed: %s' %
                               dest)
                        log.error(msg)
                        raise UserException(msg)
コード例 #25
0
    def test_audiosource_sets_source_volume_to_full(self):
        Config.given("mix", "audiosource", "cam2")

        audiomixer = AudioMix()

        self.assertListEqual(audiomixer.names, ["cam1", "cam2", "grabber"])
        self.assertListEqual(audiomixer.volumes, [0.0, 1.0, 0.0])
コード例 #26
0
    def __init__(self):

        self.warrior = TaskWarrior()
        self.config = Config()

        self.default_limit = self.config.get_default_filter()
        self.limit = self.default_limit
        self.show_annotations = []

        self.walker = urwid.SimpleListWalker([])
        self.list_box = ScrollingListBox(self.walker)
        self.view = urwid.Frame(urwid.AttrWrap(self.list_box, 'body'))
        self.refresh()

        def update_header():
            limit = ' | ' + self.limit if self.limit else ''
            header_text = ['tasky.α', ('dim', limit)]
            self.view.set_header(urwid.AttrMap(urwid.Text(header_text),
                                               'head'))

        update_header()

        loop = urwid.MainLoop(self.view,
                              Tasky.palette,
                              unhandled_input=self.keystroke)
        self.loop = loop
        urwid.connect_signal(self.walker, 'modified', update_header)
        loop.screen.set_terminal_properties(colors=256)
        loop.run()
コード例 #27
0
def test_save(mocker, config_maps_yaml):
    config_dict = {'foo': 'bar', 'foobar': 'foobaz'}

    mocker.patch('yaml.load', return_value=config_dict)
    mock_yaml_dump = mocker.patch('yaml.dump')

    mock_builtins_open = mocker.patch('builtins.open')

    # duplicate each element in list, as we are calling open twice (first with Config.load(), later with Config.save()
    mock_builtins_open.return_value.__enter__.side_effect = [
        v for v in config_maps_yaml.values() for _ in (0, 1)
    ]

    from lib.config import Config
    for filetype, filepath in config_maps_yaml.items():
        Config.load(filetype)
        Config.save(filetype)
        mock_yaml_dump.aseert_call_once_with(config_dict,
                                             filepath,
                                             default_flow_style=False,
                                             default_style="'")
        mock_yaml_dump.reset_mock()

    # invalid filetypes should return None
    assert Config.save('foo') is None
コード例 #28
0
    def test_yes_does_add_yadif(self):
        Config.given("source.cam1", "deinterlace", "yes")

        pipeline = self.simulate_connection_and_aquire_pipeline_description()
        self.assertContainsIgnoringWhitespace(
            pipeline,
            "demux. ! video/x-raw ! videoconvert ! yadif mode=interlaced name=deinter")
コード例 #29
0
ファイル: avsource.py プロジェクト: gnoutchd/voctomix
	def on_accepted(self, conn, addr):
		pipeline = """
			fdsrc fd={fd} !
			matroskademux name=demux
		""".format(
			fd=conn.fileno()
		)

		if self.has_audio:
			pipeline += """
				demux. !
				{acaps} !
				queue !
				tee name=atee
			""".format(
				acaps=Config.get('mix', 'audiocaps')
			)

			for output in self.outputs:
				pipeline += """
					atee. ! queue ! interaudiosink channel=audio_{output}
				""".format(
					output=output
				)

		if self.has_video:
			pipeline += """
				demux. !
				{vcaps} !
				queue !
				tee name=vtee
			""".format(
				vcaps=Config.get('mix', 'videocaps')
			)

			for output in self.outputs:
				pipeline += """
					vtee. ! queue ! intervideosink channel=video_{output}
				""".format(
					output=output
				)

		self.log.debug('Launching Source-Pipeline:\n%s', pipeline)
		self.receiverPipeline = Gst.parse_launch(pipeline)

		self.log.debug('Binding End-of-Stream-Signal on Source-Pipeline')
		self.receiverPipeline.bus.add_signal_watch()
		self.receiverPipeline.bus.connect("message::eos", self.on_eos)
		self.receiverPipeline.bus.connect("message::error", self.on_error)

		self.all_video_caps = Gst.Caps.from_string('video/x-raw')
		self.video_caps = Gst.Caps.from_string(Config.get('mix', 'videocaps'))

		self.all_audio_caps = Gst.Caps.from_string('audio/x-raw')
		self.audio_caps = Gst.Caps.from_string(Config.get('mix', 'audiocaps'))

		demux = self.receiverPipeline.get_by_name('demux')
		demux.connect('pad-added', self.on_pad_added)

		self.receiverPipeline.set_state(Gst.State.PLAYING)
コード例 #30
0
ファイル: commands.py プロジェクト: nueces/voctomix
	def __init__(self, pipeline):
		self.log = logging.getLogger('ControlServerCommands')

		self.pipeline = pipeline

		self.sources = Config.getlist('mix', 'sources')
		self.blankerSources = Config.getlist('stream-blanker', 'sources')
コード例 #31
0
ファイル: videomix.py プロジェクト: h01ger/voctomix
    def selectCompositeModeDefaultSources(self):
        sectionNames = {
            CompositeModes.fullscreen: 'fullscreen',
            CompositeModes.side_by_side_equal: 'side-by-side-equal',
            CompositeModes.side_by_side_preview: 'side-by-side-preview',
            CompositeModes.picture_in_picture: 'picture-in-picture'
        }

        compositeModeName = self.compositeMode.name
        sectionName = sectionNames[self.compositeMode]

        try:
            defSource = Config.get(sectionName, 'default-a')
            self.setVideoSourceA(self.names.index(defSource))
            self.log.info('Changing sourceA to default of Mode %s: %s',
                          compositeModeName, defSource)
        except Exception as e:
            pass

        try:
            defSource = Config.get(sectionName, 'default-b')
            self.setVideoSourceB(self.names.index(defSource))
            self.log.info('Changing sourceB to default of Mode %s: %s',
                          compositeModeName, defSource)
        except Exception as e:
            pass
def main():
    parser = make_argument_parser()
    args = parser.parse_args()
    logging.basicConfig(format="%(asctime)s - %(levelname)s - %(message)s",
                        level=args.loglevel)
    config = Config()

    if sys.platform in ('linux2', 'darwin') and args.syslog:
        from logging.handlers import SysLogHandler
        handler = SysLogHandler(address=get_syslog_address())
        log.addHandler(handler)

    if args.config_file:
        config.load_config(args.config_file)

    if args.get:
        log.debug("getting %s", args.get)
        section, option = args.get.split(".", 1)
        v = config.get(section, option)
        if v is not None:
            print v
        exit(0)
    elif not args.taskdir:
        parser.error("taskdir required")

    if not os.path.exists(args.taskdir):
        log.error("%s doesn't exist", args.taskdir)
        exit(1)

    runner(config, args.taskdir, args.times)
    if args.halt_after and config.halt_task:
        halt_cmd = os.path.join(args.taskdir, config.halt_task)
        log.info("finishing run with halt task: %s" % halt_cmd)
        run_task(halt_cmd, os.environ, config.max_time)
コード例 #33
0
    def test_set_composite_mode_sets_default_b_source(self):
        Config.given('side-by-side-preview', 'default-b', 'cam2')

        self.videomixer.setCompositeMode(CompositeModes.side_by_side_preview)

        self.videomixer.setVideoSourceA.assert_not_called()
        self.videomixer.setVideoSourceB.assert_called_with(1)
コード例 #34
0
def main() -> None:
    """ TODO """

    config = Config(
        basename="trellod",
        api_key=None,
        api_secret=None,
        oauth_token=None,
        oauth_token_secret=None,
    )
    if config.api_key is None:
        config.set(**authorize())

    client = login(config)

    board_name = None
    board = select_board(client, board_name)
    # lists = select_lists(board)
    lists = board.open_lists()

    filename = f"Trello {board.name.strip()}.xlsx"
    dump_trello(filename, lists)
    # download_images_in_lists(lists)

    webbrowser.open(f"file://{Path(filename).resolve()}")
コード例 #35
0
ファイル: testlight.py プロジェクト: xfxf/voctomix-outcasts
def main():
    parser = ArgumentParser(
        description='Test program for testing tallylight plugins')
    parser.add_argument('-c',
                        '--config',
                        type=FileType('r'),
                        help='Use a specific config file')
    args = parser.parse_args()
    config = Config(cmd_line_config=args.config)

    plugin_cls = PLUGINS.get(config.get('light', 'plugin'), None)
    if plugin_cls is None:
        print('No plugin selected, control will not work!')
        exit(1)

    plugin = plugin_cls(config)

    try:
        while True:
            print('Tally light on. Press ENTER to turn off, ^C to stop.')
            plugin.tally_on()
            input()
            print('Tally light off. Press ENTER to turn on, ^C to stop.')
            plugin.tally_off()
            input()
    except KeyboardInterrupt:
        pass
コード例 #36
0
    def selectCompositeModeDefaultSources(self):
        sectionNames = {
            CompositeModes.fullscreen: 'fullscreen',
            CompositeModes.side_by_side_equal: 'side-by-side-equal',
            CompositeModes.side_by_side_preview: 'side-by-side-preview',
            CompositeModes.picture_in_picture: 'picture-in-picture'
        }

        compositeModeName = self.compositeMode.name
        sectionName = sectionNames[self.compositeMode]

        try:
            defSource = Config.get(sectionName, 'default-a')
            self.setVideoSourceA(self.names.index(defSource))
            self.log.info('Changing sourceA to default of Mode %s: %s',
                          compositeModeName, defSource)
        except Exception as e:
            pass

        try:
            defSource = Config.get(sectionName, 'default-b')
            self.setVideoSourceB(self.names.index(defSource))
            self.log.info('Changing sourceB to default of Mode %s: %s',
                          compositeModeName, defSource)
        except Exception as e:
            pass
コード例 #37
0
 def __init__(self):
     # Cache the client in memory
     self._client = None
     self._mysql = MySQL(Config.get_variable('mysql_db', 'host'),
                         Config.get_variable('mysql_db', 'user'),
                         Config.get_variable('mysql_db', 'password'),
                         int(Config.get_variable('mysql_db', 'port')))
コード例 #38
0
ファイル: streamblanker.py プロジェクト: CarlFK/voctomix
	def __init__(self):
		self.acaps = Config.get('mix', 'audiocaps')
		self.vcaps = Config.get('mix', 'videocaps')

		self.names = Config.getlist('stream-blanker', 'sources')
		self.log.info('Configuring StreamBlanker video %u Sources', len(self.names))

		pipeline = """
			compositor name=vmix !
			{vcaps} !
			intervideosink channel=video_streamblanker_out

			audiomixer name=amix !
			{acaps} !
			interaudiosink channel=audio_streamblanker_out


			intervideosrc channel=video_mix_streamblanker !
			{vcaps} !
			vmix.

			interaudiosrc channel=audio_mix_streamblanker !
			{acaps} !
			amix.


			interaudiosrc channel=audio_streamblanker !
			{acaps} !
			amix.
		""".format(
			acaps=self.acaps,
			vcaps=self.vcaps
		)

		for name in self.names:
			pipeline += """
				intervideosrc channel=video_{name}_streamblanker !
				{vcaps} !
				vmix.
			""".format(
				name=name,
				vcaps=self.vcaps
			)

		self.log.debug('Creating Mixing-Pipeline:\n%s', pipeline)
		self.mixingPipeline = Gst.parse_launch(pipeline)
		self.mixingPipeline.use_clock(Clock)

		self.log.debug('Binding Error & End-of-Stream-Signal on Mixing-Pipeline')
		self.mixingPipeline.bus.add_signal_watch()
		self.mixingPipeline.bus.connect("message::eos", self.on_eos)
		self.mixingPipeline.bus.connect("message::error", self.on_error)

		self.log.debug('Initializing Mixer-State')
		self.blankSource = None
		self.applyMixerState()

		self.log.debug('Launching Mixing-Pipeline')
		self.mixingPipeline.set_state(Gst.State.PLAYING)
コード例 #39
0
    def __init__(self):
        self.acaps = Config.get('mix', 'audiocaps')
        self.vcaps = Config.get('mix', 'videocaps')

        self.names = Config.getlist('stream-blanker', 'sources')
        self.log.info('Configuring StreamBlanker video %u Sources',
                      len(self.names))

        self.volume = Config.getfloat('stream-blanker', 'volume')

        pipeline = """
            compositor name=vmix !
            {vcaps} !
            queue !
            intervideosink channel=video_stream-blanker_out

            audiomixer name=amix !
            {acaps} !
            queue !
            interaudiosink channel=audio_stream-blanker_out


            intervideosrc channel=video_mix_stream-blanker !
            {vcaps} !
            vmix.

            interaudiosrc channel=audio_mix_stream-blanker !
            {acaps} !
            amix.


            interaudiosrc channel=audio_stream-blanker !
            {acaps} !
            amix.
        """.format(acaps=self.acaps, vcaps=self.vcaps)

        for name in self.names:
            pipeline += """
                intervideosrc channel=video_stream-blanker-{name} !
                {vcaps} !
                vmix.
            """.format(name=name, vcaps=self.vcaps)

        self.log.debug('Creating Mixing-Pipeline:\n%s', pipeline)
        self.mixingPipeline = Gst.parse_launch(pipeline)
        self.mixingPipeline.use_clock(Clock)

        self.log.debug('Binding Error & End-of-Stream-Signal '
                       'on Mixing-Pipeline')
        self.mixingPipeline.bus.add_signal_watch()
        self.mixingPipeline.bus.connect("message::eos", self.on_eos)
        self.mixingPipeline.bus.connect("message::error", self.on_error)

        self.log.debug('Initializing Mixer-State')
        self.blankSource = None
        self.applyMixerState()

        self.log.debug('Launching Mixing-Pipeline')
        self.mixingPipeline.set_state(Gst.State.PLAYING)
コード例 #40
0
    def test_set_composite_mode_sets_default_a_and_b_source(self):
        Config.given('side-by-side-preview', 'default-a', 'grabber')
        Config.given('side-by-side-preview', 'default-b', 'cam1')

        self.videomixer.setCompositeMode(CompositeModes.side_by_side_preview)

        self.videomixer.setVideoSourceA.assert_called_with(2)
        self.videomixer.setVideoSourceB.assert_called_with(0)
コード例 #41
0
    def test_set_composite_mode_sets_default_a_and_b_source(self):
        Config.given('side-by-side-preview', 'default-a', 'grabber')
        Config.given('side-by-side-preview', 'default-b', 'cam1')

        self.videomixer.setCompositeMode(CompositeModes.side_by_side_preview)

        self.videomixer.setVideoSourceA.assert_called_with(2)
        self.videomixer.setVideoSourceB.assert_called_with(0)
コード例 #42
0
ファイル: main.py プロジェクト: rusko124/portf_view
def load_config(path):
    if not os.path.isfile(path):
        main_logger.log_console("Config file does not exists '%s'" % path, status="~")
        return None
    config = Config(path)
    if not config.load():
        return None
    return config
コード例 #43
0
ファイル: pilot.py プロジェクト: Manele28/projetM2
	def __init__(self):

		self.wheel_motors    = Wheel_Motors()
		self.direction       = Direction()
		self.config          = Config(self.CONFIG_FILE())
		self.position        = Position(self.config)
		self.mvt_state       = enum.Mvt_State.IDLE
		self.direction_state = enum.Direction_State.STRAIGHT
コード例 #44
0
    def test_get_config_option(self):
        Config.given('somesection', 'somekey', 'somevalue')
        response = self.commands.get_config_option('somesection', 'somekey')

        self.assertIsInstance(response, OkResponse)
        self.assertEqual(
            response.args,
            ('server_config_option', 'somesection', 'somekey', 'somevalue'))
コード例 #45
0
    def test_assume_progressive_does_add_capssetter(self):
        Config.given("source.cam1", "deinterlace", "assume-progressive")

        pipeline = self.simulate_connection_and_aquire_pipeline_description()
        self.assertContainsIgnoringWhitespace(
            pipeline,
            "demux. ! video/x-raw ! capssetter caps=video/x-raw,interlace-mode=progressive name=deinter"
        )
コード例 #46
0
ファイル: avsource.py プロジェクト: h01ger/voctomix
    def build_pipeline(self, pipeline):
        if self.has_audio:
            num_streams = self.force_num_streams
            if num_streams is None:
                num_streams = Config.getint('mix', 'audiostreams')

            for audiostream in range(0, num_streams):
                audioport = self.build_audioport(audiostream)
                if not audioport:
                    continue

                pipeline += """
                    {audioport} !
                    {acaps} !
                    queue !
                    tee name=atee_stream{audiostream}
                """.format(
                    audioport=audioport,
                    acaps=Config.get('mix', 'audiocaps'),
                    audiostream=audiostream,
                )

                for output in self.outputs:
                    pipeline += """
                        atee_stream{audiostream}. ! queue ! interaudiosink
                            channel=audio_{output}_stream{audiostream}
                    """.format(
                        output=output,
                        audiostream=audiostream,
                    )

        if self.has_video:
            pipeline += """
                {videoport} !
                {vcaps} !
                queue !
                tee name=vtee
            """.format(
                videoport=self.build_videoport(),
                deinterlacer=self.build_deinterlacer(),
                vcaps=Config.get('mix', 'videocaps')
            )

            for output in self.outputs:
                pipeline += """
                    vtee. ! queue ! intervideosink channel=video_{output}
                """.format(
                    output=output
                )

        self.log.debug('Launching Source-Pipeline:\n%s', pipeline)
        self.pipeline = Gst.parse_launch(pipeline)
        self.pipeline.use_clock(Clock)

        self.log.debug('Binding End-of-Stream-Signal on Source-Pipeline')
        self.pipeline.bus.add_signal_watch()
        self.pipeline.bus.connect("message::eos", self.on_eos)
        self.pipeline.bus.connect("message::error", self.on_error)
コード例 #47
0
ファイル: commands.py プロジェクト: voc/voctomix
    def __init__(self, pipeline):
        self.log = logging.getLogger('ControlServerCommands')

        self.pipeline = pipeline
        self.stored_values = {}

        self.sources = Config.getlist('mix', 'sources')
        if Config.getboolean('stream-blanker', 'enabled'):
            self.blankerSources = Config.getlist('stream-blanker', 'sources')
コード例 #48
0
ファイル: videomix.py プロジェクト: nueces/voctomix
	def recalculateMixerStateSideBySideEqual(self):
		self.log.info('Updating Mixer-State for Side-by-side-Equal-Composition')

		width, height = self.getInputVideoSize()
		self.log.debug('Video-Size parsed as %ux%u', width, height)

		try:
			gutter = Config.getint('side-by-side-equal', 'gutter')
			self.log.debug('Gutter configured to %u', gutter)
		except:
			gutter = int(width / 100)
			self.log.debug('Gutter calculated to %u', gutter)

		targetWidth = int((width - gutter) / 2)
		targetHeight = int(targetWidth / width * height)

		self.log.debug('Video-Size calculated to %ux%u', targetWidth, targetHeight)

		xa = 0
		xb = width - targetWidth
		y = (height - targetHeight) / 2

		try:
			ya = Config.getint('side-by-side-equal', 'atop')
			self.log.debug('A-Video Y-Pos configured to %u', ya)
		except:
			ya = y
			self.log.debug('A-Video Y-Pos calculated to %u', ya)


		try:
			yb = Config.getint('side-by-side-equal', 'btop')
			self.log.debug('B-Video Y-Pos configured to %u', yb)
		except:
			yb = y
			self.log.debug('B-Video Y-Pos calculated to %u', yb)


		for idx, name in enumerate(self.names):
			pad = self.padState[idx]
			pad.reset()

			pad.width = targetWidth
			pad.height = targetHeight

			if idx == self.sourceA:
				pad.xpos = xa
				pad.ypos = ya
				pad.zorder = 1

			elif idx == self.sourceB:
				pad.xpos = xb
				pad.ypos = yb
				pad.zorder = 2

			else:
				pad.alpha = 0
コード例 #49
0
ファイル: avpreviewoutput.py プロジェクト: CarlFK/voctomix
	def __init__(self, channel, port):
		self.log = logging.getLogger('AVPreviewOutput['+channel+']')
		super().__init__(port)

		self.channel = channel

		if Config.has_option('previews', 'videocaps'):
			vcaps_out = Config.get('previews', 'videocaps')
		else:
			vcaps_out = Config.get('mix', 'videocaps')

		pipeline = """
			intervideosrc channel=video_{channel} !
			{vcaps_in} !
			capssetter caps="video/x-raw,interlace-mode=interlaced" !
			deinterlace !
			video/x-raw,interlace-mode=progressive !
			videoscale !
			videorate !
			{vcaps_out} !
			jpegenc quality=90 !
			queue !
			mux.

			interaudiosrc channel=audio_{channel} !
			{acaps} !
			queue !
			mux.

			matroskamux
				name=mux
				streamable=true
				writing-app=Voctomix-AVPreviewOutput !

			multifdsink
				blocksize=1048576
				buffers-max=500
				sync-method=next-keyframe
				name=fd
		""".format(
			channel=self.channel,
			acaps=Config.get('mix', 'audiocaps'),
			vcaps_in=Config.get('mix', 'videocaps'),
			vcaps_out=vcaps_out
		)

		self.log.debug('Creating Output-Pipeline:\n%s', pipeline)
		self.outputPipeline = Gst.parse_launch(pipeline)
		self.outputPipeline.use_clock(Clock)

		self.log.debug('Binding Error & End-of-Stream-Signal on Output-Pipeline')
		self.outputPipeline.bus.add_signal_watch()
		self.outputPipeline.bus.connect("message::eos", self.on_eos)
		self.outputPipeline.bus.connect("message::error", self.on_error)

		self.log.debug('Launching Output-Pipeline')
		self.outputPipeline.set_state(Gst.State.PLAYING)
コード例 #50
0
    def test_set_composite_mode_does_not_set_default_source_if_requested(self):
        Config.given('side-by-side-preview', 'default-a', 'grabber')
        Config.given('side-by-side-preview', 'default-b', 'cam1')

        self.videomixer.setCompositeMode(CompositeModes.side_by_side_preview,
                                         apply_default_source=False)

        self.videomixer.setVideoSourceA.assert_not_called()
        self.videomixer.setVideoSourceB.assert_not_called()
コード例 #51
0
ファイル: videomix.py プロジェクト: h01ger/voctomix
    def recalculateMixerStatePictureInPicture(self):
        self.log.info('Updating Mixer-State for '
                      'Picture-in-Picture-Composition')

        width, height = self.getInputVideoSize()
        self.log.debug('Video-Size parsed as %ux%u', width, height)

        try:
            pipsize = [int(i) for i in Config.get('picture-in-picture',
                                                  'pipsize').split('x', 1)]
            self.log.debug('PIP-Size configured to %ux%u',
                           pipsize[0], pipsize[1])
        except NoOptionError:
            pipsize = [
                int(width / 4),  # 25%
                int(height / 4)  # 25%
            ]
            self.log.debug('PIP-Size calculated to %ux%u',
                           pipsize[0], pipsize[1])

        try:
            pipcrop = [int(i) for i in Config.get('picture-in-picture',
                                                  'pipcrop').split('/', 3)]
            self.log.debug('PIP-Video-Cropping configured to %u/%u/%u/%u',
                           pipcrop[0], pipcrop[1], pipcrop[2], pipcrop[3])
        except NoOptionError:
            pipcrop = [0, 0, 0, 0]
            self.log.debug('PIP-Video-Cropping calculated to %u/%u/%u/%u',
                           pipcrop[0], pipcrop[1], pipcrop[2], pipcrop[3])

        try:
            pippos = [int(i) for i in Config.get('picture-in-picture',
                                                 'pippos').split('/', 1)]
            self.log.debug('PIP-Position configured to %u/%u',
                           pippos[0], pippos[1])
        except NoOptionError:
            pippos = [
                width - pipsize[0] - int(width / 100),  # 1%
                height - pipsize[1] - int(width / 100)  # 1%
            ]
            self.log.debug('PIP-Position calculated to %u/%u',
                           pippos[0], pippos[1])

        for idx, name in enumerate(self.names):
            pad = self.padState[idx]
            pad.reset()

            if idx == self.sourceA:
                pass
            elif idx == self.sourceB:
                pad.xpos, pad.ypos = pippos
                pad.width, pad.height = pipsize
                pad.zorder = 2

            else:
                pad.alpha = 0
コード例 #52
0
ファイル: config.py プロジェクト: Fisk24/Tarpacker
class Config():
    def __init__(self, args, setup):
        self.args  = args
        self.setup = setup

        self.conf  = Conf(self.setup.configdir+"/settings.json")

        self.processArgs()

    def processArgs(self):
        if self.args.set:
            self.setValue()
        if self.args.get:
            self.getValue()
        if self.args.list:
            self.listValues()

    def setValue(self):
        try:
            # itterate through the values each key returns. Assuming each returned value is a dictionary, use the next key in the previously returned dictionary.
            keys = self.args.set[0].split(".")
            self.conf.data[keys[0]][keys[1]]
            self.conf.data[keys[0]][keys[1]] = self.args.set[1]
            self.conf.save()

            print(self.conf.data[keys[0]][keys[1]])

        except IndexError:
            print("Too few arguments")

        except TypeError as e:
            print("Invalid value...")
        except KeyError as e:
            print("The key {0} does not exist! Use \"tp config --list\" to see available values.".format(self.args.get))


    def getValue(self):
        try:
            # itterate through the values each key returns. Assuming each returned value is a dictionary, use the next key in the previously returned dictionary.
            keys = self.args.get.split(".")
            data = self.conf.data
            for key in keys:
                data = data[key]

            print("{key} = {value}".format(key=self.args.get, value=data))
        except TypeError as e:
            print("Invalid value...")
        except KeyError as e:
            print("The key {0} does not exist! Use \"tp config --list\" to see available values.".format(self.args.get))

    def listValues(self):
        for section in self.conf.data:
            if section != "conf_file" and section != "status":
                print("{0}:".format(section))
                for key in self.conf.data[section]:
                    print(" |--> {0} = {1}".format(key, self.conf.data[section][key]))
コード例 #53
0
ファイル: misc.py プロジェクト: gnoutchd/voctomix
	def __init__(self, drawing_area, win, uibuilder):
		self.log = logging.getLogger('MiscToolbarController')

		closebtn = uibuilder.find_widget_recursive(drawing_area, 'close')
		closebtn.set_visible( Config.getboolean('misc', 'close') )
		closebtn.connect('clicked', self.on_closebtn_clicked)

		cutbtn = uibuilder.find_widget_recursive(drawing_area, 'cut')
		cutbtn.set_visible( Config.getboolean('misc', 'cut') )
		cutbtn.connect('clicked', self.on_cutbtn_clicked)
コード例 #54
0
ファイル: avsource.py プロジェクト: jhenstridge/voctomix
	def on_accepted(self, conn, addr):
		pipeline = """
			fdsrc fd={fd} !
			matroskademux name=demux

			demux. ! 
			{acaps} !
			queue !
			tee name=atee

			atee. ! queue ! interaudiosink channel=audio_{name}_mixer
			atee. ! queue ! interaudiosink channel=audio_{name}_mirror
		""".format(
			fd=conn.fileno(),
			name=self.name,
			acaps=Config.get('mix', 'audiocaps')
		)

		if Config.getboolean('previews', 'enabled'):
			pipeline += """
				atee. ! queue ! interaudiosink channel=audio_{name}_preview
			""".format(
				name=self.name
			)

		pipeline += """
			demux. ! 
			{vcaps} !
			queue !
			tee name=vtee

			vtee. ! queue ! intervideosink channel=video_{name}_mixer
			vtee. ! queue ! intervideosink channel=video_{name}_mirror
		""".format(
			fd=conn.fileno(),
			name=self.name,
			vcaps=Config.get('mix', 'videocaps')
		)

		if Config.getboolean('previews', 'enabled'):
			pipeline += """
				vtee. ! queue ! intervideosink channel=video_{name}_preview
			""".format(
				name=self.name
			)

		self.log.debug('Launching Source-Pipeline:\n%s', pipeline)
		self.receiverPipeline = Gst.parse_launch(pipeline)

		self.log.debug('Binding End-of-Stream-Signal on Source-Pipeline')
		self.receiverPipeline.bus.add_signal_watch()
		self.receiverPipeline.bus.connect("message::eos", self.on_eos)
		self.receiverPipeline.bus.connect("message::error", self.on_error)

		self.receiverPipeline.set_state(Gst.State.PLAYING)
コード例 #55
0
ファイル: avrawoutput.py プロジェクト: h01ger/voctomix
    def __init__(self, channel, port):
        self.log = logging.getLogger('AVRawOutput[{}]'.format(channel))
        super().__init__(port)

        self.channel = channel

        pipeline = """
            intervideosrc channel=video_{channel} !
            {vcaps} !
            queue !
            mux.
        """.format(
            channel=self.channel,
            vcaps=Config.get('mix', 'videocaps'),
        )

        for audiostream in range(0, Config.getint('mix', 'audiostreams')):
            pipeline += """
                interaudiosrc channel=audio_{channel}_stream{audiostream} !
                {acaps} !
                queue !
                mux.
            """.format(
                channel=self.channel,
                acaps=Config.get('mix', 'audiocaps'),
                audiostream=audiostream,
            )

        pipeline += """
            matroskamux
                name=mux
                streamable=true
                writing-app=Voctomix-AVRawOutput !

            multifdsink
                blocksize=1048576
                buffers-max={buffers_max}
                sync-method=next-keyframe
                name=fd
        """.format(
            buffers_max=Config.getint('output-buffers', channel, fallback=500)
        )
        self.log.debug('Creating Output-Pipeline:\n%s', pipeline)
        self.outputPipeline = Gst.parse_launch(pipeline)
        self.outputPipeline.use_clock(Clock)

        self.log.debug('Binding Error & End-of-Stream-Signal '
                       'on Output-Pipeline')
        self.outputPipeline.bus.add_signal_watch()
        self.outputPipeline.bus.connect("message::eos", self.on_eos)
        self.outputPipeline.bus.connect("message::error", self.on_error)

        self.log.debug('Launching Output-Pipeline')
        self.outputPipeline.set_state(Gst.State.PLAYING)
コード例 #56
0
ファイル: audiomix.py プロジェクト: CarlFK/voctomix
	def __init__(self):
		self.log = logging.getLogger('AudioMix')

		self.selectedSource = 0

		self.caps = Config.get('mix', 'audiocaps')
		self.names = Config.getlist('mix', 'sources')
		self.log.info('Configuring Mixer for %u Sources', len(self.names))

		pipeline = """
			audiomixer name=mix !
			{caps} !
			queue !
			tee name=tee

			tee. ! queue ! interaudiosink channel=audio_mix_out
		""".format(
			caps=self.caps
		)

		if Config.getboolean('previews', 'enabled'):
			pipeline += """
				tee. ! queue ! interaudiosink channel=audio_mix_preview
			"""

		if Config.getboolean('stream-blanker', 'enabled'):
			pipeline += """
				tee. ! queue ! interaudiosink channel=audio_mix_streamblanker
			"""

		for idx, name in enumerate(self.names):
			pipeline += """
				interaudiosrc channel=audio_{name}_mixer !
				{caps} !
				mix.
			""".format(
				name=name,
				caps=self.caps
			)

		self.log.debug('Creating Mixing-Pipeline:\n%s', pipeline)
		self.mixingPipeline = Gst.parse_launch(pipeline)
		self.mixingPipeline.use_clock(Clock)

		self.log.debug('Binding Error & End-of-Stream-Signal on Mixing-Pipeline')
		self.mixingPipeline.bus.add_signal_watch()
		self.mixingPipeline.bus.connect("message::eos", self.on_eos)
		self.mixingPipeline.bus.connect("message::error", self.on_error)

		self.log.debug('Initializing Mixer-State')
		self.updateMixerState()

		self.log.debug('Launching Mixing-Pipeline')
		self.mixingPipeline.set_state(Gst.State.PLAYING)
コード例 #57
0
ファイル: test_config.py プロジェクト: danic85/mojo_home_bot
    def test_get_config(self):
        b = Config()
        b.db = Mock()
        b.db.find_one = Mock(return_value=None)
        try:
            self.assertEquals(b.get('something'), None)
        except ValueError as e:
            self.assertEqual(str(e), 'something is not set in config')

        b.db.find_one = Mock(return_value={'key': 'configItem', 'value': '1234'})
        self.assertEquals(b.get('something'), '1234')