Esempio n. 1
0
    def get_pandora_client(self):
        cfg_file = os.environ.get("PYDORA_CFG", "")
        builder = clientbuilder.PydoraConfigFileBuilder(cfg_file)
        if builder.file_exists:
            return builder.build()

        builder = clientbuilder.PianobarConfigFileBuilder()
        if builder.file_exists:
            return builder.build()

        logger.info("No valid pandora config found.")
        sys.exit(1)
Esempio n. 2
0
    def get_client(self):
        cfg_file = os.environ.get("PYDORA_CFG", "")
        builder = clientbuilder.PydoraConfigFileBuilder(cfg_file)
        if builder.file_exists:
            return builder.build()

        builder = clientbuilder.PianobarConfigFileBuilder()
        if builder.file_exists:
            return builder.build()

        if not self.client:
            Screen.print_error("No valid config found")
            sys.exit(1)
Esempio n. 3
0
    def test_integration(self):
        path = os.path.join(os.path.dirname(__file__), "pianobar.cfg")
        cfg = cb.PianobarConfigFileBuilder(path).parse_config()

        self.assertDictEqual(cfg, {
            "AUDIO_QUALITY": "test_qualityQuality",
            "DECRYPTION_KEY": "test_decryption_key",
            "DEVICE": "test_device",
            "ENCRYPTION_KEY": "test_encryption_key",
            "PARTNER_PASSWORD": "******",
            "PARTNER_USER": "******",
            "API_HOST": "test_host/services/json/",
            "PROXY": "test_proxy",
            "USER": {
                "USERNAME": "******",
                "PASSWORD": "******",
                }
            })