Skip to content
This repository has been archived by the owner on Jul 18, 2022. It is now read-only.

Commit

Permalink
Update 3.1.5
Browse files Browse the repository at this point in the history
  • Loading branch information
MateuszPerczak committed Mar 7, 2020
1 parent 1d5f95e commit 5c11634
Show file tree
Hide file tree
Showing 7 changed files with 68 additions and 50 deletions.
8 changes: 4 additions & 4 deletions src/Sounder3.iss
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ Source: "C:\Users\Mateusz\Desktop\Sounder3\*.dll"; DestDir: "{app}"; Flags: igno

; Source: "C:\Users\Mateusz\Desktop\Sounder3\lib2to3\*"; DestDir: "{app}\lib2to3\"; Flags: ignoreversion recursesubdirs createallsubdirs
; Source: "C:\Users\Mateusz\Desktop\Sounder3\lib2to3\tests\data\*"; DestDir: "{app}\lib2to3\tests\data\"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "C:\Users\Mateusz\Desktop\Sounder3\numpy\core\*"; DestDir: "{app}\numpy\core\"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "C:\Users\Mateusz\Desktop\Sounder3\numpy\fft\*"; DestDir: "{app}\numpy\fft\"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "C:\Users\Mateusz\Desktop\Sounder3\numpy\linalg\*"; DestDir: "{app}\numpy\linalg\"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "C:\Users\Mateusz\Desktop\Sounder3\numpy\random\*"; DestDir: "{app}\numpy\random\"; Flags: ignoreversion recursesubdirs createallsubdirs
;Source: "C:\Users\Mateusz\Desktop\Sounder3\numpy\core\*"; DestDir: "{app}\numpy\core\"; Flags: ignoreversion recursesubdirs createallsubdirs
;Source: "C:\Users\Mateusz\Desktop\Sounder3\numpy\fft\*"; DestDir: "{app}\numpy\fft\"; Flags: ignoreversion recursesubdirs createallsubdirs
;Source: "C:\Users\Mateusz\Desktop\Sounder3\numpy\linalg\*"; DestDir: "{app}\numpy\linalg\"; Flags: ignoreversion recursesubdirs createallsubdirs
;Source: "C:\Users\Mateusz\Desktop\Sounder3\numpy\random\*"; DestDir: "{app}\numpy\random\"; Flags: ignoreversion recursesubdirs createallsubdirs


; Source: "C:\Users\Mateusz\Desktop\Sounder3\Include\*"; DestDir: "{app}\Include\"; Flags: ignoreversion recursesubdirs createallsubdirs
Expand Down
70 changes: 41 additions & 29 deletions src/Sounder3.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
music_bitrate: ClassVar = StringVar()
debug_info: ClassVar = StringVar()
config: Dict = {}
version: str = "3.1.4"
version: str = "3.1.5"
num_of_songs: int = 0
songs: List = []
current_song: int = 0
Expand Down Expand Up @@ -88,7 +88,7 @@ def load_settings() -> bool:
global config, version, sounder_dir
os.chdir(sounder_dir)
config = {"refresh_time": 1.0, "theme": "light", "version": version, "transition_duration": 1,
"gtr_buffer": False, "mode": "r_n",
"fst_buffer": False, "mode": "r_n",
"last_song": "", "continue": False, "path": user_path + "\\Music", "fade": False, "debug": False,
"update": True}
if os.path.isfile('cfg.json'):
Expand Down Expand Up @@ -153,12 +153,22 @@ def refresh_window() -> None:
left_player_music_list.see(current_song)


def start_music() -> None:
def init_music() -> bool:
global config, songs, current_song
if bool(config["last_song"]) and config["continue"] and bool(songs):
if config["last_song"] in songs:
current_song = songs.index(config["last_song"])
music("play")
try:
if bool(songs):
if config["last_song"] in songs:
current_song = songs.index(config["last_song"])
if config["continue"]:
music("play")
else:
set_song_attrib()
else:
set_song_attrib()
return True
except Exception as e:
dump(e)
return False


