asingcrow/godot/startup.gd

46 lines
1.3 KiB
GDScript3

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")
dir.copy("res://youtube-dl.exe", "user://youtube-dl.exe")
if !o.file_exists('user://ffmpeg.exe'):
print("Need ffmpeg")
dir.copy("res://ffmpeg.exe", "user://ffmpeg.exe")
if !o.file_exists('user://dlserver.exe'):
print("Need dlserver")
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)
print("Started dl-server, pid ", Globals.pid_of_dlserver)
$ValidateServerRunningTimer.start()
func _on_ValidateServerRunningTimer_timeout():
$HTTPRequest.request("http://127.0.0.1:10435/pid/")
func _on_HTTPRequest_request_completed(result, response_code, headers, body):
print("Received ",response_code," response from server, good enough!")
$SceneChangeTimer.start()