X-Git-Url: http://dolda2000.com/gitweb/?a=blobdiff_plain;f=manga%2Flocal.py;h=7e21a9b54b8a845aba7697961d4d510250f56e9e;hb=3cc7937cd91ec6d3cfb7eebcd4c1afd85c5a615a;hp=fe699a44f2c1bccdc7d65e1bcdaa4c814e96a9c5;hpb=fab0538835546d145a61ffe2771bcb0a23f89a50;p=automanga.git diff --git a/manga/local.py b/manga/local.py index fe699a4..7e21a9b 100644 --- a/manga/local.py +++ b/manga/local.py @@ -1,5 +1,5 @@ import os -import lib +from . import lib pj = os.path.join def decode1(nm): @@ -95,9 +95,9 @@ class manga(lib.manga): self.stack = [] if os.path.exists(pj(self.path, "name")): with open(pj(self.path, "name")) as s: - self.name = s.readline().strip().decode("utf-8") + self.name = s.readline().strip() else: - self.name = os.path.basename(path).decode("utf-8") + self.name = os.path.basename(path) self.direct = self.destruct() def __len__(self): @@ -185,8 +185,13 @@ class directory(dumb): ret.append(manga(pj(self.path, dent))) return ret + def search(self, expr): + expr = expr.lower() + return [manga(pj(self.path, dent)) for dent in os.listdir(self.path) if expr in dent.lower()] + def __iter__(self): for dent in os.listdir(self.path): yield manga(pj(self.path, dent)) + library = dumb