forked from beniwtv/vr-streaming-overlay
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Now makes use of connector, can detect stream claim id from channel c…
…laim id
- Loading branch information
tuxfoo
committed
May 22, 2021
1 parent
15a9efb
commit 61230c0
Showing
5 changed files
with
184 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
extends "res://connectors/baseconnector.gd" | ||
|
||
var display_name : String = "Odysee" | ||
var tooltip : String = "Connect to odysee chat using websockets" | ||
var icon : StreamTexture = preload("res://widgets/odyseechat.png") | ||
var type : String = "odysee" | ||
|
||
var scene : String = "res://connectors/odyseeconnector_ui.tscn" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
extends Control | ||
|
||
var receiver : Node = null | ||
var info : Dictionary = {} | ||
|
||
func set_connection_info(info : Dictionary) -> void: | ||
self.info = info | ||
if info.has("claimid"): | ||
$VBoxContainer/MarginContainerClientId/ClaimId.text = info["claimid"] | ||
|
||
func verify_connection(receiver : Node) -> void: | ||
self.receiver = receiver | ||
var publisher_id = $VBoxContainer/MarginContainerClientId/ClaimId.text | ||
print("verify connection") | ||
$HTTPRequest.connect("request_completed", self, "_on_odysee_verify", [], CONNECT_DEFERRED) | ||
var err = $HTTPRequest.request("https://chainquery.lbry.com/api/sql?query=SELECT%20*%20FROM%20claim%20WHERE%20publisher_id=%22" + publisher_id + "%22%20AND%20bid_state%3C%3E%22Spent%22%20AND%20claim_type=1%20AND%20source_hash%20IS%20NULL%20ORDER%20BY%20id%20DESC%20LIMIT%201") | ||
assert(err==OK) | ||
|
||
func _on_odysee_verify(result, response_code, headers, body) -> void: | ||
$HTTPRequest.disconnect("request_completed", self, "_on_odysee_verify") | ||
var userResponse : JSONParseResult = JSON.parse(body.get_string_from_utf8()) | ||
|
||
if response_code == 200: | ||
var response = { | ||
"error": false, | ||
"name": $VBoxContainer/MarginContainerClientId/ClaimId.text, | ||
"icon": load("res://widgets/odyseechat.png"), | ||
"valid": true, | ||
"type": "odysee", | ||
"claimid": $VBoxContainer/MarginContainerClientId/ClaimId.text | ||
} | ||
|
||
if info: | ||
response["uuid"] = info["uuid"] | ||
|
||
receiver.connection_verified(response) | ||
else: | ||
var response : Dictionary | ||
|
||
if userResponse: | ||
response = { | ||
"error": true, | ||
"message": userResponse.result["message"], | ||
"valid": false | ||
} | ||
else: | ||
response = { | ||
"error": true, | ||
"message": "Temporary connection problem. Please verify your connection.", | ||
"valid": true | ||
} | ||
|
||
if info: | ||
response["uuid"] = info["uuid"] | ||
|
||
|
||
receiver.connection_verified(response) | ||
|
||
func _on_RichTextLabel_meta_clicked(meta): | ||
OS.shell_open(meta) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
[gd_scene load_steps=2 format=2] | ||
|
||
[ext_resource path="res://connectors/odyseeconnector_ui.gd" type="Script" id=1] | ||
|
||
[node name="OdyseeConnectorUI" 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 = -1.0 | ||
margin_right = -1.0 | ||
__meta__ = { | ||
"_edit_use_anchors_": false | ||
} | ||
|
||
[node name="RichTextLabel" type="RichTextLabel" parent="VBoxContainer"] | ||
margin_right = 1280.0 | ||
margin_bottom = 692.0 | ||
focus_mode = 2 | ||
size_flags_horizontal = 3 | ||
size_flags_vertical = 3 | ||
bbcode_enabled = true | ||
bbcode_text = "To connect to Odysee. Get your channels claim id from its about page and paste it into the Channel Claim id box." | ||
text = "To connect to Odysee. Get your channels claim id from its about page and paste it into the Channel Claim id box." | ||
selection_enabled = true | ||
|
||
[node name="MarginContainerClientId" type="MarginContainer" parent="VBoxContainer"] | ||
margin_top = 696.0 | ||
margin_right = 1280.0 | ||
margin_bottom = 720.0 | ||
|
||
[node name="ClaimId" type="LineEdit" parent="VBoxContainer/MarginContainerClientId"] | ||
margin_right = 1280.0 | ||
margin_bottom = 24.0 | ||
clear_button_enabled = true | ||
placeholder_text = "Channel Claim ID" | ||
|
||
[node name="HTTPRequest" type="HTTPRequest" parent="."] | ||
|
||
[connection signal="meta_clicked" from="VBoxContainer/RichTextLabel" to="." method="_on_RichTextLabel_meta_clicked"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters