Skip to content

Commit

Permalink
more work on csv imports
Browse files Browse the repository at this point in the history
  • Loading branch information
andli committed Jun 2, 2020
1 parent c9d0eb3 commit 0d2f2be
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 7 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Added progress bar to wantslists cleanup.

### Fixed

- Split card names got a better handling in CSV import
- The ligature `Æ` got better handling in CSV import

## [1.6.3]

### Added
Expand Down
2 changes: 1 addition & 1 deletion list.csv
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Card,Set Name,Quantity,Foil,Language
Dragon Breath,Scourge,1,Foil,French
Aether Vial,Iconic Masters,4,,English
2 changes: 1 addition & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"""

__author__ = "Andreas Ehrlund"
__version__ = "1.6.3"
__version__ = "1.6.4"
__license__ = "MIT"

from pymkm_app import PyMkmApp
Expand Down
18 changes: 15 additions & 3 deletions pymkm_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"""

__author__ = "Andreas Ehrlund"
__version__ = "1.6.3"
__version__ = "1.6.4"
__license__ = "MIT"

import csv
Expand Down Expand Up @@ -616,7 +616,9 @@ def import_from_csv(self, api):
(name, set_name, count, foil, language, *other) = row_array
if all(v != "" for v in [name, set_name, count]):
try:
possible_products = api.find_product(name)["product"]
possible_products = api.find_product(name, idGame="1")[
"product"
]
except Exception as err:
problem_cards.append(row_array)
else:
Expand All @@ -631,6 +633,16 @@ def import_from_csv(self, api):
or (
# filter for flip card / split card names
"/" in x["enName"]
and x["enName"].startswith(name)
and x["expansionName"] == set_name
and x["categoryName"] == "Magic Single"
)
or (
# filter for the ligature Æ
"Æ"
in x[
"enName"
] # TODO: add some sort of string distance
and x["expansionName"] == set_name
and x["categoryName"] == "Magic Single"
)
Expand Down Expand Up @@ -661,7 +673,7 @@ def import_from_csv(self, api):
"condition": "NM",
"isFoil": ("true" if foil else "false"),
}
# api.add_stock([card])
api.add_stock([card])
else:
problem_cards.append(row_array)
else:
Expand Down
2 changes: 1 addition & 1 deletion pymkm_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"""

__author__ = "Andreas Ehrlund"
__version__ = "1.6.3"
__version__ = "1.6.4"
__license__ = "MIT"

import math
Expand Down
2 changes: 1 addition & 1 deletion pymkmapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"""

__author__ = "Andreas Ehrlund"
__version__ = "1.6.3"
__version__ = "1.6.4"
__license__ = "MIT"

import sys
Expand Down

0 comments on commit 0d2f2be

Please sign in to comment.