'Send a torrent/nzb file to the downloader
:param data: dict returned from provider
Contains the release information
:param media: media dict with information
Used for creating the filename when possible
:param filedata: downloaded torrent/nzb filedata
The file gets downloaded in the searcher and send to this function
This is done to have failed checking before using the downloader, so the downloader
doesn\'t need to worry about that
:return: boolean
One faile returns false, but the downloaded should log his own errors'

def download(self, data=None, media=None, filedata=None):

    if (not media):
        media = {}
    if (not data):
        data = {}
    if (not filedata):
        log.error('Unable    to    get    NZB    file:    %s', traceback.format_exc())
        return False
    log.info('Sending    "%s"    to    NZBGet.', data.get('name'))
    nzb_name = ss(('%s.nzb' % self.createNzbName(data, media)))
    rpc = self.getRPC()
    try:
        if rpc.writelog('INFO', ('CouchPotato    connected    to    drop    off    %s.' % nzb_name)):
            log.debug('Successfully    connected    to    NZBGet')
        else:
            log.info('Successfully    connected    to    NZBGet,    but    unable    to    send    a    message')
    except socket.error:
        log.error('NZBGet    is    not    responding.    Please    ensure    that    NZBGet    is    running    and    host    setting    is    correct.')
        return False
    except xmlrpclib.ProtocolError as e:
        if (e.errcode == 401):
            log.error('Password    is    incorrect.')
        else:
            log.error('Protocol    Error:    %s', e)
        return False
    if re.search('^0', rpc.version()):
        xml_response = rpc.append(nzb_name, self.conf('category'), False, standard_b64encode(filedata.strip()))
    else:
        xml_response = rpc.append(nzb_name, self.conf('category'), tryInt(self.conf('priority')), False, standard_b64encode(filedata.strip()))
    if xml_response:
        log.info('NZB    sent    successfully    to    NZBGet')
        nzb_id = md5(data['url'])
        couchpotato_id = ('couchpotato=' + nzb_id)
        groups = rpc.listgroups()
        file_id = [item['LastID'] for item in groups if (item['NZBFilename'] == nzb_name)]
        confirmed = rpc.editqueue('GroupSetParameter', 0, couchpotato_id, file_id)
        if confirmed:
            log.debug('couchpotato    parameter    set    in    nzbget    download')
        return self.downloadReturnId(nzb_id)
    else:
        log.error('NZBGet    could    not    add    %s    to    the    queue.', nzb_name)
        return False
