Initial work on Mastodon API stuff
continuous-integration/drone/tag Build is failing Details
continuous-integration/drone/push Build is failing Details

This commit is contained in:
Martyn 2020-09-27 22:58:03 +02:00
parent bdb53d763a
commit 4f97d9bc47
14 changed files with 664 additions and 11 deletions

View File

@ -0,0 +1,91 @@
extends Node
# Declare member variables here. Examples:
# var a = 2
# var b = "text"
var SongTitle = ""
var SongArtist = ""
var CompletionType
var Tags = ""
var OriginalURL = ""
var PartsURLs = []
var PartsVolumes = []
var PartsDelays = []
var PartsOthers = []
var BackVolume = 0
enum CompletionTypeOptions {
OpenSeed,
SoloCompletion,
DuetCompletion,
AllHarmony,
AllMelody
}
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
func setSongTitle(value):
SongTitle = value
func setSongArtist(value):
SongArtist = value
func setCompletionType(value):
CompletionType = value
func setTags(value):
Tags = value
func setOriginalURL(value):
OriginalURL = value
func setPartsURLs(value):
PartsURLs = value
func setPartsVolumes(value):
PartsVolumes = value
func setPartsDelays(value):
PartsDelays = value
func setBackVolume(value):
BackVolume = value
func getFinalText():
var completiontext = ""
var partof = ""
match CompletionType :
CompletionTypeOptions.OpenSeed:
completiontext = " and it's not complete until you sing the rest of it with me!"
partof = "part of "
CompletionTypeOptions.SoloCompletion:
completiontext = " let me know what you think!"
CompletionTypeOptions.DuetCompletion:
completiontext = " with "+PartsOthers+" and it sounds great, don't you think!?"
CompletionTypeOptions.AllHarmony:
partof = "only the harmonies of "
completiontext = " and would love someone to put the melody on top!"
CompletionTypeOptions.AllMelody:
partof = "only the melody of "
completiontext = " and would love someone to put some harmonies underneath!"
var partstext = "The audio track are attached"
if len(PartsURLs) > 0:
partstext = "The audio track urls are :"
for parturl in PartsURLs:
partstext += " "+parturl
partstext += ".\n"
var volumetext = "Backing volume recommendation: "+String(BackVolume)+"db. Parts volume recommendations: "
for partvolume in PartsVolumes:
volumetext += String(partvolume)+"db, "
volumetext += ".\n"
var partdelaytext = "Audio delay recommendations: "
for partDelay in PartsDelays:
partdelaytext += String(partDelay)+"s, "
return "Hey, I sang "+partof+SongTitle+" by "+SongArtist+" at "+OriginalURL+completiontext+" "+\
"\nWith #ASingCrow, you can join it and other songs.\n"+partstext+volumetext+partdelaytext+" "+Tags
# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta):
# pass

View File

@ -0,0 +1,25 @@
extends Control
signal on_cancel
signal on_authorize(code)
# Declare member variables here. Examples:
# var a = 2
# var b = "text"
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta):
# pass
func _on_Button2_pressed():
emit_signal("on_cancel")
func _on_Button_pressed():
emit_signal("on_authorize",$VBoxContainer/LineEdit.text)

View File

@ -0,0 +1,55 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://Components/MastoAuthCode.gd" type="Script" id=1]
[node name="Control" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Button2" type="Button" parent="."]
anchor_left = 1.0
anchor_right = 1.0
margin_left = -71.0
margin_top = 10.0
margin_right = -17.0
margin_bottom = 30.0
text = "Cancel"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="VBoxContainer" type="VBoxContainer" parent="."]
anchor_top = 0.5
anchor_right = 1.0
anchor_bottom = 0.5
margin_top = -33.0
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Label" type="Label" parent="VBoxContainer"]
margin_right = 1024.0
margin_bottom = 14.0
text = "Launched an authorisation request in your system's browser, please note down the code and enter it in the box below to continue"
align = 1
valign = 1
[node name="LineEdit" type="LineEdit" parent="VBoxContainer"]
margin_top = 18.0
margin_right = 1024.0
margin_bottom = 42.0
[node name="Button" type="Button" parent="VBoxContainer"]
margin_top = 46.0
margin_right = 1024.0
margin_bottom = 66.0
text = "Authorize"
__meta__ = {
"_edit_use_anchors_": false
}
[connection signal="pressed" from="Button2" to="." method="_on_Button2_pressed"]
[connection signal="pressed" from="VBoxContainer/Button" to="." method="_on_Button_pressed"]

