Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 51be2e3cd3 | |||
| c42d604d08 | |||
| 2b553203d7 | |||
| 9fa030ee1e | |||
| ed25e8d3b6 |
@@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=62 format=3 uid="uid://b2sygl55s6fng"]
|
||||
[gd_scene load_steps=64 format=3 uid="uid://b2sygl55s6fng"]
|
||||
|
||||
[ext_resource type="Script" path="res://main.gd" id="1_ubs1p"]
|
||||
[ext_resource type="Texture2D" uid="uid://b8on1case224h" path="res://LoopPressed.png" id="2_iolk5"]
|
||||
@@ -148,6 +148,12 @@ keycode = 81
|
||||
[sub_resource type="Shortcut" id="Shortcut_g3fcr"]
|
||||
events = [SubResource("InputEventKey_puhgg")]
|
||||
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_b1152"]
|
||||
font_size = 31
|
||||
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_ivhc6"]
|
||||
font_size = 20
|
||||
|
||||
[node name="Node2D" type="Control"]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
@@ -821,7 +827,7 @@ offset_left = -64.0
|
||||
offset_top = -23.0
|
||||
grow_horizontal = 0
|
||||
grow_vertical = 0
|
||||
text = "v1.3.3"
|
||||
text = "v1.3.5"
|
||||
horizontal_alignment = 2
|
||||
|
||||
[node name="WavDisclaimer" type="AcceptDialog" parent="."]
|
||||
@@ -855,10 +861,13 @@ offset_top = -40.0
|
||||
grow_horizontal = 0
|
||||
grow_vertical = 0
|
||||
script = ExtResource("30_byc5i")
|
||||
errorColor = Color(0.981984, 0, 0.065929, 1)
|
||||
|
||||
[node name="HTTPRequest" type="HTTPRequest" parent="UpdateChecker"]
|
||||
timeout = 5.0
|
||||
|
||||
[node name="DownloadRequest" type="HTTPRequest" parent="UpdateChecker"]
|
||||
|
||||
[node name="ColorRect" type="ColorRect" parent="UpdateChecker"]
|
||||
layout_mode = 0
|
||||
offset_left = -214.0
|
||||
@@ -867,7 +876,7 @@ offset_right = -24.0
|
||||
offset_bottom = -44.0
|
||||
color = Color(0.14902, 0.14902, 0.14902, 1)
|
||||
|
||||
[node name="Label" type="Label" parent="UpdateChecker/ColorRect"]
|
||||
[node name="UpdateAvailableText" type="Label" parent="UpdateChecker/ColorRect"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 5
|
||||
anchor_left = 0.5
|
||||
@@ -877,6 +886,8 @@ offset_right = 68.0
|
||||
offset_bottom = 23.0
|
||||
grow_horizontal = 2
|
||||
text = "Update Available!"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="PatchNotesButton" type="Button" parent="UpdateChecker/ColorRect"]
|
||||
z_index = 4
|
||||
@@ -943,6 +954,92 @@ pivot_offset = Vector2(72, 0)
|
||||
icon = ExtResource("14_mioc4")
|
||||
flat = true
|
||||
|
||||
[node name="UpdatingNotification" type="Control" parent="."]
|
||||
visible = false
|
||||
custom_minimum_size = Vector2(400, 200)
|
||||
layout_mode = 1
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -20.0
|
||||
offset_top = -20.0
|
||||
offset_right = 20.0
|
||||
offset_bottom = 20.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="ColorRect" type="ColorRect" parent="UpdatingNotification"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
color = Color(0.262745, 0.462745, 0.505882, 1)
|
||||
|
||||
[node name="ColorRect2" type="ColorRect" parent="UpdatingNotification"]
|
||||
layout_mode = 1
|
||||
anchors_preset = -1
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 0.245
|
||||
grow_horizontal = 2
|
||||
color = Color(0.196078, 0.278431, 0.32549, 1)
|
||||
|
||||
[node name="Label" type="Label" parent="UpdatingNotification"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 5
|
||||
anchor_left = 0.5
|
||||
anchor_right = 0.5
|
||||
offset_left = -20.0
|
||||
offset_right = 20.0
|
||||
offset_bottom = 23.0
|
||||
grow_horizontal = 2
|
||||
text = "Simplaudio is Updating!"
|
||||
label_settings = SubResource("LabelSettings_b1152")
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="Label2" type="Label" parent="UpdatingNotification"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 5
|
||||
anchor_left = 0.5
|
||||
anchor_right = 0.5
|
||||
offset_left = -142.0
|
||||
offset_top = 52.0
|
||||
offset_right = 142.0
|
||||
offset_bottom = 153.0
|
||||
grow_horizontal = 2
|
||||
text = "Please wait.
|
||||
Simplaudio will restart automatically
|
||||
|
||||
this wont take long"
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="LoadingIMG" type="Sprite2D" parent="UpdatingNotification"]
|
||||
position = Vector2(199, 115)
|
||||
rotation = 1.5708
|
||||
scale = Vector2(-0.5, 0.5)
|
||||
texture = ExtResource("13_de5ej")
|
||||
script = ExtResource("14_rhw4k")
|
||||
|
||||
[node name="Error" type="Label" parent="UpdatingNotification"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -20.0
|
||||
offset_top = 57.0
|
||||
offset_right = 20.0
|
||||
offset_bottom = 80.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
label_settings = SubResource("LabelSettings_ivhc6")
|
||||
horizontal_alignment = 1
|
||||
|
||||
[connection signal="toggled" from="SelectPlaylist" to="SelectPlaylist" method="_on_toggled"]
|
||||
[connection signal="pressed" from="PlaylistsPanel/PlaylistsContainer/VBoxContainer/HBoxContainer/CreatePlaylist" to="PlaylistsPanel" method="_on_create_playlist_pressed"]
|
||||
[connection signal="toggled" from="PlaylistsPanel/PlaylistsContainer/VBoxContainer/HBoxContainer/PlayAll" to="PlaylistsPanel" method="_on_play_all_toggled"]
|
||||
@@ -958,5 +1055,6 @@ flat = true
|
||||
[connection signal="toggled" from="VolumeButton" to="VolumeButton" method="_on_toggled"]
|
||||
[connection signal="toggled" from="YtTabButton" to="YtTabButton" method="_on_toggled"]
|
||||
[connection signal="request_completed" from="UpdateChecker/HTTPRequest" to="UpdateChecker" method="_on_http_request_completed"]
|
||||
[connection signal="request_completed" from="UpdateChecker/DownloadRequest" to="UpdateChecker" method="_on_download_request_completed"]
|
||||
[connection signal="pressed" from="UpdateChecker/ColorRect/LinkButton" to="UpdateChecker" method="_on_link_button_pressed"]
|
||||
[connection signal="pressed" from="UpdateChecker/ColorRect/CloseBuen" to="UpdateChecker" method="_on_close_buen_pressed"]
|
||||
|
||||
@@ -9,7 +9,7 @@ Button/styles/focus = SubResource("StyleBoxEmpty_1t7mm")
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_5vqdt"]
|
||||
|
||||
[sub_resource type="Image" id="Image_x7sdv"]
|
||||
[sub_resource type="Image" id="Image_1kvtv"]
|
||||
data = {
|
||||
"data": PackedByteArray(255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 227, 227, 227, 36, 224, 224, 224, 168, 224, 224, 224, 233, 224, 224, 224, 236, 224, 224, 224, 170, 231, 231, 231, 31, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 227, 227, 227, 36, 224, 224, 224, 234, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 239, 230, 230, 230, 30, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 168, 224, 224, 224, 255, 224, 224, 224, 186, 224, 224, 224, 32, 224, 224, 224, 33, 224, 224, 224, 187, 224, 224, 224, 255, 225, 225, 225, 167, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 237, 224, 224, 224, 255, 224, 224, 224, 33, 255, 255, 255, 0, 255, 255, 255, 0, 227, 227, 227, 36, 224, 224, 224, 255, 224, 224, 224, 234, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 237, 224, 224, 224, 255, 224, 224, 224, 33, 255, 255, 255, 0, 255, 255, 255, 0, 229, 229, 229, 38, 224, 224, 224, 255, 224, 224, 224, 229, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 164, 224, 224, 224, 255, 224, 224, 224, 187, 225, 225, 225, 34, 227, 227, 227, 36, 224, 224, 224, 192, 224, 224, 224, 255, 224, 224, 224, 162, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 24, 225, 225, 225, 215, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 229, 224, 224, 224, 32, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 24, 224, 224, 224, 216, 224, 224, 224, 255, 224, 224, 224, 210, 224, 224, 224, 161, 224, 224, 224, 232, 224, 224, 224, 231, 225, 225, 225, 159, 230, 230, 230, 30, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 107, 224, 224, 224, 255, 224, 224, 224, 210, 230, 230, 230, 20, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 105, 230, 230, 230, 20, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 221, 224, 224, 224, 130, 255, 255, 255, 1, 255, 255, 255, 1, 225, 225, 225, 134, 224, 224, 224, 224, 225, 225, 225, 223, 224, 224, 224, 132, 255, 255, 255, 1, 255, 255, 255, 6, 224, 224, 224, 137, 224, 224, 224, 231, 224, 224, 224, 255, 255, 255, 255, 0, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 130, 225, 225, 225, 133, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 129, 224, 224, 224, 137, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 255, 255, 255, 0, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 65, 224, 224, 224, 255, 224, 224, 224, 220, 225, 225, 225, 223, 224, 224, 224, 255, 226, 226, 226, 61, 224, 224, 224, 65, 224, 224, 224, 255, 224, 224, 224, 222, 224, 224, 224, 231, 224, 224, 224, 255, 227, 227, 227, 62, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 255, 224, 224, 224, 255, 225, 225, 225, 67, 224, 224, 224, 255, 224, 224, 224, 219, 224, 224, 224, 222, 224, 224, 224, 255, 227, 227, 227, 63, 225, 225, 225, 67, 224, 224, 224, 255, 224, 224, 224, 219, 224, 224, 224, 230, 224, 224, 224, 255, 227, 227, 227, 63, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 225, 225, 225, 127, 224, 224, 224, 129, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 225, 225, 225, 126, 225, 225, 225, 135, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 255, 255, 255, 0, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 221, 225, 225, 225, 127, 255, 255, 255, 0, 255, 255, 255, 1, 224, 224, 224, 128, 224, 224, 224, 220, 224, 224, 224, 219, 225, 225, 225, 127, 255, 255, 255, 0, 255, 255, 255, 5, 225, 225, 225, 134, 224, 224, 224, 229, 224, 224, 224, 255, 255, 255, 255, 0),
|
||||
"format": "RGBA8",
|
||||
@@ -19,7 +19,7 @@ data = {
|
||||
}
|
||||
|
||||
[sub_resource type="ImageTexture" id="ImageTexture_gdtpn"]
|
||||
image = SubResource("Image_x7sdv")
|
||||
image = SubResource("Image_1kvtv")
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_7v0rg"]
|
||||
|
||||
|
||||
@@ -530,6 +530,7 @@ func saveUserdata(content):
|
||||
var file = FileAccess.open("user://data.dat", FileAccess.WRITE)
|
||||
@warning_ignore("static_called_on_instance")
|
||||
file.store_string(Marshalls.utf8_to_base64(json.stringify(content)))
|
||||
file.close()
|
||||
|
||||
func loadUserdata():
|
||||
var json = JSON.new()
|
||||
@@ -542,8 +543,10 @@ func loadUserdata():
|
||||
else:
|
||||
@warning_ignore("static_called_on_instance")
|
||||
content = json.parse_string(Marshalls.base64_to_utf8(file.get_as_text()))
|
||||
file.close()
|
||||
return content
|
||||
else:
|
||||
file.close()
|
||||
return null
|
||||
|
||||
func loadPlaylists():
|
||||
@@ -560,3 +563,5 @@ func loadPlaylists():
|
||||
print(PlaylistsLocation)
|
||||
print(Playlists.keys())
|
||||
print("Playlists")
|
||||
file.close()
|
||||
file2.close()
|
||||
|
||||
+63
-5
@@ -1,19 +1,21 @@
|
||||
extends Control
|
||||
@onready var Parent:MainScene = get_tree().root.get_child(2)
|
||||
@onready var animation_player := $AnimationPlayer as AnimationPlayer
|
||||
@onready var version: Label = $"../Version"
|
||||
|
||||
@onready var update_button := $Update as Button
|
||||
@onready var http_request := $HTTPRequest as HTTPRequest
|
||||
@onready var download_request: HTTPRequest = $DownloadRequest
|
||||
@onready var link_button: Button = $ColorRect/LinkButton
|
||||
@onready var update_available_text: Label = $ColorRect/UpdateAvailableText
|
||||
@onready var updating_notification: Control = $"../UpdatingNotification"
|
||||
@onready var errorLabel: Label = $"../UpdatingNotification/Error"
|
||||
|
||||
@export var errorColor:Color
|
||||
|
||||
var CheckForUpdates:bool = true
|
||||
|
||||
var updateLink:String
|
||||
|
||||
# Only update once every UPDATE_THROTTLE seconds at most
|
||||
# The GitHub releases API only allows 60 unauthenticated requests per hour,
|
||||
# so this value should be kept relatively high
|
||||
const UPDATE_THROTTLE = 600
|
||||
|
||||
|
||||
@@ -31,6 +33,7 @@ func check_for_updates() -> void:
|
||||
|
||||
if error != OK:
|
||||
push_error("! a client error occurred")
|
||||
errorLabel.text = "a client error occurred"
|
||||
|
||||
func _on_http_request_completed(result: int, _response_code: int, _headers: PackedStringArray, body: PackedByteArray) -> void:
|
||||
if result != HTTPRequest.RESULT_SUCCESS:
|
||||
@@ -43,6 +46,7 @@ func _on_http_request_completed(result: int, _response_code: int, _headers: Pack
|
||||
var result2 = json.parse_string(str(body.get_string_from_utf8()))
|
||||
print("! AHHH " + str(result2))
|
||||
if result2["tag_name"] != version.text:
|
||||
update_available_text.text = result2["tag_name"] + " Is Out!"
|
||||
show()
|
||||
updateLink = result2["html_url"]
|
||||
|
||||
@@ -51,4 +55,58 @@ func _on_close_buen_pressed() -> void:
|
||||
|
||||
|
||||
func _on_link_button_pressed() -> void:
|
||||
OS.shell_open(updateLink)
|
||||
link_button.disabled = true
|
||||
link_button.text = "Updating..."
|
||||
updating_notification.show()
|
||||
var exepath:PackedStringArray = OS.get_executable_path().split("/")
|
||||
var path:String = GetLocalPath()
|
||||
print(OS.get_executable_path())
|
||||
if !OS.has_feature("editor"):
|
||||
if OS.get_name() == "Windows":
|
||||
download_request.download_file = path + "download.zip"
|
||||
var error = download_request.request(
|
||||
"https://github.com/notdraimdev/Simplaudio/releases/latest/download/Windows.zip"
|
||||
)
|
||||
if error != OK:
|
||||
print("! DOWNLOAD ERROR: " + str(error))
|
||||
errorLabel.text = "DOWNLOAD FAILED ERROR CODE: " + str(error)
|
||||
errorLabel.label_settings.font_color = errorColor
|
||||
else:
|
||||
errorLabel.text = "downloading..."
|
||||
else:
|
||||
OS.shell_open(updateLink)
|
||||
|
||||
func _on_download_request_completed(result: int, response_code: int, headers: PackedStringArray, body: PackedByteArray) -> void:
|
||||
if result != HTTPRequest.RESULT_SUCCESS:
|
||||
print("! Something went wrong server side: " + str(result))
|
||||
errorLabel.text = "DOWNLOAD FAILED ERROR CODE: " + str(result)
|
||||
errorLabel.label_settings.font_color = errorColor
|
||||
return
|
||||
else:
|
||||
errorLabel.text = "unzipping..."
|
||||
print("works as expected brotha")
|
||||
var unzipper:ZIPReader = ZIPReader.new() # sus
|
||||
|
||||
unzipper.open(GetLocalPath()+"download.zip")
|
||||
var files:PackedStringArray = unzipper.get_files()
|
||||
for file in files:
|
||||
var actualfile = file.replace("MusicPlayerExports/","")
|
||||
print("FILE: " + actualfile)
|
||||
var FileAcess:FileAccess = FileAccess.open(GetLocalPath() + actualfile,FileAccess.WRITE_READ)
|
||||
|
||||
if FileAcess != null:
|
||||
var downloadedfile = unzipper.read_file(file)
|
||||
FileAcess.store_buffer(downloadedfile)
|
||||
print("FOUND FILE: " + GetLocalPath()+file)
|
||||
#FileAcess.store_string()
|
||||
unzipper.close()
|
||||
OS.shell_open(OS.get_executable_path())
|
||||
get_tree().root.close_requested.emit()
|
||||
get_tree().root.queue_free()
|
||||
|
||||
func GetLocalPath() -> String:
|
||||
var exepath:PackedStringArray = OS.get_executable_path().split("/")
|
||||
var path:String
|
||||
for sting in (exepath.size()-1):
|
||||
path += exepath[sting] + "/"
|
||||
return path
|
||||
|
||||
Reference in New Issue
Block a user