11import sys
2+ import os
23import subprocess
34from PyQt6 .QtCore import Qt , QThread , pyqtSignal
45import requests
@@ -8,17 +9,25 @@ class InstallSpicetify(QThread):
89 finished_signal = pyqtSignal ()
910 def run (self ):
1011 try :
11- self .progress_signal .emit ("Downloading Spicetify..." )
12- subprocess .run ('iwr -useb https://raw.githubusercontent.com/spicetify/spicetify-cli/master/install.ps1 | iex' ,check = True )
13- self .progress_signal .emit ("Creating backup..." )
14- subprocess .run ('spicetify clear' ,check = True )
15- subprocess .run ('spicetify backup' ,check = True )
16- self .progress_signal .emit ("Activating Spicetify..." )
17- #subprocess.run('powershell.exe -Command "spicetify apply"',check=True)
18- self .progress_signal .emit ("Installing Marketplace..." )
19- subprocess .run ('Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/spicetify/spicetify-marketplace/main/resources/install.ps1" | Invoke-Expression' ,check = True )
20- except :
12+ if sys .platform == 'win32' :
13+ self .progress_signal .emit ("Downloading Spicetify..." )
14+ subprocess .run ('powershell.exe -Command "iwr -useb https://raw.githubusercontent.com/spicetify/spicetify-cli/master/install.ps1 | iex"' ,check = True )
15+ self .progress_signal .emit ("Creating backup..." )
16+ subprocess .run ('spicetify clear' ,check = True )
17+ subprocess .run ('spicetify backup apply enable-devtools' ,check = True )
18+ self .progress_signal .emit ("Installing Marketplace..." )
19+ subprocess .run ('powershell.exe -Command "iwr -useb https://raw.githubusercontent.com/spicetify/spicetify-marketplace/main/resources/install.ps1 | iex"' ,check = True )
20+ else :
21+ self .progress_signal .emit ("Downloading Spicetify..." )
22+ subprocess .run ('curl -fsSL https://raw.githubusercontent.com/spicetify/spicetify-cli/master/install.sh | sh' ,check = True )
23+ self .progress_signal .emit ("Creating backup..." )
24+ subprocess .run ('spicetify clear' ,check = True )
25+ subprocess .run ('spicetify backup apply enable-devtools' ,check = True )
26+ self .progress_signal .emit ("Installing Marketplace..." )
27+ subprocess .run ('curl -fsSL https://raw.githubusercontent.com/spicetify/spicetify-marketplace/main/resources/install.sh | sh' ,check = True )
28+ except Exception as e :
2129 print ("Error detected!" )
30+ print (e )
2231 self .progress_signal .emit ("fail" )
2332 self .finished_signal .emit ()
2433class UpdateSpicetify (QThread ):
@@ -49,4 +58,11 @@ def getLatestRelease():
4958 tag_name = latest_release ["tag_name" ]
5059 return tag_name
5160 else :
52- return None
61+ return None
62+
63+ def checkApplied ():
64+ folder_path = os .path .join ( os .path .expanduser ('~' ), 'AppData' ,'Roaming/Spotify/Apps/xpui' )
65+ if os .path .exists (folder_path ) and os .path .isdir (folder_path ):
66+ return True
67+ else :
68+ return False
0 commit comments