def setUp(self): """ """ if hasattr(self, 'leader'): self._setup_dut(self.leader) self.leader.tal_http.power_state_standby_standby() if hasattr(self, 'follower'): self._setup_dut(self.follower) self.follower.tal_http.power_state_standby_standby() else: self.nav_ltap.target.set_IR_telegram_format_F17(IRTRANS.IRAddress.IRA1, IRTRANS.NetworkBit.local, IRTRANS.AudioVideo.audio) self._verification = ASEHelpers.Verification(self.logger, self.tal_http, self.assertFalse, self.assertEqual) ASEHelpers.check_tunein_url(self.tal, self.tal_http, self.selenium_server, self.chromecast, self.skipTest) self._tunein_account = comm_const.TUNEIN_ACCOUNT self._tunein_client = ASEHelpers.TuneInClientHelper(self.tal_http, self.logger, self._tunein_account, self.skipTest, self.tal) Helpers.clear_queue(self.tal_http) self.tal_http.set_active_source(comm_const.SourceJidPrefix.RADIO) self.product_fiendly_name = self.tal_http.get_product_friendly_name() if self.apple_communicator is not None: self.apple_communicator.ip_address = self.tal.get_ip() self.apple_communicator.create_client(60) self.logger.info("Setup end")
def setUp(self): """ """ if hasattr(self, 'leader'): self._setup_dut(self.leader) self.leader.tal_http.power_state_standby_standby() if hasattr(self, 'follower'): self._setup_dut(self.follower) self.follower.tal_http.power_state_standby_standby() else: self.nav_ltap.target.set_IR_telegram_format_F17( IRTRANS.IRAddress.IRA1, IRTRANS.NetworkBit.local, IRTRANS.AudioVideo.audio) self._verification = ASEHelpers.Verification( self.logger, self.tal_http, self.assertFalse, self.assertEqual) ASEHelpers.check_tunein_url(self.tal, self.tal_http, self.selenium_server, self.chromecast, self.skipTest) self._tunein_account = comm_const.TUNEIN_ACCOUNT self._tunein_client = ASEHelpers.TuneInClientHelper( self.tal_http, self.logger, self._tunein_account, self.skipTest, self.tal) Helpers.clear_queue(self.tal_http) self.tal_http.set_active_source(comm_const.SourceJidPrefix.RADIO) self.product_fiendly_name = self.tal_http.get_product_friendly_name( ) if self.apple_communicator is not None: self.apple_communicator.ip_address = self.tal.get_ip() self.apple_communicator.create_client(60) self.logger.info("Setup end")
def setUp(self): """ Setup """ self.tal_http.debug = True if self.sound_card: Helpers.mute_sound_output(self.sound_card) self._linein = PlayBack.LineInCommands(self.tal_http, self.logger, self.sound_card) self._sound_verification = ASEHelpers.SoundVerification( self.logger, self.sound_card, self.tal_http, self.assertFalse, self.assertEqual, 55) if self.bt_sound_card: self._bluetooth = PlayBack.BlueToothCommands( self.tal, self.tal_http, self.logger, self.bt_sound_card) # connecting BT player if it is necessary if len(self.tal_http.get_bluetooth_devices()) == 0: self._bluetooth.pair(self.tal.bluetooth_mac_address) ASEHelpers.check_tunein_url(self.tal, self.tal_http, self.selenium_server, self.chromecast, self.skipTest) self._deezer_account = ASEHelpers.get_deezer_account(self.tal) self._tunein_account = comm_const.TUNEIN_ACCOUNT self._deezer_client = ASEHelpers.DeezerClientHelper( self.tal_http, self.logger, self._deezer_account, self.skipTest) self._tunein_client = ASEHelpers.TuneInClientHelper( self.tal_http, self.logger, self._tunein_account, self.skipTest, self.tal) self._dlna_client = ASEHelpers.DLNAClientHelper( self.tal_http, self.logger) self._streaming = PlayBack.StreamingCommands(self.tal_http, self.logger) self._play_queue = PlayBack.PlayQueue(self.tal_http, self.logger) if self.apple_communicator is not None: self.apple_communicator.ip_address = self.tal.get_ip() self.apple_communicator.create_client(60) self._verification = ASEHelpers.Verification(self.logger, self.tal_http, self.assertFalse, self.assertEqual) self.product_friendly_name = self.tal_http.get_product_friendly_name() self._play_queue.clear() self._linein_stop_time = 0 ASEHelpers.run_first_time_setup(self.tal, self.tal_http, self.selenium_server, self.chromecast) self.setUp_done()
def _bluetooth_play(self): """ This method will start playing via the bluetooth connection. """ self.logger.info("Connecting Bluetooth") self.tal_http.set_active_source(comm_const.SourceJidPrefix.BLUETOOTH) self._bluetooth.connect(self.tal.bluetooth_mac_address) Helpers.unmute_sound_output(self.sound_card) self.logger.info("Start playing Bluetooth") self.tal_http.set_active_source(comm_const.SourceJidPrefix.BLUETOOTH) self._bluetooth.play_frequency(self._BLUETOOTH_FREQUENCY, self._BLUETOOTH_PLAY_DURATION, 10) self._verification.verify_active_source(comm_const.Source.BLUETOOTH)
def _play_deezer(self): """ Clears music playqueue and adds two deezer tracks of wich the first will start to play """ Helpers.clear_queue(self.tal_http, Helpers.PlayQueueName.MUSIC) # clear MUSIC queue current_sources = self.tal_http.get_active_sources(True) self.tal.logger.info("current sources: %s" % current_sources) self.tal_http.send_http_command_delete(comm_const.BEOZONE_PLAYQUEUE) self.tal_http.logger.info("***clear queue finish***") self.tal_http.set_active_source(comm_const.SourceJidPrefix.DEEZER) play_ids = self._deezer_client_helper.add_tracks_to_play_queue(5) self.tal_http.play_queue_play(play_ids[0]) time.sleep(5)
def setUp(self): """ Setup """ self.tal_http.debug = True if self.sound_card: Helpers.mute_sound_output(self.sound_card) self._linein = PlayBack.LineInCommands(self.tal_http, self.logger, self.sound_card) self._sound_verification = ASEHelpers.SoundVerification(self.logger, self.sound_card, self.tal_http, self.assertFalse, self.assertEqual, 55) if self.bt_sound_card: self._bluetooth = PlayBack.BlueToothCommands(self.tal, self.tal_http, self.logger, self.bt_sound_card) # connecting BT player if it is necessary if len(self.tal_http.get_bluetooth_devices()) == 0: self._bluetooth.pair(self.tal.bluetooth_mac_address) ASEHelpers.check_tunein_url(self.tal, self.tal_http, self.selenium_server, self.chromecast, self.skipTest) self._deezer_account = ASEHelpers.get_deezer_account(self.tal) self._tunein_account = comm_const.TUNEIN_ACCOUNT self._deezer_client = ASEHelpers.DeezerClientHelper(self.tal_http, self.logger, self._deezer_account, self.skipTest) self._tunein_client = ASEHelpers.TuneInClientHelper(self.tal_http, self.logger, self._tunein_account, self.skipTest, self.tal) self._dlna_client = ASEHelpers.DLNAClientHelper(self.tal_http, self.logger) self._streaming = PlayBack.StreamingCommands(self.tal_http, self.logger) self._play_queue = PlayBack.PlayQueue(self.tal_http, self.logger) if self.apple_communicator is not None: self.apple_communicator.ip_address = self.tal.get_ip() self.apple_communicator.create_client(60) self._verification = ASEHelpers.Verification(self.logger, self.tal_http, self.assertFalse, self.assertEqual) self.product_friendly_name = self.tal_http.get_product_friendly_name() self._play_queue.clear() self._linein_stop_time = 0 ASEHelpers.run_first_time_setup(self.tal, self.tal_http, self.selenium_server, self.chromecast) self.setUp_done()
def _linein_play(self): """ Method will first change the source of ASE to line-in then start playing. """ # checking if 3 min from the last line-in play have passed linein_pause_time = self._LINE_IN_PAUSE_TIME - (time.time() - self._linein_stop_time) if linein_pause_time > 0: self.logger.info("Sleeping %s sec to enable line-in" % linein_pause_time) time.sleep(linein_pause_time) self.logger.info("Start playing line-in") Helpers.unmute_sound_output(self.sound_card) self._linein.play_frequency(self._FREQUENCY, self._LINE_IN_PLAY_DURATION) self._verification.verify_active_source(comm_const.Source.LINEIN)
def _setup_dut(self, product): """ product setup @param product: Leader/Follower ex self.leader or self.follower @type product: String """ product.nav_ltap.target.set_IR_telegram_format_F17( IRTRANS.IRAddress.IRA1, IRTRANS.NetworkBit.local, IRTRANS.AudioVideo.audio) product._deezer_client = ASEHelpers.DeezerClientHelper( product.tal_http, self.logger, ASEHelpers.get_deezer_account(self.tal)) product.tal_http.set_active_source(comm_const.SourceJidPrefix.RADIO) Helpers.clear_queue(product.tal_http) product.sound_verification = ASEHelpers.SoundVerification( self.logger, product.sound_card, product.tal_http, self.assertFalse, self.assertEqual, 50)
def _setup_dut(self, product): """ product setup @param product: Leader/Follower ex self.leader or self.follower @type product: String """ product.nav_ltap.target.set_IR_telegram_format_F17(IRTRANS.IRAddress.IRA1, IRTRANS.NetworkBit.local, IRTRANS.AudioVideo.audio) product._deezer_client = ASEHelpers.DeezerClientHelper(product.tal_http, self.logger, ASEHelpers.get_deezer_account(self.tal)) product.tal_http.set_active_source(comm_const.SourceJidPrefix.RADIO) Helpers.clear_queue(product.tal_http) product.sound_verification = ASEHelpers.SoundVerification(self.logger, product.sound_card, product.tal_http, self.assertFalse, self.assertEqual, 50)
def tearDown(self): """ Tear down """ self.tearDown_starts() self._streaming.stop(0) if self.sound_card: self._linein.stop(0) Helpers.mute_sound_output(self.sound_card) if self.bt_sound_card: self._bluetooth.stop(0) self._bluetooth.disconnect(self.tal.bluetooth_mac_address) # common waiting time for all sound sources waiting_time = 5 self.logger.info("Waiting for no sound on output: %s seconds." % waiting_time) time.sleep(waiting_time)