Closed Animosity022 closed 6 years ago
So i havent implemented a way to edit TheTVDB ID via the gui yet.
run these commands for me:
cd /data/AutoMarkWatched
python3 manage.py shell
(now you should be in interpreter)
from amw.models import TVShow
show = TVShow.objects.filter(title__contains='Ash vs Evil Dead')[0]
print( show.title, show.tvdbid)
Give me the output of that print. I am thinking it doesnt have a tvdbid
Hmm. It does seem to have an id:
>>> from amw.models import TVShow
>>> show = TVShow.objects.filter(title__contains='Ash vs Evil Dead')[0]
>>> print( show.title, show.tvdbid)
Ash vs Evil Dead 296295
Seems to be that show too:
Variable | Value
-- | --
dbshowstatus | False
self | <amw.utilities.thetvdb.TheTVDB object at 0x7fdfac7091d0>
show | <TVShow: TVShow object (32)>
showinfo | {'added': '2015-05-29 11:52:35', 'addedBy': 235, 'airsDayOfWeek': 'Sunday', 'airsTime': '9:00 PM', 'aliases': ['Ash vs. Evil Dead'], 'banner': 'graphical/296295-g3.jpg', 'firstAired': '2015-10-31', 'genre': ['Comedy', 'Horror', 'Thriller'], 'id': 296295, 'imdbId': 'tt4189022', 'lastUpdated': 1522861850, 'network': 'Starz!', 'networkId': '', 'overview': 'Ash is baaack! 30 years after his last Deadite fight, badass ' 'monster fighter Ash Williams unleashes the Evil in an act of ' 'stupidity, bringing Deadite mayhem into his life again.', 'rating': 'TV-MA', 'runtime': '30', 'seriesId': '194702', 'seriesName': 'Ash vs Evil Dead', 'siteRating': 8.7, 'siteRatingCount': 55, 'status': '', 'zap2itId': 'EP02252539'}
statuses | {'Continuing': True, 'Ended': False}
tvdbshowstatus | ''
yep. That show literally doesnt have a status on TheTVDB. Oddly enough. Ill add a statement to account for it.
ok. Pull and try again
Ok. Got a little further in my list. Now this isn't a bad show.
Same error?
That is showing that the data key doesnt exist for that request. Looks like it might have failed. I cant reproduce it with that show:
g = requests.get('{}//series/{}'.format(apiurl, '74543'), headers=headers)
showinfo = g.json()['data']
{'overview': "Vincent Chase is a young actor whose career is on the rise. Joining him on his journey to stardom are his childhood buddies Eric, Turtle, his brother Johnny Drama and his hot-tempered agent Ari Gold. Together, they'll navigate the highs and lows of Hollywood's fast lane, where the stakes are higher -- and the money and temptations greater -- than ever before. ", 'firstAired': '2004-07-18', 'addedBy': None, 'zap2itId': 'EP00665420', 'added': '', 'siteRatingCount': 197, 'network': 'HBO', 'siteRating': 8.8, 'airsTime': '10:30 PM', 'seriesId': '27346', 'runtime': '30', 'id': 74543, 'status': 'Ended', 'rating': 'TV-MA', 'aliases': [], 'genre': ['Comedy', 'Drama'], 'seriesName': 'Entourage', 'banner': 'graphical/74543-g2.jpg', 'airsDayOfWeek': 'Sunday', 'networkId': '', 'lastUpdated': 1508850357, 'imdbId': 'tt0387199'}
if you run it again does it fail the same way?
Yep. Same spot if I rerun it.
try it from the interpreter and give me all the output from this:
python3
import requests
amwapikey = {'apikey': '0E4FB4A79D7C3D09'}
apiurl = 'https://api.thetvdb.com'
token = requests.post('{}/login'.format(apiurl), json=amwapikey).json()['token']
headers = {'Authorization': 'Bearer {}'.format(token)}
g = requests.get('{}//series/{}'.format(apiurl, '74543'), headers=headers)
print(g)
print(g.response_code)
print(g.json())
I get:
[root@gemini log]# python3
Python 3.6.4 (default, Mar 13 2018, 18:18:20)
[GCC 7.3.1 20180303 (Red Hat 7.3.1-5)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import requests
>>> amwapikey = {'apikey': '0E4FB4A79D7C3D09'}
>>> apiurl = 'https://api.thetvdb.com'
>>> token = requests.post('{}/login'.format(apiurl), json=amwapikey).json()['token']
>>> headers = {'Authorization': 'Bearer {}'.format(token)}
>>> g = requests.get('{}//series/{}'.format(apiurl, '74543'), headers=headers)
>>> print(g)
<Response [200]>
>>> print(g.response_code)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'Response' object has no attribute 'response_code'
>>> print(g.json())
{'data': {'id': 74543, 'seriesName': 'Entourage', 'aliases': [], 'banner': 'graphical/74543-g2.jpg', 'seriesId': '27346', 'status': 'Ended', 'firstAired': '2004-07-18', 'network': 'HBO', 'networkId': '', 'runtime': '30', 'genre': ['Comedy', 'Drama'], 'overview': "Vincent Chase is a young actor whose career is on the rise. Joining him on his journey to stardom are his childhood buddies Eric, Turtle, his brother Johnny Drama and his hot-tempered agent Ari Gold. Together, they'll navigate the highs and lows of Hollywood's fast lane, where the stakes are higher -- and the money and temptations greater -- than ever before. ", 'lastUpdated': 1508850357, 'airsDayOfWeek': 'Sunday', 'airsTime': '10:30 PM', 'rating': 'TV-MA', 'imdbId': 'tt0387199', 'zap2itId': 'EP00665420', 'added': '', 'addedBy': None, 'siteRating': 8.8, 'siteRatingCount': 197}}
>>>
that show doesnt seem to have a problem... the key is there. Whats the next show on the list?
or is there more after what you pasted in the traceback?
Next show is Episodes.
That's really all of it:
Environment:
Request Method: POST
Request URL: http://192.168.1.30:8001/settings/synctvdb/
Django Version: 2.0.4
Python Version: 3.6.4
Installed Applications:
['amw.apps.AmwConfig',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware']
Traceback:
File "/usr/local/lib/python3.6/site-packages/django/core/handlers/exception.py" in inner
35. response = get_response(request)
File "/usr/local/lib/python3.6/site-packages/django/core/handlers/base.py" in _get_response
128. response = self.process_exception_by_middleware(e, request)
File "/usr/local/lib/python3.6/site-packages/django/core/handlers/base.py" in _get_response
126. response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/data/AutoMarkWatched/amw/views.py" in syncTVDB
80. server.syncShows()
File "/data/AutoMarkWatched/amw/utilities/thetvdb.py" in syncShows
26. showinfo = self.getShowInfo(show)
File "/data/AutoMarkWatched/amw/utilities/thetvdb.py" in getShowInfo
17. showinfo = g.json()['data']
Exception Type: KeyError at /settings/synctvdb/
Exception Value: 'data'
See how on 37 it says response 404? there is no data key for the NEXT show because the ID is not found. Pull for me. I added a check to make sure it gets a valid 200 response.
Im about half way done with writing a detail view per show so you can see the info of all shows.
Next show looks good:
>>> from amw.models import TVShow
>>> show = TVShow.objects.filter(title__contains='Episodes')[0]
>>> print( show.title, show.tvdbid)
Episodes 31841
with the new pull did it pass that up or is it still stuck
Perfect!
Getting closer as I get my plex list populated and I can see everything.
i tried to a sync of my lists to for the continuing status and I believe the show that's causing the error is Ash vs Evil Dead
I did mark some shows via bulk edit and the update to plex worked as expected.