Repository: Flexget/Flexget

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.


Discussion:

Resolving patch:
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 @@ def get_params(self, config):
             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 @@ def on_task_output(self, task, config):
             # 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:


Test patch: