Skip to content
This repository was archived by the owner on Aug 8, 2025. It is now read-only.

Commit e1e8ae8

Browse files
committed
Reworked update system
1 parent 4a1ab71 commit e1e8ae8

File tree

4 files changed

+54
-58
lines changed

4 files changed

+54
-58
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Contributers wellcome!
2222
- [x] Custom cli commands
2323
- [ ] Automatically update spicetify and apply patches after spotify update
2424

25-
Currently Windows only!
25+
Currently **Windows only**!
2626
If would like to improve support for other Platforms feel free to do so!
2727
## Installation and Running
2828

components/shellbridge.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ def run(self):
1717
self.progress_signal.emit("Downloading Spicetify...")
1818
subprocess.run('powershell.exe -Command "iwr -useb https://raw.githubusercontent.com/spicetify/spicetify-cli/master/install.ps1 | iex"',check=True)
1919
self.progress_signal.emit("Creating backup...")
20-
subprocess.run('spicetify clear',check=True)
21-
subprocess.run('spicetify backup apply enable-devtools',check=True)
20+
subprocess.run('spicetify clear -n -q',check=True)
21+
subprocess.run('spicetify backup apply -n -q enable-devtools -n -q',check=True)
2222
self.progress_signal.emit("Installing Marketplace...")
2323
subprocess.run('powershell.exe -Command "iwr -useb https://raw.githubusercontent.com/spicetify/spicetify-marketplace/main/resources/install.ps1 | iex"',check=True)
2424
else:
@@ -34,23 +34,22 @@ def run(self):
3434
print(e)
3535
self.progress_signal.emit("fail")
3636
self.finished_signal.emit()
37-
# Updater task
37+
# Update spicetify task
3838
class UpdateSpicetify(QThread):
3939
finished_signal = pyqtSignal()
4040
def run(self):
4141
print("Update started")
42-
subprocess.run('spicetify upgrade')
43-
subprocess.run('spicetify update')
42+
subprocess.run('spicetify upgrade -n -q')
4443
self.finished_signal.emit()
4544

46-
# Apply task
45+
# Apply mods task
4746
class ApplySpicetify(QThread):
4847
finished_signal = pyqtSignal()
4948
def run(self):
5049
print("Apply started")
51-
subprocess.check_output('spicetify apply')
50+
subprocess.check_output('spicetify apply -n -q')
5251
self.finished_signal.emit()
53-
# Uninstaller task
52+
# Unisnatll spicetify task
5453
class UninstallSpicetify(QThread):
5554
finished_signal = pyqtSignal()
5655
def run(self):

main.py

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from PyQt6.QtCore import Qt, QTimer
44
from splash_window import Splash
55
from manager_window import Manager
6+
from components.popups import errorDialog
67

78
class SpicetifyPatcher:
89
def __init__(self):
@@ -17,20 +18,18 @@ def __init__(self):
1718
self.timer.timeout.connect(self.show_menu)
1819
self.timer.start(5000)
1920

21+
# Check os and redirect to manager
2022
def show_menu(self):
21-
self.splash_window.hide()
22-
self.manager_window.show()
23-
23+
if sys.platform == 'win32':
24+
self.splash_window.hide()
25+
self.manager_window.show()
26+
else:
27+
self.splash_window.hide()
28+
errorDialog("This script is only compatible with Windows!")
29+
2430
def run(self):
2531
sys.exit(self.app.exec())
2632

2733
if __name__ == "__main__":
2834
app = SpicetifyPatcher()
2935
app.run()
30-
31-
32-
33-
34-
35-
36-

manager_window.py

Lines changed: 37 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ def __init__(self):
3838
self.InitWindow()
3939

4040
self.bt_master.clicked.connect(self.masterButton)
41-
self.bt_update.clicked.connect(self.startUpdate)
4241
self.bt_uninstall.clicked.connect(self.startRemoval)
4342
self.bt_cmd.clicked.connect(self.Custom)
4443
self.check_noupdate.stateChanged.connect(self.DisableUpdate)
@@ -74,6 +73,7 @@ def masterButton(self):
7473
self.bt_update.setEnabled(False)
7574
self.bt_uninstall.setEnabled(False)
7675
self.l_status.setText("Installling Spicetify...")
76+
self.l_versioninfo.setText('⏳Please wait⏳')
7777
self.iprocess = InstallSpicetify()
7878
self.iprocess.finished_signal.connect(self.setup_finished)
7979
self.iprocess.progress_signal.connect(self.progressmaster)
@@ -84,6 +84,7 @@ def masterButton(self):
8484
self.bt_update.setEnabled(False)
8585
self.bt_uninstall.setEnabled(False)
8686
self.l_status.setText("Running apply")
87+
self.l_versioninfo.setText('⏳Please wait⏳')
8788
self.iprocess = ApplySpicetify()
8889
self.iprocess.finished_signal.connect(self.apply_finished)
8990
self.iprocess.start()
@@ -93,6 +94,16 @@ def masterButton(self):
9394
os.remove(killpath1)
9495
os.remove(killpath2)
9596
self.SystemSoftStatusCheck()
97+
elif self.managermode == 5:
98+
self.setCursor(Qt.CursorShape.WaitCursor)
99+
self.bt_master.setEnabled(False)
100+
self.bt_update.setEnabled(False)
101+
self.bt_uninstall.setEnabled(False)
102+
self.l_status.setText("Updating patcher")
103+
self.l_versioninfo.setText('⏳Please wait⏳')
104+
self.iprocess = UpdateSpicetify()
105+
self.iprocess.finished_signal.connect(self.update_finished)
106+
self.iprocess.start()
96107
else:
97108
print("Error selection overshoot!")
98109

