pymedusa / Medusa

Automatic Video Library Manager for TV Shows. It watches for new episodes of your favorite shows, and when they are posted it does its magic.
https://pymedusa.com
GNU General Public License v3.0
1.8k stars 276 forks source link

[APP SUBMITTED]: ValueError: invalid literal for int() with base 10: '1.62 GB' #7832

Open uowiec opened 4 years ago

uowiec commented 4 years ago

INFO

Python Version: 3.6.9 (default, Nov 7 2019, 10:44:02) [GCC 8.3.0] Operating System: Linux-4.15.4-041504-generic-x86_64-with-Ubuntu-18.04-bionic Locale: UTF-8 Branch: master Database: 44.14 Commit: pymedusa/Medusa@ee1b898d0f74750c4c265d077fcc0da73d17b41e Link to Log: https://gist.github.com/e813453b145cfcbe232cad631c1fc98e

ERROR

2020-03-10 03:18:13 ERROR    SEARCHQUEUE-DAILY-SEARCH :: [polishtracker] :: [ee1b898] Casting to int failed.
Stack trace:
  File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner
    self.run()
  File "/home/user/medusa/medusa/search/queue.py", line 266, in run
    found_results = search_for_needed_episodes(self.scheduler_start_time, force=self.force)
  File "/home/user/medusa/medusa/search/core.py", line 526, in search_for_needed_episodes
    cur_provider.cache.update_cache(scheduler_start_time)
  File "/home/user/medusa/medusa/tv/cache.py", line 250, in update_cache
    item=item)
  File "/home/user/medusa/medusa/providers/torrent/torrent_provider.py", line 48, in get_result
    item=item, cache=cache)
  File "/home/user/medusa/medusa/classes.py", line 311, in __init__
    super(TorrentSearchResult, self).__init__(provider, series=series, item=item, cache=cache)
  File "/home/user/medusa/medusa/classes.py", line 115, in __init__
    self.update_search_result()
  File "/home/user/medusa/medusa/classes.py", line 239, in update_search_result
    self.size = self.provider._get_size(self.item)
Traceback (most recent call last):
  File "/home/user/medusa/medusa/helper/common.py", line 331, in try_int
    return int(candidate)
ValueError: invalid literal for int() with base 10: '1.62 GB'

The search provider is RSS feed. Sample item:

<item>
<title>Better.Call.Saul.S05E04.720p.WEB.H264-XLF</title>
<category>TV HD</category>
<pubDate>Tue, 10 Mar 2020 01:55:01 GMT</pubDate>
<description>Better Call Saul</description>
<size>1.62 GB</size>
<link>
https://*redacted*
</link>
</item>

STAFF NOTIFIED: @pymedusa/support @pymedusa/moderators

medariox commented 4 years ago

Where is this coming from? If it is a custom provider, the size needs to be available as bytes (int).

uowiec commented 4 years ago

It's a private tracker, allow me not to mention the details. As I stated in the bug report, it is a custom provider, using RSS feed as data. This particular tracker uses 'GB' notation for file size. It does make sense to use the exact bytes number as the size, but is there any written rule for trackers to use int number of bytes in RSS feed? I have recently moved from SickChill and I never had this issue, but since Medusa displays this error all in red on the UI, I thought I better open an issue.

medariox commented 4 years ago

The only reason it "worked" is because the error is suppressed in SC. Which means the size is not used at all. We need this kind of info to be consistent and reliable, because we actually make use of it. It is really not great to ignore this kind of errors. The best thing would be to ask the provider to change it. Maybe we can add a fallback solution, will think about it.