Merge pull request #1258 from gunmantheh/dev

Added omdbapikey functionality
This commit is contained in:
Clinton Hall 2017-06-13 22:37:48 +09:30 committed by GitHub
commit 7e6ec214e6
3 changed files with 8 additions and 2 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 =
[Radarr] [Radarr]
#### autoProcessing for Movies #### autoProcessing for Movies

View file

@ -154,6 +154,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

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))
@ -1066,8 +1066,11 @@ def find_imdbid(dirName, inputName):
logger.debug("Opening URL: {0}".format(url)) logger.debug("Opening URL: {0}".format(url))
if not omdbApiKey:
return
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