diff --git a/Download.png b/Download.png new file mode 100644 index 0000000..c2d7b06 Binary files /dev/null and b/Download.png differ diff --git a/Youtube_logo.png.import b/Download.png.import similarity index 68% rename from Youtube_logo.png.import rename to Download.png.import index f380244..a773d81 100644 --- a/Youtube_logo.png.import +++ b/Download.png.import @@ -2,16 +2,16 @@ importer="texture" type="CompressedTexture2D" -uid="uid://bdpat2sfflaxq" -path="res://.godot/imported/Youtube_logo.png-22e44a6c4c4bd7a2da4492032ea62686.ctex" +uid="uid://bmbxyma4ra46p" +path="res://.godot/imported/Download.png-3a4ebaeb081d510c32ff24ab28484d7b.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://Youtube_logo.png" -dest_files=["res://.godot/imported/Youtube_logo.png-22e44a6c4c4bd7a2da4492032ea62686.ctex"] +source_file="res://Download.png" +dest_files=["res://.godot/imported/Download.png-3a4ebaeb081d510c32ff24ab28484d7b.ctex"] [params] diff --git a/Main.tscn b/Main.tscn index 108b86b..5b13e11 100644 --- a/Main.tscn +++ b/Main.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=66 format=3 uid="uid://b2sygl55s6fng"] +[gd_scene load_steps=67 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"] @@ -18,7 +18,6 @@ [ext_resource type="Script" path="res://cover.gd" id="12_3v50a"] [ext_resource type="Script" path="res://playlists_panel.gd" id="12_8ie8y"] [ext_resource type="Script" path="res://settings_button.gd" id="12_073mb"] -[ext_resource type="Texture2D" uid="uid://bdpat2sfflaxq" path="res://Youtube_logo.png" id="12_bc5ym"] [ext_resource type="Texture2D" uid="uid://myq6n4bshduj" path="res://search.png" id="12_cv2gm"] [ext_resource type="Script" path="res://search_bar.gd" id="12_mr42x"] [ext_resource type="Script" path="res://select_playlist.gd" id="12_of5fe"] @@ -30,6 +29,8 @@ [ext_resource type="Texture2D" uid="uid://1rstn6r2wisy" path="res://X.png" id="14_mioc4"] [ext_resource type="Script" path="res://Spinning.gd" id="14_rhw4k"] [ext_resource type="Script" path="res://yt_tab_button.gd" id="16_2t15p"] +[ext_resource type="Script" path="res://help_button.gd" id="17_4b8oh"] +[ext_resource type="Texture2D" uid="uid://bmbxyma4ra46p" path="res://Download.png" id="29_v44vi"] [ext_resource type="Script" path="res://update_checker.gd" id="30_byc5i"] [ext_resource type="Script" path="res://patch_notes_button.gd" id="31_hjsj1"] [ext_resource type="Script" path="res://CustomButtonColor.gd" id="32_pwgec"] @@ -271,7 +272,7 @@ script = ExtResource("12_3v50a") layout_mode = 0 offset_left = 20.0 offset_top = 24.0 -offset_right = 257.0 +offset_right = 256.0 offset_bottom = 80.0 focus_mode = 0 toggle_mode = true @@ -355,6 +356,24 @@ layout_mode = 2 size_flags_vertical = 4 alignment = 1 +[node name="YtTabButton" type="Button" parent="."] +texture_filter = 1 +layout_mode = 1 +anchors_preset = -1 +anchor_left = 1.0 +anchor_right = 1.0 +offset_left = -77.0 +offset_top = 131.0 +offset_right = -5.0 +offset_bottom = 203.0 +grow_horizontal = 0 +grow_vertical = 2 +scale = Vector2(0.79, 0.79) +focus_mode = 0 +toggle_mode = true +icon = ExtResource("29_v44vi") +script = ExtResource("16_2t15p") + [node name="YoutubeMenuHolder" type="Control" parent="."] layout_mode = 1 anchors_preset = 1 @@ -380,7 +399,7 @@ anchor_bottom = 1.0 offset_left = -7.0 offset_top = -5.0 offset_right = 7.0 -offset_bottom = 5.0 +offset_bottom = 46.0 grow_horizontal = 2 grow_vertical = 2 color = Color(0.14902, 0.14902, 0.14902, 1) @@ -400,6 +419,16 @@ offset_bottom = 110.0 focus_mode = 0 text = "Download" +[node name="YTCancel" type="Button" parent="YoutubeMenuHolder/Youtube menu"] +layout_mode = 1 +offset_left = 2.17004 +offset_top = 113.0 +offset_right = 89.17 +offset_bottom = 153.0 +focus_mode = 0 +disabled = true +text = "Cancel" + [node name="LoadingIMG" type="Sprite2D" parent="YoutubeMenuHolder/Youtube menu"] position = Vector2(108, 91) rotation = 1.5708 @@ -416,6 +445,23 @@ offset_bottom = 72.0 text = "NOTE: speeds depend on your internet" label_settings = SubResource("LabelSettings_fiiw4") +[node name="HelpButton" type="Button" parent="YoutubeMenuHolder/Youtube menu"] +custom_minimum_size = Vector2(32, 32) +layout_mode = 1 +anchors_preset = 3 +anchor_left = 1.0 +anchor_top = 1.0 +anchor_right = 1.0 +anchor_bottom = 1.0 +offset_left = -31.83 +offset_top = -40.0 +offset_right = 0.170044 +offset_bottom = -8.0 +grow_horizontal = 0 +grow_vertical = 0 +text = "?" +script = ExtResource("17_4b8oh") + [node name="CreatePlaylistsMenu" type="Control" parent="."] visible = false layout_mode = 1 @@ -813,24 +859,6 @@ offset_top = 174.0 offset_right = 1082.0 offset_bottom = 214.0 -[node name="YtTabButton" type="Button" parent="."] -layout_mode = 1 -anchors_preset = -1 -anchor_left = 1.0 -anchor_right = 1.0 -offset_left = -97.0 -offset_top = 109.0 -offset_right = 551.0 -offset_bottom = 560.0 -grow_horizontal = 0 -grow_vertical = 2 -scale = Vector2(0.105, 0.105) -focus_mode = 0 -toggle_mode = true -icon = ExtResource("12_bc5ym") -flat = true -script = ExtResource("16_2t15p") - [node name="Version" type="Label" parent="."] layout_mode = 1 anchors_preset = 3 @@ -1058,6 +1086,7 @@ 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"] +[connection signal="toggled" from="YtTabButton" to="YtTabButton" method="_on_toggled"] [connection signal="dir_selected" from="CreatePlaylistsMenu/FileDialog" to="CreatePlaylistsMenu" method="_on_file_dialog_dir_selected"] [connection signal="text_changed" from="CreatePlaylistsMenu/ScrollContainer/VBoxContainer/PlaylistName" to="CreatePlaylistsMenu" method="_on_playlist_name_text_changed"] [connection signal="pressed" from="CreatePlaylistsMenu/ScrollContainer/VBoxContainer/SelectDirButton" to="CreatePlaylistsMenu" method="_on_select_dir_button_pressed"] @@ -1068,7 +1097,6 @@ horizontal_alignment = 1 [connection signal="text_submitted" from="SearchBar" to="SearchBar" method="_on_text_submitted"] [connection signal="index_pressed" from="SearchResults" to="SearchBar" method="_on_search_results_index_pressed"] [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"] diff --git a/Youtube_logo.png b/Youtube_logo.png deleted file mode 100644 index a37389d..0000000 Binary files a/Youtube_logo.png and /dev/null differ diff --git a/addons/discord-rpc-gd/restart_window.tscn b/addons/discord-rpc-gd/restart_window.tscn index aa19bf1..1c7404a 100644 --- a/addons/discord-rpc-gd/restart_window.tscn +++ b/addons/discord-rpc-gd/restart_window.tscn @@ -9,7 +9,7 @@ Button/styles/focus = SubResource("StyleBoxEmpty_1t7mm") [sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_5vqdt"] -[sub_resource type="Image" id="Image_cdrfa"] +[sub_resource type="Image" id="Image_j0vw3"] 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_cdrfa") +image = SubResource("Image_j0vw3") [sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_7v0rg"] diff --git a/addons/godot-yt-dlp/src/yt_dlp.gd b/addons/godot-yt-dlp/src/yt_dlp.gd index 0745b63..985029c 100644 --- a/addons/godot-yt-dlp/src/yt_dlp.gd +++ b/addons/godot-yt-dlp/src/yt_dlp.gd @@ -100,6 +100,7 @@ class Download extends RefCounted: var _status: Status = Status.READY var _thread: Thread = null + var _process_id:int # Fields var _url: String @@ -158,6 +159,7 @@ class Download extends RefCounted: func _execute_on_thread() -> void: + var _process_id:int var executable: String = OS.get_user_data_dir() + \ ("/yt-dlp.exe" if OS.get_name() == "Windows" else "/yt-dlp") @@ -187,7 +189,7 @@ class Download extends RefCounted: options_and_arguments.append_array(["--no-continue", "-P", file_path, _url]) var output: Array = [] - OS.execute(executable, PackedStringArray(options_and_arguments), output) + _process_id = OS.execute(executable, PackedStringArray(options_and_arguments), output) print(options_and_arguments) self._thread_finished.call_deferred() diff --git a/help_button.gd b/help_button.gd new file mode 100644 index 0000000..73c599e --- /dev/null +++ b/help_button.gd @@ -0,0 +1,14 @@ +extends Button + + +# Called when the node enters the scene tree for the first time. +func _ready() -> void: + pass # Replace with function body. + + +func _pressed() -> void: + OS.shell_open("https://github.com/yt-dlp/yt-dlp/blob/master/supportedsites.md") + +# Called every frame. 'delta' is the elapsed time since the previous frame. +func _process(delta: float) -> void: + pass diff --git a/yt_tab_button.gd b/yt_tab_button.gd index 099a7e9..d2ad94d 100644 --- a/yt_tab_button.gd +++ b/yt_tab_button.gd @@ -5,9 +5,11 @@ extends Button @onready var yt_link: LineEdit = $"../YoutubeMenuHolder/Youtube menu/YTLink" @onready var yt_download: Button = $"../YoutubeMenuHolder/Youtube menu/YTDownload" @onready var loading_img: Sprite2D = $"../YoutubeMenuHolder/Youtube menu/LoadingIMG" +@onready var yt_cancel: Button = $"../YoutubeMenuHolder/Youtube menu/YTCancel" + var currentlyExtending:bool var Target:float = 50 - +var CurrentDownload:YtDlp.Download signal ContinueProcess @onready var Parent:MainScene = get_tree().root.get_child(2) @@ -16,7 +18,11 @@ signal ContinueProcess func _ready() -> void: YtDlp.setup_completed.connect(YTSetupCompleted) yt_download.pressed.connect(DownloadYTVidFromLink) + yt_cancel.pressed.connect(CancelDownload) +func CancelDownload(): + if CurrentDownload != null: + print("! PROCCES ID: " + str(CurrentDownload._process_id)) # Called every frame. 'delta' is the elapsed time since the previous frame. func _process(delta: float) -> void: @@ -49,7 +55,7 @@ func DownloadYTVidFromLink(): if yt_link.text.is_empty(): OS.alert("please gimme a link") return - if "&list=" in yt_link.text: + if "list=" in yt_link.text: Parent.playlist_or_song.show() Parent.playlist_or_song.confirmed.connect(DownloadPlaylistConf) Parent.playlist_or_song.canceled.connect(DownloadSingleSongConf) @@ -59,8 +65,10 @@ func DownloadYTVidFromLink(): if download == null: OS.alert("youtube setup has not finished, please wait for the finish notification") return + yt_cancel.disabled = false loading_img.show() yt_link.clear() + CurrentDownload = download download.set_destination(owner.PlaylistsLocation[owner.CurrentPlaylist]) print(owner.PlaylistsLocation[owner.CurrentPlaylist]) download.convert_to_audio(YtDlp.Audio.MP3) @@ -69,9 +77,11 @@ func DownloadYTVidFromLink(): download.completely_finished.connect(DownloadCompleted) func DownloadCompleted(): + yt_cancel.disabled = true yt_download.disabled = false owner.GetSongs(owner.PlaylistsLocation[owner.CurrentPlaylist]) loading_img.hide() + CurrentDownload = null func _on_toggled(toggled_on: bool) -> void: