def notify_pvr(torrent_id, torrent_title, auth_key, torrent_pass, name, pvr_name): if torrent_id is not None and torrent_title is not None: download_link = get_torrent_link(torrent_id, torrent_title) announced = db.Announced(date=datetime.datetime.now(), title=torrent_title, indexer=name, torrent=download_link, pvr=pvr_name) if pvr_name == 'Sonarr': approved = sonarr.wanted(torrent_title, download_link, name) elif pvr_name == 'Radarr': approved = radarr.wanted(torrent_title, download_link, name) if approved: logger.debug("%s approved release: %s", pvr_name, torrent_title) snatched = db.Snatched(date=datetime.datetime.now(), title=torrent_title, indexer=name, torrent=download_link, pvr=pvr_name) else: logger.debug("%s rejected release: %s", pvr_name, torrent_title) return
def parse(announcement): global name if 'TV' not in announcement: return decolored = utils.strip_irc_color_codes(announcement) # extract required information from announcement torrent_title = utils.substr(decolored, '] ', ' (', True) torrent_id = utils.get_id(decolored, 0) # pass announcement to sonarr if torrent_id is not None and torrent_title is not None: download_link = get_torrent_link( torrent_id, utils.replace_spaces(torrent_title, '.')) announced = db.Announced(date=datetime.datetime.now(), title=utils.replace_spaces( torrent_title, '.'), indexer=name, torrent=download_link) approved = sonarr.wanted(torrent_title, download_link, name) if approved: logger.debug("Sonarr approved release: %s", torrent_title) snatched = db.Snatched(date=datetime.datetime.now(), title=utils.replace_spaces( torrent_title, '.'), indexer=name, torrent=download_link) else: logger.debug("Sonarr rejected release: %s", torrent_title)
def notify_pvr(torrent_id, torrent_title, auth_key, torrent_pass, name, pvr_name): if torrent_id is not None and torrent_title is not None: torrent_link_title = utils.replace_periods( utils.replace_spaces(torrent_title, '-'), '').lower() download_link = get_torrent_link(torrent_id, torrent_link_title) announced = db.Announced(date=datetime.datetime.now(), title=torrent_title, indexer=name, torrent=download_link, pvr=pvr_name) if delay > 0: logger.debug("Waiting %s seconds to check %s", delay, torrent_title) time.sleep(delay) if pvr_name == 'Sonarr': approved = sonarr.wanted(torrent_title, download_link, name) elif pvr_name == 'Radarr': approved = radarr.wanted(torrent_title, download_link, name) if approved: logger.debug("%s approved release: %s", pvr_name, torrent_title) snatched = db.Snatched(date=datetime.datetime.now(), title=torrent_title, indexer=name, torrent=download_link, pvr=pvr_name) else: logger.debug("%s rejected release: %s", pvr_name, torrent_title) return
def parse(announcement): global name # extract required information from announcement torrent_title = utils.str_before(announcement, ' - ') torrent_id = utils.get_id(announcement, 1) # pass announcement to sonarr if torrent_id is not None and torrent_title is not None: download_link = get_torrent_link( torrent_id, utils.replace_spaces(torrent_title, '.')) announced = db.Announced(date=datetime.datetime.now(), title=utils.replace_spaces( torrent_title, '.'), indexer=name, torrent=download_link) approved = sonarr.wanted(torrent_title, download_link, name) if approved: logger.debug("Sonarr approved release: %s", torrent_title) snatched = db.Snatched(date=datetime.datetime.now(), title=utils.replace_spaces( torrent_title, '.'), indexer=name, torrent=download_link) else: logger.debug("Sonarr rejected release: %s", torrent_title)
def parse(announcement): global name decolored = utils.strip_irc_color_codes(announcement) if '[Episode]' not in decolored: return # extract required information from announcement torrent_title = parse_torrent_title(decolored) if not torrent_title: return torrent_id = utils.get_id(decolored, 0) # pass announcement to sonarr if torrent_id is not None and torrent_title is not None: download_link = get_torrent_link( torrent_id, utils.replace_spaces(torrent_title, '.')) announced = db.Announced(date=datetime.datetime.now(), title=utils.replace_spaces( torrent_title, '.'), indexer=name, torrent=download_link) if delay > 0: logger.debug("Waiting %s seconds to check %s", delay, torrent_title) time.sleep(delay) approved = sonarr.wanted(torrent_title, download_link, name) if approved: logger.debug("Sonarr approved release: %s", torrent_title) snatched = db.Snatched(date=datetime.datetime.now(), title=utils.replace_spaces( torrent_title, '.'), indexer=name, torrent=download_link) else: logger.debug("Sonarr rejected release: %s", torrent_title)
def notify_pvr(torrent_id, torrent_title, auth_key, torrent_pass, name, pvr_name): if torrent_id is not None and torrent_title is not None: approved = False download_link = get_torrent_link(torrent_id, torrent_title) announced = db.Announced(date=datetime.datetime.now(), title=torrent_title, indexer=name, torrent=download_link, pvr=pvr_name) if delay > 0: logger.debug("Waiting %s seconds to check %s", delay, torrent_title) time.sleep(delay) logger.debug(f"Checking PVR {pvr_name} for {torrent_title}") if pvr_name == 'Sonarr': approved = sonarr.wanted(torrent_title, download_link, name) logger.debug(f"Sonarr approved: {approved}") elif pvr_name == 'Radarr': approved = radarr.wanted(torrent_title, download_link, name) logger.debug(f"Radarr approved: {approved}") logger.debug(f"PVR {pvr_name} approved: {approved}") if approved: logger.debug("%s approved release: %s", pvr_name, torrent_title) snatched = db.Snatched(date=datetime.datetime.now(), title=torrent_title, indexer=name, torrent=download_link, pvr=pvr_name) else: logger.debug("%s rejected release: %s", pvr_name, torrent_title) return
def parse(announcement): global name, torrent_title decolored = utils.strip_irc_color_codes(announcement) # extract required information from decolored if 'NOW BROADCASTING' in decolored: torrent_title = utils.substr(decolored, '[ ', ' ]', True) torrent_id = utils.get_id(decolored, 1) # pass announcement to sonarr if torrent_id is not None and torrent_title is not None: download_link = get_torrent_link( torrent_id, utils.replace_spaces(torrent_title, '.')) announced = db.Announced(date=datetime.datetime.now(), title=utils.replace_spaces( torrent_title, '.'), indexer=name, torrent=download_link, pvr='Sonarr') if delay > 0: logger.debug("Waiting %s seconds to check %s", delay, torrent_title) time.sleep(delay) approved = sonarr.wanted(torrent_title, download_link, name) if approved: logger.debug("Sonarr approved release: %s", torrent_title) snatched = db.Snatched(date=datetime.datetime.now(), title=utils.replace_spaces( torrent_title, '.'), indexer=name, torrent=download_link) else: logger.debug("Sonarr rejected release: %s", torrent_title) torrent_title = None
def notify(): try: data = request.json if 'id' in data: # Request to check this torrent again announcement = db.Announced.get(id=data.get('id')) if announcement is not None and len(announcement.title) > 0: logger.debug("Checking announcement again: %s", announcement.title) approved = sonarr.wanted(announcement.title, announcement.torrent, announcement.indexer) if approved: logger.debug("Sonarr accepted the torrent this time!") return "OK" else: logger.debug("Sonarr still refused this torrent...") return "ERR" except Exception as ex: logger.exception("Exception while notifying sonarr announcement:") return "ERR"