itsToggle / plex_debrid

Plex torrent streaming through Debrid Services
1.52k stars 132 forks source link

Download fails 'object has no attribute 'id'' #8

Closed piratsch closed 2 years ago

piratsch commented 2 years ago

Hi!

I often get the following error when the script tries to download tv series:

Exception in thread Thread-127:
Traceback (most recent call last):
  File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.8/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "/script/plex_rd.py", line 1313, in download
    result[index] = cls.download(library=library,parentReleases=parentReleases)
  File "/script/plex_rd.py", line 347, in download
    if not self.debrid_download():
  File "/script/plex_rd.py", line 381, in debrid_download
    if not debrid.download(self,stream=False):
  File "/script/plex_rd.py", line 714, in download
    if service.download(element,stream=stream,query=query,force=force):
  File "/script/plex_rd.py", line 868, in download
    debrid.realdebrid.post('https://api.real-debrid.com/rest/1.0/torrents/selectFiles/' + str(response.id), {'files':'all'})
AttributeError: 'types.SimpleNamespace' object has no attribute 'id'
itsToggle commented 2 years ago

Oh, I should have cought that exception. The error gets triggered because the uncached torrent that was added is still in the "Magnet conversion" Phase, which usually means its broken. The script tries to select the files for the torrent, but the torrent isnt ready yet. Ive added a bit of a delay and added a catch for the exception. Can you try it again with the latest version?

piratsch commented 2 years ago

Seems to be fixed now, thanks a lot!