From 2870dfc0d8d61ae9f8ac021ccb609c3c29a46656 Mon Sep 17 00:00:00 2001 From: Paul Bramhall Date: Mon, 3 Feb 2020 11:17:05 +0000 Subject: [PATCH] Use 7 letter IMDB ID's unless title has an 8 char long IMDB ID. IMDB still returns 7-char ID's on older titles when searching, simply blanketin to 8 chars all the time (even if IMDB support 8-char padded ID's) will ultimately fail lookups on other services. This allows us to default to a 7-char ID, padded with zero's to ensure that it still works as expected, but ultimately allow newer 8-char ID's as-and-when required for neweer titles. --- couchpotato/core/helpers/variable.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/couchpotato/core/helpers/variable.py b/couchpotato/core/helpers/variable.py index 0db7248..07a240a 100755 --- a/couchpotato/core/helpers/variable.py +++ b/couchpotato/core/helpers/variable.py @@ -197,9 +197,9 @@ def getImdb(txt, check_inside = False, multiple = False): ids = re.findall('(tt\d{4,8})', txt) if multiple: - return removeDuplicate(['tt%08d' % tryInt(x[2:]) for x in ids]) if len(ids) > 0 else [] + return removeDuplicate(['tt%s' % str(tryInt(x[2:])).rjust(7, '0') for x in ids]) if len(ids) > 0 else [] - return 'tt%08d' % tryInt(ids[0][2:]) + return 'tt%s' % str(tryInt(ids[0][2:])).rjust(7, '0') except IndexError: pass