diff --git a/mylar/helpers.py b/mylar/helpers.py index d2fe4ec1..eebbd8c0 100755 --- a/mylar/helpers.py +++ b/mylar/helpers.py @@ -291,9 +291,8 @@ def rename_param(comicid, comicname, issue, ofilename, comicyear=None, issueid=N #this has to be adjusted to be able to include story arc issues that span multiple arcs chkissue = myDB.selectone("SELECT * from readinglist WHERE ComicID=? AND Issue_Number=?", [comicid, issue]).fetchone() else: - if all([annualize is None, not mylar.CONFIG.ANNUALS_ON]): - chkissue = myDB.selectone("SELECT * from issues WHERE ComicID=? AND Issue_Number=?", [comicid, issue]).fetchone() - else: + chkissue = myDB.selectone("SELECT * from issues WHERE ComicID=? AND Issue_Number=?", [comicid, issue]).fetchone() + if all([chkissue is None, annualize is None, not mylar.CONFIG.ANNUALS_ON]): chkissue = myDB.selectone("SELECT * from annuals WHERE ComicID=? AND Issue_Number=?", [comicid, issue]).fetchone() if chkissue is None: @@ -302,7 +301,7 @@ def rename_param(comicid, comicname, issue, ofilename, comicyear=None, issueid=N chkissue = myDB.selectone("SELECT * from readinglist WHERE ComicID=? AND Int_IssueNumber=?", [comicid, issuedigits(issue)]).fetchone() else: chkissue = myDB.selectone("SELECT * from issues WHERE ComicID=? AND Int_IssueNumber=?", [comicid, issuedigits(issue)]).fetchone() - if all([annualize == 'yes', mylar.CONFIG.ANNUALS_ON]): + if all([chkissue is None, annualize == 'yes', mylar.CONFIG.ANNUALS_ON]): chkissue = myDB.selectone("SELECT * from annuals WHERE ComicID=? AND Int_IssueNumber=?", [comicid, issuedigits(issue)]).fetchone() if chkissue is None: diff --git a/mylar/mb.py b/mylar/mb.py index 9d44b610..fdaa1ac9 100755 --- a/mylar/mb.py +++ b/mylar/mb.py @@ -87,15 +87,16 @@ def findComic(name, mode, issue, limityear=None, type=None): commons = ['and', 'the', '&', '-'] for x in commons: - if x in name.lower(): - for m in re.finditer(x, name.lower()): - tehstart = m.start() - tehend = m.end() - if any([x == 'the', x == 'and']): - if not all([tehstart == 0, name[tehend] == ' ']) or not all([tehstart != 0, name[tehstart-1] == ' ', name[tehend] == ' ']): - continue - else: - name = name[tehstart:tehend].replace(x, ' ').strip() + name[tehend+1:] + cnt = 0 + for m in re.finditer(x, name.lower()): + cnt +=1 + tehstart = m.start() + tehend = m.end() + if any([x == 'the', x == 'and']): + if not all([tehstart == 0, name[tehend] == ' ']) or not all([tehstart != 0, name[tehstart-1] == ' ', name[tehend] == ' ']): + continue + else: + name = name.replace(x, ' ', cnt) pattern = re.compile(ur'\w+', re.UNICODE) name = pattern.findall(name)