diff --git a/Main.tscn b/Main.tscn index 411233b..4bcc58c 100644 --- a/Main.tscn +++ b/Main.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=79 format=3 uid="uid://b2sygl55s6fng"] +[gd_scene load_steps=80 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"] @@ -39,6 +39,7 @@ [ext_resource type="AudioStream" uid="uid://n8g3v41u2u48" path="res://Error.wav" id="38_nkjlp"] [ext_resource type="Script" path="res://birthday_container.gd" id="38_pitc3"] [ext_resource type="AudioStream" uid="uid://bwfw3l3iyv67o" path="res://roblox win sound effect.mp3" id="39_3er0p"] +[ext_resource type="PackedScene" uid="uid://n7cnapaftfse" path="res://playing_now_window.tscn" id="40_ismud"] [sub_resource type="ShaderMaterial" id="ShaderMaterial_kvkfy"] shader = ExtResource("8_xtnau") @@ -752,7 +753,7 @@ offset_right = -200.0 offset_bottom = -95.0 grow_horizontal = 2 grow_vertical = 0 -text = "Please make a Playlist " +text = "(no song)" label_settings = SubResource("LabelSettings_6prit") clip_text = true text_overrun_behavior = 2 @@ -769,7 +770,6 @@ offset_right = -199.0 offset_bottom = -68.0 grow_horizontal = 2 grow_vertical = 0 -text = "Artist name" label_settings = SubResource("LabelSettings_jg5vn") clip_text = true text_overrun_behavior = 2 @@ -786,7 +786,6 @@ offset_right = -199.0 offset_bottom = -53.0 grow_horizontal = 2 grow_vertical = 0 -text = "Album" label_settings = SubResource("LabelSettings_6um0v") clip_text = true text_overrun_behavior = 2 @@ -911,7 +910,7 @@ offset_left = -64.0 offset_top = -23.0 grow_horizontal = 0 grow_vertical = 0 -text = "v1.5.2" +text = "v1.5.3" horizontal_alignment = 2 [node name="SettingsButton" type="Button" parent="."] @@ -1304,6 +1303,17 @@ grow_vertical = 2 text = "Happy Birthday!" label_settings = SubResource("LabelSettings_f1d3e") +[node name="PlayingNow" type="Window" parent="."] +transparent_bg = true +visible = false +borderless = true +transparent = true +mouse_passthrough = true +force_native = true + +[node name="PlayingNowWindow" parent="PlayingNow" node_paths=PackedStringArray("ParentScene") instance=ExtResource("40_ismud")] +ParentScene = NodePath("../..") + [connection signal="toggled" from="SelectPlaylist" to="SelectPlaylist" method="_on_toggled"] [connection signal="pressed" from="PlaylistPanelHolder/PlaylistsPanel/PlaylistsContainer/VBoxContainer/HBoxContainer/CreatePlaylist" to="PlaylistPanelHolder/PlaylistsPanel" method="_on_create_playlist_pressed"] [connection signal="toggled" from="PlaylistPanelHolder/PlaylistsPanel/PlaylistsContainer/VBoxContainer/HBoxContainer/PlayAll" to="PlaylistPanelHolder/PlaylistsPanel" method="_on_play_all_toggled"] diff --git a/Settings.tscn b/Settings.tscn index 075a74b..848d35f 100644 --- a/Settings.tscn +++ b/Settings.tscn @@ -41,7 +41,6 @@ anchor_right = 1.0 anchor_bottom = 1.0 grow_horizontal = 2 grow_vertical = 2 -scroll_vertical = 100 [node name="VBoxContainer" type="VBoxContainer" parent="ScrollContainer"] custom_minimum_size = Vector2(576, 493) @@ -507,6 +506,31 @@ autowrap_mode = 2 custom_minimum_size = Vector2(0, 16.07) layout_mode = 2 +[node name="MISC" type="Label" parent="ScrollContainer/VBoxContainer"] +custom_minimum_size = Vector2(400, 26.975) +layout_mode = 2 +size_flags_horizontal = 4 +size_flags_vertical = 3 +text = "MISC" +label_settings = SubResource("LabelSettings_2bhor") +horizontal_alignment = 1 +vertical_alignment = 1 +autowrap_mode = 2 + +[node name="NowPlayingWindowButton" type="CheckBox" parent="ScrollContainer/VBoxContainer"] +layout_mode = 2 +focus_mode = 0 +text = "Now playing window" + +[node name="NowPlayingInfo" type="Label" parent="ScrollContainer/VBoxContainer"] +custom_minimum_size = Vector2(229.895, 0) +layout_mode = 2 +size_flags_horizontal = 0 +text = "This setting enables a dedicated window for displaying the currently playing song. this can be useful when streaming " +label_settings = SubResource("LabelSettings_p55k3") +vertical_alignment = 1 +autowrap_mode = 2 + [node name="Credits" type="VBoxContainer" parent="ScrollContainer/VBoxContainer"] layout_mode = 2 @@ -588,6 +612,7 @@ flat = true [connection signal="drag_ended" from="ScrollContainer/VBoxContainer/CompressionContainer/ThresholdSettings/ThresholdSlider" to="." method="_on_threshold_slider_drag_ended"] [connection signal="drag_ended" from="ScrollContainer/VBoxContainer/CompressionContainer/RatioSettings/RatioSlider" to="." method="_on_ratio_slider_drag_ended"] [connection signal="drag_ended" from="ScrollContainer/VBoxContainer/CompressionContainer/GainSettings/GainSlider" to="." method="_on_gain_slider_drag_ended"] +[connection signal="toggled" from="ScrollContainer/VBoxContainer/NowPlayingWindowButton" to="." method="_on_now_playing_window_button_toggled"] [connection signal="pressed" from="ScrollContainer/VBoxContainer/Reset" to="." method="_on_reset_pressed"] [connection signal="pressed" from="ScrollContainer/VBoxContainer/Reset" to="ScrollContainer/VBoxContainer/EQSettings" method="_on_reset_pressed"] [connection signal="pressed" from="Exit" to="." method="_on_exit_pressed"] diff --git a/main.gd b/main.gd index e23ab80..f2cdc8a 100644 --- a/main.gd +++ b/main.gd @@ -31,6 +31,7 @@ extends Control @onready var search_results: SearchResults = $SearchResults @onready var delete_confirm: ConfirmationDialog = $deleteConfirm @onready var search_bar: LineEdit = $SearchBar +@onready var playing_now: Window = $PlayingNow var DiscordUsername:String @@ -62,6 +63,7 @@ var PlaylistsLocation:Dictionary var BackroundSetup:bool var CurrentPlaylist:String var PlayAllLists:bool +var UsingPlayingNow:bool @export var LoopPressed:Texture2D @export var LoopNotPressed:Texture2D @@ -69,11 +71,17 @@ var PlayAllLists:bool signal ContinueDelete var deleteSong:bool +signal SongChanged +var currentSongName:String +var currentArtistName:String +var currentAlbumName:String + var LoadingSaveFailed:bool @onready var loading_failed_screen: Control = $LoadingFailedScreen # Called when the node enters the scene tree for the first time. func _ready() -> void: + playing_now.visible = false get_tree().root.min_size = Vector2(850,492) current_progress.drag_ended.connect(SongDragStopped) current_progress.drag_started.connect(SongDragStarted) @@ -156,6 +164,8 @@ func _ready() -> void: PlayAllLists = data["PlayAllLists"] if PlayAllLists: play_all.button_pressed = true + if data.has("UsingPlayingNow"): + UsingPlayingNow = data["UsingPlayingNow"] else: if data != null: print(data["Volume"]) @@ -350,7 +360,7 @@ func PlaySongs(): if LoopingSong: music_player.play() elif textSongs.size() != 0: - var index + var index:int if OpenedSong.is_empty(): if PlayAllLists: if CurrentIDX >= (textSongs.size()): @@ -369,6 +379,7 @@ func PlaySongs(): GetSongs(PlaylistsLocation[CurrentPlaylist]) var CurrentSongDir:String = PlaylistsLocation[CurrentPlaylist] + "/" + textSongs[index] DiscordRPC.details = textSongs[index].replace(".mp3","") + currentSongName = textSongs[index].replace(".mp3","") print(CurrentSongDir) var sonnname:String = textSongs[index] sonnname = sonnname.replace(".mp3", "") @@ -385,11 +396,13 @@ func PlaySongs(): if MusicMetadataAutoload.get_mp3_metadata(song).title != "": song_name.text = MusicMetadataAutoload.get_mp3_metadata(song).title if MusicMetadataAutoload.get_mp3_metadata(song).artist != "": - artist_name.text = MusicMetadataAutoload.get_mp3_metadata(song).artist - else: artist_name.text = "" + currentArtistName = MusicMetadataAutoload.get_mp3_metadata(song).artist + else: currentArtistName = "" + artist_name.text = currentArtistName if MusicMetadataAutoload.get_mp3_metadata(song).album != "": - album_name.text = MusicMetadataAutoload.get_mp3_metadata(song).album - else: album_name.text = "" + currentAlbumName = MusicMetadataAutoload.get_mp3_metadata(song).album + else: currentAlbumName = "" + album_name.text = currentAlbumName if song != null: CurrentSongLenth = song.get_length() music_player.stream = song @@ -397,6 +410,7 @@ func PlaySongs(): if !LoadingSaveFailed: SaveEverything() print("set stream") + SongChanged.emit() func GetSongs(dir:String): @@ -465,6 +479,7 @@ func PlaylistSelected(Playlist:String,PlaylistLocation:String): # Called every frame. 'delta' is the elapsed time since the previous frame. func _process(_delta: float) -> void: + playing_now.visible = UsingPlayingNow currentSaveTime -= _delta if !BackroundSetup: if CurrentCustomBackroundImageDirectory != null and CurrentCustomBackroundImageDirectory != "": @@ -583,7 +598,8 @@ func SaveEverything(): "CompressionGain" : settings_menu_child.gain_slider.value, "CurrentCustomBackroundImageDirectory" : CurrentCustomBackroundImageDirectory, "PlayAllLists" : PlayAllLists, - "DiscordUsername" : DiscordRPC.get_current_user().get("username") + "DiscordUsername" : DiscordRPC.get_current_user().get("username"), + "UsingPlayingNow" : UsingPlayingNow } print("saving") saveUserdata(Data) diff --git a/playing_now_window.gd b/playing_now_window.gd new file mode 100644 index 0000000..4bdca20 --- /dev/null +++ b/playing_now_window.gd @@ -0,0 +1,21 @@ +extends Control + +@export var ParentScene:MainScene +@onready var desctibtor: Label = $Desctibtor +@onready var ParentWindow:Window = $".." +# Called when the node enters the scene tree for the first time. +func _ready() -> void: + ParentScene.SongChanged.connect(SongChanged) + + + +# Called every frame. 'delta' is the elapsed time since the previous frame. +func _process(delta: float) -> void: + ParentWindow.size = size + +func SongChanged(): + print("SongChanged: ", ParentScene.currentSongName) + desctibtor.text = 'Now Playing: "' + ParentScene.currentSongName + '"' + if ParentScene.currentArtistName: + desctibtor.text += " from " + ParentScene.currentArtistName + #ParentWindow.size = size * 2 diff --git a/playing_now_window.tscn b/playing_now_window.tscn new file mode 100644 index 0000000..a8a24e2 --- /dev/null +++ b/playing_now_window.tscn @@ -0,0 +1,21 @@ +[gd_scene load_steps=2 format=3 uid="uid://n7cnapaftfse"] + +[ext_resource type="Script" path="res://playing_now_window.gd" id="1_f0rac"] + +[node name="PlayingNowWindow" type="AspectRatioContainer"] +offset_right = 160.0 +offset_bottom = 23.0 +script = ExtResource("1_f0rac") + +[node name="Desctibtor" type="Label" parent="."] +layout_mode = 2 + +[node name="ColorRect" type="ColorRect" parent="Desctibtor"] +z_index = -2 +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +color = Color(0.187176, 0.187176, 0.187176, 0.101961) diff --git a/project.godot b/project.godot index accda60..9468e23 100644 --- a/project.godot +++ b/project.godot @@ -32,6 +32,7 @@ window/size/initial_position_type=3 window/size/extend_to_title=true window/energy_saving/keep_screen_on=false window/stretch/aspect="expand" +window/per_pixel_transparency/allowed=true [dotnet] diff --git a/settings.gd b/settings.gd index 6b0b29e..9a0d8a6 100644 --- a/settings.gd +++ b/settings.gd @@ -2,6 +2,8 @@ class_name Settings extends Control @onready var exit: Button = $Exit +# do NOT think i dont hate this codebase, it sucks man 😭 + @onready var discord_rich_presence_button: CheckBox = $ScrollContainer/VBoxContainer/DiscordRichPresenceButton @onready var pitch_slider: HSlider = $ScrollContainer/VBoxContainer/PitchAdjustSettings/PitchSlider @@ -40,11 +42,14 @@ extends Control @onready var select_bg: Button = $ScrollContainer/VBoxContainer/VBoxContainer/HBoxContainer/SelectBG @onready var reset_bg: Button = $ScrollContainer/VBoxContainer/VBoxContainer/HBoxContainer/ResetBG +@onready var now_playing_window_button: CheckBox = $ScrollContainer/VBoxContainer/NowPlayingWindowButton + + var CurrentBGImagePath:String # Called when the node enters the scene tree for the first time. func _ready() -> void: - pass + now_playing_window_button.button_pressed = Parent.UsingPlayingNow # Called every frame. 'delta' is the elapsed time since the previous frame. @@ -181,3 +186,9 @@ func _on_reset_bg_pressed() -> void: Parent.user_bg.texture = null Parent.CurrentCustomBackroundImageDirectory = "" Parent.SaveEverything() + + +func _on_now_playing_window_button_toggled(toggled_on: bool) -> void: + Parent.UsingPlayingNow = toggled_on + Parent.SaveEverything() + diff --git a/wallpaper_manager.gd b/wallpaper_manager.gd index 174b5de..e9c205d 100644 --- a/wallpaper_manager.gd +++ b/wallpaper_manager.gd @@ -11,27 +11,26 @@ func _ready() -> void: # Called every frame. 'delta' is the elapsed time since the previous frame. func _process(delta: float) -> void: - if true != true: - var timeInHours = Time.get_datetime_dict_from_system()["hour"] - if timeInHours < 6: - currentBG = 3 - elif timeInHours >= 6 and timeInHours <= 9: - currentBG = 2 - elif timeInHours >= 9 and timeInHours <= 17: - currentBG = 1 - elif timeInHours >= 17 and timeInHours <= 21: - currentBG = 2 - elif timeInHours > 21: - currentBG = 3 - if currentBG == 1: - Daytime.show() - Nighttime.hide() - Evening.hide() - elif currentBG == 2: - Daytime.hide() - Nighttime.hide() - Evening.show() - elif currentBG == 3: - Daytime.hide() - Nighttime.show() - Evening.hide() + var timeInHours = Time.get_datetime_dict_from_system()["hour"] + if timeInHours < 6: + currentBG = 3 + elif timeInHours >= 6 and timeInHours <= 9: + currentBG = 2 + elif timeInHours >= 9 and timeInHours <= 17: + currentBG = 1 + elif timeInHours >= 17 and timeInHours <= 21: + currentBG = 2 + elif timeInHours > 21: + currentBG = 3 + if currentBG == 1: + Daytime.show() + Nighttime.hide() + Evening.hide() + elif currentBG == 2: + Daytime.hide() + Nighttime.hide() + Evening.show() + elif currentBG == 3: + Daytime.hide() + Nighttime.show() + Evening.hide()