@@ -110,33 +121,6 @@ def startRemoval(self):
110121
self.iprocess.start()
111122

112123

113-
# Launch updater task
114-
def startUpdate(self):
115-
try:
116-
self.setCursor(Qt.CursorShape.WaitCursor)
117-
self.bt_update.setEnabled(False)
118-
self.bt_uninstall.setEnabled(False)
119-
self.bt_master.setEnabled(False)
120-
self.l_status.setStyleSheet("color: Orange")
121-
self.l_status.setText("Checking for updates...")
122-
localversion = subprocess.check_output('spicetify --version',shell=True).decode("utf-8").strip()
123-
latestrelease = getLatestRelease().replace("v","").strip()
124-
if(latestrelease == localversion):
125-
self.l_status.setStyleSheet("color: Green")
126-
self.l_status.setText("You are up to date!")
127-
self.setCursor(Qt.CursorShape.ArrowCursor)
128-
self.bt_update.setEnabled(True)
129-
self.bt_uninstall.setEnabled(True)
130-
self.bt_master.setEnabled(True)
131-
else:
132-
self.l_status.setStyleSheet("color: Orange")
133-
self.l_status.setText("Updating...")
134-
self.iprocess = UpdateSpicetify()
135-
self.iprocess.finished_signal.connect(self.update_finished)
136-
self.iprocess.start()
137-
except:
138-
print("E: Error while checking version during update!")
139-
140124
# Run custom commands
141125
def Custom(self):
142126
self.iprocess = CustomCommand(self.combo_cmd.currentIndex())
@@ -157,29 +141,32 @@ def setup_finished(self):
157141
self.SystemSoftStatusCheck()
158142
dialog = Popup(self)
159143
dialog.exec()
160-
windowsNotification("Spicetify Manager", "Spicetify has been installed!")
144+
windowsNotification("Spicetify Manager", "Spicetify has successfully been installed!")
145+
161146
#Called when spicetify is applied
162147
def apply_finished(self):
163148
self.SystemSoftStatusCheck()
164149
windowsNotification("Spicetify Manager", "Spicetify has been applied!")
150+
165151
#Called when spicetify is updated
166152
def update_finished(self):
167153
self.SystemSoftStatusCheck()
168154
windowsNotification("Spicetify Manager", "Spicetify has been updated!")
155+
169156
#Called when spicetify is uninstalled
170157
def uninstall_finished(self):
171158
self.SystemSoftStatusCheck()
172159
windowsNotification("Spicetify Manager", "Spicetify has been uninstalled!")
173160

174-
# Spicetify status check V2
161+
162+
# Spicetify status check
175163
def SystemSoftStatusCheck(self):
176164
spotipath = os.path.join(os.path.join( os.path.expanduser('~'), 'AppData','Roaming'), 'Spotify', 'Spotify.exe')
177165
if os.path.exists(spotipath):
178166
self.isSpotifyInstalled = True
179167
else:
180168
self.isSpotifyInstalled = False
181169

182-
# maybe (also) check executable in local appdata
183170
spicypath = os.path.join(os.path.join( os.path.expanduser('~'), 'AppData','Local'), 'spicetify', 'spicetify.exe')
184171
if os.path.exists(spicypath):
185172
self.isSpicetifyInstalled = True
@@ -208,24 +195,35 @@ def installerUiUpdate(self):
208195
self.bt_update.setEnabled(True)
209196
self.bt_uninstall.setEnabled(True)
210197
self.bt_master.setEnabled(True)
198+
211199
if(self.isSpotifyInstalled):
200+
212201
if(self.isSpicetifyInstalled):
202+
213203
if(self.isApplied):
204+
214205
if(self.isActive):
215-
#Implement update checker here
216-
self.l_status.setText("Spotify is spiced up!")
217-
self.l_status.setStyleSheet("color: lime")
218-
self.bt_master.setText("Launch Spotify")
219-
self.l_versioninfo.setText('Version: '+self.LOCALSPICETIFYVER)
220-
self.managermode = 0
206+
207+
if(self.LOCALSPICETIFYVER == self.LATESTSPICETIFYVER):
208+
self.l_status.setText("🔥 Spotify is spiced up 🔥")
209+
self.l_status.setStyleSheet("color: lime")
210+
self.bt_master.setText("Launch Spotify")
211+
self.l_versioninfo.setText('Version: '+self.LOCALSPICETIFYVER)
212+
self.managermode = 0
213+
else:
214+
self.l_status.setText("♻️ Update available ♻️")
215+
self.l_status.setStyleSheet("color: yellow")
216+
self.l_versioninfo.setText('Update now to the latest version: '+self.LATESTSPICETIFYVER)
217+
self.bt_master.setText("Update")
218+
self.managermode = 5
221219
else:
222-
self.l_status.setText("Spicetify is inactive")
220+
self.l_status.setText("⚠️ Spicetify is inactive ⚠️")
223221
self.l_status.setStyleSheet("color: yellow")
224222
self.l_versioninfo.setText('Press activate to activate Spicetify')
225223
self.bt_master.setText("Activate")
226224
self.managermode = 4
227225
else:
228-
self.l_status.setText("Spicetify is not applied yet")
226+
self.l_status.setText("🩹 Modifications not applied 🩹")
229227
self.l_status.setStyleSheet("color: orange")
230228
self.l_versioninfo.setText('Press apply to enable modifications')
231229
self.bt_master.setText("Apply")

0 commit comments

Comments
 (0)