'Find movie by name'

def search(self, q, limit=3):

    if self.isDisabled():
        return False
    log.debug('Searching    for    movie:    %s', q)
    raw = None
    try:
        name_year = fireEvent('scanner.name_year', q, single=True)
        raw = self.request('search/movie', {'query': name_year.get('name', q), 'year': name_year.get('year'), 'search_type': ('ngram' if (limit > 1) else 'phrase')}, return_key='results')
    except:
        log.error('Failed    searching    TMDB    for    "%s":    %s', (q, traceback.format_exc()))
    results = []
    if raw:
        try:
            nr = 0
            for movie in raw:
                parsed_movie = self.parseMovie(movie, extended=False)
                if parsed_movie:
                    results.append(parsed_movie)
                nr += 1
                if (nr == limit):
                    break
            log.info('Found:    %s', [(((result['titles'][0] + '    (') + str(result.get('year', 0))) + ')') for result in results])
            return results
        except SyntaxError as e:
            log.error('Failed    to    parse    XML    response:    %s', e)
            return False
    return results
