def bad_fetch(nzo, url, msg='', content=False): """ Create History entry for failed URL Fetch msg : message to be logged retry : make retry link in history content : report in history that cause is a bad NZB file """ if msg: msg = unicoder(msg) else: msg = '' nzo.status = Status.FAILED if url: nzo.filename = url nzo.final_name = url.strip() if content: # Bad content msg = T('Unusable NZB file') else: # Failed fetch msg = T('URL Fetching failed; %s') % msg nzo.fail_msg = msg notifier.send_notification(T('URL Fetching failed; %s') % '', '%s\n%s' % (msg, url), 'other', nzo.cat) if cfg.email_endjob() > 0: emailer.badfetch_mail(msg, url) NzbQueue.do.remove(nzo.nzo_id, add_to_history=True)
def fail_to_history(self, nzo, url, msg='', content=False): """ Create History entry for failed URL Fetch msg: message to be logged content: report in history that cause is a bad NZB file """ # Remove the "Trying to fetch" part if url: nzo.filename = url nzo.final_name = url.strip() if content: # Bad content msg = T('Unusable NZB file') else: # Failed fetch msg = T('URL Fetching failed; %s') % unicoder(msg) # Mark as failed nzo.status = Status.FAILED nzo.fail_msg = msg notifier.send_notification(T('URL Fetching failed; %s') % '', '%s\n%s' % (msg, url), 'other', nzo.cat) if cfg.email_endjob() > 0: emailer.badfetch_mail(msg, url) # Parse category to make sure script is set correctly after a grab nzo.cat, _, nzo.script, _ = misc.cat_to_opts(nzo.cat, script=nzo.script) # Add to history and run script if desired NzbQueue.do.remove(nzo.nzo_id, add_to_history=False) PostProcessor.do.process(nzo)
def bad_fetch(nzo, url, msg='', content=False): """ Create History entry for failed URL Fetch msg : message to be logged retry : make retry link in history content : report in history that cause is a bad NZB file """ if msg: msg = unicoder(msg) else: msg = '' nzo.status = Status.FAILED if url: nzo.filename = url nzo.final_name = url.strip() if content: # Bad content msg = T('Unusable NZB file') else: # Failed fetch msg = T('URL Fetching failed; %s') % msg nzo.fail_msg = msg growler.send_notification(T('URL Fetching failed; %s') % '', '%s\n%s' % (msg, url), 'other') if cfg.email_endjob() > 0: emailer.badfetch_mail(msg, url) NzbQueue.do.remove(nzo.nzo_id, add_to_history=True)
def fail_to_history(nzo: NzbObject, url: str, msg="", content=False): """Create History entry for failed URL Fetch msg: message to be logged content: report in history that cause is a bad NZB file """ # Remove the "Trying to fetch" part if url: nzo.filename = url nzo.final_name = url.strip() if content: # Bad content msg = T("Unusable NZB file") else: # Failed fetch msg = T("URL Fetching failed; %s") % msg # Mark as failed nzo.set_unpack_info("Source", msg) nzo.fail_msg = msg notifier.send_notification( T("URL Fetching failed; %s") % "", "%s\n%s" % (msg, url), "failed", nzo.cat) if cfg.email_endjob() > 0: emailer.badfetch_mail(msg, url) # Parse category to make sure script is set correctly after a grab nzo.cat, _, nzo.script, _ = misc.cat_to_opts(nzo.cat, script=nzo.script) # Add to history and run script if desired sabnzbd.NzbQueue.remove(nzo.nzo_id) sabnzbd.PostProcessor.process(nzo)
def fail_to_history(self, nzo, url, msg='', content=False): """ Create History entry for failed URL Fetch msg: message to be logged content: report in history that cause is a bad NZB file """ # Remove the "Trying to fetch" part if url: nzo.filename = url nzo.final_name = url.strip() if content: # Bad content msg = T('Unusable NZB file') else: # Failed fetch msg = T('URL Fetching failed; %s') % unicoder(msg) # Mark as failed nzo.status = Status.FAILED nzo.fail_msg = msg notifier.send_notification( T('URL Fetching failed; %s') % '', '%s\n%s' % (msg, url), 'other', nzo.cat) if cfg.email_endjob() > 0: emailer.badfetch_mail(msg, url) # Parse category to make sure script is set correctly after a grab nzo.cat, _, nzo.script, _ = misc.cat_to_opts(nzo.cat, script=nzo.script) # Add to history and run script if desired NzbQueue.do.remove(nzo.nzo_id, add_to_history=False) PostProcessor.do.process(nzo)