{"action":"created","issue":{"url":"https://api.github.com/repos/mdhiggins/sickbeard_mp4_automator/issues/743","repository_url":"https://api.github.com/repos/mdhiggins/sickbeard_mp4_automator","labels_url":"https://api.github.com/repos/mdhiggins/sickbeard_mp4_automator/issues/743/labels{/name}","comments_url":"https://api.github.com/repos/mdhiggins/sickbeard_mp4_automator/issues/743/comments","events_url":"https://api.github.com/repos/mdhiggins/sickbeard_mp4_automator/issues/743/events","html_url":"https://github.com/mdhiggins/sickbeard_mp4_automator/issues/743","id":235320588,"number":743,"title":"[ISSUE] Sonarr updated API to use webroot, notifying no longer works","user":{"login":"Mirabis","id":3105038,"avatar_url":"https://avatars0.githubusercontent.com/u/3105038?v=3","gravatar_id":"","url":"https://api.github.com/users/Mirabis","html_url":"https://github.com/Mirabis","followers_url":"https://api.github.com/users/Mirabis/followers","following_url":"https://api.github.com/users/Mirabis/following{/other_user}","gists_url":"https://api.github.com/users/Mirabis/gists{/gist_id}","starred_url":"https://api.github.com/users/Mirabis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Mirabis/subscriptions","organizations_url":"https://api.github.com/users/Mirabis/orgs","repos_url":"https://api.github.com/users/Mirabis/repos","events_url":"https://api.github.com/users/Mirabis/events{/privacy}","received_events_url":"https://api.github.com/users/Mirabis/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2017-06-12T18:20:13Z","updated_at":"2017-06-18T14:03:52Z","closed_at":"2017-06-18T10:55:42Z","body":"file: autoprocess/sonarr\r\n\r\nis not using the webroot, thus after receiving the automatic redirect since Sonarr v2.0.0.4807 (BETA) , it will error out.\r\n\r\nSuggestion:\r\n```\r\nimport sys\r\nimport os\r\nimport logging\r\nimport json\r\n\r\n\r\ndef processEpisode(dirName, settings, nzbGet=False, logger=None):\r\n\r\n    if nzbGet:\r\n        errorprefix = \"[ERROR] \"\r\n        infoprefix = \"[INFO] \"\r\n    else:\r\n        errorprefix = \"\"\r\n        infoprefix = \"\"\r\n\r\n    # Setup logging\r\n    if logger:\r\n        log = logger\r\n    else:\r\n        log = logging.getLogger(__name__)\r\n\r\n    log.info(\"%sSonarr notifier started.\" % infoprefix)\r\n\r\n    # Import Requests\r\n    try:\r\n        import requests\r\n    except ImportError:\r\n        log.exception(\"%sPython module REQUESTS is required. Install with 'pip install requests' then try again.\" % errorprefix)\r\n        log.error(\"%sPython executable path is %s\" % (errorprefix, sys.executable))\r\n        return False\r\n\r\n    host = settings.Sonarr['host']\r\n    port = settings.Sonarr['port']\r\n    apikey = settings.Sonarr['apikey']\r\n    webroot = '' if settings.Sonarr['web_root'] is None else settings.Sonarr['web_root']\r\n\r\n    if apikey == '':\r\n        log.error(\"%sYour Sonarr API Key can not be blank. Update autoProcess.ini.\" % errorprefix)\r\n        return False\r\n\r\n    try:\r\n        ssl = int(settings.Sonarr['ssl'])\r\n    except:\r\n        ssl = 0\r\n    if ssl:\r\n        protocol = \"https://\"\r\n    else:\r\n        protocol = \"http://\"\r\n\r\n    url = protocol + host + \":\" + port + webroot + \"/api/command\"\r\n    payload = {'name': 'downloadedepisodesscan', 'path': dirName}\r\n    headers = {'X-Api-Key': apikey}\r\n\r\n    log.debug(\"Sonarr host: %s.\" % host)\r\n    log.debug(\"Sonarr port: %s.\" % port)\r\n    log.debug(\"Sonarr urlbase: %s.\" % webroot)\r\n    log.debug(\"Sonarr apikey: %s.\" % apikey)\r\n    log.debug(\"Sonarr protocol: %s.\" % protocol)\r\n    log.debug(\"URL '%s' with payload '%s.'\" % (url, payload))\r\n\r\n    log.info(\"%sRequesting Sonarr to scan directory '%s'.\" % (infoprefix, dirName))\r\n\r\n    try:\r\n        r = requests.post(url, data=json.dumps(payload), headers=headers)\r\n        rstate = r.json()\r\n        log.info(\"%sSonarr response: %s.\" % (infoprefix, rstate['state']))\r\n        return True\r\n    except:\r\n        log.exception(\"%sUpdate to Sonarr failed, check if Sonarr is running, autoProcess.ini settings and make sure your Sonarr settings are correct (apikey?), or check install of python modules requests.\" % errorprefix)\r\n        return False\r\n```"},"comment":{"url":"https://api.github.com/repos/mdhiggins/sickbeard_mp4_automator/issues/comments/309279613","html_url":"https://github.com/mdhiggins/sickbeard_mp4_automator/issues/743#issuecomment-309279613","issue_url":"https://api.github.com/repos/mdhiggins/sickbeard_mp4_automator/issues/743","id":309279613,"user":{"login":"mdhiggins","id":3608298,"avatar_url":"https://avatars3.githubusercontent.com/u/3608298?v=3","gravatar_id":"","url":"https://api.github.com/users/mdhiggins","html_url":"https://github.com/mdhiggins","followers_url":"https://api.github.com/users/mdhiggins/followers","following_url":"https://api.github.com/users/mdhiggins/following{/other_user}","gists_url":"https://api.github.com/users/mdhiggins/gists{/gist_id}","starred_url":"https://api.github.com/users/mdhiggins/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mdhiggins/subscriptions","organizations_url":"https://api.github.com/users/mdhiggins/orgs","repos_url":"https://api.github.com/users/mdhiggins/repos","events_url":"https://api.github.com/users/mdhiggins/events{/privacy}","received_events_url":"https://api.github.com/users/mdhiggins/received_events","type":"User","site_admin":false},"created_at":"2017-06-18T14:03:52Z","updated_at":"2017-06-18T14:03:52Z","body":"Sonarr and SABNZBD are 2 different types of programs\r\n\r\nSABNZBD would be affected if it was trying to send downloads back to Sonarr in this case"}}
{"actor":{"display_login":"mdhiggins"}}