private static void Save() { if (!vidMem.Equals(undefinedVid)) { Console.WriteLine("Input the directory of the folder you wish to save to:"); string input = ConsoleHelper.Prompt("save>directory"); if (Directory.Exists(input)) { Console.WriteLine("Input the name which you wish to name the file. It will be given the .asciivid file extension."); string input2 = ConsoleHelper.Prompt("save>filename"); try { VideoCreator.Save(Path.Combine(input, input2 + ".asciivid"), vidMem); Console.WriteLine("Saving Successful"); } catch (Exception e) { Console.WriteLine("Saving Failed. " + e.Message); } } else { Console.WriteLine("Saving Failed. The directory you wish to save into does not exist."); } } else { Console.WriteLine("Saving Failed. No video is rendered/loaded to be saved."); } }
private void OnFileToUploadOccured(FileSystemEventArgs e) { LOGGER.Debug($"Received a file found event for file '{e.FullPath}'"); if (!e.Name.StartsWith("_") && Uploader.Queue.All(job => job.Video.File.FullName.ToLower() != e.FullPath.ToLower()) && archive.RegisteredJobs.All(job => job.Video.File.FullName.ToLower() != e.FullPath.ToLower())) { LOGGER.Info($"Found file to upload: '{e.FullPath}', adding it to uploader"); var videoAndEvaluator = VideoCreator.CreateVideo(e.FullPath); var video = videoAndEvaluator.Video; var evaluator = videoAndEvaluator.Evaluator; var notificationSettings = videoAndEvaluator.NotificationSettings; LOGGER.Info($"Video title: '{video.Title}', queueing it"); var job = Uploader.QueueUpload(video, Account, notificationSettings); var path = VideoCreator.FindNearestPath(e.FullPath); FileToUploadOccured?.Invoke(this, new JobEventArgs(job)); job.UploadCompletedAction += (args) => evaluator.CleanUp().Wait(); if (path.MoveAfterUpload) { LOGGER.Info($"Moving finished video file from: '{video.Path}' to: '{path.MoveDirectoryPath}'"); job.UploadCompletedAction += (args) => MoveVideo(args.Job, path.MoveDirectoryPath); } Uploader.StartUploader(); } }
private static void Load() { Console.WriteLine("This is used to load rendered files by this program. This cannot load video files.\nInput the directory of the video you wish to load from:"); string input1 = ConsoleHelper.Prompt("load"); if (File.Exists(input1)) { try { vidMem = VideoCreator.Load(input1); Console.WriteLine("Loading Successful"); } catch (Exception e) { if (e is System.Runtime.Serialization.SerializationException) { Console.WriteLine("Loading Failed. Ensure that you are specifying a file rendered by this program."); } else { Console.WriteLine("Loading Failed. " + e.Message); } } } else { Console.WriteLine("Loading Failed. Cannot load from specified directory"); } }
public void When_GetVideo_is_called_with_a_new_Video_and_an_empty_string_for_setName_then_UploadVideo_on_the_VideoAdapter_is_called_with_that_Video_and_the_stored_VideoAdapterSettings() { var tracks = VideoCreator.CreateCollection(); var entity = AdapterSettingsCreator.CreateSingle(); entity.SetName = string.Empty; BandRepository .Expect(repository => repository.GetAdapterSettings(Arg <string> .Is.Anything)) .Return(entity) .Repeat.Once(); BandRepository.Replay(); VideoAdapter .Expect(adapter => adapter.GetItems(entity.SetName, entity.OAuthAccessToken)) .Return(tracks) .Repeat.Once(); VideoAdapter.Replay(); var result = Process.GetVideos(); Assert.AreEqual(tracks.Count(), result.Count()); Assert.AreEqual(tracks.First().ResourceUri, result.First().ResourceUri); VideoAdapter.VerifyAllExpectations(); }
private void GenerateClick(object sender, RoutedEventArgs e) { UIElement[] array = new UIElement[VideoViewPort.Children.Count]; VideoViewPort.Children.CopyTo(array, 0); IEnumerable<IWidget> widgets = array.Select(x => (IWidget)x); foreach (var widget in widgets) { Draggables.Base.DraggableBase variable = widget as Draggables.Base.DraggableBase; if (variable != null) { variable.FreezeAttributes(); } } //VideoCreator creator = new VideoCreator(GetData(), widgets, 25); // Danny's VideoCreator creator = new VideoCreator(GetData(), widgets, 30); // JD's creator.ProgressUpdate += OnProgressUpdate; creator.FinishedProcessing += OnFinishedProcessing; GenerateButton.IsEnabled = false; FileInfo inputFile = new FileInfo(inputFileName); Task.Factory.StartNew(() => creator.Create(inputFileName, Path.Combine(inputFile.Directory.FullName, outputFileName))); }
public void SetUp() { _command = new CreateLectureCommand { Title = "title", ModuleId = "moduleId", Order = 1 }; _sut = new VideoCreator(); }
public void RemoveCreatorFromVideo(VideoCreator creator, long videoId) { using (var db = DataAccessUtil.CreateSqlConnection()) { db.Open(); var command = new SqliteCommand($"DELETE FROM video_creator WHERE creator_id = {creator.CharacterDetails.CharacterId} AND video_id = {videoId}", db); command.ExecuteNonQuery(); } }
public void UpdateVideoCreatorRole(VideoCreator creator, long videoId) { using (var db = DataAccessUtil.CreateSqlConnection()) { db.Open(); var command = new SqliteCommand(); command.Connection = db; command.CommandText = $"UPDATE video_creator SET role = @Role WHERE creator_id = {creator.CharacterDetails.CharacterId} AND video_id = {videoId}"; command.Parameters.AddWithValue("@Role", creator.Role); command.ExecuteNonQuery(); } }
private static void Render() { Console.WriteLine("Recommended video sizes upto 144p and at a recommended 30fps, as playback speeds may vary.\nInput the directory of the video you wish to render from:"); string input = ConsoleHelper.Prompt("render"); if (File.Exists(input)) { int quality = 1; Console.WriteLine("Input the quality you wish to render at (Low/Med/High)"); switch (ConsoleHelper.Prompt("render>quality").ToLower()) { case "low": quality = 0; break; case "med": quality = 1; break; case "high": quality = 2; break; default: Console.WriteLine("Invalid setting selected, choosing medium quality by default."); break; } try { vidMem = VideoCreator.RenderFrom(input, quality); Console.WriteLine("Render Successful."); } catch (Exception e) { if (e is ArgumentException || e is OverflowException) { Console.WriteLine("Render Failed. The video you attempted to render is too large."); } if (e is ArgumentOutOfRangeException) { Console.WriteLine("Render Failed. Ensure that you are specifying an mp4 video file."); } } } else { Console.WriteLine("Render Failed. Cannot render from specified directory."); } }
private static void Play() { if (!vidMem.Equals(undefinedVid)) { try { VideoCreator.PlayVideo(vidMem); } catch (Exception e) { Console.WriteLine("Playback Failed. " + e.Message); } } else { Console.WriteLine("Playback Failed. No video is rendered/loaded."); } }
public void When_GetVideo_is_called_then_GetVideoAdapterSettings_on_the_BandRepository_is_called() { var tracks = VideoCreator.CreateCollection(); var entity = AdapterSettingsCreator.CreateSingle(); BandRepository .Expect(repository => repository.GetAdapterSettings(Arg <string> .Is.Anything)) .Return(entity) .Repeat.Once(); BandRepository.Replay(); VideoAdapter .Expect(adapter => adapter.GetItems(entity.SetName, entity.OAuthAccessToken)) .Return(tracks) .Repeat.Once(); VideoAdapter.Replay(); Process.GetVideos(); BandRepository.VerifyAllExpectations(); }
static void Main(string[] args) { switch (args.Length) { case 0: Console.WriteLine("Console Video Watcher: by Heerod Sahraei\nCopyright (C) Hababisoft Corporation, All rights reserved.\nVersion 1.5A"); break; case 1: //What to do when file is opened with this program. if (args[0].Contains(".mp4")) //When an mp4 video is put in. { if (File.Exists(args[0])) { int quality = 1; Console.WriteLine("Input the quality you wish to render at (Low/Med/High)"); switch (ConsoleHelper.Prompt("render>quality").ToLower()) { case "low": quality = 0; break; case "med": quality = 1; break; case "high": quality = 2; break; default: Console.WriteLine("Invalid setting selected, choosing medium quality by default."); break; } try { UserPrompt.vidMem = VideoCreator.RenderFrom(args[0], quality); Console.WriteLine("Render Successful."); } catch (Exception e) { if (e is ArgumentException || e is OverflowException) { Console.WriteLine("Render Failed. The video you attempted to render is too large."); } if (e is ArgumentOutOfRangeException) { Console.WriteLine("Render Failed. Ensure that you are specifying an mp4 video file."); } } } else { Console.WriteLine("Render Failed. Cannot render from specified directory."); } } else //If it isn't an mp4 video, it will just try to load it directly. { if (File.Exists(args[0])) { try { UserPrompt.vidMem = VideoCreator.Load(args[0]); try { VideoCreator.PlayVideo(UserPrompt.vidMem); } catch { Console.WriteLine("Playback Failed. The video you are trying to play may be corrupted."); } } catch (Exception e) { if (e is System.Runtime.Serialization.SerializationException) { Console.WriteLine("Loading Failed. Ensure that you are specifying a file rendered by this program."); } else { Console.WriteLine("Loading Failed. " + e.Message); } } } else { Console.WriteLine("Loading Failed. Cannot load from specified directory"); } } break; } UserPrompt.Ask(); }
public void AddVideo(string name) { _itemCreator = new VideoCreator(); Items.Add(_itemCreator.CreateItem(name)); }
public async Task RemoveCreatorFromVideo(VideoCreator creator, long videoId) { characterRepository.RemoveCreatorFromVideo(creator, videoId); }
public async Task UpdateVideoCreatorRole(VideoCreator creator, long videoId) { characterRepository.UpdateVideoCreatorRole(creator, videoId); }