Repository: pymedusa/Medusa

Issue:
[APP SUBMITTED]: ValueError: invalid literal for int() with base 10: ''
### 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@f971a8ce45008e3c3ddc6ede4a602b16db123cbf
**Link to Log**: https://gist.github.com/38875ed7ff1eb6d81f0bed33db949c7d
### ERROR
<pre>
2017-09-24 20:44:18 ERROR    Thread-18 :: [f971a8c] Exception generated: invalid literal for int() with base 10: ''
Traceback (most recent call last):
  File "/home/pi/Medusa/<a href="../blob/f971a8ce45008e3c3ddc6ede4a602b16db123cbf/medusa/server/web/core/base.py#L258">medusa/server/web/core/base.py</a>", line 258, in async_call
    result = function(**kwargs)
  File "/home/pi/Medusa/<a href="../blob/f971a8ce45008e3c3ddc6ede4a602b16db123cbf/medusa/server/web/home/handler.py#L1036">medusa/server/web/home/handler.py</a>", line 1036, in pickManualSearch
    ep_objs.append(show_obj.get_episode(int(cached_result[b'season']), int(episode)))
ValueError: invalid literal for int() with base 10: ''
</pre>
---
_STAFF NOTIFIED_: @pymedusa/support @pymedusa/moderators
[APP SUBMITTED]: ValueError: invalid literal for int() with base 10: ''
### 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@f971a8ce45008e3c3ddc6ede4a602b16db123cbf
**Link to Log**: https://gist.github.com/38875ed7ff1eb6d81f0bed33db949c7d
### ERROR
<pre>
2017-09-24 20:44:18 ERROR    Thread-18 :: [f971a8c] Exception generated: invalid literal for int() with base 10: ''
Traceback (most recent call last):
  File "/home/pi/Medusa/<a href="../blob/f971a8ce45008e3c3ddc6ede4a602b16db123cbf/medusa/server/web/core/base.py#L258">medusa/server/web/core/base.py</a>", line 258, in async_call
    result = function(**kwargs)
  File "/home/pi/Medusa/<a href="../blob/f971a8ce45008e3c3ddc6ede4a602b16db123cbf/medusa/server/web/home/handler.py#L1036">medusa/server/web/home/handler.py</a>", line 1036, in pickManualSearch
    ep_objs.append(show_obj.get_episode(int(cached_result[b'season']), int(episode)))
ValueError: invalid literal for int() with base 10: ''
</pre>
---
_STAFF NOTIFIED_: @pymedusa/support @pymedusa/moderators


Discussion:
That happened on manual snatch, right? You made a manual episode search, but snatched a season?

### INFO
**Python Version**: `2.7.14 (default, May 28 2018, 14:47:18) [GCC 4.7.3 20130102 (prerelease)]`
**Operating System**: `Linux-3.10.105-x86_64-with-glibc2.2.5`
**Locale**: `UTF-8`
**Branch**: [master](../tree/master)
**Database**: `44.11`
**Commit**: pymedusa/Medusa@c65ca2607fae74405dcceaaf8c02f3d29d0313ea
**Link to Log**: https://gist.github.com/5a08076350d2660dfe545ff7cbfc9105
### ERROR
<pre>
2018-06-27 06:59:39 ERROR    SEARCHQUEUE-DAILY-SEARCH :: [Yggtorrent] :: [c65ca26] Failed parsing provider.
Traceback (most recent call last):
  File "/volume1/@appstore/sickbeard-custom/var/<a href="../blob/c65ca2607fae74405dcceaaf8c02f3d29d0313ea/SickBeard/medusa/helper/common.py#L319">SickBeard/medusa/helper/common.py</a>", line 319, in try_int
    return int(candidate)
ValueError: invalid literal for int() with base 10: '705.68Mo'
</pre>
---
_STAFF NOTIFIED_: @pymedusa/support @pymedusa/moderators


### INFO
**Python Version**: `2.7.12 (default, Dec  4 2017, 14:50:18) [GCC 5.4.0 20160609]`
**Operating System**: `Linux-4.4.0-116-generic-x86_64-with-Ubuntu-16.04-xenial`
**Locale**: `UTF-8`
**Branch**: [develop](../tree/develop)
**Database**: `44.11`
**Commit**: pymedusa/Medusa@8cea718e0e623453074f1c2e7965ec1e03080761
**Link to Log**: https://gist.github.com/d39cf044acf125de0d69410a5d4584f9
### ERROR
<pre>
2018-06-28 11:11:39 ERROR    SEARCHQUEUE-DAILY-SEARCH :: [Yggtorrent] :: [8cea718] Failed parsing provider.
Traceback (most recent call last):
  File "/media/NAS/Medusa/<a href="../blob/8cea718e0e623453074f1c2e7965ec1e03080761/medusa/helper/common.py#L328">medusa/helper/common.py</a>", line 328, in try_int
    return int(candidate)
