Skip to content

Commit

Permalink
Finishing sys icon change impl.
Browse files Browse the repository at this point in the history
  • Loading branch information
OfficialAhmed committed Feb 3, 2022
1 parent 95659f4 commit 7a43491
Show file tree
Hide file tree
Showing 10 changed files with 38 additions and 6 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@ Data/prxUserMeta/pronunciation.xml
Data/Pref/pref.ini
Data/prxUserMeta/MegaSRX/metadata/do not delete.txt
Data/prxUserMeta/MegaSRX/metadata/do not delete.txt
*.png
Data/Pref/bgm/tmp.mp3
system icons test.py
Logs.txt
5 changes: 4 additions & 1 deletion ChangeIcon.py
Original file line number Diff line number Diff line change
Expand Up @@ -1012,7 +1012,10 @@ def Resize_Upload(self):


if __name__ == "__main__":
import sys
import sys, os
from shared import playSound as play

play(f"{os.getcwd()}/Data/Pref/bgm/home.mp3")

app = QtWidgets.QApplication(sys.argv)
ChangeIconWindow = QtWidgets.QWidget()
Expand Down
Binary file added Data/Pref/bgm/home.mp3
Binary file not shown.
1 change: 0 additions & 1 deletion Data/prxUserMeta/MegaSRX/metadata/do not delete.txt

This file was deleted.

21 changes: 18 additions & 3 deletions Iconit.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
temp_path = local_path + "\Data\prxUserMeta\\"
img_dir = local_path + "\\data\\User\\appmeta"

sys_path = "system_ex\\app\\"

setting_path = ""
for change in local_path:
if change == "\\":
Expand Down Expand Up @@ -625,9 +627,11 @@ def CacheChangeAvatar(self):
os.remove(dir + i)
except Exception as e:
self.logIt(str(e), "Warning")

progress = int(100 / len(self.userID))
progressed = 0
self.CacheBar.setProperty("value", 1)

for user in self.userID:
ftp.set_debuglevel(0)
ftp.connect(IP, int(Port))
Expand Down Expand Up @@ -681,18 +685,21 @@ def CacheChangeAvatar(self):
]
cont = url.split("\/")
link = ""

for i in cont:
if i != "":
link += i + "//"
img = req.get(link[:-2])

with open(dir + "\\" + user + "Original.png", "wb") as origIcon:
origIcon.write(img.content)

except Exception as e:
self.logIt(str(e), "Warning")

for i in range(1, progress):
self.CacheBar.setProperty("value", progressed + i)

progressed += progress

self.CacheBar.setProperty("value", 100)
Expand All @@ -707,10 +714,11 @@ def fetchIcon(self, current_CUSA, icon_name):
ftp.retrbinary("RETR " + icon_name, downloaded_file.write, 24)

def CacheGameIcon(self):
t1 = time.time()
global all_CUSA, all_CUSA_ex, ftp, temp_path, working_dir, IP, Port, Game
from xml.dom import minidom

global all_CUSA, all_CUSA_ex, ftp, temp_path, working_dir, IP, Port, Game
t1 = time.time()

numGames = len(all_CUSA + all_CUSA_ex)
# (FF) (go to 900)
file_name = "pronunciation.xml"
Expand Down Expand Up @@ -742,10 +750,12 @@ def CacheGameIcon(self):
ftp.login("", "")
ftp.cwd(dir)
counter = 0

if "external" in dir:
currentDir = all_CUSA_ex
else:
currentDir = all_CUSA

for i in currentDir:
if counter == int(numGames / 2):
for i in range(25, 50):
Expand Down Expand Up @@ -841,6 +851,7 @@ def CacheGameIcon(self):
Game[current_CUSA] = "Unknown"
else:
Game[current_CUSA] = "Unknown Homebrew"

if "external" in dir:
# Get back to root directory
ftp.set_debuglevel(0)
Expand All @@ -857,12 +868,13 @@ def CacheGameIcon(self):
for i in range(51, 100):
self.CacheBar.setProperty("value", i)
time.sleep(0.01)

try:
t2 = time.time()
print((t2 - t1) / 60)
self.OpenWindow("GameIcon")
except Exception as e:
print(str(e), "<<<<<<<<<<<<<<<<<<<<< (O) go to line 700 Error")
print(str(e), "(O) go to line 700")

def OpenWindow(self, WinType):
if WinType == "GameIcon":
Expand Down Expand Up @@ -918,6 +930,9 @@ def logIt(self, description, Type):

if __name__ == "__main__":
import sys
from func import playSound as play

play(f"{local_path}/Data/Pref/bgm/home.mp3")

app = QtWidgets.QApplication(sys.argv)
screenResolution = app.desktop().screenGeometry()
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ This application is much convenient than uploading the images manually for many

# Update v4.72 (WIP. Not yet compiled for the end-user)

* Ability to detect all Homebrews (Note: make sure to enable HB in the settings) (4-letter prefix followed by 5-number suffix format. Exp: LAPY00000)
* Ability to change all Homebrews (Note: make sure to enable HB in the settings) (4-letter prefix followed by 5-number suffix format. Exp: LAPY00000)

* Ability to change System icons (ATTENTION: This will require extra permissions. Make sure to run FTP with Full R/W mode, as of writing this only Lapy Xplorer offer an option to allow FTP in "Danger mode" => Full R/W permissions by pressing (L2+Triangle). Only allow "Danger mode" when you need to change the system icons disable it afterwards to be in the safe side)

* More accurate Game Titles (Less abbreviations shown as the Game title)

Expand Down
Binary file modified __pycache__/ChangeIcon.cpython-38.pyc
Binary file not shown.
Binary file modified __pycache__/Iconit.cpython-38.pyc
Binary file not shown.
Binary file added __pycache__/shared.cpython-38.pyc
Binary file not shown.
9 changes: 9 additions & 0 deletions func.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
def playSound(path):
try:
import pygame

pygame.mixer.init()
pygame.mixer.music.load(path)
pygame.mixer.music.play(loops=-1) # repeat indefinitely
except Exception as e:
print(str(e))

0 comments on commit 7a43491

Please sign in to comment.