<commit_before>import mpd


class MpdStatusWidget(object):
    def __init__(self, server, timeout=10):
        self.server = server
        self.client = mpd.MPDClient()
        self.client.timeout = timeout
        self.client.connect(server, 6600)

    def output(self):
        song = self.client.currentsong()
        return {
            'full_text': ' {artist} - {title}'.format(**song),
            'icon': 'mmbar/icons/note.xbm',
        }<commit_msg>mpdstatus: no error when mpd has no current song<commit_after>import mpd


class MpdStatusWidget(object):
    def __init__(self, server, timeout=10):
        self.server = server
        self.client = mpd.MPDClient()
        self.client.timeout = timeout
        self.client.connect(server, 6600)

    def output(self):
        song = self.client.currentsong()
        if song:
            return {
                'full_text': ' {artist} - {title}'.format(**song),
                'icon': 'mmbar/icons/note.xbm',
            }
        else:
            pass
{'fraction_non_alphanumeric': 0.1248770894788594, 'fraction_numerical': 0.011799410029498525, 'mean_word_length': 2.057057057057057, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6107662', 'n_tokens_mistral': 325, 'n_tokens_neox': 303, 'n_words': 64}