Ejemplo n.º 1
0
        private static void PrintCreationTime(string inputFile)
        {
            VideoTasks video    = new VideoTasks();
            DateTime   creation = video.GetCreationTime(inputFile);

            Console.WriteLine(
                $"File: {inputFile}, video creationtime " +
                creation.ToString("MM/dd/yyyy h:mm tt"));
        }
Ejemplo n.º 2
0
 public MainPageViewModel()
 {
     if (Clipboard.ContainsText())
     {
         var text = Clipboard.GetText();
         var(success, videos) = Video.Parse(text);
         if (success)
         {
             videos.ForEach(video => VideoTasks.Add(new VideoTask(video)));
         }
     }
     VideoTasks.ForEach(async it => await it.Download());
 }
Ejemplo n.º 3
0
        private static void PrintCreationTime(string inputFile)
        {
            VideoTasks video    = new VideoTasks(inputFile);
            DateTime   creation = video.GetCreationTime();

            Console.WriteLine(
                $"File: {inputFile}, video creationtime " +
                creation.ToString("MM/dd/yyyy h:mm tt"));

            SkiVideoEntity entity = new SkiVideoEntity("http://localhost/TEST.MP4", creation);
            string         obj    = Newtonsoft.Json.JsonConvert.SerializeObject(entity);

            System.Console.WriteLine("Object:\n" + obj);
        }
Ejemplo n.º 4
0
        private static async Task UpdateThumbnailAsync(Storage storage, SkiVideoEntity video)
        {
            Logger.Log($"Updating thumbnail for {video.PartitionKey}, {video.RowKey}");
            double thumbnailAtSeconds = 0; // video.EntryTime;

            string     localVideoPath = Storage.DownloadVideo(video.HotUrl ?? video.Url);
            VideoTasks _videoTasks    = new VideoTasks(localVideoPath);

            string localThumbnailPath = await _videoTasks.GetThumbnailAsync(thumbnailAtSeconds);

            string modifiedThumbnailPath = localThumbnailPath.Replace("_ts.PNG", ".PNG");

            System.IO.File.Move(localThumbnailPath, modifiedThumbnailPath);
            string thumbnailUrl = storage.UploadThumbnail(modifiedThumbnailPath, video.RecordedTime);

            Logger.Log($"New thumbnail at {thumbnailUrl}");
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Downloads video, extracts metadata, trims video to just the course pass, removes audio,
        /// generates thumbnail, uploads metadata, thumbnail, final video, deletes ingest video.
        /// </summary>
        /// <returns>Url of processed video.</returns>
        public async Task ProcessAsync()
        {
            try
            {
                var download     = DownloadVideoAsync();
                var timeOverride = GetPassOverrideAsync();

                await Task.WhenAll(download, timeOverride);

                _localVideoPath = download.Result;
                _timeOverrides  = timeOverride.Result;

                _videoTasks = new VideoTasks(_localVideoPath);

                var        getCreationTime = GetCreationTimeAsync();
                CoursePass pass            = await CreateCoursePassAsync();

                do
                {
                    var createThumbnail = CreateThumbnailAsync(pass);
                    var uploadThumbnail = UploadThumbnailAsync(createThumbnail, getCreationTime);
                    var trimAndSilence  = TrimAndSilenceAsync(pass);
                    var uploadVideo     = UploadVideoAsync(trimAndSilence, getCreationTime);
                    var uploadHotVideo  = UploadGoogleVideoAsync(trimAndSilence, getCreationTime);

                    await FitCenterLineAsync(pass);
                    await CreateAndUploadMetadataAsync(
                        pass,
                        uploadThumbnail,
                        uploadVideo,
                        uploadHotVideo
                        );
                } while ((pass = HasAnotherPass(in pass)) != null);

                DeleteIngestVideo();
            }
            catch (System.AggregateException aggEx)
            {
                throw new ApplicationException($"Unable to process {_sourceVideoUrl}.  Failed at: \n" +
                                               aggEx.GetBaseException().Message);
            }
        }