def refresh_dir() -> None:
Expand Down Expand Up @@ -191,10 +201,10 @@ def verify_settings() -> None:
except:
config["transition_duration"] = 1
try:
if not type(config["gtr_buffer"]) is bool:
config["gtr_buffer"] = False
if not type(config["fst_buffer"]) is bool:
config["fst_buffer"] = False
except:
config["gtr_buffer"] = False
config["fst_buffer"] = False
try:
if not type(config["last_song"]) is str:
config["last_song"] = ""
Expand Down Expand Up @@ -303,7 +313,7 @@ def apply_theme() -> bool:
top_player_folder_button.configure(image=folder_img)
top_player_refresh_button.configure(image=refresh_img)
third_settings_theme_button.configure(image=toggle_off_img)
if config["gtr_buffer"]:
if config["fst_buffer"]:
fourth_settings_buffer_button.configure(image=toggle_on_img)
else:
fourth_settings_buffer_button.configure(image=toggle_off_img)
Expand Down Expand Up @@ -389,7 +399,7 @@ def apply_theme() -> bool:
top_player_folder_button.configure(image=folder_img)
top_player_refresh_button.configure(image=refresh_img)
third_settings_theme_button.configure(image=toggle_on_img)
if config["gtr_buffer"]:
if config["fst_buffer"]:
fourth_settings_buffer_button.configure(image=toggle_on_img)
else:
fourth_settings_buffer_button.configure(image=toggle_off_img)
Expand Down Expand Up @@ -428,7 +438,7 @@ def debug(char) -> None:
show(main_debug_screen)
debug_info.set("refresh_time: " + str(config["refresh_time"]) + "\ntheme: "
+ str(config["theme"]) + "\nversion: " + str(config["version"]) + "\ntransition_duration: "
+ str(config["transition_duration"]) + "\ngtr_buffer: " + str(config["gtr_buffer"]) + "\nmode: "
+ str(config["transition_duration"]) + "\nfst_buffer: " + str(config["fst_buffer"]) + "\nmode: "
+ str(config["mode"]) + "\ncontinue: " + str(config["continue"]) + "\nfade: "
+ str(config["fade"]) + "\ndebug: " + str(config["debug"]) + "\nmusic_title: "
+ str(music_title.get()) + "\nmusic_artist: " + str(music_artist.get())
Expand Down Expand Up @@ -461,10 +471,10 @@ def apply_settings() -> bool:
def init_mixer() -> bool:
global config
try:
if config["gtr_buffer"]:
mixer.pre_init(frequency=44100, size=16, channels=2, buffer=6144, devicename=None)
if config["fst_buffer"]:
mixer.pre_init(frequency=44100, size=16, channels=2, buffer=2048, devicename=None)
else:
mixer.pre_init(frequency=44100, size=-16, channels=2, buffer=3072, devicename=None)
mixer.pre_init(frequency=44100, size=16, channels=2, buffer=3072, devicename=None)
mixer.init()
mixer.music.set_volume(1)
except Exception as e:
Expand All @@ -489,14 +499,11 @@ def init_player() -> None:
if apply_theme():
if init_mixer():
if load_music():
if config["continue"]:
start_music()
else:
set_song_attrib()
refresh_window()
show(main_player_frame)
if config["update"]:
check_for_update()
if init_music():
refresh_window()
show(main_player_frame)
if config["update"]:
check_for_update()
except Exception as e:
dump(e)

Expand All @@ -506,12 +513,15 @@ def music(mode) -> None:
try:
if bool(songs):
if mode == "forward":
if config["mode"] == "s_p":
music("shuffle")
if not current_song >= num_of_songs:
current_song += 1
if mixer.music.get_busy():
mixer.music.stop()
mixer.music.load(songs[current_song])
mixer.music.play()
set_song_attrib()
if not play_button_state:
play_button_state = True
buttons_player_play_button.configure(image=pause_img)
Expand All @@ -520,6 +530,7 @@ def music(mode) -> None:
if not mixer.music.get_busy():
mixer.music.load(songs[current_song])
mixer.music.play()
set_song_attrib()
else:
mixer.music.unpause()
play_button_state = True
Expand Down Expand Up @@ -548,6 +559,7 @@ def music(mode) -> None:
current_song = left_player_music_list.curselection()[0]
mixer.music.load(songs[current_song])
mixer.music.play()
set_song_attrib()
elif mode == "shuffle":
if num_of_songs > 0:
new_song = songs.index(choice(songs))
Expand All @@ -559,10 +571,10 @@ def music(mode) -> None:
mixer.music.stop()
mixer.music.load(songs[current_song])
mixer.music.play()
set_song_attrib()
if not play_button_state:
play_button_state = True
buttons_player_play_button.configure(image=pause_img)
set_song_attrib()
left_player_music_list.see(current_song)
elif mode == "play":
if play_button_state:
Expand Down Expand Up @@ -835,12 +847,12 @@ def toggle_theme() -> None:
def toggle_buffer() -> None:
global config
try:
if config["gtr_buffer"]:
if config["fst_buffer"]:
fourth_settings_buffer_button.configure(image=toggle_off_img)
config["gtr_buffer"] = False
config["fst_buffer"] = False
else:
fourth_settings_buffer_button.configure(image=toggle_on_img)
config["gtr_buffer"] = True
config["fst_buffer"] = True
except Exception as e:
dump(e)

Expand Down Expand Up @@ -1047,7 +1059,7 @@ def changelog():
# end
# fourth setting
settings_frame_fourth: ClassVar = Frame(main_settings_frame)
fourth_settings_buffer_label: ClassVar = ttk.Label(settings_frame_fourth, text="Use double buffer"
fourth_settings_buffer_label: ClassVar = ttk.Label(settings_frame_fourth, text="Use faster buffer"
, font='Bahnschrift 11', style="W.TLabel")
fourth_settings_buffer_button: ClassVar = ttk.Button(settings_frame_fourth, cursor="hand2", takefocus=False
, command=toggle_buffer)
Expand Down
Binary file modified src/Updater.exe
Binary file not shown.
19 changes: 16 additions & 3 deletions src/Updater.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ def update() -> None:
downloaded_zip: bytes = b''
bytes_downloaded: float = 0
file_size: float
upgrade: bool = False
try:
server_version = requests.get(
"https://raw.githubusercontent.com/losek1/Sounder3/master/updates/version.txt").text.strip()
Expand All @@ -100,25 +101,30 @@ def update() -> None:
info_progress["value"] = bytes_downloaded
task.set(str(round(bytes_downloaded / 1000000, 1)) + "MB / " + str(file_size) + "MB")
info_progress["value"] = 0
info_progress.stop()
try:
task.set("")
status.set("Installing...")
info_progress.stop()
info_progress.configure(mode="indeterminate")
info_progress.start(4)
with zipfile.ZipFile(io.BytesIO(downloaded_zip)) as zip_file:
for file in zip_file.namelist():
if file == "Updater.exe":
continue
task.set("Updating:" + file)
if file == "New-Updater.exe":
upgrade = True
task.set("Replacing:" + file)
try:
zip_file.extract(file, sounder_dir)
except Exception as error_obj:
logging.error(error_obj, exc_info=True)
task.set("Skipping:" + file)
status.set("Done")
if os.path.isfile("Sounder3.exe"):
os.system("start Sounder3.exe")
os.popen("start Sounder3.exe", 'r')
if upgrade:
if os.path.isfile("New-Updater.exe"):
os.popen("start New-Updater.exe upgrade", 'r')
close()
except Exception as error_obj:
logging.error(error_obj, exc_info=True)
Expand Down Expand Up @@ -158,10 +164,17 @@ def gui_setup() -> None:


def main() -> None:
if len(sys.argv) > 1:
if sys.argv[1] == "upgrade" and sys.argv[0] == "New-Updater.exe":
os.remove("Updater.exe")
os.rename("New-Updater.exe", "Updater.exe")
close()
if is_admin():
gui_setup()
if load_config():
update()
else:
status.set("Config file not found")
else:
close()

Expand Down
2 changes: 1 addition & 1 deletion src/cfg.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"refresh_time": 1.0, "theme": "dark", "version": "3.1.4", "transition_duration": 0.0, "gtr_buffer": false, "last_song": "Centuries.mp3", "continue": false, "fade": false, "mode": "r_n", "debug": true, "path": "C:/Users/Mateusz/Music", "update": true}
{"refresh_time": 1.0, "theme": "dark", "version": "3.1.5", "transition_duration": 0.0, "gtr_buffer": false, "last_song": "Rihanna - Princess of China .mp3", "continue": false, "fade": false, "mode": "s_p", "debug": true, "path": "C:/Users/Mateusz/Music", "update": true, "fst_buffer": true}
17 changes: 5 additions & 12 deletions src/changelog.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
+Fixed shuffle play.
+Changed the way how the current directory is displayed.
+Fixed init function.
+Fixed console window that was showing up when restarting or updating.
+Changed the way how windows are displayed.
+Changed changelog window size and style.
+Removed unnecessary lines of code.
+Fixed baitrate label.
+Reduced buffer size.
+Changed the way how sounder is closing.
+Changed size of sliders.
+Added open logs button to the error screen.
~Fixed song progress time.
+Changed the buffer setting.
+Added init_music function.
+Added shuffle play to the forward button.
+Prepared updater for self-update.
2 changes: 1 addition & 1 deletion updates/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.1.4
3.1.5

0 comments on commit 5c11634

Please sign in to comment.