RuudBurger/CouchPotatoServer — pull request #2674 by russholio (2014-01-10 09:22:15+00:00)
Title: Renamer - Ignores completed NZB found in the Sabnzbd history.

**Movie:** Gravity (2013 tt1454468)
**Movie quality:** 720p
**Hardware:** Synology NAS (DS411+), **Processor:** Atom 1.6GHz Dual Core, **RAM:** 1GB
**Downloader:** Sabnzbd

**Providers:**
- Usenet
- nzbs.org
- nzbs.in
- Torrent
- IPTorrent
- SceneAccess

**Pertinent Logs:**

01-10 04:32:33 DEBUG [tato.core.plugins.renamer] Checking status snatched releases...
01-10 04:32:33 DEBUG [.core.downloaders.sabnzbd] Checking SABnzbd download status.
01-10 04:32:33 INFO [hpotato.core.plugins.base] Opening url: http://localhost:9200/api?output=json&apikey=xxx&mode=queue, params: []
01-10 04:32:33 INFO [hpotato.core.plugins.base] Opening url: http://localhost:9200/api?output=json&apikey=xxx&limit=15&mode=history, params: []
01-10 04:32:34 DEBUG [tato.core.plugins.renamer] Russ SABnzbd_nzo_1xDOiz : {'status': 'completed', 'files': '', 'timeleft': '0:00:00', 'name': u'Gravity.2013.720p.WEB-DL.DD5.1.H.264-HDCLUB.cp(tt1454468)', 'downloader': 'Sabnzbd', 'original_status': u'Completed', 'folder': '/volume1/downloads/complete/movies/Gravity (2013)', 'id': u'SABnzbd_nzo_pQrr4L'} : Gravity.2013.720p.WEB-DL.DD5.1.H.264-HDCLUB.cp(tt1454468)
01-10 04:32:34 DEBUG [tato.core.plugins.renamer] Russ SABnzbd_nzo_1xDOiz : {'status': 'completed', 'files': '', 'timeleft': '0:00:00', 'name': u'Psych.S08E01.PROPER.720p.HDTV.x264-KILLERS.nzb', 'downloader': 'Sabnzbd', 'original_status': u'Completed', 'folder': '/volume1/downloads/complete/Psych.S08E01.PROPER.720p.HDTV.x264-KILLERS.nzb', 'id': u'SABnzbd_nzo_vU6LAZ'} : Gravity.2013.720p.WEB-DL.DD5.1.H.264-HDCLUB.cp(tt1454468)
01-10 04:32:34 DEBUG [tato.core.plugins.renamer] Russ SABnzbd_nzo_1xDOiz : {'status': 'completed', 'files': '', 'timeleft': '0:00:00', 'name': u'Anchorman.The.Legend.Of.Ron.Burgundy.2004.UNRATED.720p.HDDVD.x264-SiNNERS.cp(tt0357413)', 'downloader': 'Sabnzbd', 'original_status': u'Completed', 'folder': '/volume1/downloads/complete/Anchorman The Legend Of Ron Burgundy (2004)', 'id': u'SABnzbd_nzo_SLt3hl'} : Gravity.2013.720p.WEB-DL.DD5.1.H.264-HDCLUB.cp(tt1454468)
01-10 04:32:34 DEBUG [tato.core.plugins.renamer] Russ SABnzbd_nzo_1xDOiz : {'status': 'completed', 'files': '', 'timeleft': '0:00:00', 'name': u'Psych.S08E01.720p.HDTV.x264-REMARKABLE.nzb', 'downloader': 'Sabnzbd', 'original_status': u'Completed', 'folder': '/volume1/downloads/complete/Psych.S08E01.720p.HDTV.x264-REMARKABLE.nzb', 'id': u'SABnzbd_nzo_CIl2p4'} : Gravity.2013.720p.WEB-DL.DD5.1.H.264-HDCLUB.cp(tt1454468)
01-10 04:32:34 INFO [tato.core.plugins.renamer] Gravity.2013.720p.WEB-DL.DD5.1.H.264-HDCLUB.cp(tt1454468) not found in downloaders

I added an extra debugging line in _./couchpotato/core/plugins/renamer/main.py:836_ so that I could see what was being compared.
```python
log.debug('Russ %s : %s : %s', (str(rel_dict['info'].get('download_id')), str(release_download), nzbname))
```

##### Concluseion:
As you can see in the log file the Gravity nzb job was getting retrieved from Sabnzbd, for some reason the `rel_dict['info']['download_id']` does not match the `release_download['id']`.

I have altered the structure of the _if block_ so that it falls back to finding the the download based on the nzbname if finding by download_id fails.