public void Punch(PunchType p) { if (p.PunchCategory == Category.Meta) { if (p.StartorEnd == StartEnd.Start) { StartTime = DateTime.Now; } else { EndTime = DateTime.Now; } } else if (p.StartorEnd == StartEnd.Start) //we've started a project or break. { //check that there aren't any unended segments. if (WorkSegments.Count > 0) { PunchSegment segment = WorkSegments[WorkSegments.Count - 1]; if (!segment.Ended) { //auto-fill in the blank. segment.EndTime = DateTime.Now; segment.EndLabel = "End " + (p.PunchCategory == Category.Break ? "Break" : "Project"); } } //make a new segment and start it. PunchSegment newSeg = new PunchSegment(); newSeg.StartLabel = p.Label; newSeg.SegmentCategory = p.PunchCategory; newSeg.StartTime = DateTime.Now; WorkSegments.Add(newSeg); } else if (p.StartorEnd == StartEnd.End) { //if the segment types don't match throw an exception. PunchSegment segment = WorkSegments[WorkSegments.Count - 1]; if (segment.SegmentCategory != p.PunchCategory) { throw new Exception("Current Segment Type does not match the punch type."); } //otherwise if (!segment.Ended) { segment.EndLabel = p.Label; segment.EndTime = DateTime.Now; } } }
public void TestSplitIntoWorkSegments() { //string videoFile = testdata + @"\TestMoveToCloudAndTranscribe - Copy\USA_ME_LincolnCounty_BoothbayHarbor_Selectmen_EN_2017-02-15.mp4"; //string transcriptFile = testdata + @"\TestMoveToCloudAndTranscribe - Copy\USA_ME_LincolnCounty_BoothbayHarbor_Selectmen_EN_2017-02-15.json"; //string outputFolder = Path.Combine(testdata, "TestSplitIntoWorkSegments"); //DeleteAndCreateDirectory(outputFolder); string outputFolder = @"C:\GOVMEETING\_SOURCECODE\src\DATAFILES\USA_ME_LincolnCounty_BoothbayHarbor_Selectmen_EN\2017-01-09"; string videoFile = Path.Combine(outputFolder, "01-Video.mp4"); string transcriptFile = Path.Combine(outputFolder, "R3-ToBeFixed.json"); int segmentSize = 180; int overlap = 5; WorkSegments split = new WorkSegments(); split.Split(outputFolder, videoFile, transcriptFile, segmentSize, overlap); }