Skip to content

Commit

Permalink
1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
xlenore committed Oct 16, 2023
1 parent c4ec551 commit 94ac20f
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 19 deletions.
5 changes: 3 additions & 2 deletions src/_dist.bat
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
pyinstaller "gui.py" --onefile --clean --distpath ""
@RD /S /Q "build"
pyinstaller "gui.py" --onefile --clean --distpath "" --icon="app/icon.ico" --add-data="resources;resources" --add-data="icons;icons" --add-data="app;app"
@RD /S /Q "build"
rename gui.exe pscoverdl.exe
Binary file added src/app/icon.ico
Binary file not shown.
41 changes: 27 additions & 14 deletions src/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,17 @@
import pscoverdl
import requests

VERSION = "1.0"
VERSION = 1.0


class pscoverdl_gui(ctk.CTk):
def __init__(self):
super().__init__()
self.check_updates(VERSION)
icon_path = os.path.join(
os.path.dirname(os.path.realpath(__file__)), "app/icon.ico"
)
self.iconbitmap(icon_path)
self.geometry("450x350")
self.resizable(False, False)
self.font = ("MS Sans Serif", 12, "bold")
Expand Down Expand Up @@ -273,9 +277,9 @@ def duckstation_button_event(self):
def pcsx2_button_event(self):
self.select_frame_by_name("pcsx2_frame")

def select_directory(self, module: str, is_cache: bool):
# module - pcsx2, duckstation
if module == "pcsx2":
def select_directory(self, emulator: str, is_cache: bool):
# emulator - pcsx2, duckstation
if emulator == "pcsx2":
if is_cache:
filetypes = (("gamelist", "*.cache"),)
file_path = filedialog.askopenfilename(filetypes=filetypes)
Expand All @@ -285,7 +289,7 @@ def select_directory(self, module: str, is_cache: bool):
file_path = filedialog.askdirectory()
self.pcsx2_covers_directory_textbox.delete(0, "end")
self.pcsx2_covers_directory_textbox.insert(0, file_path)
elif module == "duckstation":
elif emulator == "duckstation":
if is_cache:
filetypes = (("gamelist", "*.cache"),)
file_path = filedialog.askopenfilename(filetypes=filetypes)
Expand Down Expand Up @@ -351,25 +355,34 @@ def save_configurations(self):
def start_download(self, emulator: str):
self.start_download_button.configure(state="disabled")

pscoverdl.download_covers(
self.duckstation_covers_directory_textbox.get(),
self.duckstation_gamecache_textbox.get(),
self.duckstation_cover_type_var.get(),
self.duckstation_use_ssl_checkbox.get(),
emulator,
)
if emulator == "pcsx2":
pscoverdl.download_covers(
self.pcsx2_covers_directory_textbox.get(),
self.pcsx2_gamecache_textbox.get(),
self.pcsx2_cover_type_var.get(),
self.pcsx2_use_ssl_checkbox.get(),
emulator,
)
elif emulator == "duckstation":
pscoverdl.download_covers(
self.duckstation_covers_directory_textbox.get(),
self.duckstation_gamecache_textbox.get(),
self.duckstation_cover_type_var.get(),
self.duckstation_use_ssl_checkbox.get(),
emulator,
)

self.save_configurations()
self.start_download_button.configure(state="normal")

def check_updates(self, version: str):
try:
rep_version = requests.get(
"https://github.com/xlenore/pscoverdl/raw/main/version"
"https://github.com/xlenore/pscoverdl/raw/main/VERSION"
).text.strip()

try:
rep_version = int(rep_version)
rep_version = float(rep_version)
except ValueError:
rep_version = version

Expand Down
8 changes: 5 additions & 3 deletions src/pscoverdl.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@ def get_serial_list(self, gamelist_cache_path, existing_covers):
regex = re.findall(r"(\w{4}-\d{5})", file.read())
serial_list = list(set(regex))
print(colored(f"[LOG]: {len(serial_list)} games found", "green"))
print(colored(f"[LOG]: Removing already downloaded covers...", "green"))
print(
colored(
f"[LOG]: Removing already downloaded covers from queue...", "green"
)
)
serial_list = [
game_serial
for game_serial in serial_list
Expand Down Expand Up @@ -95,8 +99,6 @@ def download(self):
if self.cover_type == 1:
covers_url = covers_url_3d

print(covers_url)

if self.cover_type == 0:
cover_urls = [
f"{covers_url}/{game_serial}.jpg"
Expand Down

0 comments on commit 94ac20f

Please sign in to comment.