From 5c11ebea8cbdb69f6d9026d7ecbe02b0997ed869 Mon Sep 17 00:00:00 2001 From: Fredrik Tolf Date: Thu, 31 Dec 2015 03:08:29 +0100 Subject: [PATCH] Group Batoto chapters into groups. --- manga/batoto.py | 49 +++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 39 insertions(+), 10 deletions(-) diff --git a/manga/batoto.py b/manga/batoto.py index a7a2108..b626dc1 100644 --- a/manga/batoto.py +++ b/manga/batoto.py @@ -67,13 +67,14 @@ class page(lib.page): return self.name def __repr(self): - return "" % (self.chapter.manga.name, self.chapter.name, self.name) + return "" % (self.chapter.manga.name, self.chapter.group.name, self.chapter.name, self.name) class chapter(lib.pagelist): - def __init__(self, manga, stack, id, name, readerid): + def __init__(self, group, stack, id, name, readerid): self.stack = stack - self.manga = manga - self.lib = manga.lib + self.group = group + self.manga = group.manga + self.lib = self.manga.lib self.id = id self.name = name self.readerid = readerid @@ -100,7 +101,27 @@ class chapter(lib.pagelist): return self.name def __repr__(self): - return "" % (self.manga.name, self.name) + return "" % (self.manga.name, self.group.name, self.name) + +class group(lib.pagelist): + def __init__(self, manga, stack, id, name): + self.stack = stack + self.manga = manga + self.id = id + self.name = name + self.ch = [] + + def __getitem__(self, i): + return self.ch[i] + + def __len__(self): + return len(self.ch) + + def __str__(self): + return self.name + + def __repr__(self): + return "