Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            ConfigWrapper config = new ConfigWrapper(new ConfigurationBuilder()
                                                     .SetBasePath(Directory.GetCurrentDirectory())
                                                     .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
                                                     .AddEnvironmentVariables()
                                                     .Build());
            TextModerator textModerator = new TextModerator(config);

            string videoPath = "https://shigeyfampdemo.azurewebsites.net/videos/ignite.mp4";

            try
            {
                Task <TextModerationResult> task1  = textModerator.ModerateVideo(videoPath);
                TextModerationResult        result = task1.Result;
                Task <string> task2 = WebVttParser.LoadWebVtt(result.StreamingUrlDetails.VttUrl);
                result.WebVtt = task2.Result;
                List <CaptionTextModerationResult>         captionTextResults = WebVttParser.ParseWebVtt(result.WebVtt);
                Task <List <CaptionTextModerationResult> > task3 = textModerator.TextScreen(captionTextResults);
                result.CaptionTextResults = task3.Result;
            }
            catch (Exception e)
            {
                Console.WriteLine("Error: ", e.ToString());
            }
            Console.WriteLine("Visual Modeation has finished.");
            Console.WriteLine("Press any key to stop...");
            Console.ReadKey();
        }
Ejemplo n.º 2
0
        public static async Task Main(string[] args)
        {
            ConfigWrapper config = new ConfigWrapper(new ConfigurationBuilder()
                                                     .SetBasePath(Directory.GetCurrentDirectory())
                                                     .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
                                                     .AddEnvironmentVariables()
                                                     .Build());

            textModerator       = new TextModerator(config);
            visualModerator     = new VisualModerator(config);
            videoReviewUploader = new VideoReviewUploader(config);

            if (args.Length == 0)
            {
                string videoPath = string.Empty;
                GetUserInputs(out videoPath);
                try
                {
                    await ProcessVideo(videoPath);
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }
            }
            else
            {
                DirectoryInfo directoryInfo = new DirectoryInfo(args[0]);
                var           files         = directoryInfo.GetFiles("*.mp4", SearchOption.AllDirectories);
                foreach (var file in files)
                {
                    try
                    {
                        await ProcessVideo(file.FullName);
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.Message);
                    }
                }
            }
        }