junalmeida / Sick-Beard

Sick-Beard is a PVR & episode guide that downloads and manages all your TV shows. You must have rights to the TV Shows being downloaded. Always observe network regulations and laws in your country.
GNU General Public License v3.0
143 stars 75 forks source link

unhanded exception during post processing #346

Closed jwaterwo closed 4 years ago

jwaterwo commented 4 years ago

`Processing failed for file: Post Processor returned unhandled exception: 'NoneType' object has no attribute 'split'

junalmeida commented 4 years ago

It is difficult to help without stack trace, steps to reproduce and screen shots.

jwaterwo commented 4 years ago

Thanks. I noticed my episodes were not getting detected. Manual post processing shows this message in the logs.

I took a quick glance at the code but didn't see an easy way to enable debug. I can poke more at it tomorrow.

jwaterwo commented 4 years ago
Traceback (most recent call last):
  File "/mnt/sickbeard/lib/cherrypy/_cprequest.py", line 670, in respond
    response.body = self.handler()
  File "/mnt/sickbeard/lib/cherrypy/lib/encoding.py", line 220, in __call__
    self.body = self.oldhandler(*args, **kwargs)
  File "/mnt/sickbeard/lib/cherrypy/_cpdispatch.py", line 60, in __call__
    return self.callable(*self.args, **self.kwargs)
  File "/mnt/sickbeard/sickbeard/webserve.py", line 1588, in processEpisode
    result = processTV.processDir(dir, nzbName, method=method, pp_options=pp_options)
  File "/mnt/sickbeard/sickbeard/processTV.py", line 147, in processDir
    returnStr += processDir(cur_folder, nzbName=parent_nzbName, recurse=True, method=method, pp_options=pp_options)
  File "/mnt/sickbeard/sickbeard/processTV.py", line 187, in processDir
    process_result = processor.process()
  File "/mnt/sickbeard/sickbeard/postProcessor.py", line 731, in process
    (tvdb_id, season, episodes, quality) = self._find_info()
  File "/mnt/sickbeard/sickbeard/postProcessor.py", line 459, in _find_info
    (cur_tvdb_id, cur_season, cur_episodes, cur_quality) = cur_attempt()
  File "/mnt/sickbeard/sickbeard/postProcessor.py", line 442, in <lambda>
    lambda: self._analyze_name(self.file_name),
  File "/mnt/sickbeard/sickbeard/postProcessor.py", line 377, in _analyze_name
    showObj = t[cur_name]
  File "/mnt/sickbeard/lib/tvdb_api/tvdb_api.py", line 877, in __getitem__
    sid = self._nameToSid(key)
  File "/mnt/sickbeard/lib/tvdb_api/tvdb_api.py", line 857, in _nameToSid
    selected_series = self._getSeries( name )
  File "/mnt/sickbeard/lib/tvdb_api/tvdb_api.py", line 643, in _getSeries
    allSeries = self.search(series)
  File "/mnt/sickbeard/lib/tvdb_api/tvdb_api.py", line 631, in search
    result['aliasnames'] = result['aliasnames'].split("|")
AttributeError: 'NoneType' object has no attribute 'split'
jwaterwo commented 4 years ago

alright, here is the result returned from tvdb: {'seriesid': '75805', 'lid': 7, 'language': 'en', 'zap2it_id': None, 'overview': 'Four egocentric friends who run a neighborhood Irish pub in Philadelphia try to find their way through the adult world of work and relationships. Unfortunately, their warped views and precarious judgments often lead them to trouble, creating a myriad of uncomfortable situations that usually only get worse before they get better.', 'aliasnames': None, 'imdb_id': None, 'seriesname': "It's Always Sunny in Philadelphia", 'firstaired': '2005-8-4', 'banner': '/banners/posters/75805-12.jpg', 'id': 75805}

The code currently only checks to see if aliasnames is returned, and if so, assumes its a string. Because this is returning a None, we are getting the traceback, and failing the postProcessing. This looks like it was probably a change on the tvdb side.

    630             if 'aliasnames' in result:
    631                 result['aliasnames'] = result['aliasnames'].split("|")

Can fix with something like:

    630             if 'aliasnames' in result:
    631                 if not type(result['aliasnames']) == None:
    632                     result['aliasnames'] = result['aliasnames'].split("|")

Let me try out in my environment.

junalmeida commented 4 years ago

That's what I was just writing to suggest you. Maybe it is simpler to use:

if result['aliasnames'] is not None:

If it works please open a pull request

jwaterwo commented 4 years ago

I used

    631             if 'aliasnames' in result and not result['aliasnames'] == None:

This seems to work, even if aliasnames is not in the result. I'll open a pull request. Thanks.