// GET: Edit public ActionResult Edit(int?wordId, int?id) { if (wordId is null || id is null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var service = CreateVideoService((int)wordId); var video = service.GetVideoById((int)id); if (video is null) { return(HttpNotFound()); } var model = new VideoEdit { VideoId = (int)id, Description = video.Description }; ViewData["WordId"] = (int)wordId; return(View(model)); }
/// <summary> /// 修改摄像头信息 /// </summary> /// <param name="videoEdit"></param> /// <returns></returns> public ActionResult <bool> EditVideo(VideoEdit videoEdit) { try { var dbv = _rpsv.GetModel(videoEdit.ID); if (dbv == null) { throw new Exception("未找到所需修改的摄像头信息"); } var check = _rpsv.Any(p => p.ID != videoEdit.ID && p.Code == videoEdit.Code); if (check) { throw new Exception("该摄像头信息已存在"); } dbv = videoEdit.CopyTo <Basic_Vedio>(dbv); _rpsvs.Delete(p => p.VedioID == videoEdit.ID); var lsvs = (from vs in videoEdit.Subjects select new Basic_VedioSubject { ID = Guid.NewGuid(), SubjectID = vs.SubjectID, SubjectType = vs.SubjectType, VedioID = dbv.ID }).ToList(); _rpsv.Update(dbv); _rpsvs.Add(lsvs); _work.Commit(); return(new ActionResult <bool>(true)); } catch (Exception ex) { return(new ActionResult <bool>(ex)); } }
private void cbAudioCodec_SelectedIndexChanged(object sender, EventArgs e) { string name = this.cbAudioCodec.Text; btAudioSettings.Enabled = VideoEdit.Audio_Codec_Has_Dialog(name, VFPropertyPage.Default) || VideoEdit.Audio_Codec_Has_Dialog(name, VFPropertyPage.VFWCompConfig); }
public bool EditVideo(string id, VideoEdit edit) { switch (edit.Flag) { case EditType.New: var newVideo = new Video(); EditVideoAction(newVideo, edit); Videos.Add(newVideo); break; case EditType.Update: var existingVideo = Videos.Find(x => x.Id == id.ToString()); if (existingVideo.UpdateDate == edit.UpdateDate) { EditVideoAction(existingVideo, edit); } else { return(false); } break; case EditType.Delete: Videos.RemoveAll(x => x.Id == id.ToString()); break; } return(true); }
// Update public bool UpdateVideo(VideoEdit model) { var entity = _context .Videos .SingleOrDefault(e => e.VideoId == model.VideoId && e.UserId == _userId); entity.Description = model.Description; return(_context.SaveChanges() == 1); }
private void btAddTransition_Click(object sender, EventArgs e) { // get id int id = VideoEdit.Video_Transition_GetIDFromName(cbTransitionName.Text); // add transition VideoEdit1.Video_Transition_Add(Convert.ToInt32(edTransStartTime.Text), Convert.ToInt32(edTransStopTime.Text), id); // add to list lbTransitions.Items.Add(cbTransitionName.Text + "(Start: " + edTransStartTime.Text + ", stop: " + edTransStopTime.Text + ")"); }
public void EditVideoAction(ApplicationVideo video, VideoEdit edit) { if (edit.Archive.HasValue) { video.Archived = edit.Archive.Value; } if (edit.Title != null) { video.Title = edit.Title; } video.UpdateDate = DateTime.UtcNow; }
private void btAddInputFile_Click(object sender, EventArgs e) { if (OpenDialog1.ShowDialog() == DialogResult.OK) { string s = this.OpenDialog1.FileName; lbFiles.Items.Add(s); VideoEdit.GetFileLength(s, out var videoDuration, out var audioDuration); VideoEdit1.Sources_AddFile(s, videoDuration.TotalMilliseconds > 0, audioDuration.TotalMilliseconds > 0); } }
private void btAudioSettings_Click(object sender, EventArgs e) { string name = this.cbAudioCodec.Text; if (VideoEdit.Audio_Codec_Has_Dialog(name, VFPropertyPage.Default)) { VideoEdit.Audio_Codec_Show_Dialog(IntPtr.Zero, name, VFPropertyPage.Default); } else if (VideoEdit.Audio_Codec_Has_Dialog(name, VFPropertyPage.VFWCompConfig)) { VideoEdit.Audio_Codec_Show_Dialog(IntPtr.Zero, name, VFPropertyPage.VFWCompConfig); } }
private void btAddInputFile_Click(object sender, RoutedEventArgs e) { if (openFileDialog1.ShowDialog() == true) { string s = openFileDialog1.FileName; lbFiles.Items.Add(s); TimeSpan videoDuration; TimeSpan audioDuration; VideoEdit.GetFileLength(s, out videoDuration, out audioDuration); VideoEdit1.Sources_AddFile(s, videoDuration.TotalMilliseconds > 0, audioDuration.TotalMilliseconds > 0); } }
public bool EditVideo(ApplicationDbContext context, string id, VideoEdit edit) { switch (edit.Flag) { case EditType.New: { if (edit.AddedVideos == null || !edit.AddedVideos.Any()) { return(false); } var newVideo = new ApplicationVideo(); EditVideoAction(newVideo, edit); context.Add(newVideo); context.SaveChanges(); EditVideoRelation(context, newVideo, edit); } break; case EditType.Update: { int intId = int.Parse(id); var existingVideo = context.ApplicationVideos.First(x => x.Id == intId); if (edit.UpdateDate == existingVideo.UpdateDate) { EditVideoAction(existingVideo, edit); EditVideoRelation(context, existingVideo, edit); } else { return(false); } } break; case EditType.Delete: { int intId = int.Parse(id); var existingVideo = context.ApplicationVideos.First(x => x.Id == intId); context.ApplicationVideos.Remove(existingVideo); } break; default: throw new Exception("No edit flag passed"); } return(true); }
public ActionResult Edit(int languageId, int wordId, int id, VideoEdit model) { if (!ModelState.IsValid) { return(View(model)); } if (model.VideoId != id) { ModelState.AddModelError("", "Id Mismatch"); return(View(model)); } var service = CreateVideoService(wordId); if (service.UpdateVideo(model)) { TempData["SaveResult"] = "Video was successfully updated."; return(RedirectToAction("Details", "Word", new { languageId, id = wordId })); } ModelState.AddModelError("", "Video was not updated."); return(View(model)); }
public VideoEdit GetVideoForView(int videoId, int userId, bool isAdmin = false) { var video = context.Videos .Include(x => x.Notes) .SingleOrDefault(x => x.Id == videoId); if (video == null) { throw new ServiceException("The video you are trying to edit does not exist!"); } var user = context.Users.SingleOrDefault(x => x.Id == userId); if (user == null) { throw new ServiceException("User Not Found!"); } if (video.Public == false && video.UserId != user.Id) { throw new ServiceException("You can note edit video that does not belong to you!"); } var publicViewer = false; if (video.UserId != user.Id) { publicViewer = true; } ///Reordering the notes so that when there are deletions the numbers are sequential var dbNotes = video.Notes.OrderBy(x => x.Order).ToArray(); for (int i = 0; i < dbNotes.Length; i++) { dbNotes[i].Order = i; } context.SaveChanges(); var map = new Dictionary <int, int>(); var pageNotes = new NoteCreate[dbNotes.Length]; for (int i = 0; i < dbNotes.Length; i++) { var dbNote = dbNotes[i]; ///The inPageId is mapped from the order pageNotes[i] = Mapper.Instance.Map <NoteCreate>(dbNote); pageNotes[i].Level = dbNote.Level; map.Add(dbNote.Id, i); } for (int i = 0; i < dbNotes.Length; i++) { var dbNote = dbNotes[i]; var pageNote = pageNotes[i]; if (dbNote.ParentNoteId != null) { pageNote.InPageParentId = map[(int)dbNote.ParentNoteId]; } } var result = new VideoEdit { Id = video.Id, Description = video.Description, Url = video.Url, Name = video.Name, DirectoryId = video.DirectoryId, SeekTo = video.SeekTo, Duration = video.Duration, Notes = pageNotes.ToList(), IsYouTube = video.IsYouTube, IsLocal = video.IsLocal, IsVimeo = video.IsVimeo, }; if (publicViewer) { video.TimesPublicAccessed++; } else { video.LastAccessed = DateTime.Now; video.TimesAccessed += 1; } context.SaveChanges(); return(result); }
private async void btStart_Click(object sender, EventArgs e) { mmLog.Clear(); VideoEdit1.Debug_Mode = cbDebugMode.Checked; VideoEdit1.Video_Resize = cbResize.Checked; if (VideoEdit1.Video_Resize) { VideoEdit1.Video_Resize_Width = Convert.ToInt32(edWidth.Text); VideoEdit1.Video_Resize_Height = Convert.ToInt32(edHeight.Text); } VideoEdit1.Video_FrameRate = Convert.ToDouble(cbFrameRate.Text); // apply capture parameters if (VideoEdit.Filter_Supported_EVR()) { VideoEdit1.Video_Renderer.Video_Renderer = VFVideoRenderer.EVR; } else if (VideoEdit.Filter_Supported_VMR9()) { VideoEdit1.Video_Renderer.Video_Renderer = VFVideoRenderer.VMR9; } else { VideoEdit1.Video_Renderer.Video_Renderer = VFVideoRenderer.VideoRenderer; } if (!rbConvert.Checked) { VideoEdit1.Mode = VFVideoEditMode.Preview; } else { VideoEdit1.Mode = VFVideoEditMode.Convert; VideoEdit1.Output_Filename = edOutput.Text; switch (cbOutputFormat.SelectedIndex) { case 0: { var aviOutput = new VFAVIOutput(); SetAVIOutput(ref aviOutput); VideoEdit1.Output_Format = aviOutput; break; } case 1: { var mkvOutput = new VFMKVv1Output(); SetMKVOutput(ref mkvOutput); VideoEdit1.Output_Format = mkvOutput; break; } case 2: { var wmvOutput = new VFWMVOutput(); SetWMVOutput(ref wmvOutput); VideoEdit1.Output_Format = wmvOutput; break; } case 3: { var dvOutput = new VFDVOutput(); SetDVOutput(ref dvOutput); VideoEdit1.Output_Format = dvOutput; break; } case 4: { var webmOutput = new VFWebMOutput(); SetWebMOutput(ref webmOutput); VideoEdit1.Output_Format = webmOutput; break; } case 5: { var ffmpegDLLOutput = new VFFFMPEGDLLOutput(); SetFFMPEGDLLOutput(ref ffmpegDLLOutput); VideoEdit1.Output_Format = ffmpegDLLOutput; break; } case 6: { var ffmpegOutput = new VFFFMPEGEXEOutput(); SetFFMPEGEXEOutput(ref ffmpegOutput); VideoEdit1.Output_Format = ffmpegOutput; break; } case 7: { var mp4Output = new VFMP4v8v10Output(); SetMP4v10Output(ref mp4Output); VideoEdit1.Output_Format = mp4Output; break; } case 8: { var mp4Output = new VFMP4v11Output(); SetMP4v11Output(ref mp4Output); VideoEdit1.Output_Format = mp4Output; break; } case 9: { var gifOutput = new VFAnimatedGIFOutput(); SetGIFOutput(ref gifOutput); VideoEdit1.Output_Format = gifOutput; break; } case 10: { var encOutput = new VFMP4v8v10Output(); SetMP4v10Output(ref encOutput); encOutput.Encryption = true; encOutput.Encryption_Format = VFEncryptionFormat.MP4_H264_SW_AAC; VideoEdit1.Output_Format = encOutput; break; } } } VideoEdit1.Video_Effects_Enabled = true; VideoEdit1.Video_Effects_Clear(); lbLogos.Items.Clear(); ConfigureVideoEffects(); VideoEdit1.Input_Clear_List(); if (rbImagesPredefined.Checked) { predefinedImagesUsed = true; await VideoEdit1.Input_AddVideoBlankAsync( TimeSpan.FromMilliseconds(10000), TimeSpan.FromMilliseconds(0), 1280, 720, Color.Black); } else { predefinedImagesUsed = false; if (!Directory.Exists(edImagesFolder.Text)) { MessageBox.Show(this, "Folder with images doesn't exists!"); return; } loadedFiles = EnumerateImageFiles(edImagesFolder.Text); int width = Convert.ToInt32(edWidth.Text); int height = Convert.ToInt32(edHeight.Text); loadedImageFilename = null; if (loadedImage != null) { loadedImage.Dispose(); loadedImage = null; } await VideoEdit1.Input_AddVideoBlankAsync( TimeSpan.FromSeconds(loadedFiles.Length * 2), TimeSpan.FromMilliseconds(0), width, height, Color.Black); } await VideoEdit1.StartAsync(); }
private void btStart_Click(object sender, EventArgs e) { mmLog.Clear(); VideoEdit1.Debug_Mode = cbDebugMode.Checked; VideoEdit1.Video_Resize = cbResize.Checked; if (VideoEdit1.Video_Resize) { VideoEdit1.Video_Resize_Width = Convert.ToInt32(edWidth.Text); VideoEdit1.Video_Resize_Height = Convert.ToInt32(edHeight.Text); } VideoEdit1.Video_FrameRate = Convert.ToDouble(cbFrameRate.Text); // apply capture parameters if (VideoEdit.Filter_Supported_EVR()) { VideoEdit1.Video_Renderer.Video_Renderer = VFVideoRenderer.EVR; } else if (VideoEdit.Filter_Supported_VMR9()) { VideoEdit1.Video_Renderer.Video_Renderer = VFVideoRenderer.VMR9; } else { VideoEdit1.Video_Renderer.Video_Renderer = VFVideoRenderer.VideoRenderer; } if (!rbConvert.Checked) { VideoEdit1.Mode = VFVideoEditMode.Preview; } else { VideoEdit1.Mode = VFVideoEditMode.Convert; VideoEdit1.Output_Filename = edOutput.Text; switch (cbOutputFormat.SelectedIndex) { case 0: { var aviOutput = new VFAVIOutput(); SetAVIOutput(ref aviOutput); VideoEdit1.Output_Format = aviOutput; break; } case 1: { var mkvOutput = new VFMKVv1Output(); SetMKVOutput(ref mkvOutput); VideoEdit1.Output_Format = mkvOutput; break; } case 2: { var wmvOutput = new VFWMVOutput(); SetWMVOutput(ref wmvOutput); VideoEdit1.Output_Format = wmvOutput; break; } case 3: { var dvOutput = new VFDVOutput(); SetDVOutput(ref dvOutput); VideoEdit1.Output_Format = dvOutput; break; } case 4: { var webmOutput = new VFWebMOutput(); SetWebMOutput(ref webmOutput); VideoEdit1.Output_Format = webmOutput; break; } case 5: { var ffmpegDLLOutput = new VFFFMPEGDLLOutput(); SetFFMPEGDLLOutput(ref ffmpegDLLOutput); VideoEdit1.Output_Format = ffmpegDLLOutput; break; } case 6: { var ffmpegOutput = new VFFFMPEGEXEOutput(); SetFFMPEGEXEOutput(ref ffmpegOutput); VideoEdit1.Output_Format = ffmpegOutput; break; } case 7: { var mp4Output = new VFMP4v8v10Output(); SetMP4v10Output(ref mp4Output); VideoEdit1.Output_Format = mp4Output; break; } case 8: { var mp4Output = new VFMP4v11Output(); SetMP4v11Output(ref mp4Output); VideoEdit1.Output_Format = mp4Output; break; } case 9: { var gifOutput = new VFAnimatedGIFOutput(); SetGIFOutput(ref gifOutput); VideoEdit1.Output_Format = gifOutput; break; } case 10: { var encOutput = new VFMP4v8v10Output(); SetMP4v10Output(ref encOutput); encOutput.Encryption = true; encOutput.Encryption_Format = VFEncryptionFormat.MP4_H264_SW_AAC; VideoEdit1.Output_Format = encOutput; break; } } } VideoEdit1.Video_Effects_Enabled = true; VideoEdit1.Video_Effects_Clear(); lbLogos.Items.Clear(); ConfigureVideoEffects(); VideoEdit1.Input_Clear_List(); VideoEdit1.Input_AddVideoBlank(10000, 0, 640, 480, Color.Black); VideoEdit1.Start(); }
public ActionResult <bool> EditVideo(VideoEdit videoEdit) { LogContent = "修改了监控模型,参数源:" + JsonConvert.SerializeObject(videoEdit); return(bll.EditVideo(videoEdit)); }
private void btStart_Click(object sender, EventArgs e) { mmLog.Clear(); VideoEdit1.Debug_Mode = cbDebugMode.Checked; VideoEdit1.Video_Effects_Clear(); if (rbConvert.Checked) { VideoEdit1.Mode = VFVideoEditMode.Convert; } else { VideoEdit1.Mode = VFVideoEditMode.Preview; } VideoEdit1.Video_Resize = cbResize.Checked; if (VideoEdit1.Video_Resize) { VideoEdit1.Video_Resize_Width = Convert.ToInt32(edWidth.Text); VideoEdit1.Video_Resize_Height = Convert.ToInt32(edHeight.Text); } VideoEdit1.Video_FrameRate = Convert.ToDouble(cbFrameRate.Text); // apply capture parameters if (VideoEdit.Filter_Supported_EVR()) { VideoEdit1.Video_Renderer.Video_Renderer = VFVideoRenderer.EVR; } else if (VideoEdit.Filter_Supported_VMR9()) { VideoEdit1.Video_Renderer.Video_Renderer = VFVideoRenderer.VMR9; } else { VideoEdit1.Video_Renderer.Video_Renderer = VFVideoRenderer.VideoRenderer; } VideoEdit1.Output_Filename = edOutput.Text; if (rbAVI.Checked) { var aviOutput = new VFAVIOutput(); aviOutput.ACM.Name = cbAudioCodec.Text; aviOutput.ACM.Channels = Convert.ToInt32(cbChannels.Text); aviOutput.ACM.BPS = Convert.ToInt32(cbBPS.Text); aviOutput.ACM.SampleRate = Convert.ToInt32(cbSampleRate.Text); aviOutput.Video_Codec = cbVideoCodec.Text; aviOutput.Audio_UseMP3Encoder = false; VideoEdit1.Output_Format = aviOutput; } else { var wmvOutput = new VFWMVOutput(); wmvOutput.Mode = VFWMVMode.InternalProfile; if (cbWMVInternalProfile9.SelectedIndex != -1) { wmvOutput.Internal_Profile_Name = cbWMVInternalProfile9.Text; } VideoEdit1.Output_Format = wmvOutput; } VideoEdit1.Video_Effects_Enabled = true; VideoEdit1.Video_Effects_Clear(); if (this.cbImageLogo.Checked) { cbImageLogo_CheckedChanged(null, null); } if (cbTextLogo.Checked) { cbTextLogo_CheckedChanged(null, null); } VideoEdit1.Input_Clear_List(); VideoEdit1.Input_AddVideoBlank(10000, 0, 640, 480, Color.Black); VideoEdit1.Start(); }
public void EditVideoRelation(ApplicationDbContext context, ApplicationVideo video, VideoEdit edit) { if (edit.MetaTags != null) { foreach (var etag in edit.MetaTags) { EditVideoMetaTags(context, video, etag); } } if (edit.AddedGenericTags != null) { foreach (var etag in edit.AddedGenericTags) { AddGenericTag(context, video, etag); } } if (edit.RemovedGenericTags != null) { foreach (var etag in edit.RemovedGenericTags) { RemoveGenericTag(context, video, etag); } } if (edit.AddedCampaigns != null) { foreach (var id in edit.AddedCampaigns) { AddVideoCampaign(context, video, id); } } if (edit.RemovedCampaigns != null) { foreach (var id in edit.RemovedCampaigns) { RemoveVideoCampaign(context, video, id); } } if (edit.AddedVideos != null) { foreach (var id in edit.AddedVideos) { AddVideoSourceVideo(context, video, id); } } if (edit.RemovedVideos != null) { foreach (var id in edit.RemovedVideos) { RemoveVideoSourceVideo(context, video, id); } } }
public void EditVideoAction(Video v, VideoEdit edit) { if (edit.Archive.HasValue) { v.Archived = edit.Archive.Value; } if (edit.Title != null) { v.Title = edit.Title; } if (edit.MetaTags != null) { foreach (var etag in edit.MetaTags) { var value = etag.Value; if (value == null) { v.Tags.RemoveAll(x => x.Type == etag.Key); } else { v.Tags.RemoveAll(x => x.Type == etag.Key); v.Tags.Add(new Tag() { Type = etag.Key, Value = etag.Value }); } } } if (edit.AddedGenericTags != null) { v.Tags.AddRange(edit.AddedGenericTags.Select(x => new Tag() { Type = Constants.GenericTag, Value = x })); } if (edit.RemovedGenericTags != null) { v.Tags.RemoveAll(x => edit.RemovedGenericTags.Contains(x.Value)); } if (edit.AddedVideos != null) { foreach (var id in edit.AddedVideos) { AddVideoSourceObject(v, id); } } if (edit.RemovedVideos != null) { foreach (var id in edit.RemovedVideos) { RemoveVideoSourceObject(v, id); } } if (edit.AddedCampaigns != null) { foreach (var id in edit.AddedCampaigns) { AddVideoSourceObject(v, id); } } if (edit.RemovedCampaigns != null) { foreach (var id in edit.RemovedCampaigns) { RemoveVideoSourceObject(v, id); } } }