'Configuration::
periscope:
languages: List of languages in order of preference (at least one is required).
alternatives: List of second-choice languages; subs will be downloaded but entries rejected.
overwrite: If yes it will try to download even for videos that are already subbed. Default: no.
subexts: List of subtitles file extensions to check (only useful with overwrite=no).
Default: srt, stp, sub, stl, ssa.'

def on_task_output(self, task, config):

    if (not task.accepted):
        log.debug(u'nothing    accepted,    aborting')
        return
    import periscope
    psc = periscope.Periscope(tempfile.gettempdir())
    logging.getLogger(u'periscope').setLevel(logging.CRITICAL)
    langs = [s.encode(u'utf8') for s in config[u'languages']]
    alts = [s.encode(u'utf8') for s in config.get(u'alternatives', [])]
    if (not config[u'overwrite']):
        self.exts = [(u'.' + s) for s in config[u'subexts']]
    for entry in task.accepted:
        if (u'location' not in entry):
            log.warning(u'Cannot    act    on    entries    that    do    not    represent    a    local    file.')
        elif (not os.path.exists(entry[u'location'])):
            entry.fail((u'file    not    found:    %s' % entry[u'location']))
        elif (u'$RECYCLE.BIN' in entry[u'location']):
            continue
        elif ((not config[u'overwrite']) and self.subbed(entry[u'location'])):
            log.warning((u'cannot    overwrite    existing    subs    for    %s' % entry[u'location']))
        else:
            try:
                if psc.downloadSubtitle(entry[u'location'].encode(u'utf8'), langs):
                    log.info((u'Subtitles    found    for    %s' % entry[u'location']))
                elif (alts and psc.downloadSubtitle(entry[u'location'].encode(u'utf8'), alts)):
                    entry.fail(u'subtitles    found    for    a    second-choice    language.')
                else:
                    entry.fail(u'cannot    find    any    subtitles    for    now.')
            except Exception as err:
                entry.fail(err.message)
