From d438584ab04a12b7051f0ce1bacaf78d79b9b1ac Mon Sep 17 00:00:00 2001 From: evilhero Date: Sun, 3 Dec 2017 12:47:40 -0500 Subject: [PATCH] FIX: Improved pack support - will now properly determine issue numbering sequence across packs that contain both a range and individual issues (ie. '1-4, 0') --- mylar/helpers.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/mylar/helpers.py b/mylar/helpers.py index cebb7c58..d2fe4ec1 100755 --- a/mylar/helpers.py +++ b/mylar/helpers.py @@ -2363,7 +2363,23 @@ def issue_find_ids(ComicName, ComicID, pack, IssueNumber): issuelist = myDB.select("SELECT * FROM issues WHERE ComicID=?", [ComicID]) if 'Annual' not in pack: - pack_issues = range(int(pack[:pack.find('-')]),int(pack[pack.find('-')+1:])+1) + packlist = [x.strip() for x in pack.split(',')] + plist = [] + pack_issues = [] + for pl in packlist: + if '-' in pl: + plist.append(range(int(pl[:pl.find('-')]),int(pl[pl.find('-')+1:])+1)) + else: + plist.append(int(pl)) + + for pi in plist: + if type(pi) == list: + for x in pi: + pack_issues.append(x) + else: + pack_issues.append(pi) + + pack_issues.sort() annualize = False else: #remove the annuals wording