def _downloadResult(result):
 resProvider = result.provider
 newResult = False
 if (resProvider is None):
  logger.log(u'Invalid provider name - this is a coding error, report it please', logger.ERROR)
  return False
 if (result.resultType == 'nzb'):
  newResult = resProvider.downloadResult(result)
 elif (result.resultType == 'nzbdata'):
  fileName = ek.ek(os.path.join, sickbeard.NZB_DIR, (result.name + '.nzb'))
  logger.log((u'Saving NZB to ' + fileName))
  newResult = True
  try:
   with ek.ek(open, fileName, 'w') as fileOut:
    fileOut.write(result.extraInfo[0])
   helpers.chmodAsParent(fileName)
  except EnvironmentError as e:
   logger.log((u'Error trying to save NZB to black hole: ' + ex(e)), logger.ERROR)
   newResult = False
 elif (resProvider.providerType == 'torrent'):
  newResult = resProvider.downloadResult(result)
 else:
  logger.log(u'Invalid provider type - this is a coding error, report it please', logger.ERROR)
  return False
 return newResult

def _downloadResult ( result ) : resProvider = result . provider newResult = False if ( resProvider is None ) : logger . log ( u'Invalid provider name - this is a coding error, report it please' , logger . ERROR ) return False if ( result . resultType == 'nzb' ) : newResult = resProvider . downloadResult ( result ) elif ( result . resultType == 'nzbdata' ) : fileName = ek . ek ( os . path . join , sickbeard . NZB_DIR , ( result . name + '.nzb' ) ) logger . log ( ( u'Saving NZB to ' + fileName ) ) newResult = True try : with ek . ek ( open , fileName , 'w' ) as fileOut : fileOut . write ( result . extraInfo [ 0 ] ) helpers . chmodAsParent ( fileName ) except EnvironmentError as e : logger . log ( ( u'Error trying to save NZB to black hole: ' + ex ( e ) ) , logger . ERROR ) newResult = False elif ( resProvider . providerType == 'torrent' ) : newResult = resProvider . downloadResult ( result ) else : logger . log ( u'Invalid provider type - this is a coding error, report it please' , logger . ERROR ) return False return newResult
downloads a result to the appropriate black hole folder .