internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: pymedusa/Medusa

Issue:
Fail to download with Extratorrent
Hi,
I've a problem with Extratorrent provider, this appear in manual download in example but also with other search in general.
I've tested URL and it works fine.

Version:
Medusa Info: Branch: master
Commit: 9f544d4
Version: v0.1.7
Database: 44.2
Python Version: 2.7.11 (default, Dec 17 2015, 13:37:18) [GCC 4.6.4 20130102 (prerelease)]
SSL Version: OpenSSL 1.0.2e 3 Dec 2015
OS: Linux-3.2.40-armv7l-with-glibc2.4
Locale: en_US.UTF-8

Logs:
```
2016-11-01 10:00:39 WARNING  SNATCHQUEUE-MANUALSNATCH-274431 :: [b6a8bc7] Failed to download any results
2016-11-01 10:00:39 WARNING  SNATCHQUEUE-MANUALSNATCH-274431 :: [b6a8bc7] Error requesting download url: http://extratorrent.cc/download/5264008/Gotham+S03E07+720p+HDTV+350MB+-+NBY.torrent. Error: error ("bad handshake: Error([('SSL routines', 'ssl3_get_server_certificate', 'certificate verify failed')],)",)
2016-11-01 10:00:22 INFO     SNATCHQUEUE-MANUALSNATCH-274431 :: [b6a8bc7] Downloading a result from ExtraTorrent at http://extratorrent.cc/download/5264008/Gotham+S03E07+720p+HDTV+350MB+-+NBY.torrent
2016-11-01 10:00:21 INFO     SNATCHQUEUE-MANUALSNATCH-274431 :: [b6a8bc7] Downloading Gotham.S03E07.720p.HDTV.350MB.-.NBY with 385 seeders and 270 leechers from ExtraTorrent
2016-11-01 10:00:21 INFO     SNATCHQUEUE-MANUALSNATCH-274431 :: [b6a8bc7] Beginning to manual snatch release: Gotham.S03E07.720p.HDTV.350MB.-.NBY
```



Discussion:
@ratoaq2 @medariox ssl erros again. what we changed in 0.1.7? we don't have this in 0.1.6

@FireBladeNooT in general settings, disable "ssl verify". see if happens again

@fernandog 
It's works thanks

@FireBladeNooT can you update your ssl version?  you are using an old version with some known bugs

OpenSSL 1.0.2e 3 Dec 2015

I have a better solution for this. Will PR later. 

@fernandog 
How can I do this? (I'm on Synology)

@FireBladeNooT you syno has the latest updates?

@fernandog 
Yes: DSM 6.0.2-8451 Update 2


Resolving patch:
diff --git a/medusa/providers/generic_provider.py b/medusa/providers/generic_provider.py
--- a/medusa/providers/generic_provider.py
+++ b/medusa/providers/generic_provider.py
@@ -111,8 +111,10 @@ def download_result(self, result):
             if url.endswith(GenericProvider.TORRENT) and filename.endswith(GenericProvider.NZB):
                 filename = replace_extension(filename, GenericProvider.TORRENT)
 
+            verify = False if self.public else None
+
             if download_file(url, filename, session=self.session, headers=self.headers,
-                             hooks={'response': self.get_url_hook}):
+                             hooks={'response': self.get_url_hook}, verify=verify):
                 if self._verify_download(filename):
                     logger.log('Saved result to %s' % filename, logger.INFO)
                     return True


Test patch:
Repository: pymedusa/Medusa

