From 1cd3a0c07da7fcb0bb202c1d866bb858f2b0691e Mon Sep 17 00:00:00 2001 From: Gogodr Date: Wed, 4 May 2022 20:52:52 -0500 Subject: [PATCH] fuzzier item name classification --- README.md | 5 ++++- index.py | 2 +- modules/db.py | 4 ++-- modules/scan.py | 16 ++++++++++++---- 4 files changed, 19 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 0b94f9c..8be405c 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -## LostArk Market Watcher 0.4.11 +## LostArk Market Watcher 0.4.12 This app listens to the screenshot folder for new files. Starting on the version 0.3.0 this app needs to be launched through the [Lost Ark Market Launcher](https://github.com/gogodr/LostArk-Market-Launcher) Each new file is scanned and if the market window is detected in the picture then the image is segmented. @@ -21,6 +21,9 @@ In order to contribute to the LostArk Marketplace database, the contributor must Audio files from [MixKit](https://mixkit.co/) ### Changelog +### 0.4.12 +- Make name filter classificator fuzzier + ### 0.4.11 - Link error logs from db instance diff --git a/index.py b/index.py index 16c0695..e2155d2 100644 --- a/index.py +++ b/index.py @@ -21,7 +21,7 @@ from ui.config.config import LostArkMarketWatcherConfig from ui.log.log import LostArkMarketWatcherLog -version = '0.4.11' +version = '0.4.12' debug = True diff --git a/modules/db.py b/modules/db.py index 5386657..f885d35 100644 --- a/modules/db.py +++ b/modules/db.py @@ -109,7 +109,7 @@ def add_entry(self, market_line: MarketLine, play_audio=True): to_update['updatedAt'] = datetime.utcnow() to_update['author'] = self.uid - to_update['watcher-version'] = self.version + to_update['watcher_version'] = self.version item_doc_ref.update(to_update) @@ -120,7 +120,7 @@ def add_entry(self, market_line: MarketLine, play_audio=True): 'recentPrice': market_line.recent_price, 'createdAt': datetime.utcnow(), 'author': self.uid, - 'watcher-version': self.version + 'watcher_version': self.version }) self.log.emit(f"Updated: {market_line.name} | {market_line.avg_price} | {market_line.recent_price} | {market_line.lowest_price} | {market_line.cheapest_remaining}") diff --git a/modules/scan.py b/modules/scan.py index 8dad38c..e071a6f 100644 --- a/modules/scan.py +++ b/modules/scan.py @@ -4,6 +4,7 @@ import numpy as np import pytesseract import os +import re from concurrent.futures import ThreadPoolExecutor, wait from modules.common.market_line import MarketLine @@ -232,10 +233,17 @@ def process_line(screenshot, tab, anchor, line_index, debug=False, log_cb=lambda if name is None: return None - if name.find('[Sold in bundles') > 0: - name = name[0:name.find('[Sold in bundles')].strip() - if name.find('[Untradable upon') > 0: - name = name[0:name.find('[Untradable upon')].strip() + if debug: + log_cb(f"Raw Name: {name}") + + + name = re.sub(f"\n*[\(\[]Sold in bundles.*","",name) + + name = re.sub(f"\n*[\(\[]Untradable upon.*","",name) + + if debug: + log_cb(f"Filtered Name: {name}") + log_cb(f"=================================") # Filter name with whitelist name = filter_market_item_name(name)