ValueError: invalid literal for int() with base 10: '6.56Go'
</pre>
---
_STAFF NOTIFIED_: @pymedusa/support @pymedusa/moderators

That happened on manual snatch, right? You made a manual episode search, but snatched a season?

### INFO
**Python Version**: `2.7.14 (default, May 28 2018, 14:47:18) [GCC 4.7.3 20130102 (prerelease)]`
**Operating System**: `Linux-3.10.105-x86_64-with-glibc2.2.5`
**Locale**: `UTF-8`
**Branch**: [master](../tree/master)
**Database**: `44.11`
**Commit**: pymedusa/Medusa@c65ca2607fae74405dcceaaf8c02f3d29d0313ea
**Link to Log**: https://gist.github.com/5a08076350d2660dfe545ff7cbfc9105
### ERROR
<pre>
2018-06-27 06:59:39 ERROR    SEARCHQUEUE-DAILY-SEARCH :: [Yggtorrent] :: [c65ca26] Failed parsing provider.
Traceback (most recent call last):
  File "/volume1/@appstore/sickbeard-custom/var/<a href="../blob/c65ca2607fae74405dcceaaf8c02f3d29d0313ea/SickBeard/medusa/helper/common.py#L319">SickBeard/medusa/helper/common.py</a>", line 319, in try_int
    return int(candidate)
ValueError: invalid literal for int() with base 10: '705.68Mo'
</pre>
---
_STAFF NOTIFIED_: @pymedusa/support @pymedusa/moderators


### INFO
**Python Version**: `2.7.12 (default, Dec  4 2017, 14:50:18) [GCC 5.4.0 20160609]`
**Operating System**: `Linux-4.4.0-116-generic-x86_64-with-Ubuntu-16.04-xenial`
**Locale**: `UTF-8`
**Branch**: [develop](../tree/develop)
**Database**: `44.11`
**Commit**: pymedusa/Medusa@8cea718e0e623453074f1c2e7965ec1e03080761
**Link to Log**: https://gist.github.com/d39cf044acf125de0d69410a5d4584f9
### ERROR
<pre>
2018-06-28 11:11:39 ERROR    SEARCHQUEUE-DAILY-SEARCH :: [Yggtorrent] :: [8cea718] Failed parsing provider.
Traceback (most recent call last):
  File "/media/NAS/Medusa/<a href="../blob/8cea718e0e623453074f1c2e7965ec1e03080761/medusa/helper/common.py#L328">medusa/helper/common.py</a>", line 328, in try_int
    return int(candidate)
ValueError: invalid literal for int() with base 10: '6.56Go'
</pre>
---
_STAFF NOTIFIED_: @pymedusa/support @pymedusa/moderators


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
@@ -1006,13 +1006,12 @@ def titler(x):
             title=series_obj.name, controller='home', action='displayShow',
         )
 
-    def pickManualSearch(self, provider=None, rowid=None, manual_search_type='episode'):
+    def pickManualSearch(self, provider=None, rowid=None):
         """
         Tries to Perform the snatch for a manualSelected episode, episodes or season pack.
 
         @param provider: The provider id, passed as usenet_crawler and not the provider name (Usenet-Crawler)
         @param rowid: The provider's cache table's rowid. (currently the implicit sqlites rowid is used, needs to be replaced in future)
-        @param manual_search_type: Episode or Season search
 
         @return: A json with a {'success': true} or false.
         """
@@ -1057,10 +1056,11 @@ def pickManualSearch(self, provider=None, rowid=None, manual_search_type='episod
         # Single-episode: |1|
         # Season pack: || so we need to get all episodes from season and create all ep objects
         ep_objs = []
-        if manual_search_type == 'episode':
-            for episode in cached_result[b'episodes'].strip('|').split('|'):
+        result_episodes = cached_result[b'episodes'].strip('|')
+        if result_episodes:
+            for episode in result_episodes.split('|'):
                 ep_objs.append(series_obj.get_episode(int(cached_result[b'season']), int(episode)))
-        elif manual_search_type == 'season':
+        else:
             ep_objs.extend(series_obj.get_all_episodes([int(cached_result[b'season'])]))
 
         # Create the queue item


Test patch: