Closed dwardor closed 2 years ago
Thanks for your contribution. I am not certain however, what specific error in the code this fixes.
Does the variable item
not have a field ['imdbnumber']
if you use the scraper you mentioned? In that case I would prefer checking this before.
I think using try-except should be only used as a last resort or if the possible errors can not be estimated beforehand.
I can't speak for @dwardor, but for me the imdbnumber
field is populated by the tmdb
id. As such, there is no tt
prefix and none of the movies are recognized. I've edited the code locally to just remove the prefix and that works (for now).
Btw, all my movies have both imdb
and tmdb
uniqueid
s, but tmdb is the default, which is probably why the imdbnumber
field is populated by tmdb
in the jsonrpc
API. It's a bit strange behavior though.
I can't speak for @dwardor, but for me the
imdbnumber
field is populated by thetmdb
id. As such, there is nott
prefix and none of the movies are recognized. I've edited the code locally to just remove the prefix and that works (for now).Btw, all my movies have both
imdb
andtmdb
uniqueid
s, but tmdb is the default, which is probably why theimdbnumber
field is populated bytmdb
in thejsonrpc
API. It's a bit strange behavior though.
Yes I use The Movie Database Python
scrapper and my imdbnumber
field is filled with tmdb
id (because I chose tmdb as default rating source ??? I'm not really sure why...) that contains no tt
prefix.
I pulled the "try except" from what is done for tvshow ids (see excerp below) in what seemed to me the exact same "spirit"
try:
# check if series number is in imdb-format (scraper=imdb?)
res = re.compile(r'tt(\d+)').findall(item['imdbnumber'])
if not res:
# number in thetvdb-format
tvshowId_imdb = int(item['imdbnumber'])
else:
# number in imdb-format
tvshowId_imdb = int(res[0])
except BaseException:
utils.log(u'get_watched_xbmc: tv show "%s" has no imdb-number in database. tvshowid=%d. Try rescraping.' % (item['title'], tvshowId_xbmc), xbmc.LOGINFO)
if not silent:
utils.showNotification(utils.getString(32101), utils.getString(32297) % (item['title'], tvshowId_xbmc), xbmc.LOGINFO)
tvshowId_imdb = int(0)
I agree: The handling of different scrapers is not really consistent in the API. I would prefer having multiple unique ids for a movie in the watchedlist database (if this is no contradiction in itself). Before doing a major refactorisation little fixes like this have to do it. I will merge this into the official repo. As for try-except: Its hard to demand higher coding standards from others, than one is willing to provide oneself :-D
Make watchedlist addon compatible with "The Movie Database Python" scrapper which does not have the "tt" in its movie number format