diff --git a/webjammies.py b/webjammies.py index 77378b4..15bbc10 100644 --- a/webjammies.py +++ b/webjammies.py @@ -48,6 +48,7 @@ class MusicPlayer: while True: try: if not self.mixer.music.get_busy() and not paused: + self.mixer.music.unload() return while self.mixer.music.get_busy(): time.sleep(0.1) @@ -88,6 +89,7 @@ class MusicPlayer: pass elif choice == 4: self.mixer.music.stop() + self.mixer.music.unload() return elif choice == 5: print( @@ -101,6 +103,7 @@ class MusicPlayer: continue else: self.mixer.music.stop() + self.mixer.music.unload() self.looping = False return else: @@ -177,6 +180,11 @@ class MusicGetter: def download_song(self, song): content = requests.get(f"{self.server}/webjammies/{song}", verify=False) + # for some reason windows will throw permission denied errors trying to + # overwrite the file, so that's why i'll remove it first for windows + if os.name == "nt": + if os.path.exists("song0.mp3"): + os.remove("song0.mp3") with open("song0.mp3", "wb") as f: f.write(content.content) self.musicplayer.nextmeta = self.metadata.get(song)