We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
SABnzbd not adding local nzb files
### Expected behaviour:
Add local nzb file to SABnzbd.

### Actual behaviour:
Not added to SABnzbd but still logged as a success.

### Steps to reproduce:
- Step 1: Run the task below

#### Config:
```
download-manual:
  filesystem:
    path: /data/watch
    mask: '*.nzb'
  disable: seen
  accept_all: yes
  sabnzbd:
    <<: *sabnzbd-config
```
  
#### Log:
```
2018-08-01 19:19 VERBOSE  filesystem    download-movies-manual Scanning folder /data/watch. Recursion is set to False.
2018-08-01 19:27 DEBUG    filesystem    download-movies-manual Scanning /data/watch
2018-08-01 19:27 DEBUG    filesystem    download-movies-manual Checking if /data/watch/Butch_Cassidy_and_the_Sundance_Kid.1969-NoGroup.nzb qualifies to be added as an entry.
2018-08-01 19:27 DEBUG    backlog       download-movies-manual 0 entries purged from backlog
2018-08-01 19:19 VERBOSE  details       download-movies-manual Produced 1 entries.
2018-08-01 19:19 VERBOSE  task          download-movies-manual ACCEPTED: `Butch_Cassidy_and_the_Sundance_Kid.1969-NoGroup` by accept_all plugin
2018-08-01 19:19 VERBOSE  details       download-movies-manual Summary - Accepted: 1 (Rejected: 0 Undecided: 0 Failed: 0)
2018-08-01 19:27 DEBUG    sabnzbd       download-movies-manual request_url: http://sabnzbd:8080/api?nzbname=Butch_Cassidy_and_the_Sundance_Kid.1969-NoGroup&apikey=<api_key>&mode=addurl&name=file%3A%2F%2F%2Fdata%2Fwatch%2FButch_Cassidy_and_the_Sundance_Kid.1969-NoGroup.nzb
2018-08-01 19:27 DEBUG    utils.requests download-movies-manual GETing URL http://sabnzbd:8080/api?nzbname=Butch_Cassidy_and_the_Sundance_Kid.1969-NoGroup&apikey=<api_key>&mode=addurl&name=file%3A%2F%2F%2Fdata%2Fwatch%2FButch_Cassidy_and_the_Sundance_Kid.1969-NoGroup.nzb with args () and kwargs {'allow_redirects': True, u'timeout': 30}
2018-08-01 19:19 INFO     sabnzbd       download-movies-manual Added `Butch_Cassidy_and_the_Sundance_Kid.1969-NoGroup` to SABnzbd
```

### Additional information:
- FlexGet version: 2.14.13.dev
- Python version: 2.7.15
- Installation method: git install
- Using daemon: no
- OS and version: Debian GNU/Linux 9 (stretch)

