summaryrefslogtreecommitdiffstats
path: root/module/plugins/internal
diff options
context:
space:
mode:
Diffstat (limited to 'module/plugins/internal')
-rw-r--r--module/plugins/internal/Addon.py2
-rw-r--r--module/plugins/internal/Base.py16
-rw-r--r--module/plugins/internal/OCR.py38
-rw-r--r--module/plugins/internal/Plugin.py4
-rw-r--r--module/plugins/internal/SevenZip.py4
-rw-r--r--module/plugins/internal/SimpleCrypter.py6
-rw-r--r--module/plugins/internal/SimpleHoster.py8
-rw-r--r--module/plugins/internal/UnRar.py6
-rw-r--r--module/plugins/internal/misc.py22
9 files changed, 53 insertions, 53 deletions
diff --git a/module/plugins/internal/Addon.py b/module/plugins/internal/Addon.py
index b171813d8..fcb9210ce 100644
--- a/module/plugins/internal/Addon.py
+++ b/module/plugins/internal/Addon.py
@@ -66,7 +66,7 @@ class Addon(Plugin):
#@TODO: Remove in 0.4.10
def _log(self, level, plugintype, pluginname, messages):
- plugintype = "addon" if plugintype is "hook" else plugintype
+ plugintype = "addon" if plugintype == "hook" else plugintype
return super(Addon, self)._log(level, plugintype, pluginname, messages)
diff --git a/module/plugins/internal/Base.py b/module/plugins/internal/Base.py
index 9c355d5de..104b67edc 100644
--- a/module/plugins/internal/Base.py
+++ b/module/plugins/internal/Base.py
@@ -27,7 +27,7 @@ def parse_fileInfo(klass, url="", html=""):
class Base(Plugin):
__name__ = "Base"
__type__ = "base"
- __version__ = "0.21"
+ __version__ = "0.22"
__status__ = "stable"
__pattern__ = r'^unmatchable$'
@@ -235,19 +235,19 @@ class Base(Plugin):
def check_status(self):
status = self.pyfile.status
- if status is 1:
+ if status == 1:
self.offline()
- elif status is 4:
+ elif status == 4:
self.skip(self.pyfile.statusname)
- elif status is 6:
+ elif status == 6:
self.temp_offline()
- elif status is 8:
+ elif status == 8:
self.fail()
- elif status is 9 or self.pyfile.abort:
+ elif status == 9 or self.pyfile.abort:
self.abort()
@@ -255,10 +255,10 @@ class Base(Plugin):
self.log_debug("Plugin version: " + self.__version__)
self.log_debug("Plugin status: " + self.__status__)
- if self.__status__ is "broken":
+ if self.__status__ == "broken":
self.abort(_("Plugin is temporarily unavailable"))
- elif self.__status__ is "testing":
+ elif self.__status__ == "testing":
self.log_warning(_("Plugin may be unstable"))
diff --git a/module/plugins/internal/OCR.py b/module/plugins/internal/OCR.py
index 217305459..274f14d8b 100644
--- a/module/plugins/internal/OCR.py
+++ b/module/plugins/internal/OCR.py
@@ -20,7 +20,7 @@ from module.plugins.internal.misc import encode, fsjoin
class OCR(Plugin):
__name__ = "OCR"
__type__ = "ocr"
- __version__ = "0.22"
+ __version__ = "0.25"
__status__ = "stable"
__description__ = """OCR base plugin"""
@@ -92,7 +92,7 @@ class OCR(Plugin):
self.log_debug("Saving tiff...")
self.img.save(tmpTif.name, 'TIFF')
- if os.name is "nt":
+ if os.name == "nt":
command = os.path.join(pypath, "tesseract", "tesseract.exe")
else:
command = "tesseract"
@@ -167,34 +167,34 @@ class OCR(Plugin):
for x in xrange(w):
for y in xrange(h):
- if pixels[x, y] is 255:
+ if pixels[x, y] == 255:
continue
#: No point in processing white pixels since we only want to remove black pixel
count = 0
try:
- if pixels[x - 1, y - 1] is not 255:
+ if pixels[x - 1, y - 1] != 255:
count += 1
- if pixels[x - 1, y] is not 255:
+ if pixels[x - 1, y] != 255:
count += 1
- if pixels[x - 1, y + 1] is not 255:
+ if pixels[x - 1, y + 1] != 255:
count += 1
- if pixels[x, y + 1] is not 255:
+ if pixels[x, y + 1] != 255:
count += 1
- if pixels[x + 1, y + 1] is not 255:
+ if pixels[x + 1, y + 1] != 255:
count += 1
- if pixels[x + 1, y] is not 255:
+ if pixels[x + 1, y] != 255:
count += 1
- if pixels[x + 1, y - 1] is not 255:
+ if pixels[x + 1, y - 1] != 255:
count += 1
- if pixels[x, y - 1] is not 255:
+ if pixels[x, y - 1] != 255:
count += 1
except Exception:
@@ -208,7 +208,7 @@ class OCR(Plugin):
#: Second pass: this time set all 1's to 255 (white)
for x in xrange(w):
for y in xrange(h):
- if pixels[x, y] is 1:
+ if pixels[x, y] == 1:
pixels[x, y] = 255
self.pixels = pixels
@@ -223,7 +223,7 @@ class OCR(Plugin):
for x in xrange(w):
for y in xrange(h):
- if pixels[x, y] is 0:
+ if pixels[x, y] == 0:
pixels[x, y] = 155
highest = {}
@@ -239,7 +239,7 @@ class OCR(Plugin):
for x in xrange(w):
for y in xrange(h):
- if pixels[x, y] is 0:
+ if pixels[x, y] == 0:
pixels[x, y] = 255
count = {}
@@ -247,14 +247,14 @@ class OCR(Plugin):
for x in xrange(w):
count[x] = 0
for y in xrange(h):
- if pixels[x, y] is 155:
+ if pixels[x, y] == 155:
count[x] += 1
sum = 0
cnt = 0
for x in count.values():
- if x is not 0:
+ if x != 0:
sum += x
cnt += 1
@@ -280,10 +280,10 @@ class OCR(Plugin):
for x in xrange(w):
for y in xrange(h):
- if pixels[x, y] is 0:
+ if pixels[x, y] == 0:
pixels[x, y] = 255
- if pixels[x, y] is 155:
+ if pixels[x, y] == 155:
pixels[x, y] = 0
self.pixels = pixels
@@ -300,7 +300,7 @@ class OCR(Plugin):
for x in xrange(width):
black_pixel_in_col = False
for y in xrange(height):
- if pixels[x, y] is not 255:
+ if pixels[x, y] != 255:
if not started:
started = True
firstX = x
diff --git a/module/plugins/internal/Plugin.py b/module/plugins/internal/Plugin.py
index f670a2324..cf03085f7 100644
--- a/module/plugins/internal/Plugin.py
+++ b/module/plugins/internal/Plugin.py
@@ -6,7 +6,7 @@ import inspect
import os
import re
-if os.name is not "nt":
+if os.name != "nt":
import grp
import pwd
@@ -150,7 +150,7 @@ class Plugin(object):
mode = int(permission, 8)
os.chmod(path, mode)
- if os.name is not "nt" and self.pyload.config.get("permission", "change_dl"):
+ if os.name != "nt" and self.pyload.config.get("permission", "change_dl"):
uid = pwd.getpwnam(self.pyload.config.get("permission", "user"))[2]
gid = grp.getgrnam(self.pyload.config.get("permission", "group"))[2]
os.chown(path, uid, gid)
diff --git a/module/plugins/internal/SevenZip.py b/module/plugins/internal/SevenZip.py
index a8306f393..2ae3c197c 100644
--- a/module/plugins/internal/SevenZip.py
+++ b/module/plugins/internal/SevenZip.py
@@ -11,7 +11,7 @@ from module.plugins.internal.misc import encode, fsjoin, renice
class SevenZip(UnRar):
__name__ = "SevenZip"
__type__ = "extractor"
- __version__ = "0.19"
+ __version__ = "0.20"
__status__ = "testing"
__description__ = """7-Zip extractor plugin"""
@@ -37,7 +37,7 @@ class SevenZip(UnRar):
@classmethod
def find(cls):
try:
- if os.name is "nt":
+ if os.name == "nt":
cls.CMD = os.path.join(pypath, "7z.exe")
p = subprocess.Popen([cls.CMD], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
diff --git a/module/plugins/internal/SimpleCrypter.py b/module/plugins/internal/SimpleCrypter.py
index d8bb7ad3c..0cd343426 100644
--- a/module/plugins/internal/SimpleCrypter.py
+++ b/module/plugins/internal/SimpleCrypter.py
@@ -11,7 +11,7 @@ from module.plugins.internal.misc import parse_name, replace_patterns
class SimpleCrypter(Crypter):
__name__ = "SimpleCrypter"
__type__ = "crypter"
- __version__ = "0.82"
+ __version__ = "0.83"
__status__ = "testing"
__pattern__ = r'^unmatchable$'
@@ -90,12 +90,12 @@ class SimpleCrypter(Crypter):
info.update(cls.api_info(url))
- if not html and info['status'] is not 2:
+ if not html and info['status'] != 2:
if not url:
info['error'] = "missing url"
info['status'] = 1
- elif info['status'] is 3:
+ elif info['status'] == 3:
try:
html = get_url(url, cookies=cls.COOKIES, decode=cls.TEXT_ENCODING)
diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py
index a00b6e3fb..98f040bad 100644
--- a/module/plugins/internal/SimpleHoster.py
+++ b/module/plugins/internal/SimpleHoster.py
@@ -16,7 +16,7 @@ from module.plugins.internal.misc import (encode, parse_name, parse_size,
class SimpleHoster(Hoster):
__name__ = "SimpleHoster"
__type__ = "hoster"
- __version__ = "2.17"
+ __version__ = "2.18"
__status__ = "stable"
__pattern__ = r'^unmatchable$'
@@ -137,12 +137,12 @@ class SimpleHoster(Hoster):
info = super(SimpleHoster, cls).get_info(url)
info.update(cls.api_info(url))
- if not html and info['status'] is not 2:
+ if not html and info['status'] != 2:
if not url:
info['error'] = "missing url"
info['status'] = 1
- elif info['status'] is 3:
+ elif info['status'] == 3:
try:
html = get_url(url, cookies=cls.COOKIES, decode=cls.TEXT_ENCODING)
@@ -269,7 +269,7 @@ class SimpleHoster(Hoster):
self.preload()
self.check_errors()
- if self.info.get('status', 3) is not 2:
+ if self.info.get('status', 3) != 2:
self.grab_info()
self.check_status()
self.check_duplicates()
diff --git a/module/plugins/internal/UnRar.py b/module/plugins/internal/UnRar.py
index b9c91bce8..d1f180546 100644
--- a/module/plugins/internal/UnRar.py
+++ b/module/plugins/internal/UnRar.py
@@ -12,7 +12,7 @@ from module.plugins.internal.misc import decode, encode, fsjoin, renice
class UnRar(Extractor):
__name__ = "UnRar"
__type__ = "extractor"
- __version__ = "1.30"
+ __version__ = "1.31"
__status__ = "testing"
__description__ = """RAR extractor plugin"""
@@ -37,7 +37,7 @@ class UnRar(Extractor):
@classmethod
def find(cls):
try:
- if os.name is "nt":
+ if os.name == "nt":
cls.CMD = os.path.join(pypath, "RAR.exe")
else:
cls.CMD = "rar"
@@ -49,7 +49,7 @@ class UnRar(Extractor):
except OSError:
try:
- if os.name is "nt":
+ if os.name == "nt":
cls.CMD = os.path.join(pypath, "UnRAR.exe")
else:
cls.CMD = "unrar"
diff --git a/module/plugins/internal/misc.py b/module/plugins/internal/misc.py
index 200e030c1..b5b25260a 100644
--- a/module/plugins/internal/misc.py
+++ b/module/plugins/internal/misc.py
@@ -33,7 +33,7 @@ except ImportError:
class misc(object):
__name__ = "misc"
__type__ = "plugin"
- __version__ = "0.17"
+ __version__ = "0.18"
__status__ = "stable"
__pattern__ = r'^unmatchable$'
@@ -264,7 +264,7 @@ def compare_time(start, end):
def free_space(folder):
- if os.name is "nt":
+ if os.name == "nt":
import ctypes
free_bytes = ctypes.c_ulonglong(0)
@@ -285,7 +285,7 @@ def fsbsize(path):
"""
path = encode(path)
- if os.name is "nt":
+ if os.name == "nt":
import ctypes
drive = "%s\\" % os.path.splitdrive(path)[0]
@@ -337,8 +337,8 @@ def isiterable(obj):
def get_console_encoding(enc):
- if os.name is "nt":
- if enc is "cp65001": #: aka UTF-8
+ if os.name == "nt":
+ if enc == "cp65001": #: aka UTF-8
enc = "cp850"
# print "WARNING: Windows codepage 65001 (UTF-8) is not supported, used `%s` instead" % enc
else:
@@ -392,7 +392,7 @@ def exists(path):
path = encode(path)
if os.path.exists(path):
- if os.name is "nt":
+ if os.name == "nt":
dir, name = os.path.split(path.rstrip(os.sep))
return name in os.listdir(dir)
else:
@@ -476,7 +476,7 @@ def safepath(value):
path = os.path.abspath(drive + filename)
try:
- if os.name is not "nt":
+ if os.name != "nt":
return
length = len(path) - 259
@@ -502,7 +502,7 @@ def safename(value):
"""
Remove invalid characters
"""
- repl = '<>:"/\\|?*' if os.name is "nt" else '\0/\\"'
+ repl = '<>:"/\\|?*' if os.name == "nt" else '\0/\\"'
name = remove_chars(value, repl)
return name
@@ -527,7 +527,7 @@ def parse_size(value, unit=""): #: returns bytes
size = float(m.group(1).replace(',', '.'))
unit = (unit.strip().lower() or m.group(2) or "byte")[0]
- if unit is "b":
+ if unit == "b":
return int(size)
sizeunits = ['b', 'k', 'm', 'g', 't', 'p', 'e']
@@ -693,7 +693,7 @@ def set_cookies(cj, cookies):
if not isinstance(cookie, tuple):
continue
- if len(cookie) is not 3:
+ if len(cookie) != 3:
continue
set_cookie(cj, *cookie)
@@ -768,7 +768,7 @@ def chunks(iterable, size):
def renice(pid, value):
- if not value or os.name is "nt":
+ if not value or os.name == "nt":
return
try: