X-Git-Url: http://dolda2000.com/gitweb/?a=blobdiff_plain;f=manga%2Flocal.py;h=2d79b20bd0fa05e331f8c43c57e574632eeb2484;hb=ffd12e718bf1915abde0455fdf05a34d0632ed4d;hp=3051013f971a43ce50166d107b9b340d5be0c8d2;hpb=afd66b913158fdca95d1a30a0518808afb437374;p=automanga.git diff --git a/manga/local.py b/manga/local.py index 3051013..2d79b20 100644 --- a/manga/local.py +++ b/manga/local.py @@ -128,6 +128,8 @@ class manga(lib.manga): ordered, files = self.imglist() pages, orig = self.bakenames(files) mx = maxstruct(pages) + if mx is None: + raise TypeError("could not figure out any structure") var = [i for i, part in enumerate(mx) if part == int] structs = [(nm, decode1(nm)) for nm in pages] if not ordered: @@ -183,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