View File

@ -0,0 +1,127 @@
extends Control
var ca_request
var auth_request
var toot_request
# Called when the node enters the scene tree for the first time.
func _ready():
Globals.loadConfig()
if len(Globals.providers.mastodon) > 0:
if Globals.providers.mastodon[0].has("baseURL"):
print("Setting base url")
$VBoxContainer/HBoxContainer/TextEdit.text = Globals.providers.mastodon[0].baseURL
if Globals.providers.mastodon[0].has("oauth_token"):
print("Already Registered")
$VBoxContainer/AuthUser.disabled = true
# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta):
# pass
func _on_Login_pressed():
if len(Globals.providers.mastodon) == 0:
Globals.providers.mastodon = {}
if !Globals.providers.mastodon[0].has("app_client_id"):
register_app()
if !Globals.providers.mastodon[0].has("oauth_token"):
auth_user()
func register_app():
var headers = ["Content-Type: application/json"]
var data = {
"client_name": "ASingCrow",
"redirect_uris": "urn:ietf:wg:oauth:2.0:oob",
"scopes": "read write follow push",
"website": "https://asingcrow.martyn.berlin"
}
ca_request = HTTPRequest.new()
add_child(ca_request)
ca_request.connect("request_completed",self,"_on_app_created")
ca_request.request("https://toot.martyn.berlin/api/v1/apps",headers,true,HTTPClient.METHOD_POST,JSON.print(data))
func _on_app_created(result, response_code, headers, body):
print("Response...")
if response_code != 200:
print("PANIC! got "+String(response_code))
print(body.get_string_from_utf8)
return
var response = parse_json(body.get_string_from_utf8())
var dict = {
"app_client_id": response.client_id,
"app_client_secret": response.client_secret }
Globals.providers.mastodon.append(dict)
Globals.saveConfig()
remove_child(ca_request)
func _on_token_requested(result, response_code, headers, body):
print("Response...")
if response_code != 200:
print("PANIC! got "+String(response_code))
print(body.get_string_from_utf8())
return
var response = parse_json(body.get_string_from_utf8())
Globals.providers.mastodon[0].oauth_token = response.access_token
Globals.saveConfig()
remove_child(auth_request)
pass
func _on_Button3_pressed():
var client = Globals.providers.mastodon
var headers = ["Content-Type: application/json",
"Authorization: Bearer "+client[0].oauth_token]
var data = {
"status": "Test toot",
}
toot_request = HTTPRequest.new()
add_child(toot_request)
toot_request.connect("request_completed",self,"_on_tooted")
toot_request.request("https://toot.martyn.berlin/api/v1/statuses",headers,true,HTTPClient.METHOD_POST,JSON.print(data))
print("Headers: ")
print(headers)
print("Sending...")
print(JSON.print(data))
func _on_tooted(result, response_code, headers, body):
if response_code != 200:
print("PANIC! got "+String(response_code))
print(body.get_string_from_utf8())
return
var response = parse_json(body.get_string_from_utf8())
print("Tooted successfully!")
print(body)
remove_child(toot_request)
func auth_user():
var client = Globals.providers.mastodon
OS.shell_open("https://toot.martyn.berlin/oauth/authorize?client_id="+client[0].app_client_id+"&scope=read+write+follow+push&redirect_uri=urn:ietf:wg:oauth:2.0:oob&response_type=code")
$VBoxContainer/CodeEntry.visible=true
func _on_CodeEntry_on_authorize(code):
var client = Globals.providers.mastodon
var headers = ["Content-Type: application/json"]
var data = {
"client_id": client[0].app_client_id,
"client_secret": client[0].app_client_secret,
"redirect_uri": "urn:ietf:wg:oauth:2.0:oob",
"grant_type": "authorization_code",
"scope": "read write follow push",
"code": code
}
auth_request = HTTPRequest.new()
add_child(auth_request)
auth_request.connect("request_completed",self,"_on_token_requested")
auth_request.request("https://toot.martyn.berlin/oauth/token",headers,true,HTTPClient.METHOD_POST,JSON.print(data))
pass # Replace with function body.
func _on_TextEdit_text_changed(new_text):
var dict
if len(Globals.providers.mastodon) > 0:
dict = Globals.providers.mastodon[0]
else:
dict = {}
Globals.providers.mastodon[0] = dict
Globals.providers.mastodon[0].baseURL = $VBoxContainer/HBoxContainer/TextEdit.text
Globals.saveConfig()

