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
|
||||
|
||||
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 _unsync = flags & 0x80 > 0
|
||||
var extended = flags & 0x40 > 0
|
||||
@@ -66,15 +66,18 @@ func get_mp3_metadata(stream: AudioStreamMP3) -> MusicMetadata:
|
||||
match frame_id:
|
||||
"TBPM", 'TBP':
|
||||
meta.bpm = int(get_string_from_data(data, idx, size))
|
||||
"TIT2":
|
||||
"TIT2","TT2":
|
||||
print("a " + str(Array(data.slice(idx, idx + 3)).hash()))
|
||||
print([1, 0xff, 0xfe].hash())
|
||||
meta.title = get_string_from_data(data, idx, size)
|
||||
"TALB", 'TAL':
|
||||
meta.album = get_string_from_data(data, idx, size)
|
||||
"COMM":
|
||||
meta.comments = get_string_from_data(data, idx, size)
|
||||
"TYER":
|
||||
"COMM","COM":
|
||||
var string:String = get_string_from_data(data, idx, size)
|
||||
print("got comment " + string)
|
||||
if string:
|
||||
meta.comments = string
|
||||
"TYER","TYE":
|
||||
meta.year = int(get_string_from_data(data, idx, size))
|
||||
"TPE1", 'TP1':
|
||||
meta.artist = get_string_from_data(data, idx, size)
|
||||
|
||||
+19
-20
@@ -6,28 +6,32 @@
|
||||
[node name="SearchItem" type="Control"]
|
||||
custom_minimum_size = Vector2(0, 30)
|
||||
layout_mode = 3
|
||||
anchors_preset = 14
|
||||
anchor_top = 0.5
|
||||
anchors_preset = 10
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 0.5
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 4
|
||||
script = ExtResource("1_j4126")
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="."]
|
||||
custom_minimum_size = Vector2(700, 32)
|
||||
custom_minimum_size = Vector2(200, 32)
|
||||
layout_mode = 1
|
||||
anchors_preset = 4
|
||||
anchor_top = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_top = -16.0
|
||||
offset_right = 700.0
|
||||
offset_bottom = 16.0
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
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"]
|
||||
custom_minimum_size = Vector2(20, 0)
|
||||
layout_mode = 2
|
||||
@@ -38,17 +42,12 @@ flat = true
|
||||
icon_alignment = 1
|
||||
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="."]
|
||||
item_count = 1
|
||||
item_count = 2
|
||||
item_0/text = "DELETE"
|
||||
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/Dropdown" to="." method="_on_dropdown_pressed"]
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
class_name MainScene
|
||||
extends Control
|
||||
static var instance:MainScene
|
||||
@onready var file_dialog: FileDialog = $FileDialog
|
||||
@onready var music_player: AudioStreamPlayer = $MusicPlayer
|
||||
@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.
|
||||
func _ready() -> void:
|
||||
instance = self
|
||||
playing_now.visible = false
|
||||
get_tree().root.min_size = Vector2(850,492)
|
||||
current_progress.drag_ended.connect(SongDragStopped)
|
||||
|
||||
+11
-1
@@ -16,8 +16,18 @@ func _ready() -> void:
|
||||
popup_menu.index_pressed.connect(popupPressed)
|
||||
|
||||
func popupPressed(idx:int):
|
||||
if idx == 0:
|
||||
match idx:
|
||||
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.
|
||||
func _process(delta: float) -> void:
|
||||
|
||||
Reference in New Issue
Block a user