Added omdbapikey functionality

This commit is contained in:
gunmantheh 2017-05-30 21:50:57 +02:00
commit 3766fa3b84
3 changed files with 7 additions and 3 deletions

View file

@ -68,6 +68,8 @@
watch_dir = watch_dir =
##### Set the recursive directory permissions to the following (0 to disable) ##### Set the recursive directory permissions to the following (0 to disable)
chmodDirectory = 0 chmodDirectory = 0
# api key for www.omdbapi.com (used as alternative to imdb)
omdbapikey =
[SickBeard] [SickBeard]
#### autoProcessing for TV Series #### autoProcessing for TV Series

View file

@ -117,6 +117,7 @@ class autoProcessMovie(object):
web_root = cfg.get("web_root", "") web_root = cfg.get("web_root", "")
remote_path = int(cfg.get("remote_path", 0)) remote_path = int(cfg.get("remote_path", 0))
protocol = "https://" if ssl else "http://" protocol = "https://" if ssl else "http://"
omdbapikey = cfg.get("omdbapikey", "")
status = int(status) status = int(status)
if status > 0 and core.NOEXTRACTFAILED: if status > 0 and core.NOEXTRACTFAILED:
extract = 0 extract = 0
@ -128,7 +129,7 @@ class autoProcessMovie(object):
logger.error("Server did not respond. Exiting", section) logger.error("Server did not respond. Exiting", section)
return [1, "{0}: Failed to post-process - {1} did not respond.".format(section, section)] return [1, "{0}: Failed to post-process - {1} did not respond.".format(section, section)]
imdbid = find_imdbid(dirName, inputName) imdbid = find_imdbid(dirName, inputName, omdbapikey)
release = self.get_release(baseURL, imdbid, download_id) release = self.get_release(baseURL, imdbid, download_id)
# pull info from release found if available # pull info from release found if available

View file

@ -1018,7 +1018,7 @@ def listMediaFiles(path, minSize=0, delete_ignored=0, media=True, audio=True, me
return sorted(files, key=len) return sorted(files, key=len)
def find_imdbid(dirName, inputName): def find_imdbid(dirName, inputName, omdbApiKey):
imdbid = None imdbid = None
logger.info('Attemping imdbID lookup for {0}'.format(inputName)) logger.info('Attemping imdbID lookup for {0}'.format(inputName))
@ -1064,7 +1064,8 @@ def find_imdbid(dirName, inputName):
logger.debug("Opening URL: {0}".format(url)) logger.debug("Opening URL: {0}".format(url))
try: try:
r = requests.get(url, params={'y': year, 't': title}, verify=False, timeout=(60, 300)) r = requests.get(url, params={'apikey': omdbApiKey, 'y': year, 't': title},
verify=False, timeout=(60, 300))
except requests.ConnectionError: except requests.ConnectionError:
logger.error("Unable to open URL {0}".format(url)) logger.error("Unable to open URL {0}".format(url))
return return