View File

@ -0,0 +1,110 @@
[gd_scene load_steps=3 format=2]
[ext_resource path="res://Components/MastoConfig.gd" type="Script" id=1]
[ext_resource path="res://Components/MastoAuthCode.tscn" type="PackedScene" id=2]
[node name="MastoConfig" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="VBoxContainer" type="VBoxContainer" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = 5.0
margin_top = 5.0
margin_right = -5.0
margin_bottom = -5.0
__meta__ = {
"_edit_use_anchors_": false
}
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer"]
margin_right = 1014.0
margin_bottom = 24.0
[node name="Label" type="Label" parent="VBoxContainer/HBoxContainer"]
margin_top = 5.0
margin_right = 328.0
margin_bottom = 19.0
text = "Mastodon root url (e.g. https://toot.martyn.berlin) : "
[node name="TextEdit" type="LineEdit" parent="VBoxContainer/HBoxContainer"]
margin_left = 332.0
margin_right = 1014.0
margin_bottom = 24.0
size_flags_horizontal = 3
size_flags_vertical = 3
[node name="AuthUser" type="Button" parent="VBoxContainer"]
margin_top = 28.0
margin_right = 1014.0
margin_bottom = 48.0
text = "Authenticate as user..."
[node name="CodeEntry" parent="VBoxContainer" instance=ExtResource( 2 )]
visible = false
anchor_right = 0.0
anchor_bottom = 0.0
margin_top = 100.0
margin_right = 1014.0
margin_bottom = 400.0
rect_min_size = Vector2( 0, 300 )
[node name="TestToot" type="Button" parent="VBoxContainer"]
margin_top = 52.0
margin_right = 1014.0
margin_bottom = 72.0
text = "Test Post"
[node name="Panel" type="Panel" parent="VBoxContainer"]
margin_top = 76.0
margin_right = 1014.0
margin_bottom = 76.0
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Label" type="Label" parent="VBoxContainer/Panel"]
margin_right = 122.0
margin_bottom = 14.0
text = "Mastodon settings:"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="GridContainer" type="GridContainer" parent="VBoxContainer/Panel"]
anchor_right = 1.0
margin_top = 20.0
margin_bottom = 20.0
size_flags_horizontal = 3
size_flags_vertical = 3
__meta__ = {
"_edit_use_anchors_": false
}
[node name="CheckBox" type="CheckBox" parent="VBoxContainer/Panel/GridContainer"]
margin_right = 741.0
margin_bottom = 24.0
text = "Attach Audio to Toot (Mastodon Admins may not like this, audio takes up a fair amount of space and bandwidth)"
[node name="CheckBox2" type="CheckBox" parent="VBoxContainer/Panel/GridContainer"]
margin_top = 28.0
margin_right = 741.0
margin_bottom = 52.0
text = "Send Audio to binary pastebin paste.c-net.org - again, might upset their admins..."
[node name="Label" type="Label" parent="VBoxContainer/Panel/GridContainer"]
margin_top = 56.0
margin_right = 741.0
margin_bottom = 70.0
text = "We'll add more options as time goes on."
[node name="HTTPRequest" type="HTTPRequest" parent="."]
[connection signal="text_changed" from="VBoxContainer/HBoxContainer/TextEdit" to="." method="_on_TextEdit_text_changed"]
[connection signal="pressed" from="VBoxContainer/AuthUser" to="." method="_on_Login_pressed"]
[connection signal="on_authorize" from="VBoxContainer/CodeEntry" to="." method="_on_CodeEntry_on_authorize"]
[connection signal="pressed" from="VBoxContainer/TestToot" to="." method="_on_Button3_pressed"]

View File

