'Select input source.'

@soco_error
@soco_coordinator
def select_source(self, source):

    if (source == SUPPORT_SOURCE_LINEIN):
        self._source_name = SUPPORT_SOURCE_LINEIN
        self._player.switch_to_line_in()
    elif (source == SUPPORT_SOURCE_TV):
        self._source_name = SUPPORT_SOURCE_TV
        self._player.switch_to_tv()
    else:
        fav = [fav for fav in self._favorite_sources if (fav['title'] == source)]
        if (len(fav) == 1):
            src = fav.pop()
            self._source_name = src['title']
            if ('object.container.playlistContainer' in src['meta']):
                self._replace_queue_with_playlist(src)
                self._player.play_from_queue(0)
            else:
                self._player.play_uri(src['uri'], src['meta'], src['title'])
