Fixed a bug where makeCollections would fail based on certain permutations of file naming

This commit is contained in:
Raelon Masters
2020-07-18 02:22:08 -04:00
parent b733eb9122
commit 37fb8fcf58

View File

@@ -114,7 +114,6 @@ class Storage:
return True return True
def make_collections(self): def make_collections(self):
breakpoint()
_title_regx = re.compile(r"^[0-9][0-9]*|-|\ \B") _title_regx = re.compile(r"^[0-9][0-9]*|-|\ \B")
_q = "SELECT id,file_name FROM books" _q = "SELECT id,file_name FROM books"
self.cursor.execute(_q) self.cursor.execute(_q)
@@ -123,8 +122,11 @@ class Storage:
path = self.config.book_path + "/" path = self.config.book_path + "/"
_collections = [] _collections = []
_pathing = book[1].split(path)[1].split("/") _pathing = book[1].split(path)[1].split("/")
_pathing.pop(0) try:
_pathing.pop(-1) _pathing.pop(0)
_pathing.pop(-1)
except IndexError:
continue
for _p in _pathing: for _p in _pathing:
_s = _p.replace("'", "") _s = _p.replace("'", "")
_x = re.sub(_title_regx, "", _s) _x = re.sub(_title_regx, "", _s)