first steps for opening the source url on songs
This commit is contained in:
@@ -38,7 +38,7 @@ func get_mp3_metadata(stream: AudioStreamMP3) -> MusicMetadata:
|
|||||||
return meta
|
return meta
|
||||||
|
|
||||||
var v = "ID3v2.%d.%d" % [header[3], header[4]]
|
var v = "ID3v2.%d.%d" % [header[3], header[4]]
|
||||||
if v == "ID3v2.4.0" or v == "ID3v2.3.0":
|
if v == "ID3v2.4.0" or v == "ID3v2.3.0" or v == "ID3v2.2.0":
|
||||||
var flags = header[5]
|
var flags = header[5]
|
||||||
var _unsync = flags & 0x80 > 0
|
var _unsync = flags & 0x80 > 0
|
||||||
var extended = flags & 0x40 > 0
|
var extended = flags & 0x40 > 0
|
||||||
@@ -66,15 +66,18 @@ func get_mp3_metadata(stream: AudioStreamMP3) -> MusicMetadata:
|
|||||||
match frame_id:
|
match frame_id:
|
||||||
"TBPM", 'TBP':
|
"TBPM", 'TBP':
|
||||||
meta.bpm = int(get_string_from_data(data, idx, size))
|
meta.bpm = int(get_string_from_data(data, idx, size))
|
||||||
"TIT2":
|
"TIT2","TT2":
|
||||||
print("a " + str(Array(data.slice(idx, idx + 3)).hash()))
|
print("a " + str(Array(data.slice(idx, idx + 3)).hash()))
|
||||||
print([1, 0xff, 0xfe].hash())
|
print([1, 0xff, 0xfe].hash())
|
||||||
meta.title = get_string_from_data(data, idx, size)
|
meta.title = get_string_from_data(data, idx, size)
|
||||||
"TALB", 'TAL':
|
"TALB", 'TAL':
|
||||||
meta.album = get_string_from_data(data, idx, size)
|
meta.album = get_string_from_data(data, idx, size)
|
||||||
"COMM":
|
"COMM","COM":
|
||||||
meta.comments = get_string_from_data(data, idx, size)
|
var string:String = get_string_from_data(data, idx, size)
|
||||||
"TYER":
|
print("got comment " + string)
|
||||||
|
if string:
|
||||||
|
meta.comments = string
|
||||||
|
"TYER","TYE":
|
||||||
meta.year = int(get_string_from_data(data, idx, size))
|
meta.year = int(get_string_from_data(data, idx, size))
|
||||||
"TPE1", 'TP1':
|
"TPE1", 'TP1':
|
||||||
meta.artist = get_string_from_data(data, idx, size)
|
meta.artist = get_string_from_data(data, idx, size)
|
||||||
|
|||||||
+19
-20
@@ -6,28 +6,32 @@
|
|||||||
[node name="SearchItem" type="Control"]
|
[node name="SearchItem" type="Control"]
|
||||||
custom_minimum_size = Vector2(0, 30)
|
custom_minimum_size = Vector2(0, 30)
|
||||||
layout_mode = 3
|
layout_mode = 3
|
||||||
anchors_preset = 14
|
anchors_preset = 10
|
||||||
anchor_top = 0.5
|
|
||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
anchor_bottom = 0.5
|
|
||||||
grow_horizontal = 2
|
grow_horizontal = 2
|
||||||
grow_vertical = 2
|
|
||||||
size_flags_horizontal = 3
|
size_flags_horizontal = 3
|
||||||
size_flags_vertical = 4
|
size_flags_vertical = 4
|
||||||
script = ExtResource("1_j4126")
|
script = ExtResource("1_j4126")
|
||||||
|
|
||||||
[node name="HBoxContainer" type="HBoxContainer" parent="."]
|
[node name="HBoxContainer" type="HBoxContainer" parent="."]
|
||||||
custom_minimum_size = Vector2(700, 32)
|
custom_minimum_size = Vector2(200, 32)
|
||||||
layout_mode = 1
|
layout_mode = 1
|
||||||
anchors_preset = 4
|
anchors_preset = 15
|
||||||
anchor_top = 0.5
|
anchor_right = 1.0
|
||||||
anchor_bottom = 0.5
|
anchor_bottom = 1.0
|
||||||
offset_top = -16.0
|
grow_horizontal = 2
|
||||||
offset_right = 700.0
|
|
||||||
offset_bottom = 16.0
|
|
||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
alignment = 1
|
alignment = 1
|
||||||
|
|
||||||
|
[node name="Songname" type="Button" parent="HBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
focus_mode = 0
|
||||||
|
flat = true
|
||||||
|
alignment = 0
|
||||||
|
text_overrun_behavior = 1
|
||||||
|
clip_text = true
|
||||||
|
|
||||||
[node name="Dropdown" type="Button" parent="HBoxContainer"]
|
[node name="Dropdown" type="Button" parent="HBoxContainer"]
|
||||||
custom_minimum_size = Vector2(20, 0)
|
custom_minimum_size = Vector2(20, 0)
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
@@ -38,17 +42,12 @@ flat = true
|
|||||||
icon_alignment = 1
|
icon_alignment = 1
|
||||||
expand_icon = true
|
expand_icon = true
|
||||||
|
|
||||||
[node name="Songname" type="Button" parent="HBoxContainer"]
|
|
||||||
layout_mode = 2
|
|
||||||
size_flags_horizontal = 3
|
|
||||||
focus_mode = 0
|
|
||||||
flat = true
|
|
||||||
alignment = 0
|
|
||||||
|
|
||||||
[node name="PopupMenu" type="PopupMenu" parent="."]
|
[node name="PopupMenu" type="PopupMenu" parent="."]
|
||||||
item_count = 1
|
item_count = 2
|
||||||
item_0/text = "DELETE"
|
item_0/text = "DELETE"
|
||||||
item_0/id = 0
|
item_0/id = 0
|
||||||
|
item_1/text = "open source"
|
||||||
|
item_1/id = 1
|
||||||
|
|
||||||
[connection signal="pressed" from="HBoxContainer/Dropdown" to="." method="_on_dropdown_pressed"]
|
|
||||||
[connection signal="pressed" from="HBoxContainer/Songname" to="." method="_on_songname_pressed"]
|
[connection signal="pressed" from="HBoxContainer/Songname" to="." method="_on_songname_pressed"]
|
||||||
|
[connection signal="pressed" from="HBoxContainer/Dropdown" to="." method="_on_dropdown_pressed"]
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
class_name MainScene
|
class_name MainScene
|
||||||
extends Control
|
extends Control
|
||||||
|
static var instance:MainScene
|
||||||
@onready var file_dialog: FileDialog = $FileDialog
|
@onready var file_dialog: FileDialog = $FileDialog
|
||||||
@onready var music_player: AudioStreamPlayer = $MusicPlayer
|
@onready var music_player: AudioStreamPlayer = $MusicPlayer
|
||||||
@onready var randomize_list: Button = $RandomizeList
|
@onready var randomize_list: Button = $RandomizeList
|
||||||
@@ -83,6 +84,7 @@ var LoadingSaveFailed:bool = true
|
|||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
# Called when the node enters the scene tree for the first time.
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
|
instance = self
|
||||||
playing_now.visible = false
|
playing_now.visible = false
|
||||||
get_tree().root.min_size = Vector2(850,492)
|
get_tree().root.min_size = Vector2(850,492)
|
||||||
current_progress.drag_ended.connect(SongDragStopped)
|
current_progress.drag_ended.connect(SongDragStopped)
|
||||||
|
|||||||
+12
-2
@@ -16,8 +16,18 @@ func _ready() -> void:
|
|||||||
popup_menu.index_pressed.connect(popupPressed)
|
popup_menu.index_pressed.connect(popupPressed)
|
||||||
|
|
||||||
func popupPressed(idx:int):
|
func popupPressed(idx:int):
|
||||||
if idx == 0:
|
match idx:
|
||||||
DeletePressed.emit(songidx)
|
0:
|
||||||
|
DeletePressed.emit(songidx)
|
||||||
|
1:
|
||||||
|
var songdir = MainScene.instance.CurrentDir + "/" + MainScene.instance.textSongs[songidx]
|
||||||
|
var song = AudioStreamMP3.load_from_file(songdir)
|
||||||
|
var meta:MusicMeta.MusicMetadata = MusicMeta.new().get_mp3_metadata(song)
|
||||||
|
print(songdir)
|
||||||
|
meta.print_info()
|
||||||
|
if meta.comments:
|
||||||
|
OS.shell_open(meta.comments)
|
||||||
|
|
||||||
|
|
||||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
func _process(delta: float) -> void:
|
func _process(delta: float) -> void:
|
||||||
|
|||||||
Reference in New Issue
Block a user