Skip to content

Commit

Permalink
missing files
Browse files Browse the repository at this point in the history
  • Loading branch information
mtill committed Sep 2, 2018
1 parent a40b52b commit 54b356c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 15 deletions.
2 changes: 1 addition & 1 deletion hbciMail/config_mail.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
regex(contentregex='^.*$'),
HBCIParser()
],
'postRun': [SaveTitlesParser(thepath=workingDirectory, filenamebase='banking')]
'postRun': [SaveTitlesParser(sqlitefile=os.path.join(workingDirectory, 'konto.sqlite'), account='banking')]
}

]
Expand Down
31 changes: 17 additions & 14 deletions hbciMail/config_mail_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,15 @@ def parseOneObject(self, content):
name = contentsplit[10]+contentsplit[11]
titlelist = contentsplit[12:22]

# addItem(self, thedate, theaccount, theamount, thecurrency, thename, thedescription, thecategory, thenote)
resulttitle = getSubject(amount + currency + ' ' + name + ' ' + (' '.join(titlelist)))
resultadditional['csv'] = date.replace(';', '_') + '; ' + amount.replace(';', '_') + '; ' + currency.replace(';', '_') + '; ' + name.strip().replace(';', '_') + '; ' + (' '.join(titlelist)).strip().replace(';', '_') + ';'
if not content.content.startswith("\"transactionId\";\"localBankCode\";"):
resultadditional['csv'] = {'thedate': date.replace('/', '-'),
'theamount': float(amount),
'thecurrency': currency,
'thename': name.strip(),
'thedescription': (' '.join(titlelist)).strip()
}

resultcontent = 'Date: ' + date + '<br>\nName: ' + name + '<br>\nAmount: ' + amount + currency + '<br><br>Details:<br>\n' + ('\n<br>'.join(titlelist))
break
Expand All @@ -72,19 +79,15 @@ def parseOneObject(self, content):


class SaveTitlesParser(Parser):
def __init__(self, thepath, filenamebase):
self.thepath = thepath
self.filenamebase = filenamebase
def __init__(self, sqlitefile, account):
self.sqlitefile = sqlitefile
self.account = account

def performAction(self, contentList):
thefilename = self.filenamebase + time.strftime("-%Y-%m")

kontomodel.doLock(thefilename=thefilename, thepath=self.thepath)
with open(os.path.join(self.thepath, thefilename + '.list'), 'a') as thefile:
for content in contentList:
if 'csv' in content.additional:
theline = content.additional['csv']
thefile.write(theline + "\n")

kontomodel.doUnlock(thefilename=thefilename, thepath=self.thepath)
print(self.sqlitefile)
k = kontomodel.KontoModel(sqlitefile=self.sqlitefile)
for content in contentList:
if 'csv' in content.additional:
i = content.additional['csv']
k.addItem(thedate=i['thedate'], theaccount=self.account, theamount=i['theamount'], thecurrency=i['thecurrency'], thename=i['thename'], thedescription=i['thedescription'], thecategory=None, thenote=None)

0 comments on commit 54b356c

Please sign in to comment.