Issue:
[APP SUBMITTED]: IOError: [Errno 28] No space left on device: '/media/extssd/Shows/Cordon/Season 01/Cordon.S01E10.720p.iP.WEBRip.AAC2.0.H.264-EsQ.nfo'
### INFO
**Python Version**: `2.7.6 (default, Jun 22 2015, 18:00:18) [GCC 4.8.2]`
**Operating System**: `Linux-4.2.0-42-generic-i686-with-Ubuntu-14.04-trusty`
**Locale**: `None`
**Branch**: [develop](../tree/develop)
**Database**: `44.2`
**Commit**: pymedusa/Medusa@1fdd694705afae43337fced099f2595575570fae
**Link to Log**: https://gist.github.com/3cc93f5de2e66b879a0da4525b6581fa
### ERROR
<pre>
2016-11-02 15:10:35 ERROR    POSTPROCESSOR :: [1fdd694] Unable to write file to /media/extssd/Shows/Cordon/Season 01/Cordon.S01E10.720p.iP.WEBRip.AAC2.0.H.264-EsQ.nfo: Exception generated: [Errno 28] No space left on device: '/media/extssd/Shows/Cordon/Season 01/Cordon.S01E10.720p.iP.WEBRip.AAC2.0.H.264-EsQ.nfo'
Traceback (most recent call last):
  File "/home/home/SickRage/<a href="../blob/1fdd694705afae43337fced099f2595575570fae/medusa/metadata/generic.py#L449">medusa/metadata/generic.py</a>", line 449, in write_ep_file
    nfo_file = io.open(nfo_file_path, 'wb')
  File "/home/home/SickRage/<a href="../blob/1fdd694705afae43337fced099f2595575570fae/medusa/init/filesystem.py#L85">medusa/init/filesystem.py</a>", line 85, in <lambda>
    return lambda *args, **kwargs: handle_output(f(*[handle_arg(arg) for arg in args], **{k: handle_arg(arg) for k, arg in kwargs.items()}))
IOError: [Errno 28] No space left on device: '/media/extssd/Shows/Cordon/Season 01/Cordon.S01E10.720p.iP.WEBRip.AAC2.0.H.264-EsQ.nfo'
</pre>

---
_STAFF NOTIFIED_: @pymedusa/support @pymedusa/moderators


Discussion:
@ratoaq2 

Delete a few old shows. 🙉 

I moved the OSError handling to the exception_handler, but I was naive and my assumption that the original code was correct is wrong. The "not enough disk space" happens with an IOError, that's why this error was submittable.


