@@ -25,7 +25,7 @@ def from_csv(self, filepath):
2525 ausgelesenen Kontoumsätzen.
2626 """
2727 result = []
28- rx = re .compile (r'Auftraggeber\:\s(.*)Buchungstext\:\s(.*)' )
28+ rx = re .compile (r'(?: Auftraggeber|Empfänger) \:\s(.*)Buchungstext\:\s(.*)' )
2929 with open (filepath , 'r' , encoding = 'Windows-1252' ) as infile :
3030
3131 # Skip the first 4 lines of the file: Standard Comdirect Header
@@ -37,24 +37,22 @@ def from_csv(self, filepath):
3737 date_format = "%d.%m.%Y"
3838 for row in reader :
3939 date_tx = row ['Buchungstag' ]
40- if date_tx == "offen" :
41- # Skippe offene Buchungen
40+ if re . match ( r'^[0-9]{2}\.[0-9]{2}\.[0-9]{4}$' , date_tx ) is None :
41+ # Skippe offene Buchungen oder Überschriften
4242 continue
4343
44- amount = float (row ['Umsatz in EUR' ].replace (',' , '.' ))
44+ amount = float (row ['Umsatz in EUR' ].replace ('.' , '' ). replace ( ' ,' , '.' ))
4545 date_tx = self ._parse_from_strftime (date_tx , date_format )
4646 valuta = self ._parse_from_strftime (row ['Wertstellung (Valuta)' ], date_format )
47-
48- text_tx = row ['Buchungstext' ]
49- match = rx .match (text_tx )
47+ text_tx_match = rx .match (row ['Buchungstext' ])
5048
5149 line = {
5250 'date_tx' : date_tx ,
5351 'valuta' : valuta ,
5452 'art' : row ['Vorgang' ],
55- 'text_tx' : match .group (2 ).strip (),
53+ 'text_tx' : text_tx_match .group (2 ).strip (),
5654 'amount' : amount ,
57- 'peer' : match .group (1 ).strip (),
55+ 'peer' : text_tx_match .group (1 ).strip (),
5856 'currency' : "EUR" ,
5957 'parsed' : {},
6058 'category' : None ,
0 commit comments