From 6227a8da1770de3eb09e220d3330c21c00dd97ba Mon Sep 17 00:00:00 2001
From: Constantin Wenger <constantin.wenger@googlemail.com>
Date: Tue, 13 Aug 2019 20:41:25 +0000
Subject: [PATCH] work a round for "con" being a forbidden filename on windows
---
opencv_dnn.py | 12 ++++++++++--
1 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/opencv_dnn.py b/opencv_dnn.py
index a2c9d3b..bf6142e 100644
--- a/opencv_dnn.py
+++ b/opencv_dnn.py
@@ -49,15 +49,21 @@
for card_name in card_names:
# Fetch the image - name can be found based on the card's information
card_info['name'] = card_name
+ cname = card_name
+ if cname == 'con':
+ cname == 'con__'
img_name = '%s/card_img/png/%s/%s_%s.png' % (Config.data_dir, card_info['set'],
card_info['collector_number'],
- fetch_data.get_valid_filename(card_info['name']))
+ fetch_data.get_valid_filename(cname))
card_img = cv2.imread(img_name)
# If the image doesn't exist, download it from the URL
if card_img is None:
+ set_name = card_info['set']
+ if set_name == 'con':
+ set_name = 'con__'
fetch_data.fetch_card_image(card_info,
- out_dir='%s/card_img/png/%s' % (Config.data_dir, card_info['set']))
+ out_dir='%s/card_img/png/%s' % (Config.data_dir, set_name))
card_img = cv2.imread(img_name)
if card_img is None:
print('WARNING: card %s is not found!' % img_name)
@@ -624,6 +630,8 @@
# Merge database for all cards, then calculate pHash values of each, store them
df_list = []
for set_name in Config.all_set_list:
+ if set_name == 'con':
+ set_name = 'con__'
csv_name = '%s/csv/%s.csv' % (Config.data_dir, set_name)
df = fetch_data.load_all_cards_text(csv_name)
df_list.append(df)
--
Gitblit v1.10.0