PR incoming.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `flexget/plugins/output/sabnzbd.py`
Content:
```
1 from __future__ import unicode_literals, division, absolute_import
2 from builtins import *  # noqa pylint: disable=unused-import, redefined-builtin
3 from future.moves.urllib.parse import urlencode
4 
5 import logging
6 
7 from flexget import plugin
8 from flexget.event import event
9 from requests import RequestException
10 
11 log = logging.getLogger('sabnzbd')
12 
13 
14 class OutputSabnzbd(object):
15     """
16     Example::
17 
18       sabnzbd:
19         apikey: 123456
20         url: http://localhost/sabnzbd/api?
21         category: movies
22 
23     All parameters::
24 
25       sabnzbd:
26         apikey: ...
27         url: ...
28         category: ...
29         script: ...
30         pp: ...
31         priority: ...
32     """
33     schema = {
34         'type': 'object',
35         'properties': {
36             'key': {'type': 'string'},
37             'url': {'type': 'string', 'format': 'url'},
38             'category': {'type': 'string'},
39             'script': {'type': 'string'},
40             'pp': {'type': 'string'},
41             'priority': {'type': 'integer'},
42             'password': {'type': 'string'},
43             'username': {'type': 'string'},
44         },
45         'required': ['key', 'url'],
46         'additionalProperties': False,
47     }
48 
49     def get_params(self, config):
50         params = {}
51         if 'key' in config:
52             params['apikey'] = config['key']
53         if 'category' in config:
54             params['cat'] = '%s' % config['category']
55         if 'script' in config:
56             params['script'] = config['script']
57         if 'pp' in config:
58             params['pp'] = config['pp']
59         if 'priority' in config:
60             params['priority'] = config['priority']
61         if 'username' in config:
62             params['ma_username'] = config['username']
63         if 'password' in config:
64             params['ma_password'] = config['password']
65         params['mode'] = 'addurl'
66         return params
67 
68     def on_task_output(self, task, config):
69         for entry in task.accepted:
70             if task.options.test:
71                 log.info('Would add into sabnzbd: %s' % entry['title'])
72                 continue
73 
74             params = self.get_params(config)
75             # allow overriding the category
76             if 'category' in entry:
77                 # Dirty hack over the next few lines to strip out non-ascii
78                 # chars. We're going to urlencode this, which causes
79                 # serious issues in python2.x if it's not ascii input.
80                 params['cat'] = ''.join([x for x in entry['category'] if ord(x) < 128])
81             params['name'] = ''.join([x for x in entry['url'] if ord(x) < 128])
82             # add cleaner nzb name (undocumented api feature)
83             params['nzbname'] = ''.join([x for x in entry['title'] if ord(x) < 128])
84 
85             request_url = config['url'] + urlencode(params)
86             log.debug('request_url: %s' % request_url)
87             try:
88                 response = task.requests.get(request_url)
89             except RequestException as e:
90                 log.critical('Failed to use sabnzbd. Requested %s' % request_url)
91                 log.critical('Result was: %s' % e.args[0])
92                 entry.fail('sabnzbd unreachable')
93                 if task.options.debug:
94                     log.exception(e)
95                 continue
96 
97             if 'error' in response.text.lower():
98                 entry.fail(response.text.replace('\n', ''))
99             else:
100                 log.info('Added `%s` to SABnzbd' % (entry['title']))
101 
102 
103 @event('plugin.register')
104 def register_plugin():
105     plugin.register(OutputSabnzbd, 'sabnzbd', api_ver=2)
106
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/flexget/plugins/output/sabnzbd.py b/flexget/plugins/output/sabnzbd.py
--- a/flexget/plugins/output/sabnzbd.py
+++ b/flexget/plugins/output/sabnzbd.py
@@ -62,7 +62,6 @@
             params['ma_username'] = config['username']
         if 'password' in config:
             params['ma_password'] = config['password']
-        params['mode'] = 'addurl'
         return params
 
     def on_task_output(self, task, config):
@@ -82,6 +81,13 @@
             # add cleaner nzb name (undocumented api feature)
             params['nzbname'] = ''.join([x for x in entry['title'] if ord(x) < 128])
 
+            # check whether file is local or remote
+            if entry['url'].startswith('file://'):
+                params['mode'] = 'addlocalfile'
+                params['name'] = entry['location']
+            else:
+                params['mode'] = 'addurl'
+
             request_url = config['url'] + urlencode(params)
             log.debug('request_url: %s' % request_url)
             try:

{"golden_diff": "diff --git a/flexget/plugins/output/sabnzbd.py b/flexget/plugins/output/sabnzbd.py\n--- a/flexget/plugins/output/sabnzbd.py\n+++ b/flexget/plugins/output/sabnzbd.py\n@@ -62,7 +62,6 @@\n             params['ma_username'] = config['username']\n         if 'password' in config:\n             params['ma_password'] = config['password']\n-        params['mode'] = 'addurl'\n         return params\n \n     def on_task_output(self, task, config):\n@@ -82,6 +81,13 @@\n             # add cleaner nzb name (undocumented api feature)\n             params['nzbname'] = ''.join([x for x in entry['title'] if ord(x) < 128])\n \n+            # check whether file is local or remote\n+            if entry['url'].startswith('file://'):\n+                params['mode'] = 'addlocalfile'\n+                params['name'] = entry['location']\n+            else:\n+                params['mode'] = 'addurl'\n+\n             request_url = config['url'] + urlencode(params)\n             log.debug('request_url: %s' % request_url)\n             try:\n", "issue": "SABnzbd not adding local nzb files\n### Expected behaviour:\r\nAdd local nzb file to SABnzbd.\r\n\r\n### Actual behaviour:\r\nNot added to SABnzbd but still logged as a success.\r\n\r\n### Steps to reproduce:\r\n- Step 1: Run the task below\r\n\r\n#### Config:\r\n```\r\ndownload-manual:\r\n  filesystem:\r\n    path: /data/watch\r\n    mask: '*.nzb'\r\n  disable: seen\r\n  accept_all: yes\r\n  sabnzbd:\r\n    <<: *sabnzbd-config\r\n```\r\n  \r\n#### Log:\r\n```\r\n2018-08-01 19:19 VERBOSE  filesystem    download-movies-manual Scanning folder /data/watch. Recursion is set to False.\r\n2018-08-01 19:27 DEBUG    filesystem    download-movies-manual Scanning /data/watch\r\n2018-08-01 19:27 DEBUG    filesystem    download-movies-manual Checking if /data/watch/Butch_Cassidy_and_the_Sundance_Kid.1969-NoGroup.nzb qualifies to be added as an entry.\r\n2018-08-01 19:27 DEBUG    backlog       download-movies-manual 0 entries purged from backlog\r\n2018-08-01 19:19 VERBOSE  details       download-movies-manual Produced 1 entries.\r\n2018-08-01 19:19 VERBOSE  task          download-movies-manual ACCEPTED: `Butch_Cassidy_and_the_Sundance_Kid.1969-NoGroup` by accept_all plugin\r\n2018-08-01 19:19 VERBOSE  details       download-movies-manual Summary - Accepted: 1 (Rejected: 0 Undecided: 0 Failed: 0)\r\n2018-08-01 19:27 DEBUG    sabnzbd       download-movies-manual request_url: http://sabnzbd:8080/api?nzbname=Butch_Cassidy_and_the_Sundance_Kid.1969-NoGroup&apikey=<api_key>&mode=addurl&name=file%3A%2F%2F%2Fdata%2Fwatch%2FButch_Cassidy_and_the_Sundance_Kid.1969-NoGroup.nzb\r\n2018-08-01 19:27 DEBUG    utils.requests download-movies-manual GETing URL http://sabnzbd:8080/api?nzbname=Butch_Cassidy_and_the_Sundance_Kid.1969-NoGroup&apikey=<api_key>&mode=addurl&name=file%3A%2F%2F%2Fdata%2Fwatch%2FButch_Cassidy_and_the_Sundance_Kid.1969-NoGroup.nzb with args () and kwargs {'allow_redirects': True, u'timeout': 30}\r\n2018-08-01 19:19 INFO     sabnzbd       download-movies-manual Added `Butch_Cassidy_and_the_Sundance_Kid.1969-NoGroup` to SABnzbd\r\n```\r\n\r\n### Additional information:\r\n- FlexGet version: 2.14.13.dev\r\n- Python version: 2.7.15\r\n- Installation method: git install\r\n- Using daemon: no\r\n- OS and version: Debian GNU/Linux 9 (stretch)\r\n\r\nPR incoming.\n", "before_files": [{"content": "from __future__ import unicode_literals, division, absolute_import\nfrom builtins import *  # noqa pylint: disable=unused-import, redefined-builtin\nfrom future.moves.urllib.parse import urlencode\n\nimport logging\n\nfrom flexget import plugin\nfrom flexget.event import event\nfrom requests import RequestException\n\nlog = logging.getLogger('sabnzbd')\n\n\nclass OutputSabnzbd(object):\n    \"\"\"\n    Example::\n\n      sabnzbd:\n        apikey: 123456\n        url: http://localhost/sabnzbd/api?\n        category: movies\n\n    All parameters::\n\n      sabnzbd:\n        apikey: ...\n        url: ...\n        category: ...\n        script: ...\n        pp: ...\n        priority: ...\n    \"\"\"\n    schema = {\n        'type': 'object',\n        'properties': {\n            'key': {'type': 'string'},\n            'url': {'type': 'string', 'format': 'url'},\n            'category': {'type': 'string'},\n            'script': {'type': 'string'},\n            'pp': {'type': 'string'},\n            'priority': {'type': 'integer'},\n            'password': {'type': 'string'},\n            'username': {'type': 'string'},\n        },\n        'required': ['key', 'url'],\n        'additionalProperties': False,\n    }\n\n    def get_params(self, config):\n        params = {}\n        if 'key' in config:\n            params['apikey'] = config['key']\n        if 'category' in config:\n            params['cat'] = '%s' % config['category']\n        if 'script' in config:\n            params['script'] = config['script']\n        if 'pp' in config:\n            params['pp'] = config['pp']\n        if 'priority' in config:\n            params['priority'] = config['priority']\n        if 'username' in config:\n            params['ma_username'] = config['username']\n        if 'password' in config:\n            params['ma_password'] = config['password']\n        params['mode'] = 'addurl'\n        return params\n\n    def on_task_output(self, task, config):\n        for entry in task.accepted:\n            if task.options.test:\n                log.info('Would add into sabnzbd: %s' % entry['title'])\n                continue\n\n            params = self.get_params(config)\n            # allow overriding the category\n            if 'category' in entry:\n                # Dirty hack over the next few lines to strip out non-ascii\n                # chars. We're going to urlencode this, which causes\n                # serious issues in python2.x if it's not ascii input.\n                params['cat'] = ''.join([x for x in entry['category'] if ord(x) < 128])\n            params['name'] = ''.join([x for x in entry['url'] if ord(x) < 128])\n            # add cleaner nzb name (undocumented api feature)\n            params['nzbname'] = ''.join([x for x in entry['title'] if ord(x) < 128])\n\n            request_url = config['url'] + urlencode(params)\n            log.debug('request_url: %s' % request_url)\n            try:\n                response = task.requests.get(request_url)\n            except RequestException as e:\n                log.critical('Failed to use sabnzbd. Requested %s' % request_url)\n                log.critical('Result was: %s' % e.args[0])\n                entry.fail('sabnzbd unreachable')\n                if task.options.debug:\n                    log.exception(e)\n                continue\n\n            if 'error' in response.text.lower():\n                entry.fail(response.text.replace('\\n', ''))\n            else:\n                log.info('Added `%s` to SABnzbd' % (entry['title']))\n\n\n@event('plugin.register')\ndef register_plugin():\n    plugin.register(OutputSabnzbd, 'sabnzbd', api_ver=2)\n", "path": "flexget/plugins/output/sabnzbd.py"}], "after_files": [{"content": "from __future__ import unicode_literals, division, absolute_import\nfrom builtins import *  # noqa pylint: disable=unused-import, redefined-builtin\nfrom future.moves.urllib.parse import urlencode\n\nimport logging\n\nfrom flexget import plugin\nfrom flexget.event import event\nfrom requests import RequestException\n\nlog = logging.getLogger('sabnzbd')\n\n\nclass OutputSabnzbd(object):\n    \"\"\"\n    Example::\n\n      sabnzbd:\n        apikey: 123456\n        url: http://localhost/sabnzbd/api?\n        category: movies\n\n    All parameters::\n\n      sabnzbd:\n        apikey: ...\n        url: ...\n        category: ...\n        script: ...\n        pp: ...\n        priority: ...\n    \"\"\"\n    schema = {\n        'type': 'object',\n        'properties': {\n            'key': {'type': 'string'},\n            'url': {'type': 'string', 'format': 'url'},\n            'category': {'type': 'string'},\n            'script': {'type': 'string'},\n            'pp': {'type': 'string'},\n            'priority': {'type': 'integer'},\n            'password': {'type': 'string'},\n            'username': {'type': 'string'},\n        },\n        'required': ['key', 'url'],\n        'additionalProperties': False,\n    }\n\n    def get_params(self, config):\n        params = {}\n        if 'key' in config:\n            params['apikey'] = config['key']\n        if 'category' in config:\n            params['cat'] = '%s' % config['category']\n        if 'script' in config:\n            params['script'] = config['script']\n        if 'pp' in config:\n            params['pp'] = config['pp']\n        if 'priority' in config:\n            params['priority'] = config['priority']\n        if 'username' in config:\n            params['ma_username'] = config['username']\n        if 'password' in config:\n            params['ma_password'] = config['password']\n        return params\n\n    def on_task_output(self, task, config):\n        for entry in task.accepted:\n            if task.options.test:\n                log.info('Would add into sabnzbd: %s' % entry['title'])\n                continue\n\n            params = self.get_params(config)\n            # allow overriding the category\n            if 'category' in entry:\n                # Dirty hack over the next few lines to strip out non-ascii\n                # chars. We're going to urlencode this, which causes\n                # serious issues in python2.x if it's not ascii input.\n                params['cat'] = ''.join([x for x in entry['category'] if ord(x) < 128])\n            params['name'] = ''.join([x for x in entry['url'] if ord(x) < 128])\n            # add cleaner nzb name (undocumented api feature)\n            params['nzbname'] = ''.join([x for x in entry['title'] if ord(x) < 128])\n\n            # check whether file is local or remote\n            if entry['url'].startswith('file://'):\n                params['mode'] = 'addlocalfile'\n                params['name'] = entry['location']\n            else:\n                params['mode'] = 'addurl'\n\n            request_url = config['url'] + urlencode(params)\n            log.debug('request_url: %s' % request_url)\n            try:\n                response = task.requests.get(request_url)\n            except RequestException as e:\n                log.critical('Failed to use sabnzbd. Requested %s' % request_url)\n                log.critical('Result was: %s' % e.args[0])\n                entry.fail('sabnzbd unreachable')\n                if task.options.debug:\n                    log.exception(e)\n                continue\n\n            if 'error' in response.text.lower():\n                entry.fail(response.text.replace('\\n', ''))\n            else:\n                log.info('Added `%s` to SABnzbd' % (entry['title']))\n\n\n@event('plugin.register')\ndef register_plugin():\n    plugin.register(OutputSabnzbd, 'sabnzbd', api_ver=2)\n", "path": "flexget/plugins/output/sabnzbd.py"}]}