Commit f6a00294 authored by Ing. Jiří Fryč's avatar Ing. Jiří Fryč

new version

parent 4b17a472
No preview for this file type
......@@ -36,11 +36,11 @@ namespace KazetaNode
if (HistoryPos > 0)
{
HistoryPos--;
Line = History[HistoryPos];
LinePos = Line.Length;
ClearLine();
Console.Write(LinePrefix + Line);
}
Line = History[HistoryPos];
LinePos = Line.Length;
ClearLine();
Console.Write(LinePrefix + Line);
break;
case ConsoleKey.DownArrow:
if (HistoryPos < History.Count)
......@@ -112,7 +112,7 @@ namespace KazetaNode
{
string ToBeAdded = "";
int i = Line.Length;
while (true)
while (res.Count()>0)
{
bool kill = false;
char ch = ' ';
......@@ -232,6 +232,26 @@ namespace KazetaNode
{
Console.WriteLine(line);
}
public static void WriteLine(params string[] items)
{
foreach (string item in items)
{
switch (item)
{
case "@reset": Console.ResetColor(); break;
case "@red": Console.ForegroundColor = ConsoleColor.Red; break;
case "@black": Console.ForegroundColor = ConsoleColor.Black; break;
case "@green": Console.ForegroundColor = ConsoleColor.Green; break;
case "@white": Console.ForegroundColor = ConsoleColor.White; break;
case "@blue": Console.ForegroundColor = ConsoleColor.Blue; break;
case "@yellow": Console.ForegroundColor = ConsoleColor.Yellow; break;
case "@gray": Console.ForegroundColor = ConsoleColor.Gray; break;
default: Console.Write(item); break;
}
}
Console.ResetColor();
Console.WriteLine();
}
public static void Write(string text)
{
Console.Write(text);
......
using System;
using System.Collections.Generic;
using System.Security.Cryptography;
using System.Text;
namespace KazetaNode.Helpers
......@@ -14,6 +15,17 @@ namespace KazetaNode.Helpers
Console.WriteLine(str);
Console.Write("kazeta@" + Program.NodeId + ": ");
}
public static string HashSha256(this string str)
{
var crypt = new SHA256Managed();
string hash = String.Empty;
byte[] crypto = crypt.ComputeHash(Encoding.ASCII.GetBytes(str));
foreach (byte theByte in crypto)
{
hash += theByte.ToString("x2");
}
return hash;
}
public static int ToInt32(this string str)
{
......
using System;
using System.Collections.Generic;
using System.Text;
using KazetaNode.Coms;
namespace KazetaNode.Libraries.FileShare
{
class FileShare : AbstractLibrary
{
public override string Id => "fileshare";
public override string Name => "File Share";
public override string Version => "1.0";
public override List<Command> Commands => new List<Command>() { };
public override Dictionary<string, Tuple<Type, Network.ReceiveMessage>> Messages => throw new NotImplementedException();
public override AbstractLibraryInstance CreateCaptureInstance()
{
throw new NotImplementedException();
}
public void SendProjectToNode(string node,string project_id)
{
}
}
}
using System;
using System.Collections.Generic;
using System.Text;
namespace KazetaNode.Libraries.FileShare
{
class Messages
{
}
}
using System;
using System.Collections.Generic;
using System.Text;
namespace KazetaNode.Libraries.LocalStorage
{
class LocalStorage
{
}
}
using KazetaNode.Models;
using System;
using System.Collections.Generic;
using System.Text;
namespace KazetaNode.Libraries.Room
{
class RoomsModel
{
public List<RoomModel> rooms { get; set; } = new List<RoomModel>();
}
class RoomTrigger
{
public List<CaptureMode> Only { get; set; } = new List<CaptureMode>();
public List<string> Script { get; set; } = new List<string>();
}
class RoomModel
{
public string Id { get; set; }
public List<CaptureMode> Modes { get; set; } = new List<CaptureMode>();
public List<RoomTrigger> Capture { get; set; }
public List<RoomTrigger> Terminate { get; set; }
public List<RoomTrigger> Initialize { get; set; }
public List<VideoQuality> Capability { get; set; } = new List<VideoQuality>();
public List<NdiSourceDescriptor> Sources { get; set; } = new List<NdiSourceDescriptor>();
}
}
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using KazetaNode.Coms;
using YamlDotNet.Serialization;
using YamlDotNet.Serialization.NamingConventions;
namespace KazetaNode.Libraries.Room
{
class Room : AbstractLibrary
{
public override string Id => "room";
public override string Name => "Room";
public override string Version => "1.0";
public override List<Command> Commands => new List<Command>();
public override Dictionary<string, Tuple<Type, Network.ReceiveMessage>> Messages => throw new NotImplementedException();
protected internal Dictionary<string, RoomModel> LocalRooms { get; set; } = new Dictionary<string, RoomModel>();
protected internal Dictionary<string, Tuple<List<string>, RoomModel>> RemoteRooms { get; set; } = new Dictionary<string, Tuple<List<string>, RoomModel>>();
public override AbstractLibraryInstance CreateCaptureInstance()
{
throw new NotImplementedException();
}
public Room()
{
var deserializer = new DeserializerBuilder().IgnoreUnmatchedProperties().WithNamingConvention(new CamelCaseNamingConvention()).Build();
var input = new StringReader(File.ReadAllText(@"rooms.yaml"));
RoomsModel yamlObject = deserializer.Deserialize<RoomsModel>(input);
foreach (var r in yamlObject.rooms)
LocalRooms.Add(r.Id, r);
}
public bool RoomExist(string room)
{
return LocalRooms.ContainsKey(room) || RemoteRooms.ContainsKey(room);
}
public List<string> RemoteRoomNodes(string room)
{
return RemoteRooms.ContainsKey(room) ? RemoteRooms[room].Item1:null;
}
public RoomModel RoomDescription(string room)
{
return LocalRooms.ContainsKey(room) ? LocalRooms[room] : (RemoteRooms.ContainsKey(room) ? RemoteRooms[room].Item2 : null);
}
}
}
using System;
using KazetaNode.Helpers;
using System;
using System.Collections.Generic;
using System.Text;
......@@ -9,11 +10,21 @@ namespace KazetaNode.Models
public string Id { get; set; }
public string Name { get; set; }
}
enum ProjectStage
{
NOT_STARTED=1,CAPTURE_WAITING=2,CAPTURE_RUNNING=3,CAPTURE_UPLOADING=4,PERSIST_UPLOADING=5,PROCESS_WAITING=6,PROCESS_RUNNING=7,PROCESS_UPLOADING=8,PERSIST_READY=9
}
enum ProjectFileType
{
RAW=1,HELP=2,PROCESSED=3
}
class ProjectFile
{
public string FileName { get; set; }
public int Size { get; set; }
public string Checksum { get; set; }
public string Source { get; set; }
public ProjectFileType Type { get; set; }
}
class ProjectCapture
......@@ -26,16 +37,38 @@ namespace KazetaNode.Models
public List<string> Before { get; set; } = new List<string>();
public List<string> After { get; set; } = new List<string>();
}
class ProjectPersistComunication
{
public string Type { get; set; }
public int MaxBandwith { get; set; }
}
class ProjectPersist
{
public List<string> At { get; set; }
public List<string> At { get; set; } = new List<string>();
public List<ProjectPersistComunication> Communications { get; set; } = new List<ProjectPersistComunication>();
public bool KeepRawFiles { get; set; } = true;
public bool KeepHelpFiles { get; set; } = false;
public bool KeepProcessFiles { get; set; } = true;
}
class ProjectProcess
{
public string Format { get; set; }
public string VideoQuality { get; set; }
public List<string> VideoSource { get; set; } = new List<string>();
public string VideoCodec { get; set; }
public List<string> AudioSource { get; set; } = new List<string>();
public string AudioCodec { get; set; }
}
class Project
{
public Guid Id { get; set; }
public string Id => (Capture.Room + "%%" + Capture.From.ToString("s", System.Globalization.CultureInfo.InvariantCulture) + "%%" + Capture.To.ToString("s", System.Globalization.CultureInfo.InvariantCulture)).HashSha256();
public string Author { get; set; }
public List<string> Notify { get; set; } = new List<string>();
public ProjectStage Stage { get; set; } = ProjectStage.NOT_STARTED;
public List<ProjectFile> Files { get; set; } = new List<ProjectFile>();
public ProjectCapture Capture { get; set; }
public ProjectCapture Capture { get; set; } = new ProjectCapture();
public List<ProjectProcess> Process { get; set; } = new List<ProjectProcess>();
}
}
......@@ -62,17 +62,19 @@ namespace KazetaNode
var input = new StringReader(File.ReadAllText(@"kazeta.yaml"));
yamlObject = deserializer.Deserialize(input);
NodeId = yamlObject["id"];
ConsoleP.WriteLine("OK");
ConsoleP.WriteLine("OK");
ConsoleP.WriteLine("Connecting to network: ");
Network = new Network(yamlObject);
Network.Connect();
ConsoleP.WriteLine("Modules:");
ConsoleP.Write(" - Capture: ");
ConsoleP.WriteLine(EnableCapture() ? "enabled" : "disabled");
ConsoleP.WriteLine(EnableCapture() ? new string[] { "@green","enabled" } : new string[] { "@red","disabled" });
ConsoleP.Write(" - Process: ");
ConsoleP.WriteLine(EnableProcess() ? "enabled" : "disabled");
ConsoleP.WriteLine(EnableProcess() ? new string[] { "@green", "enabled" } : new string[] { "@red", "disabled" });
ConsoleP.Write(" - Persist: ");
ConsoleP.WriteLine(EnableProcess() ? new string[] { "@green", "enabled" } : new string[] { "@red", "disabled" });
ConsoleP.Write(" - Deliver: ");
ConsoleP.WriteLine(EnableDeliver() ? "enabled" : "disabled");
ConsoleP.WriteLine(EnableDeliver() ? new string[] { "@green", "enabled" } : new string[] { "@red", "disabled" });
}
catch(Exception e)
{
......
......@@ -5,6 +5,15 @@ network:
virtual_host: kazeta
hostname: ndi-rabbit.felk.cvut.cz
port: 5672
modules:
capture:
enabled: true
process:
enabled: true
persist:
enabled: true
deliver:
enabled: true
libraries:
kosapi:
clientid: 314b28ac-b629-424d-b33b-ee1eec37596e
......
tracked:
- course:
\ No newline at end of file
id: test
stage: NOT_STARTED # 0 - Not started, 1 - At capture node waiting, 2 - At capture node started, 3 - At capture node waiting for upload, 4 - At persist node, 5 - At process node waiting for process, 6 - At process node processing, 7 - At process node waiting for upload, 8 - done
notify: ["frycjiri@fel.cvut.cz"]
author: frycjiri
files:
- filename: test.mp4
size: 1024
checksum: asdasdasdasdjiojpojpoi
capture:
room: KN:E-301
from: 2019-04-10T12:59:36+0000
to: 2019-04-10T18:59:36+0000
mode: SPEAKER_PRESENTATION_BLACKBOARD
quality: v1080p
before:
- artnet turn-on -universe=8 0x06 0x07
after:
- artnet turn-off -universe=8 0x06 0x07
persist:
at: [Node_2]
communications:
- type: ARQP
max_bandwith: 128MB
keep_raw_files: false
keep_help_files: false
keep_processed_files: true
process:
mapped_files:
- filename: output_1080.mp4
quality: v1080p
- filename: output_720.mp4
quality: v720p
- filename: output_480.mp4
quality: v480p
script:
- ffmpeg -i %primary_video% -i %primary_audio% -c:a aac -c:v libx264 -strict experimental merged.mp4
- ffmpeg -i merged.mp4 -filter:v scale=1080:-1 output_1080.mp4
- ffmpeg -i merged.mp4 -filter:v scale=720:-1 output_720.mp4
- ffmpeg -i merged.mp4 -filter:v scale=480:-1 output_480.mp4
deliver:
rtmp:
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment