CmdrShepard / Skyhook

Wrapper for the Sonarr Skyhook (TVDB API Wrapper)
GNU Lesser General Public License v3.0
7 stars 5 forks source link

AttributeError: 'NoneType' object has no attribute 'split' #5

Open solbu opened 4 years ago

solbu commented 4 years ago

Hi Shepard. We seem to be close to implementing this, but have an error we can't figure out how to resolve. This is the log from testing a search using the test link in the readme.

Maybe Rodney can fix it? ;-)

(venv) root@skyhook:/opt/skyhook/src# uwsgi --ini skyhook.ini                                                                                                                                             
[uWSGI] getting INI configuration from skyhook.ini
*** Starting uWSGI 2.0.19 (64bit) on [Mon Jun 15 13:36:58 2020] ***
compiled with version: 9.3.0 on 14 June 2020 23:44:41
os: Linux-5.4.0-37-generic #41-Ubuntu SMP Wed Jun 3 18:57:02 UTC 2020
nodename: skyhook
machine: x86_64
clock source: unix
detected number of CPU cores: 1
current working directory: /opt/skyhook/src
detected binary path: /opt/skyhook/venv/bin/uwsgi
!!! no internal routing support, rebuild with pcre support !!!
setgid() to 33
setuid() to 33
your processes number limit is 15212
your memory page size is 4096 bytes
detected max file descriptor number: 1024
lock engine: pthread robust mutexes
thunder lock: disabled (you can enable it with --thunder-lock)
uwsgi socket 0 bound to UNIX address /tmp/skyhook.sock fd 3
Python version: 3.8.2 (default, Apr 27 2020, 15:53:34)  [GCC 9.3.0]
*** Python threads support is disabled. You can enable it with --enable-threads ***
Python main interpreter initialized at 0x56282f9fb7c0
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
mapped 145808 bytes (142 KB) for 1 cores
*** Operational MODE: single process ***
Starting Sonarr Skyhook v1.0.0
WSGI app 0 (mountpoint='') ready in 0 seconds on interpreter 0x56282f9fb7c0 pid: 33788 (default app)
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI master process (pid: 33788)
spawned uWSGI worker 1 (pid: 33791, cores: 1)

2020-06-15 13:37:37,266 [skyhook.views] [INFO] norske rednecks
2020-06-15 13:37:37,267 [skyhook.views] [DEBUG] Searching for norske rednecks
2020-06-15 13:37:37,279 [skyhook.cache] [DEBUG] Did not find any Sonarr cached search results for "norske rednecks" and language "en"                                                                     
2020-06-15 13:37:37,279 [skyhook.tvdb] [DEBUG] Searching TVDB for NAME="norske rednecks" and language "no"                                                                                                
Traceback (most recent call last):
  File "/opt/skyhook/venv/lib/python3.8/site-packages/flask/app.py", line 1836, in __call__
    return self.wsgi_app(environ, start_response)
  File "/opt/skyhook/venv/lib/python3.8/site-packages/flask/app.py", line 1820, in wsgi_app
    response = self.make_response(self.handle_exception(e))
  File "/opt/skyhook/venv/lib/python3.8/site-packages/flask/app.py", line 1403, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/opt/skyhook/venv/lib/python3.8/site-packages/flask/_compat.py", line 33, in reraise
    raise value
  File "/opt/skyhook/venv/lib/python3.8/site-packages/flask/app.py", line 1817, in wsgi_app
    response = self.full_dispatch_request()
  File "/opt/skyhook/venv/lib/python3.8/site-packages/flask/app.py", line 1477, in full_dispatch_request                                                                                                  
    rv = self.handle_user_exception(e)
  File "/opt/skyhook/venv/lib/python3.8/site-packages/flask/app.py", line 1381, in handle_user_exception                                                                                                  
    reraise(exc_type, exc_value, tb)
  File "/opt/skyhook/venv/lib/python3.8/site-packages/flask/_compat.py", line 33, in reraise
    raise value
  File "/opt/skyhook/venv/lib/python3.8/site-packages/flask/app.py", line 1475, in full_dispatch_request                                                                                                  
    rv = self.dispatch_request()
  File "/opt/skyhook/venv/lib/python3.8/site-packages/flask/app.py", line 1461, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "./skyhook/views.py", line 61, in search
    sonarr_results = handle_results(search_string, language)
  File "./skyhook/views.py", line 28, in handle_results
    results = tvdb.search(search_string, language)
  File "./skyhook/tvdb.py", line 137, in search
    results = self.tvdb.search(string)
  File "/opt/skyhook/venv/lib/python3.8/site-packages/tvdb_api.py", line 706, in search
    result['aliasnames'] = result['aliasnames'].split("|")
AttributeError: 'NoneType' object has no attribute 'split'
[pid: 33791|app: 0|req: 1/1] 10.0.0.4 () {40 vars in 980 bytes} [Mon Jun 15 13:37:37 2020] GET /v1/tvdb/search/en/?term=norske%20rednecks => generated 0 bytes in 64 msecs (HTTP/1.1 500) 0 headers in 0 bytes (0 switches on core 0)
solbu commented 4 years ago

In case it matters, here is the installed python packages in the venv folder:

ls -1d venv/lib/python3.8/site-packages/*info|sed 's_venv/lib/python3.8/site-packages/__'|sed 's_.dist-info__'
attrs-19.3.0
callable-0.1.2
callable_pip-1.0.0
certifi-2020.4.5.2
chardet-3.0.4
click-7.1.2
client_for_tvdb-2020.5.24
deserialize-1.7.0
Flask-0.10.1
Flask_Ext-0.1
flask_shell-0.1.3
Flask_SQLAlchemy-2.1
idna-2.8
itsdangerous-1.1.0
Jinja2-2.11.2
libtvdb-0.7.0
lxml-4.5.1
MarkupSafe-1.1.1
pip-20.1.1
psycopg2-2.8.5
python_dateutil-2.5.3
python_dotenv-0.13.0
pytvmaze-1.5.1
pytz-2016.4
requests-2.22.0
requests_cache-0.5.2
requests_wsgi_adapter-0.4.1
sanction-0.4.1
setuptools-47.1.1
six-1.15.0
slackweb-1.0.5
SQLAlchemy-1.3.17
tvdb-0.22
tvdbAPI-0.2.3
tvdb_api-1.10
tvdb_api_client-0.4.0
tvdb_client-0.1.2
tvdb_rest-0.1
urllib3-1.25.9
uWSGI-2.0.19
Werkzeug-1.0.1
wheel-0.34.2
wsgi_content_modifier-1.0
CmdrShepard commented 4 years ago

Could be that TVDB updated their API, I haven't tested it lately. I recommend upgrading the tvdb_api package, 3.0.2 is the latest, but might be worth testing the other versions if that one doesn't work, see here: https://pypi.org/project/tvdb-api/#history

CmdrShepard commented 4 years ago

Yeah, you're out of luck.

I just did a quick check. TVDB updated their API and website, so this project would require a rewrite to make use of the new TVDB API. I have taken a break for a while, so I haven't had a need for this.

This feature seems to be still missing in Sonarr (?): https://github.com/Sonarr/Sonarr/issues/269