Skip to content

Commit c4ec551

Browse files
committed
Release
1 parent 9b6e03e commit c4ec551

File tree

19 files changed

+550195
-0
lines changed

19 files changed

+550195
-0
lines changed

.gitignore

Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
pscoverdl.ini
2+
3+
# Byte-compiled / optimized / DLL files
4+
__pycache__/
5+
*.py[cod]
6+
*$py.class
7+
8+
# C extensions
9+
*.so
10+
11+
# Distribution / packaging
12+
.Python
13+
build/
14+
develop-eggs/
15+
dist/
16+
downloads/
17+
eggs/
18+
.eggs/
19+
lib/
20+
lib64/
21+
parts/
22+
sdist/
23+
var/
24+
wheels/
25+
share/python-wheels/
26+
*.egg-info/
27+
.installed.cfg
28+
*.egg
29+
MANIFEST
30+
31+
# PyInstaller
32+
# Usually these files are written by a python script from a template
33+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
34+
*.manifest
35+
*.spec
36+
37+
# Installer logs
38+
pip-log.txt
39+
pip-delete-this-directory.txt
40+
41+
# Unit test / coverage reports
42+
htmlcov/
43+
.tox/
44+
.nox/
45+
.coverage
46+
.coverage.*
47+
.cache
48+
nosetests.xml
49+
coverage.xml
50+
*.cover
51+
*.py,cover
52+
.hypothesis/
53+
.pytest_cache/
54+
cover/
55+
56+
# Translations
57+
*.mo
58+
*.pot
59+
60+
# Django stuff:
61+
*.log
62+
local_settings.py
63+
db.sqlite3
64+
db.sqlite3-journal
65+
66+
# Flask stuff:
67+
instance/
68+
.webassets-cache
69+
70+
# Scrapy stuff:
71+
.scrapy
72+
73+
# Sphinx documentation
74+
docs/_build/
75+
76+
# PyBuilder
77+
.pybuilder/
78+
target/
79+
80+
# Jupyter Notebook
81+
.ipynb_checkpoints
82+
83+
# IPython
84+
profile_default/
85+
ipython_config.py
86+
87+
# pyenv
88+
# For a library or package, you might want to ignore these files since the code is
89+
# intended to run in multiple environments; otherwise, check them in:
90+
# .python-version
91+
92+
# pipenv
93+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
94+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
95+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
96+
# install all needed dependencies.
97+
#Pipfile.lock
98+
99+
# poetry
100+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
101+
# This is especially recommended for binary packages to ensure reproducibility, and is more
102+
# commonly ignored for libraries.
103+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
104+
#poetry.lock
105+
106+
# pdm
107+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
108+
#pdm.lock
109+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
110+
# in version control.
111+
# https://pdm.fming.dev/#use-with-ide
112+
.pdm.toml
113+
114+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
115+
__pypackages__/
116+
117+
# Celery stuff
118+
celerybeat-schedule
119+
celerybeat.pid
120+
121+
# SageMath parsed files
122+
*.sage.py
123+
124+
# Environments
125+
.env
126+
.venv
127+
env/
128+
venv/
129+
ENV/
130+
env.bak/
131+
venv.bak/
132+
133+
# Spyder project settings
134+
.spyderproject
135+
.spyproject
136+
137+
# Rope project settings
138+
.ropeproject
139+
140+
# mkdocs documentation
141+
/site
142+
143+
# mypy
144+
.mypy_cache/
145+
.dmypy.json
146+
dmypy.json
147+
148+
# Pyre type checker
149+
.pyre/
150+
151+
# pytype static type analyzer
152+
.pytype/
153+
154+
# Cython debug symbols
155+
cython_debug/
156+
157+
# PyCharm
158+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
159+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
160+
# and can be added to the global gitignore or merged into this file. For a more nuclear
161+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
162+
#.idea/

