SpookTubeEX/Uploader.cs

38 lines
912 B
C#
Raw Normal View History

2024-05-29 08:18:35 +10:00
using System.IO;
using WebSocketSharp;
using Newtonsoft.Json;
namespace SpookedTube;
public class SpookNetMessage
{
public string statusID { get; set; }
public string data { get; set; }
}
class SpookedUploader
{
public static int Upload(IPlayableVideo cameraRecording, int views, CommentUI[] comments)
{
if (cameraRecording.TryGetVideoPath(out string path))
{
if (!File.Exists(path))
{
Modal.ShowError("[SPOOKEDTUBE] File Error", $"Can't find {path}");
return -1;
}
using (WebSocket ws = new(Plugin.URL.Value))
{
ws.OnMessage += (sender, evt) =>
{
SpookNetMessage message = JsonConvert.DeserializeObject<SpookNetMessage>(evt.Data);
};
ws.Connect();
}
}
return 0;
}
}