Skip to content

Commit

Permalink
win32api remove
Browse files Browse the repository at this point in the history
  • Loading branch information
gogodr committed May 14, 2022
1 parent c4c89c3 commit 6f26a40
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 11 deletions.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## LostArk Market Watcher 0.7.0
## LostArk Market Watcher 0.7.1
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.
Expand All @@ -17,11 +17,16 @@ In order to contribute to the LostArk Marketplace database, the contributor must
- Watchdog `pip install watchdog`
- Python Slugify `pip install python-slugify`
- TheFuzz `pip install thefuzz[speedup]`
- lxml `pip install lxml`
- pycaw `pip install pycaw`

### Assets
Audio files from [MixKit](https://mixkit.co/)

### Changelog
### 0.7.1
- Fix win32api dependency, changed to ctypes windll

### 0.7.0
- Add Threading controls to config
- Add Volume controls to config
Expand Down
2 changes: 1 addition & 1 deletion debug.spec
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ exe = EXE(
a.datas,
[],
name='LostArkMarketWatcher_Debug',
debug=False,
debug=True,
bootloader_ignore_signals=False,
strip=False,
upx=True,
Expand Down
2 changes: 1 addition & 1 deletion modules/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
}

class Config(metaclass=Singleton):
version = "0.7.0"
version = "0.7.1"
region: str
game_region: str
debug = False
Expand Down
13 changes: 11 additions & 2 deletions modules/find_game.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
import os
import re
import win32api
import string
from ctypes import windll

def get_drives():
drives = []
bitmask = windll.kernel32.GetLogicalDrives()
for letter in string.ascii_uppercase:
if bitmask & 1:
drives.append(f"{letter}:\\")
bitmask >>= 1
return drives

def find_file(root_folder, rex):
for root, _, files in os.walk(root_folder):
Expand All @@ -13,7 +22,7 @@ def find_file(root_folder, rex):

def find_file_in_all_drives(file_name):
rex = re.compile(file_name)
for drive in win32api.GetLogicalDriveStrings().split('\000')[:-1]:
for drive in get_drives():
return find_file(drive, rex)


Expand Down
29 changes: 23 additions & 6 deletions test_find.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,37 @@
import string
import os
import re
import win32api
from ctypes import windll


def get_drives():
drives = []
bitmask = windll.kernel32.GetLogicalDrives()
for letter in string.ascii_uppercase:
if bitmask & 1:
drives.append(f"{letter}:\\")
bitmask >>= 1
return drives


print(get_drives())


def find_file(root_folder, rex):
for root,_,files in os.walk(root_folder):
for root, _, files in os.walk(root_folder):
for f in files:
result = rex.search(f)
if result:
return os.path.join(root, f)


def find_file_in_all_drives(file_name):
rex = re.compile(file_name)
for drive in win32api.GetLogicalDriveStrings().split('\000')[:-1]:
return find_file( drive, rex )
for drive in get_drives():
return find_file(drive, rex)


lostark_file = find_file_in_all_drives('LOSTARK\.exe')
lostark_directoy = os.path.abspath(os.path.join(os.path.dirname(lostark_file),'..','..'))
print(lostark_directoy)
lostark_directoy = os.path.abspath(os.path.join(
os.path.dirname(lostark_file), '..', '..'))
print(lostark_directoy)

0 comments on commit 6f26a40

Please sign in to comment.