diff --git a/couchpotato/core/helpers/variable.py b/couchpotato/core/helpers/variable.py index 9406a207..537b3563 100644 --- a/couchpotato/core/helpers/variable.py +++ b/couchpotato/core/helpers/variable.py @@ -106,6 +106,11 @@ def md5(text): def sha1(text): return hashlib.sha1(text).hexdigest() +def isLocalIP(ip): + ip = ip.lstrip('htps:/') + regex = '/(^127\.)|(^192\.168\.)|(^10\.)|(^172\.1[6-9]\.)|(^172\.2[0-9]\.)|(^172\.3[0-1]\.)|(^::1)$/' + return re.search(regex, ip) is not None or 'localhost' in ip or ip[:4] == '127.' + def getExt(filename): return os.path.splitext(filename)[1][1:]