@ -0,0 +1,45 @@
extends Control
# Declare member variables here. Examples:
# var a = 2
# var b = "text"
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta):
# pass
func _on_any_text_changed(new_text):
BundlePost.setSongArtist($HBoxContainer/GridContainer/GridContainer/ArtistEdit.text)
BundlePost.setSongTitle($HBoxContainer/GridContainer/GridContainer/SongEdit.text)
match $HBoxContainer/GridContainer/GridContainer/CompletionDropdown.selected:
0:
BundlePost.setCompletionType(BundlePost.CompletionTypeOptions.OpenSeed)
1:
BundlePost.setCompletionType(BundlePost.CompletionTypeOptions.SoloCompletion)
2:
BundlePost.setCompletionType(BundlePost.CompletionTypeOptions.DuetCompletion)
3:
BundlePost.setCompletionType(BundlePost.CompletionTypeOptions.AllHarmony)
4:
BundlePost.setCompletionType(BundlePost.CompletionTypeOptions.AllMelody)
BundlePost.setSongTitle($HBoxContainer/GridContainer/GridContainer/SongEdit.text)
BundlePost.setTags($HBoxContainer/GridContainer/GridContainer/TagsEdit.text)
$HBoxContainer/Panel/GridContainer/PostContent.text = BundlePost.getFinalText()
pass # Replace with function body.
func _on_Control_ready():
$HBoxContainer/GridContainer/GridContainer/CompletionDropdown.add_item("Open Seed - part of a duet")
$HBoxContainer/GridContainer/GridContainer/CompletionDropdown.add_item("Solo Completion")
$HBoxContainer/GridContainer/GridContainer/CompletionDropdown.add_item("Duet Completion")
$HBoxContainer/GridContainer/GridContainer/CompletionDropdown.add_item("All Harmony Seed")
$HBoxContainer/GridContainer/GridContainer/CompletionDropdown.add_item("All Melody Seed")
pass # Replace with function body.

View File

@ -0,0 +1,115 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://Components/PublishDetails.gd" type="Script" id=1]
[node name="Control" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="HBoxContainer" type="HBoxContainer" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
__meta__ = {
"_edit_use_anchors_": false
}
[node name="GridContainer" type="GridContainer" parent="HBoxContainer"]
margin_right = 510.0
margin_bottom = 600.0
size_flags_horizontal = 3
size_flags_vertical = 3
[node name="GridContainer" type="GridContainer" parent="HBoxContainer/GridContainer"]
margin_right = 510.0
margin_bottom = 600.0
size_flags_horizontal = 3
size_flags_vertical = 3
columns = 2
[node name="Label" type="Label" parent="HBoxContainer/GridContainer/GridContainer"]
margin_top = 5.0
margin_right = 122.0
margin_bottom = 19.0
text = "Artist name : "
[node name="ArtistEdit" type="LineEdit" parent="HBoxContainer/GridContainer/GridContainer"]
margin_left = 126.0
margin_right = 184.0
margin_bottom = 24.0
[node name="Label2" type="Label" parent="HBoxContainer/GridContainer/GridContainer"]
margin_top = 33.0
margin_right = 122.0
margin_bottom = 47.0
text = "Song name : "
[node name="SongEdit" type="LineEdit" parent="HBoxContainer/GridContainer/GridContainer"]
margin_left = 126.0
margin_top = 28.0
margin_right = 184.0
margin_bottom = 52.0
[node name="Label3" type="Label" parent="HBoxContainer/GridContainer/GridContainer"]
margin_top = 59.0
margin_right = 122.0
margin_bottom = 73.0
text = "Completion type : "
[node name="CompletionDropdown" type="OptionButton" parent="HBoxContainer/GridContainer/GridContainer"]
margin_left = 126.0
margin_top = 56.0
margin_right = 184.0
margin_bottom = 76.0
[node name="Label4" type="Label" parent="HBoxContainer/GridContainer/GridContainer"]
margin_top = 85.0
margin_right = 122.0
margin_bottom = 99.0
text = "Extra tags : "
[node name="TagsEdit" type="LineEdit" parent="HBoxContainer/GridContainer/GridContainer"]
margin_left = 126.0
margin_top = 80.0
margin_right = 184.0
margin_bottom = 104.0
[node name="Panel" type="Panel" parent="HBoxContainer"]
margin_left = 514.0
margin_right = 1024.0
margin_bottom = 600.0
size_flags_horizontal = 3
size_flags_vertical = 3
[node name="GridContainer" type="GridContainer" parent="HBoxContainer/Panel"]
anchor_right = 1.0
anchor_bottom = 1.0
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Label" type="Label" parent="HBoxContainer/Panel/GridContainer"]
margin_right = 510.0
margin_bottom = 14.0
size_flags_horizontal = 3
text = "Post looks like :"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="PostContent" type="Label" parent="HBoxContainer/Panel/GridContainer"]
margin_top = 18.0
margin_right = 510.0
margin_bottom = 32.0
autowrap = true
__meta__ = {
"_edit_use_anchors_": false
}
[connection signal="ready" from="." to="." method="_on_Control_ready"]
[connection signal="text_changed" from="HBoxContainer/GridContainer/GridContainer/ArtistEdit" to="." method="_on_any_text_changed"]
[connection signal="text_changed" from="HBoxContainer/GridContainer/GridContainer/SongEdit" to="." method="_on_any_text_changed"]
[connection signal="item_selected" from="HBoxContainer/GridContainer/GridContainer/CompletionDropdown" to="." method="_on_any_text_changed"]
[connection signal="text_changed" from="HBoxContainer/GridContainer/GridContainer/TagsEdit" to="." method="_on_any_text_changed"]

