music2storage/connection.py
def use_music_service(self, service_name, api_key):
        """
        Sets the current music service to service_name.

        :param str service_name: Name of the music service
        :param str api_key: Optional API key if necessary
        """

        try:
            self.current_music = self.music_services[service_name]
        except KeyError:
            if service_name == 'youtube':
                self.music_services['youtube'] = Youtube()
                self.current_music = self.music_services['youtube']
            elif service_name == 'soundcloud':
                self.music_services['soundcloud'] = Soundcloud(api_key=api_key)
                self.current_music = self.music_services['soundcloud']
            else:
                log.error('Music service name is not recognized.')
def use_music_service(self, service_name, api_key):
        try:
            self.current_music = self.music_services[service_name]
        except KeyError:
            if service_name == 'youtube':
                self.music_services['youtube'] = Youtube()
                self.current_music = self.music_services['youtube']
            elif service_name == 'soundcloud':
                self.music_services['soundcloud'] = Soundcloud(api_key=api_key)
                self.current_music = self.music_services['soundcloud']
            else:
                log.error('Music service name is not recognized.')
def use_music_service ( self , service_name , api_key ) : try : self . current_music = self . music_services [ service_name ] except KeyError : if service_name == 'youtube' : self . music_services [ 'youtube' ] = Youtube ( ) self . current_music = self . music_services [ 'youtube' ] elif service_name == 'soundcloud' : self . music_services [ 'soundcloud' ] = Soundcloud ( api_key = api_key ) self . current_music = self . music_services [ 'soundcloud' ] else : log . error ( 'Music service name is not recognized.' )
Sets the current music service to service_name.

        :param str service_name: Name of the music service
        :param str api_key: Optional API key if necessary
Sets the current music service to service_name .