asingcrow/godot/startup.gd

46 lines
1.3 KiB
GDScript3
Raw Permalink Normal View History

2020-09-19 15:21:40 +00:00
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_Timer_timeout():
get_tree().change_scene("res://main_menu.tscn")
func _on_Timer2_timeout():
var output = []
var o = File.new()
var dir = Directory.new()
if !o.file_exists('user://youtube-dl.exe'):
print("Need youtube-dl")
2020-09-20 10:53:16 +00:00
dir.copy("res://youtube-dl.exe", "user://youtube-dl.exe")
2020-09-19 15:21:40 +00:00
if !o.file_exists('user://ffmpeg.exe'):
print("Need ffmpeg")
2020-09-20 10:53:16 +00:00
dir.copy("res://ffmpeg.exe", "user://ffmpeg.exe")
2020-09-19 15:21:40 +00:00
if !o.file_exists('user://dlserver.exe'):
print("Need dlserver")
2020-09-20 10:53:16 +00:00
dir.copy("res://dlserver.exe", "user://dlserver.exe")
Globals.pid_of_dlserver = OS.execute(OS.get_user_data_dir()+"/dlserver.exe", [OS.get_user_data_dir()], false)
2020-09-19 15:21:40 +00:00
print("Started dl-server, pid ", Globals.pid_of_dlserver)
$ValidateServerRunningTimer.start()
func _on_ValidateServerRunningTimer_timeout():
2020-09-26 11:16:01 +00:00
$HTTPRequest.request("http://127.0.0.1:10435/pid/")
2020-09-19 15:21:40 +00:00
func _on_HTTPRequest_request_completed(result, response_code, headers, body):
print("Received ",response_code," response from server, good enough!")
$SceneChangeTimer.start()