View File

@ -1,9 +1,10 @@
[gd_scene load_steps=5 format=2] [gd_scene load_steps=6 format=2]
[ext_resource path="res://main_menu.gd" type="Script" id=1] [ext_resource path="res://main_menu.gd" type="Script" id=1]
[ext_resource path="res://GlobalSettings.gd" type="Script" id=2] [ext_resource path="res://GlobalSettings.gd" type="Script" id=2]
[ext_resource path="res://Components/MicMeterHoriz.tscn" type="PackedScene" id=3] [ext_resource path="res://Components/MicMeterHoriz.tscn" type="PackedScene" id=3]
[ext_resource path="res://UI/src/165316__ani-music__synthesizer-echo-plinks-2.wav" type="AudioStream" id=4] [ext_resource path="res://UI/src/165316__ani-music__synthesizer-echo-plinks-2.wav" type="AudioStream" id=4]
[ext_resource path="res://Components/MastoConfig.tscn" type="PackedScene" id=5]
[node name="Control" type="Control"] [node name="Control" type="Control"]
anchor_right = 1.0 anchor_right = 1.0
@ -194,6 +195,33 @@ margin_top = 32.0
margin_right = -4.0 margin_right = -4.0
margin_bottom = -4.0 margin_bottom = -4.0
[node name="Button" type="Button" parent="MarginContainer/VBoxContainer/TabContainer/Providers"]
anchor_left = 1.0
anchor_right = 1.0
margin_left = -111.0
margin_bottom = 5.0
text = "Add Provider"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="GridContainer" type="GridContainer" parent="MarginContainer/VBoxContainer/TabContainer/Providers"]
anchor_right = 1.0
anchor_bottom = 1.0
margin_top = 28.0
size_flags_horizontal = 3
size_flags_vertical = 3
__meta__ = {
"_edit_use_anchors_": false
}
[node name="MastoConfig" parent="MarginContainer/VBoxContainer/TabContainer/Providers/GridContainer" instance=ExtResource( 5 )]
anchor_right = 0.0
anchor_bottom = 0.0
margin_right = 1006.0
size_flags_horizontal = 3
size_flags_vertical = 0
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."] [node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."]
stream = ExtResource( 4 ) stream = ExtResource( 4 )
[connection signal="pressed" from="MarginContainer/VBoxContainer/HBoxContainer2/Quit" to="." method="_on_Quit_pressed"] [connection signal="pressed" from="MarginContainer/VBoxContainer/HBoxContainer2/Quit" to="." method="_on_Quit_pressed"]

View File

@ -9,6 +9,7 @@ var config = ConfigFile.new()
# Declare member variables here. Examples: # Declare member variables here. Examples:
# var a = 2 # var a = 2
# var b = "text" # var b = "text"
var providers = { "mastodon" : []}
# Called when the node enters the scene tree for the first time. # Called when the node enters the scene tree for the first time.
@ -51,6 +52,10 @@ func loadConfig():
if not config.has_section_key("audio","audio_delay_seconds"): if not config.has_section_key("audio","audio_delay_seconds"):
config.set_value("audio","audio_delay_seconds",0.0) config.set_value("audio","audio_delay_seconds",0.0)
audio_delay_seconds = config.get_value("audio","audio_delay_seconds",0.0) audio_delay_seconds = config.get_value("audio","audio_delay_seconds",0.0)
if not config.has_section_key("providers","mastodon"):
config.set_value("providers","mastodon",[])
providers.mastodon = config.get_value("providers", "mastodon", [])
config.save("user://settings.cfg") config.save("user://settings.cfg")
config_loaded = true config_loaded = true
@ -59,5 +64,6 @@ func saveConfig():
config.set_value("audio","playback_device",playback_device) config.set_value("audio","playback_device",playback_device)
config.set_value("audio","capture_device",capture_device) config.set_value("audio","capture_device",capture_device)
config.set_value("audio","audio_delay_seconds",audio_delay_seconds) config.set_value("audio","audio_delay_seconds",audio_delay_seconds)
config.set_value("providers","mastodon",providers.mastodon)
config.save("user://settings.cfg") config.save("user://settings.cfg")

View File

@ -46,7 +46,9 @@ func _ready():
spectrum_play = AudioServer.get_bus_effect_instance(0,0) spectrum_play = AudioServer.get_bus_effect_instance(0,0)
spectrum_record = AudioServer.get_bus_effect_instance(1,1) spectrum_record = AudioServer.get_bus_effect_instance(1,1)
position_changing_by_code = false position_changing_by_code = false
$MarginContainer/VBoxContainer/HBoxContainer4/SaveMode.add_item("Save separate streams") $MarginContainer/VBoxContainer/HBoxContainer4/SaveButton.get_popup().add_item("Save separate streams")
$MarginContainer/VBoxContainer/HBoxContainer4/SaveButton.get_popup().add_item("Save mixed down")
$MarginContainer/VBoxContainer/HBoxContainer4/SaveButton.get_popup().add_item("Publish")
# 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): func _process(delta):

View File

@ -226,16 +226,10 @@ __meta__ = {
"_edit_use_anchors_": false "_edit_use_anchors_": false
} }
[node name="SaveMode" type="OptionButton" parent="MarginContainer/VBoxContainer/HBoxContainer4"] [node name="SaveButton" type="MenuButton" parent="MarginContainer/VBoxContainer/HBoxContainer4"]
margin_right = 968.0 margin_right = 109.0
margin_bottom = 20.0 margin_bottom = 20.0
size_flags_horizontal = 3 text = "Save or Publish"
[node name="SaveButton" type="Button" parent="MarginContainer/VBoxContainer/HBoxContainer4"]
margin_left = 972.0
margin_right = 1013.0
margin_bottom = 20.0
text = "Save"
[node name="AudioStreamRecorder" type="AudioStreamPlayer" parent="."] [node name="AudioStreamRecorder" type="AudioStreamPlayer" parent="."]
stream = SubResource( 1 ) stream = SubResource( 1 )

29
godot/mastotest.gd Normal file
View File

@ -0,0 +1,29 @@
extends Control
# Declare member variables here. Examples:
# var a = 2
# var b = "text"
# Called when the node enters the scene tree for the first time.
func _ready():
$HTTPRequest.request("http://toot.martyn.berlin/api/v1/timelines/tag/cat")
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta):
# pass
func _on_HTTPRequest_request_completed(result, response_code, headers, body):
for slice in $GridContainer.get_children():
slice.remove_and_skip()
var json = JSON.parse(body.get_string_from_utf8())
if json.result != null:
for toot in json.result:
var tootitem = Label.new()
tootitem.text = toot.account.display_name+": "+toot.content
$GridContainer.add_child(tootitem)
pass # Replace with function body.

25
godot/mastotest.tscn Normal file
View File

@ -0,0 +1,25 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://mastotest.gd" type="Script" id=1]
[node name="Control" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="HTTPRequest" type="HTTPRequest" parent="."]
[node name="GridContainer" type="GridContainer" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = 5.0
margin_top = 5.0
margin_right = -5.0
margin_bottom = -5.0
__meta__ = {
"_edit_use_anchors_": false
}
[connection signal="request_completed" from="HTTPRequest" to="." method="_on_HTTPRequest_request_completed"]

View File

@ -27,6 +27,7 @@ enable_audio_input=true
[autoload] [autoload]
Globals="*res://Globals.tscn" Globals="*res://Globals.tscn"
BundlePost="*res://Components/BundlePost.gd"
[rendering] [rendering]