VERSION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1.0
Binary file not shown.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
pyinstaller "DuckStation cover downloader.py" --onefile --clean --distpath ""
2+
@RD /S /Q "build"
Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
"""
2+
⣞⢽⢪⢣⢣⢣⢫⡺⡵⣝⡮⣗⢷⢽⢽⢽⣮⡷⡽⣜⣜⢮⢺⣜⢷⢽⢝⡽⣝
3+
⠸⡸⠜⠕⠕⠁⢁⢇⢏⢽⢺⣪⡳⡝⣎⣏⢯⢞⡿⣟⣷⣳⢯⡷⣽⢽⢯⣳⣫⠇
4+
⠀⠀⢀⢀⢄⢬⢪⡪⡎⣆⡈⠚⠜⠕⠇⠗⠝⢕⢯⢫⣞⣯⣿⣻⡽⣏⢗⣗⠏⠀
5+
⠀⠪⡪⡪⣪⢪⢺⢸⢢⢓⢆⢤⢀⠀⠀⠀⠀⠈⢊⢞⡾⣿⡯⣏⢮⠷⠁⠀⠀
6+
⠀⠀⠀⠈⠊⠆⡃⠕⢕⢇⢇⢇⢇⢇⢏⢎⢎⢆⢄⠀⢑⣽⣿⢝⠲⠉⠀⠀⠀⠀
7+
⠀⠀⠀⠀⠀⡿⠂⠠⠀⡇⢇⠕⢈⣀⠀⠁⠡⠣⡣⡫⣂⣿⠯⢪⠰⠂⠀⠀⠀⠀
8+
⠀⠀⠀⠀⡦⡙⡂⢀⢤⢣⠣⡈⣾⡃⠠⠄⠀⡄⢱⣌⣶⢏⢊⠂⠀⠀⠀⠀⠀⠀
9+
⠀⠀⠀⠀⢝⡲⣜⡮⡏⢎⢌⢂⠙⠢⠐⢀⢘⢵⣽⣿⡿⠁⠁⠀⠀⠀⠀⠀⠀⠀
10+
⠀⠀⠀⠀⠨⣺⡺⡕⡕⡱⡑⡆⡕⡅⡕⡜⡼⢽⡻⠏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
11+
⠀⠀⠀⠀⣼⣳⣫⣾⣵⣗⡵⡱⡡⢣⢑⢕⢜⢕⡝⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
12+
⠀⠀⠀⣴⣿⣾⣿⣿⣿⡿⡽⡑⢌⠪⡢⡣⣣⡟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
13+
⠀⠀⠀⡟⡾⣿⢿⢿⢵⣽⣾⣼⣘⢸⢸⣞⡟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
14+
⠀⠀⠀⠀⠁⠇⠡⠩⡫⢿⣝⡻⡮⣒⢽⠋⠀⠀⠀
15+
16+
NO COVERS?
17+
"""
18+
19+
20+
import re
21+
from time import sleep
22+
from urllib.error import HTTPError
23+
from termcolor import colored
24+
from colorama import init
25+
import urllib.request
26+
import os, sys, ssl
27+
import platform
28+
29+
ssl._create_default_https_context = ssl._create_unverified_context
30+
COVERS_URL = "https://raw.githubusercontent.com/xlenore/psx-covers/main/covers/"
31+
VERSION_URL = "https://raw.githubusercontent.com/xlenore/psx-covers/main/DuckStation-cover-downloader/version"
32+
VERSION = 1.1
33+
34+
35+
def path():
36+
if getattr(sys, "frozen", False):
37+
path = os.path.dirname(os.path.realpath(sys.executable))
38+
elif __file__:
39+
path = os.path.dirname(__file__)
40+
return path
41+
42+
43+
def check_version():
44+
try:
45+
version = urllib.request.urlopen(VERSION_URL)
46+
if float(version.read().decode("utf-8").replace("\n", "")) != VERSION:
47+
print("[LOG]:", colored(f"New update available!\n", "green"))
48+
except:
49+
pass
50+
51+
52+
def serial_list(): # Get game serial
53+
with open(
54+
f'{os.path.join(path(), "cache", "gamelist.cache")}', errors="ignore"
55+
) as file:
56+
regex = re.compile("(\w{4}-\d{5})").findall(file.read())
57+
serial_list = list(dict.fromkeys(regex))
58+
print("[LOG]:", colored(f"Found {len(serial_list)} games", "green"))
59+
if len(serial_list) == 0:
60+
print("[ERROR]:", colored(f"You have 0 games installed", "red"))
61+
input()
62+
quit()
63+
return serial_list
64+
65+
66+
def existing_covers():
67+
covers = [
68+
w.replace(".jpg", "") for w in os.listdir(f'{os.path.join(path(), "covers")}')
69+
]
70+
71+
return covers
72+
73+
74+
def download_covers(serial_list: list): # Download Covers
75+
existing_cover = existing_covers()
76+
for i in range(len(serial_list)):
77+
game_serial = serial_list[i]
78+
if game_serial not in existing_cover:
79+
print("[LOG]:", colored(f"Downloading {game_serial} cover...", "green"))
80+
try:
81+
urllib.request.urlretrieve(
82+
f"{COVERS_URL}{game_serial}.jpg",
83+
f'{os.path.join("covers", "{game_serial}.jpg")}',
84+
)
85+
sleep(0.1)
86+
except HTTPError:
87+
print(
88+
"[WARNING]",
89+
colored(f"{game_serial} Not found. Skipping...", "yellow"),
90+
)
91+
else:
92+
print(
93+
"[WARNING]:",
94+
colored(
95+
f"{game_serial} already exist in \covers. Skipping...", "yellow"
96+
),
97+
)
98+
99+
100+
def set_terminal_title(title):
101+
if platform.system() == "Windows":
102+
os.system(f"title {title}")
103+
104+
105+
def run():
106+
set_terminal_title(f"DuckStation Cover Downloader {VERSION}")
107+
# check_version()
108+
download_covers(serial_list())
109+
print(
110+
"[LOG]:",
111+
colored(
112+
f"Done!, please report Not found | Low quality | Wrong covers in GitHub.",
113+
"green",
114+
),
115+
)
116+
input()
117+
118+
119+
init()
120+
run()
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
colorama==0.4.4
2+
PyYAML==6.0
3+
termcolor==1.1.0
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1.1

0 commit comments

Comments
 (0)