-
Notifications
You must be signed in to change notification settings - Fork 0
/
Program.cs
38 lines (29 loc) · 1001 Bytes
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
using CommandLine;
using System;
namespace StreamLapse
{
internal class Program
{
static void Main(string[] args)
{
Console.Title = "..:: StreamLapse ::..";
try
{
Parser.Default.ParseArguments<Options>(args).WithParsed(RunOptions);
}
catch (Exception ex) when (ex is FormatException)
{
Console.WriteLine(ex.Message);
}
}
static void RunOptions(Options options)
{
if (!Validation.IsValidRtspUrl(options.Stream)) throw new FormatException("Stream url is not valid.");
StreamHandler streamHandler = new StreamHandler(options.Stream);
streamHandler.SetCaptureInterval(options.CaptureInterval);
streamHandler.SetOutputDirectory(options.Output);
streamHandler.SetImagePrefix(options.Prefix);
while (true) streamHandler.SaveFrameToJPGFile();
}
}
}