public void Setup() { _helper = new FLExTextExporter(null, "Homer", null, "en", "fr", "filename1", "filename2"); var tempMediaPath = MediaFileInfoTests.GetLongerTestAudioFile(); _tempFolder = new TemporaryFolder("TierCollectionTests"); _mediaFile = Path.Combine(_tempFolder.Path, "mediaFile.wav"); File.Move(tempMediaPath, _mediaFile); }
/// ------------------------------------------------------------------------------------ private void OnFLexTextExportClick(object sender, EventArgs e) { Analytics.Track("Export FlexText initiated"); var file = (AnnotationComponentFile)_file; var fullMediaFileName = file.GetPathToAssociatedMediaFile(); var mediaFileName = Path.GetFileName(fullMediaFileName); var sourceFileName = string.Empty; if (mediaFileName == null) { return; } // SP-869: "Sequence contains no matching element" if the source media file does not contain the text "source" in the name var componentFile = file.ParentElement.GetComponentFiles().FirstOrDefault( compfile => compfile.GetAssignedRoles().Any(r => r.Id == ComponentRole.kSourceComponentRoleId)); if (componentFile != null) { // In case the media file is the source file we don't want two references to it. if (componentFile.PathToAnnotatedFile != mediaFileName) { sourceFileName = componentFile.PathToAnnotatedFile; } } using (var dlg = new ExportToFieldWorksInterlinearDlg(mediaFileName)) { if (dlg.ShowDialog() == DialogResult.Cancel) { Analytics.Track("Export FlexText cancelled"); return; } FLExTextExporter.Save(dlg.FileName, mediaFileName, file.Tiers, dlg.TranscriptionWs.Id, dlg.FreeTranslationWs.Id, fullMediaFileName, sourceFileName); } }
/// ------------------------------------------------------------------------------------ private void CreateTestTier() { var tier = new TextTier(TextTier.ElanTranscriptionTierId); tier.AddSegment("up"); tier.AddSegment("down"); tier.AddSegment("over"); var dependentTier = new TextTier(TextTier.ElanTranslationTierId); dependentTier.AddSegment("in"); dependentTier.AddSegment("around"); dependentTier.AddSegment("through"); var timeTier = new TimeTier("test tier", _mediaFile); timeTier.AddSegment(10f, 20f); timeTier.AddSegment(20f, 30f); timeTier.AddSegment(30f, 40f); _helper = new FLExTextExporter(null, "Homer", new TierCollection { tier, dependentTier, timeTier }, "en", "fr", "filename1", "filename2"); }