Resolving patch:
diff --git a/medusa/exception_handler.py b/medusa/exception_handler.py
--- a/medusa/exception_handler.py
+++ b/medusa/exception_handler.py
@@ -15,12 +15,12 @@ def handle(err, message='', *args, **kwargs):
     :type err: Exception
     """
     m = message.format(*args, **kwargs) + ': ' if message else ''
-    if isinstance(err, OSError):
+    if isinstance(err, EnvironmentError):
         if err.errno == 28:
             logger.warning('{m}Out of disk space: {error_msg}', m=m, error_msg=err)
         elif err.errno == 13:
             logger.warning('{m}Permission denied: {error_msg}', m=m, error_msg=err)
         else:
-            logger.warning('{m}OS error: {error_msg}', m=m, error_msg=err)
+            logger.warning('{m}Environment error: {error_msg}', m=m, error_msg=err)
     else:
         logger.exception('{m}Exception generated: {error_msg}', m=m, error_msg=err)


Test patch:
Repository: pymedusa/Medusa

Issue:
[APP SUBMITTED]: UnboundLocalError: local variable 'do_update' referenced before assignment
### INFO
**Python Version**: `2.7.13 (v2.7.13:a06454b1afa1, Dec 17 2016, 20:42:59) [MSC v.1500 32 bit (Intel)]`
**Operating System**: `Windows-10-10.0.14393`
**Locale**: `cp1252`
**Branch**: [develop](../tree/develop)
**Database**: `44.4`
**Commit**: pymedusa/Medusa@e0e6acf52478ac0317c7c017ab7e342274919a1f
**Link to Log**: https://gist.github.com/1018bbce05692e5fc51591bb08f5596f
### ERROR
<pre>
2017-01-29 07:17:53 ERROR    Thread-28 :: [e0e6acf] Exception generated: local variable 'do_update' referenced before assignment
Traceback (most recent call last):
  File "C:\pymedusaSickRage\medusa\server\web\core\base.py", line 259, in async_call
    result = function(**kwargs)
  File "C:\pymedusaSickRage\medusa\server\web\home\handler.py", line 1513, in editShow
    if do_update:
UnboundLocalError: local variable 'do_update' referenced before assignment
</pre>
---
_STAFF NOTIFIED_: @pymedusa/support @pymedusa/moderators


Discussion:
Tried adding Taboo.UK  to scene exceptions, when clicking save changes web page went to white page and this error happened.
@p0psicles 

1)
![image](https://cloud.githubusercontent.com/assets/2620870/22404036/3ab960e6-e60f-11e6-8521-bcd9f1d8ac85.png)


2)
![image](https://cloud.githubusercontent.com/assets/2620870/22404046/6f328e56-e60f-11e6-8baa-89e075579819.png)


Resolving patch:
diff --git a/medusa/server/web/home/handler.py b/medusa/server/web/home/handler.py
--- a/medusa/server/web/home/handler.py
+++ b/medusa/server/web/home/handler.py
@@ -1380,6 +1380,7 @@ def editShow(self, show=None, location=None, allowed_qualities=None, preferred_q
         anime = config.checkbox_to_value(anime)
         subtitles = config.checkbox_to_value(subtitles)
 
+        do_update = False
         if show_obj.lang != indexer_lang:
             msg = (
                 '{{status}} {language}'
@@ -1389,7 +1390,6 @@ def editShow(self, show=None, location=None, allowed_qualities=None, preferred_q
                     indexer_name=indexerApi(show_obj.indexer).name,
                 )
             )
-            do_update = False
             status = 'Unexpected result when changing language to'
             log_level = logger.WARNING
             language = show_obj.lang


Test patch:
Repository: pymedusa/Medusa

Issue:
[APP SUBMITTED]: KeyError: u'status'
### INFO
**Python Version**: `2.7.9 (default, Sep 17 2016, 20:26:04) [GCC 4.9.2]`
**Operating System**: `Linux-4.4.38-v7+-armv7l-with-debian-8.0`
**Locale**: `UTF-8`
**Branch**: [develop](../tree/develop)
**Database**: `44.4`
**Commit**: pymedusa/Medusa@a5c2d8aed26476ac2c8fa354ade89640eca2f5bb
**Link to Log**: https://gist.github.com/436c95de307ed2d84051bd351bba4f83
### ERROR
<pre>
2017-02-10 13:33:23 ERROR    Thread-18 :: [a5c2d8a] Exception generated: u'status'
Traceback (most recent call last):
  File "/home/pi/Medusa/<a href="../blob/a5c2d8aed26476ac2c8fa354ade89640eca2f5bb/medusa/server/web/core/base.py#L259">medusa/server/web/core/base.py</a>", line 259, in async_call
    result = function(**kwargs)
  File "/home/pi/Medusa/<a href="../blob/a5c2d8aed26476ac2c8fa354ade89640eca2f5bb/medusa/server/web/home/handler.py#L1414">medusa/server/web/home/handler.py</a>", line 1414, in editShow
    msg = msg.format(satus=status)
KeyError: u'status'
</pre>
---
_STAFF NOTIFIED_: @pymedusa/support @pymedusa/moderators


Discussion:
I am unable to change a show's language.
Doh typo... pushing fix now

Resolving patch:
diff --git a/medusa/server/web/home/handler.py b/medusa/server/web/home/handler.py
--- a/medusa/server/web/home/handler.py
+++ b/medusa/server/web/home/handler.py
@@ -1411,7 +1411,7 @@ def editShow(self, show=None, location=None, allowed_qualities=None, preferred_q
                 log_level = logger.INFO
             finally:
                 indexer_lang = language
-                msg = msg.format(satus=status)
+                msg = msg.format(status=status)
                 if log_level >= logger.WARNING:
                     errors.append(msg)
                 logger.log(msg, log_level)


Test patch:
Repository: pymedusa/Medusa

Issue:
Wrong attribute type causing object to be dirty
In the tuple: Left is NEW info, right is the DB info

DEBUG    SHOWQUEUE-UPDATE :: [b4a8a54] Series object keys that were modified: {'runtime': (u'45', 45)}
DEBUG    SHOWQUEUE-UPDATE :: [b4a8a54] IMDB object keys that were modified: {'rating': (7.9, u'7.9')}

@p0psicles need to handle the self.runtime

@medariox imdbpie returns votes as number right?. But in the DB we store as TEXT. So we need to adjust the self.rating in imdb object

With this, it will always update DB even the value didn't changed

ping @labrys 


Discussion:
I used this commit to find this: https://github.com/pymedusa/Medusa/commits/feature/dirty_item

Resolving patch:
diff --git a/medusa/tv/series.py b/medusa/tv/series.py
--- a/medusa/tv/series.py
+++ b/medusa/tv/series.py
@@ -1217,7 +1217,7 @@ def load_from_indexer(self, tvapi=None):
         self.classification = getattr(indexed_show, 'classification', 'Scripted')
         self.genre = getattr(indexed_show, 'genre', '')
         self.network = getattr(indexed_show, 'network', '')
-        self.runtime = getattr(indexed_show, 'runtime', '')
+        self.runtime = int(getattr(indexed_show, 'runtime', 0))
 
         # set the externals, using the result from the indexer.
         self.externals = {k: v for k, v in getattr(indexed_show, 'externals', {}).items() if v}
@@ -1277,7 +1277,7 @@ def load_imdb_info(self):
             'genres': '|'.join(imdb_obj.genres or ''),
             'countries': '',
             'country_codes': '',
-            'rating': imdb_obj.rating or '',
+            'rating': str(imdb_obj.rating) or '',
             'votes': imdb_obj.votes or '',
             'runtimes': int(imdb_obj.runtime / 60) if imdb_obj.runtime else '',  # Time is returned in seconds
             'certificates': imdb_obj.certification or '',


Test patch:
Repository: pymedusa/Medusa

Issue:
[APP SUBMITTED]: AttributeError: 'exceptions.TypeError' object has no attribute 'errno'
### INFO
**Python Version**: `2.7.9 (default, Sep 17 2016, 20:26:04) [GCC 4.9.2]`
**Operating System**: `Linux-4.4.38-v7+-armv7l-with-debian-8.0`
**Locale**: `UTF-8`
**Branch**: [binsearch_search](../tree/binsearch_search)
**Database**: `44.8`
**Commit**: pymedusa/Medusa@162aa6b6a8d6dce9bdb77d39e1de201702ef3704
**Link to Log**: https://gist.github.com/1eb2ddfb5f4a487e6acfc853386ae3bb
### ERROR
<pre>
2017-04-23 22:44:14 ERROR    FINDPROPERS :: [T411] :: [162aa6b] Exception generated: 'exceptions.TypeError' object has no attribute 'errno'
Traceback (most recent call last):
  File "/home/pi/Medusa/<a href="../blob/162aa6b6a8d6dce9bdb77d39e1de201702ef3704/medusa/scheduler.py#L103">medusa/scheduler.py</a>", line 103, in run
    self.action.run(self.force)
  File "/home/pi/Medusa/<a href="../blob/162aa6b6a8d6dce9bdb77d39e1de201702ef3704/medusa/search/proper.py#L78">medusa/search/proper.py</a>", line 78, in run
    propers = self._get_proper_results()
  File "/home/pi/Medusa/<a href="../blob/162aa6b6a8d6dce9bdb77d39e1de201702ef3704/medusa/search/proper.py#L165">medusa/search/proper.py</a>", line 165, in _get_proper_results
    if 'ECONNRESET' in e or getattr(e, 'errno') == errno.ECONNRESET:
AttributeError: 'exceptions.TypeError' object has no attribute 'errno'
</pre>
---
_STAFF NOTIFIED_: @pymedusa/support @pymedusa/moderators


Discussion:

Resolving patch:
diff --git a/medusa/search/proper.py b/medusa/search/proper.py
--- a/medusa/search/proper.py
+++ b/medusa/search/proper.py
@@ -162,7 +162,7 @@ def _get_proper_results(self):  # pylint: disable=too-many-locals, too-many-bran
                            (provider=cur_provider.name, error=ex(e)), logger.DEBUG)
                 continue
             except Exception as e:
-                if 'ECONNRESET' in e or getattr(e, 'errno') == errno.ECONNRESET:
+                if 'ECONNRESET' in e or getattr(e, 'errno', None) == errno.ECONNRESET:
                     logger.log('Connection reset by peer while searching for propers in {provider}. '
                                'Skipping: {error}'.format
                                (provider=cur_provider.name, error=ex(e)), logger.DEBUG)


Test patch:
Repository: pymedusa/Medusa

Issue:
[APP SUBMITTED]: TypeError: level must be an integer
### INFO
**Python Version**: `2.7.9 (default, Sep 17 2016, 20:26:04) [GCC 4.9.2]`
**Operating System**: `Linux-4.4.38-v7+-armv7l-with-debian-8.0`
**Locale**: `UTF-8`
**Branch**: [develop](../tree/develop)
**Database**: `44.8`
**Commit**: pymedusa/Medusa@289e34a0ff1556d94f314ee1d268036bccbc19ba
**Link to Log**: https://gist.github.com/fab36c448ceab560ac5437227d5f393a
### ERROR
<pre>
2017-05-10 00:06:46 ERROR    SEARCHQUEUE-MANUAL-274431 :: [Danishbits] :: [289e34a] Failed parsing provider. Traceback: 'Traceback (most recent call last):\n  File "/home/pi/Medusa/medusa/providers/torrent/html/danishbits.py", line 174, in parse\n    title, seeders, leechers)\n  File "/home/pi/Medusa/medusa/logger/adapters/style.py", line 79, in log\n    self.logger.log(level, brace_msg, **kwargs)\n  File "/usr/lib/python2.7/logging/__init__.py", line 1482, in log\n    self.logger.log(level, msg, *args, **kwargs)\n  File "/usr/lib/python2.7/logging/__init__.py", line 1220, in log\n    raise TypeError("level must be an integer")\nTypeError: level must be an integer\n'
Traceback (most recent call last):
  File "/home/pi/Medusa/<a href="../blob/289e34a0ff1556d94f314ee1d268036bccbc19ba/medusa/providers/torrent/html/danishbits.py#L174">medusa/providers/torrent/html/danishbits.py</a>", line 174, in parse
    title, seeders, leechers)
  File "/home/pi/Medusa/<a href="../blob/289e34a0ff1556d94f314ee1d268036bccbc19ba/medusa/logger/adapters/style.py#L79">medusa/logger/adapters/style.py</a>", line 79, in log
    self.logger.log(level, brace_msg, **kwargs)
  File "/usr/lib/python2.7/logging/__init__.py", line 1482, in log
    self.logger.log(level, msg, *args, **kwargs)
  File "/usr/lib/python2.7/logging/__init__.py", line 1220, in log
    raise TypeError("level must be an integer")
TypeError: level must be an integer
</pre>
---
_STAFF NOTIFIED_: @pymedusa/support @pymedusa/moderators


Discussion:
@labrys  one slipped through.

Resolving patch:
diff --git a/medusa/providers/torrent/html/danishbits.py b/medusa/providers/torrent/html/danishbits.py
--- a/medusa/providers/torrent/html/danishbits.py
+++ b/medusa/providers/torrent/html/danishbits.py
@@ -170,8 +170,8 @@ def process_column_header(td):
                         'pubdate': pubdate,
                     }
                     if mode != 'RSS':
-                        log.log('Found result: {0} with {1} seeders and {2} leechers',
-                                title, seeders, leechers)
+                        log.debug('Found result: {0} with {1} seeders and {2} leechers',
+                                  title, seeders, leechers)
 
                     items.append(item)
                 except (AttributeError, TypeError, KeyError, ValueError, IndexError):


Test patch:
Repository: pymedusa/Medusa

Issue:
[APP SUBMITTED]: AttributeError: 'BraceAdapter' object has no attribute 'DEBUG'
### INFO
**Python Version**: `2.7.13 (v2.7.13:a06454b1afa1, Dec 17 2016, 20:53:40) [MSC v.1500 64 bit (AMD64)]`
**Operating System**: `Windows-10-10.0.15063`
**Locale**: `cp1252`
**Branch**: [develop](../tree/develop)
**Database**: `44.8`
**Commit**: pymedusa/Medusa@a2aaaf4dd43c018019a67fe1a27074b124681fa4
**Link to Log**: https://gist.github.com/66f5f5fc2f3cc2fbaec732d8d994335e
### ERROR
<pre>
2017-05-12 08:29:52 ERROR    SEARCHQUEUE-FORCED-309269 :: [Rarbg] :: [a2aaaf4] Unknown exception while searching Rarbg. Error: "'BraceAdapter' object has no attribute 'DEBUG'"
Traceback (most recent call last):
  File "C:\Medusa\medusa\search\core.py", line 547, in search_providers
    down_cur_quality, manual_search, manual_search_type)
  File "C:\Medusa\medusa\providers\generic_provider.py", line 207, in find_search_results
    items_list += self.search(search_string, ep_obj=episode)
  File "C:\Medusa\medusa\providers\torrent\json\rarbg.py", line 136, in search
    log_level = log.DEBUG
AttributeError: 'BraceAdapter' object has no attribute 'DEBUG'
</pre>
---
_STAFF NOTIFIED_: @pymedusa/support @pymedusa/moderators


Discussion:

Resolving patch:
diff --git a/medusa/providers/torrent/json/rarbg.py b/medusa/providers/torrent/json/rarbg.py
--- a/medusa/providers/torrent/json/rarbg.py
+++ b/medusa/providers/torrent/json/rarbg.py
@@ -126,14 +126,14 @@ def search(self, search_strings, age=0, ep_obj=None):
                     # List of errors: https://github.com/rarbg/torrentapi/issues/1#issuecomment-114763312
                     if error_code == 5:
                         # 5 = Too many requests per second
-                        log_level = log.INFO
+                        log_level = logging.INFO
                     elif error_code not in (4, 8, 10, 12, 14, 20):
                         # 4 = Invalid token. Use get_token for a new one!
                         # 8, 10, 12, 14 = Cant find * in database. Are you sure this * exists?
                         # 20 = No results found
-                        log_level = log.WARNING
+                        log_level = logging.WARNING
                     else:
-                        log_level = log.DEBUG
+                        log_level = logging.DEBUG
                     log.log(log_level, '{msg} Code: {code}', {'msg': error, 'code': error_code})
                     continue
 


Test patch:
Repository: pymedusa/Medusa

Issue:
Anidex Exception
On develop, I'm getting this exception because they don't always post a torrent file but only a magnet link. But I don't if magnets links are fully supported by Medusa.
``` shell 
2017-05-19 09:18:34 ERROR    SEARCHQUEUE-DAILY-SEARCH :: [AniDex] :: [c6cfffd] Failed parsing provider. Traceback: 'Traceback (most recent call last):\n  File "/opt/Medusa/medusa/providers/torrent/html/anidex.py", line 120, in parse\n    download_url = cells[labels.index(\'Torrent\')].a.get(\'href\')\nAttributeError: \'NoneType\' object has no attribute \'get\'\n'
Traceback (most recent call last):
  File "/opt/Medusa/medusa/providers/torrent/html/anidex.py", line 120, in parse
    download_url = cells[labels.index('Torrent')].a.get('href')
AttributeError: 'NoneType' object has no attribute 'get'
``` 


Discussion:
Yes they are, but we need to make a small change to the provider's code for that.
@medariox can you take a look at this?
Yes, it's a quick fix.
@IDerr 
Can you tell me a file that only has the magnet please?

Resolving patch:
diff --git a/medusa/providers/torrent/html/anidex.py b/medusa/providers/torrent/html/anidex.py
--- a/medusa/providers/torrent/html/anidex.py
+++ b/medusa/providers/torrent/html/anidex.py
@@ -107,9 +107,10 @@ def parse(self, data, mode):
                 log.debug('Data returned from provider does not contain any torrents')
                 return items
 
-            table_spans = table_header.find_all('span')
-            # Skip 'Likes' to have the same amount of cells and labels
-            labels = [label.get('title') for label in table_spans if label.get('title') != 'Likes']
+            table_ths = table_header.find_all('th')
+            # [u'Category', u'', u'Filename', u'Comments', u'Torrent', u'Magnet',
+            #  u'File size', u'Age', u'Seeders', u'Leechers', u'Completed']
+            labels = [label.span.get('title') if label.span else '' for label in table_ths]
 
             torrent_rows = html.find('tbody').find_all('tr')
             for row in torrent_rows:


Test patch:
Repository: pymedusa/Medusa

Issue:
[Trakt Checker] AttributeError: 'NoneType' object has no attribute 'get_episode'
### Before submitting your issue:

Enable debug logging in Medusa settings, reproduce the error (be sure to disable after the bug is fixed)

**Branch/Commit:**
**OS:**
**What you did:**
**What happened:**
**What you expected:**
**Logs:**
```

2017-05-11 18:42:04 ERROR    TRAKTCHECKER :: [6b2df91] Exception generated: 'NoneType' object has no attribute 'get_episode'
Traceback (most recent call last):
  File "/volumeUSB1/usbshare/applications/sickrage/SickBeard/medusa/scheduler.py", line 103, in run
    self.action.run(self.force)
  File "/volumeUSB1/usbshare/applications/sickrage/SickBeard/medusa/trakt_checker.py", line 89, in run
    self.sync_watchlist()
  File "/volumeUSB1/usbshare/applications/sickrage/SickBeard/medusa/trakt_checker.py", line 320, in sync_watchlist
    self.sync_trakt_episodes()
  File "/volumeUSB1/usbshare/applications/sickrage/SickBeard/medusa/trakt_checker.py", line 555, in sync_trakt_episodes
    set_episode_to_wanted(show, trakt_season, trakt_episode)
  File "/volumeUSB1/usbshare/applications/sickrage/SickBeard/medusa/trakt_checker.py", line 37, in set_episode_to_wanted
    ep_obj = show.get_episode(season, episode)
AttributeError: 'NoneType' object has no attribute 'get_episode'
```



Discussion:
known issue
this will be fixed only when I finish the Trakt rewrite as talked to @p0psicles some time ago.
no ETA to finish tho




Resolving patch:
diff --git a/medusa/trakt_checker.py b/medusa/trakt_checker.py
--- a/medusa/trakt_checker.py
+++ b/medusa/trakt_checker.py
@@ -551,7 +551,8 @@ def sync_trakt_episodes(self):
                 if indexer_id not in added_shows:
                     self.add_show(trakt_default_indexer, indexer_id, trakt_show['title'], SKIPPED)
                     added_shows.append(indexer_id)
-            if not trakt_season == 0 or not show.paused:
+
+            elif not trakt_season == 0 and not show.paused:
                 set_episode_to_wanted(show, trakt_season, trakt_episode)
 
         logger.log(u"Synced episodes with Trakt watchlist", logger.DEBUG)


Test patch: