Repository: pymedusa/Medusa

Issue:
[APP SUBMITTED]: IndexError: tuple index out of range
### INFO
**Python Version**: `2.7.9 (default, Sep 17 2016, 20:26:04) [GCC 4.9.2]`
**Operating System**: `Linux-4.9.35-v7+-armv7l-with-debian-8.0`
**Locale**: `UTF-8`
**Branch**: [develop](../tree/develop)
**Database**: `44.8`
**Commit**: pymedusa/Medusa@c3a7a22042211c3ca56a11d208f247971e8989cd
**Link to Log**: https://gist.github.com/19e28ececb2afebb240c02b54a88fc6a
### ERROR
<pre>
2017-08-26 04:35:05 ERROR    TORNADO :: [c3a7a22] API :: 'tuple index out of range'
Traceback (most recent call last):
  File "/home/pi/Medusa/<a href="../blob/c3a7a22042211c3ca56a11d208f247971e8989cd/medusa/server/api/v1/core.py#L126">medusa/server/api/v1/core.py</a>", line 126, in get
    out_dict = _call_dispatcher(args, kwargs)
  File "/home/pi/Medusa/<a href="../blob/c3a7a22042211c3ca56a11d208f247971e8989cd/medusa/server/api/v1/core.py#L196">medusa/server/api/v1/core.py</a>", line 196, in call_dispatcher
    cur_out_dict = func(cur_args, cur_kwargs).run()  # call function and get response
  File "/home/pi/Medusa/<a href="../blob/c3a7a22042211c3ca56a11d208f247971e8989cd/medusa/server/api/v1/core.py#L1640">medusa/server/api/v1/core.py</a>", line 1640, in run
    results.append({INDEXER_IDS[_indexer]: int(cur_series['id']),
IndexError: tuple index out of range
</pre>
---
_STAFF NOTIFIED_: @pymedusa/support @pymedusa/moderators


Discussion:
### INFO
**Python Version**: `2.7.9 (default, Sep 17 2016, 20:26:04) [GCC 4.9.2]`
**Operating System**: `Linux-4.9.35-v7+-armv7l-with-debian-8.0`
**Locale**: `UTF-8`
**Branch**: [develop](../tree/develop)
**Database**: `44.8`
**Commit**: pymedusa/Medusa@d397bcb905b820a12fac135a398cdc2ed9544d3d
**Link to Log**: https://gist.github.com/a149949d3d3fef8859dcbf893960b6f8
### ERROR
<pre>
2017-10-09 09:05:20 ERROR    FINDPROPERS :: [Pretome] :: [d397bcb] Failed parsing provider. Traceback: 'Traceback (most recent call last):\n  File "/home/pi/Medusa/medusa/providers/torrent/html/pretome.py", line 126, in parse\n    seeders = try_int(cells[9].get_text(), 1)\nIndexError: list index out of range\n'
Traceback (most recent call last):
  File "/home/pi/Medusa/<a href="../blob/d397bcb905b820a12fac135a398cdc2ed9544d3d/medusa/providers/torrent/html/pretome.py#L126">medusa/providers/torrent/html/pretome.py</a>", line 126, in parse
    seeders = try_int(cells[9].get_text(), 1)
IndexError: list index out of range
</pre>
---
_STAFF NOTIFIED_: @pymedusa/support @pymedusa/moderators

### INFO
**Python Version**: `2.7.9 (default, Sep 17 2016, 20:26:04) [GCC 4.9.2]`
**Operating System**: `Linux-4.9.35-v7+-armv7l-with-debian-8.0`
**Locale**: `UTF-8`
**Branch**: [develop](../tree/develop)
**Database**: `44.8`
**Commit**: pymedusa/Medusa@ecd4b38ba4c39b16dc196c5245bd8226ae5834a7
**Link to Log**: https://gist.github.com/b4eb22711f1aed4fb250e4cb6c449e1b
### ERROR
<pre>
2017-12-27 16:05:41 ERROR    SHOWQUEUE-REFRESH :: [ecd4b38] 73807: Error while refreshing show Fire Chasers. Error: list index out of range
Traceback (most recent call last):
  File "/home/pi/Medusa/<a href="../blob/ecd4b38ba4c39b16dc196c5245bd8226ae5834a7/medusa/show_queue.py#L632">medusa/show_queue.py</a>", line 632, in run
    self.show.write_metadata()
  File "/home/pi/Medusa/<a href="../blob/ecd4b38ba4c39b16dc196c5245bd8226ae5834a7/medusa/tv/series.py#L848">medusa/tv/series.py</a>", line 848, in write_metadata
    self.__get_images(metadata_provider)
  File "/home/pi/Medusa/<a href="../blob/ecd4b38ba4c39b16dc196c5245bd8226ae5834a7/medusa/tv/series.py#L1197">medusa/tv/series.py</a>", line 1197, in __get_images
    fanart_result = metadata_provider.create_fanart(self) or fanart_result
  File "/home/pi/Medusa/<a href="../blob/ecd4b38ba4c39b16dc196c5245bd8226ae5834a7/medusa/metadata/generic.py#L299">medusa/metadata/generic.py</a>", line 299, in create_fanart
    return self.save_fanart(show_obj)
  File "/home/pi/Medusa/<a href="../blob/ecd4b38ba4c39b16dc196c5245bd8226ae5834a7/medusa/metadata/generic.py#L516">medusa/metadata/generic.py</a>", line 516, in save_fanart
    fanart_data = self._retrieve_show_image(u'fanart', show_obj, which=which)
  File "/home/pi/Medusa/<a href="../blob/ecd4b38ba4c39b16dc196c5245bd8226ae5834a7/medusa/metadata/generic.py#L729">medusa/metadata/generic.py</a>", line 729, in _retrieve_show_image
    indexer_show_obj = self._get_show_data(show_obj)
  File "/home/pi/Medusa/<a href="../blob/ecd4b38ba4c39b16dc196c5245bd8226ae5834a7/medusa/metadata/generic.py#L852">medusa/metadata/generic.py</a>", line 852, in _get_show_data
    my_show = self.indexer_api[int(show_id)]
  File "/home/pi/Medusa/<a href="../blob/ecd4b38ba4c39b16dc196c5245bd8226ae5834a7/medusa/indexers/indexer_base.py#L285">medusa/indexers/indexer_base.py</a>", line 285, in __getitem__
    self._get_show_data(key, self.config['language'])
  File "/home/pi/Medusa/<a href="../blob/ecd4b38ba4c39b16dc196c5245bd8226ae5834a7/medusa/indexers/tmdb/tmdb.py#L460">medusa/indexers/tmdb/tmdb.py</a>", line 460, in _get_show_data
    self._parse_images(sid)
  File "/home/pi/Medusa/<a href="../blob/ecd4b38ba4c39b16dc196c5245bd8226ae5834a7/medusa/indexers/tmdb/tmdb.py#L361">medusa/indexers/tmdb/tmdb.py</a>", line 361, in _parse_images
    self._save_images(sid, _images)
  File "/home/pi/Medusa/<a href="../blob/ecd4b38ba4c39b16dc196c5245bd8226ae5834a7/medusa/indexers/indexer_base.py#L261">medusa/indexers/indexer_base.py</a>", line 261, in _save_images
    highest_rated = images_by_rating[0]
IndexError: list index out of range
</pre>
---
_STAFF NOTIFIED_: @pymedusa/support @pymedusa/moderators

@p0psicles 

Resolving patch:
diff --git a/medusa/indexers/indexer_base.py b/medusa/indexers/indexer_base.py
--- a/medusa/indexers/indexer_base.py
+++ b/medusa/indexers/indexer_base.py
@@ -257,6 +257,9 @@ def _save_images(self, series_id, images):
                 }
             )
 
+            if not images_by_rating:
+                continue
+
             # Get the highest rated image
             highest_rated = images_by_rating[0]
             img_url = highest_rated['_bannerpath']


Test patch: