Repository: pymedusa/Medusa

Issue:
[APP SUBMITTED]: ValueError: invalid literal for int() with base 10: ''

### INFO
**Python Version**: `3.7.3 (default, Jul 25 2020, 13:03:44) [GCC 8.3.0]`
**Operating System**: `Linux-4.19.0-12-amd64-x86_64-with-debian-10.6`
**Locale**: `UTF-8`
**Branch**: [develop](../tree/develop)
**Database**: `44.19`
**Commit**: pymedusa/Medusa@085f27439608d1c51053ad343f96698364880e4a
**Link to Log**: https://gist.github.com/3e4dac5968fe732c85547b78c9d6bb2a
### ERROR
<pre>
2022-03-03 21:00:53 ERROR    SHOWQUEUE-REFRESH :: [085f274] 395971: Error while refreshing show Stjerner i trøjen. Error: invalid literal for int() with base 10: ''
Traceback (most recent call last):
  File "/opt/medusa/<a href="../blob/085f27439608d1c51053ad343f96698364880e4a/medusa/queues/show_queue.py#L761">medusa/queues/show_queue.py</a>", line 761, in run
    self.show.populate_cache()
  File "/opt/medusa/<a href="../blob/085f27439608d1c51053ad343f96698364880e4a/medusa/tv/series.py#L1982">medusa/tv/series.py</a>", line 1982, in populate_cache
    image_cache.fill_cache(self)
  File "/opt/medusa/<a href="../blob/085f27439608d1c51053ad343f96698364880e4a/medusa/image_cache.py#L343">medusa/image_cache.py</a>", line 343, in fill_cache
    _cache_image_from_indexer(series_obj, img_type)
  File "/opt/medusa/<a href="../blob/085f27439608d1c51053ad343f96698364880e4a/medusa/image_cache.py#L266">medusa/image_cache.py</a>", line 266, in _cache_image_from_indexer
    img_data = metadata_generator._retrieve_show_image(img_type_name, series_obj)
  File "/opt/medusa/<a href="../blob/085f27439608d1c51053ad343f96698364880e4a/medusa/metadata/generic.py#L777">medusa/metadata/generic.py</a>", line 777, in _retrieve_show_image
    indexer_show_obj = self._get_show_data(show_obj)
  File "/opt/medusa/<a href="../blob/085f27439608d1c51053ad343f96698364880e4a/medusa/metadata/generic.py#L925">medusa/metadata/generic.py</a>", line 925, in _get_show_data
    my_show = self.indexer_api[int(series_id)]
  File "/opt/medusa/<a href="../blob/085f27439608d1c51053ad343f96698364880e4a/medusa/indexers/base.py#L435">medusa/indexers/base.py</a>", line 435, in __getitem__
    self._get_show_data(key, self.config['language'])
  File "/opt/medusa/<a href="../blob/085f27439608d1c51053ad343f96698364880e4a/medusa/indexers/tvdbv2/api.py#L562">medusa/indexers/tvdbv2/api.py</a>", line 562, in _get_show_data
    self._set_show_data(tvdb_id, 'externals', {'imdb_id': ImdbIdentifier(getattr(self[tvdb_id], 'imdb_id', None)).series_id})
  File "/opt/medusa/<a href="../blob/085f27439608d1c51053ad343f96698364880e4a/medusa/indexers/imdb/api.py#L43">medusa/indexers/imdb/api.py</a>", line 43, in __init__
    self.imdb_id = imdb_id
  File "/opt/medusa/<a href="../blob/085f27439608d1c51053ad343f96698364880e4a/medusa/indexers/imdb/api.py#L72">medusa/indexers/imdb/api.py</a>", line 72, in imdb_id
    self.series_id = int(value)
ValueError: invalid literal for int() with base 10: ''
</pre>
---
_STAFF NOTIFIED_: @pymedusa/support @pymedusa/moderators



Discussion:

Resolving patch:
diff --git a/medusa/indexers/imdb/api.py b/medusa/indexers/imdb/api.py
--- a/medusa/indexers/imdb/api.py
+++ b/medusa/indexers/imdb/api.py
@@ -69,7 +69,10 @@ def imdb_id(self, value):
             self.series_id = int(self._imdb_id.split('tt')[-1])
         else:
             self._imdb_id = 'tt{0}'.format(text_type(value).zfill(7))
-            self.series_id = int(value)
+            try:
+                self.series_id = int(value)
+            except (TypeError, ValueError):
+                self.series_id = None
 
 
 class Imdb(BaseIndexer):


Test patch: