public void mkvmergelanguageservice_returns_undetermined_when_language_not_found_test() { //given IJsonSerializationService <ISOLanguageCodeCollection> jsonSerializationService = new JsonSerializationService <ISOLanguageCodeCollection>(); IMKVMergeLanguageService service = new MKVMergeLanguageService(jsonSerializationService); //when var language = service.GetLanguageByName("nolanguage"); //then language.Value.Should().Be("und"); }
public void mkvmergelanguageservice_can_get_languages_test() { //given IJsonSerializationService <ISOLanguageCodeCollection> jsonSerializationService = new JsonSerializationService <ISOLanguageCodeCollection>(); IMKVMergeLanguageService service = new MKVMergeLanguageService(jsonSerializationService); //when var languages = service.GetLanguages(); //then languages.Count().Should().BeGreaterThan(0); }
public void mkvmergelanguageservice_returns_correct_language_test() { //given IJsonSerializationService <ISOLanguageCodeCollection> jsonSerializationService = new JsonSerializationService <ISOLanguageCodeCollection>(); IMKVMergeLanguageService service = new MKVMergeLanguageService(jsonSerializationService); //when var language = service.GetLanguageByName("English"); //then language.Value.Should().Be("eng"); }
public void bluraytitleparserservice_can_set_subtitle_language_test() { List <ProcessOutputLineItem> lineItems = new List <ProcessOutputLineItem> { new ProcessOutputLineItem() { Id = 1, Text = "4: Subtitle (pgs), French" } }; IJsonSerializationService <ISOLanguageCodeCollection> jsonSerializationService = new JsonSerializationService <ISOLanguageCodeCollection>(); IMKVMergeLanguageService languageService = new MKVMergeLanguageService(jsonSerializationService); ILineItemIdentifierService lineItemService = new BluRayTitleLineItemIdentifierService(); IBluRayTitleParserService parserService = new BluRayTitleParserService(lineItemService, lineItems, languageService); BluRayTitleInfo info = parserService.GetTitleInfo(); info.Subtitles[0].Language.Should().Be("French"); }
public void bluraytitleparserservice_can_set_header_text_test() { List <ProcessOutputLineItem> lineItems = new List <ProcessOutputLineItem> { new ProcessOutputLineItem() { Id = 1, Text = "M2TS, 1 video track, 1 audio track, 1 subtitle track, 0:58:28, 50i" } }; IJsonSerializationService <ISOLanguageCodeCollection> jsonSerializationService = new JsonSerializationService <ISOLanguageCodeCollection>(); IMKVMergeLanguageService languageService = new MKVMergeLanguageService(jsonSerializationService); ILineItemIdentifierService lineItemService = new BluRayTitleLineItemIdentifierService(); IBluRayTitleParserService parserService = new BluRayTitleParserService(lineItemService, lineItems, languageService); BluRayTitleInfo info = parserService.GetTitleInfo(); info.HeaderText.Should().Be(lineItems[0].Text); }
public void bluraytitleparserservice_can_set_audio_language_test() { List <ProcessOutputLineItem> lineItems = new List <ProcessOutputLineItem> { new ProcessOutputLineItem() { Id = 1, Text = "3: Dolby Digital Audio English 448 kbps 5.1 / 48 kHz / 448 kbps" } }; IJsonSerializationService <ISOLanguageCodeCollection> jsonSerializationService = new JsonSerializationService <ISOLanguageCodeCollection>(); IMKVMergeLanguageService languageService = new MKVMergeLanguageService(jsonSerializationService); ILineItemIdentifierService lineItemService = new BluRayTitleLineItemIdentifierService(); IBluRayTitleParserService parserService = new BluRayTitleParserService(lineItemService, lineItems, languageService); BluRayTitleInfo info = parserService.GetTitleInfo(); info.AudioList[0].Language.Should().Be("English"); }
public void bluraytitleparserservice_can_set_audio_type_lpcm_test() { List <ProcessOutputLineItem> lineItems = new List <ProcessOutputLineItem> { new ProcessOutputLineItem() { Id = 1, Text = "3: English / LPCM Audio / 1.0 / 48 kHz / 1152 kbps / 24-bit" } }; IJsonSerializationService <ISOLanguageCodeCollection> jsonSerializationService = new JsonSerializationService <ISOLanguageCodeCollection>(); IMKVMergeLanguageService languageService = new MKVMergeLanguageService(jsonSerializationService); ILineItemIdentifierService lineItemService = new BluRayTitleLineItemIdentifierService(); IBluRayTitleParserService parserService = new BluRayTitleParserService(lineItemService, lineItems, languageService); BluRayTitleInfo info = parserService.GetTitleInfo(); info.AudioList[0].AudioType.Should().Be(EnumAudioType.LPCM); }
private void LoadMKVLanguageDropDownBoxes() { IJsonSerializationService <ISOLanguageCodeCollection> jsonSerializationService = new JsonSerializationService <ISOLanguageCodeCollection>(); IMKVMergeLanguageService service = new MKVMergeLanguageService(jsonSerializationService); foreach (MKVMergeLanguageItem item in service.GetLanguages()) { _bindingListSubtitlesMKVMergeDefaultSettingsLanguage.Add(item); _bindingListAudioMKVMergeDefaultSettingsLanguage.Add(item); } bsAudioMKVMergeDefaultSettingsLanguage.DataSource = _bindingListAudioMKVMergeDefaultSettingsLanguage; _bindingListAudioMKVMergeDefaultSettingsLanguage.AllowEdit = false; bsSubtitlesMKVMergeDefaultSettingsLanguage.DataSource = _bindingListSubtitlesMKVMergeDefaultSettingsLanguage; _bindingListSubtitlesMKVMergeDefaultSettingsLanguage.AllowEdit = false; }
public void bluraytitleparserservice_can_set_audio_id_test() { List <ProcessOutputLineItem> lineItems = new List <ProcessOutputLineItem> { new ProcessOutputLineItem() { Id = 1, Text = "3: DTS Master Audio, French, 5.1 channels, 24 bits, 48kHz" } }; IJsonSerializationService <ISOLanguageCodeCollection> jsonSerializationService = new JsonSerializationService <ISOLanguageCodeCollection>(); IMKVMergeLanguageService languageService = new MKVMergeLanguageService(jsonSerializationService); ILineItemIdentifierService lineItemService = new BluRayTitleLineItemIdentifierService(); IBluRayTitleParserService parserService = new BluRayTitleParserService(lineItemService, lineItems, languageService); BluRayTitleInfo info = parserService.GetTitleInfo(); info.AudioList[0].Id.Should().Be("3:"); }
public void bluraytitleparserservice_can_set_video_test() { List <ProcessOutputLineItem> lineItems = new List <ProcessOutputLineItem> { new ProcessOutputLineItem() { Id = 1, Text = "2: h264/AVC, 1080i50 (16:9)" } }; IJsonSerializationService <ISOLanguageCodeCollection> jsonSerializationService = new JsonSerializationService <ISOLanguageCodeCollection>(); IMKVMergeLanguageService languageService = new MKVMergeLanguageService(jsonSerializationService); ILineItemIdentifierService lineItemService = new BluRayTitleLineItemIdentifierService(); IBluRayTitleParserService parserService = new BluRayTitleParserService(lineItemService, lineItems, languageService); BluRayTitleInfo info = parserService.GetTitleInfo(); info.Video.Should().NotBeNull(); info.Video.Id.Should().Be("2:"); }
public void bluraytitleparserservice_is_id_valid_test() { List <ProcessOutputLineItem> lineItems = new List <ProcessOutputLineItem> { new ProcessOutputLineItem() { Id = 1, Text = "4: Subtitle (pgs), French" } }; IJsonSerializationService <ISOLanguageCodeCollection> jsonSerializationService = new JsonSerializationService <ISOLanguageCodeCollection>(); IMKVMergeLanguageService languageService = new MKVMergeLanguageService(jsonSerializationService); ILineItemIdentifierService lineItemService = new BluRayTitleLineItemIdentifierService(); IBluRayTitleParserService parserService = new BluRayTitleParserService(lineItemService, lineItems, languageService); bool isValid = parserService.IsIdValid("4:"); isValid.Should().BeTrue(); }
public void bluraytitleparserservice_is_id_not_valid_test() { List <ProcessOutputLineItem> lineItems = new List <ProcessOutputLineItem> { new ProcessOutputLineItem() { Id = 1, Text = "(core: DTS, 5.1 channels, 1509kpps, 48kHz)" } }; IJsonSerializationService <ISOLanguageCodeCollection> jsonSerializationService = new JsonSerializationService <ISOLanguageCodeCollection>(); IMKVMergeLanguageService languageService = new MKVMergeLanguageService(jsonSerializationService); ILineItemIdentifierService lineItemService = new BluRayTitleLineItemIdentifierService(); IBluRayTitleParserService parserService = new BluRayTitleParserService(lineItemService, lineItems, languageService); bool isValid = parserService.IsIdValid("core:"); isValid.Should().BeFalse(); }
private void LoadMKVMergeLangugeItemsDropDown() { IJsonSerializationService <ISOLanguageCodeCollection> jsonSerializationService = new JsonSerializationService <ISOLanguageCodeCollection>(); IMKVMergeLanguageService service = new MKVMergeLanguageService(jsonSerializationService); foreach (MKVMergeLanguageItem item in service.GetLanguages()) { _bindingListMKVMergeLanguageItem.Add(item); } bsMKVMergeLanguageItem.DataSource = _bindingListMKVMergeLanguageItem; _bindingListMKVMergeLanguageItem.AllowEdit = false; if (_isAdd) { _currentMKVMergeItem.Language = service.GetLanguageByName("undetermined"); } }
private void bgwEac3toLoadTitle_DoWork(object sender, DoWorkEventArgs e) { try { IJsonSerializationService <ISOLanguageCodeCollection> jsonSerializationService = new JsonSerializationService <ISOLanguageCodeCollection>(); IMKVMergeLanguageService languageService = new MKVMergeLanguageService(jsonSerializationService); ICommandLineProcessService commandLineProcessService = e.Argument as CommandLineProcessService; List <ProcessOutputLineItem> processOutputLineItems = commandLineProcessService.GetProcessOutputLineItems(); ILineItemIdentifierService lineItemService = new BluRayTitleLineItemIdentifierService(); IBluRayTitleParserService parserService = new BluRayTitleParserService(lineItemService, processOutputLineItems, languageService); _bluRaySummaryInfo.BluRayTitleInfo = parserService.GetTitleInfo(); } catch (Exception ex) { _displayErrorMessageService.LogAndDisplayError(new ErrorMessage() { DisplayMessage = "There was a problem loading the title!", DisplayTitle = "Error.", Exception = ex, MethodNameWhereExceptionOccurred = MethodBase.GetCurrentMethod().Name }); } }
private void SetMKVMergetItemDefaults() { try { IJsonSerializationService <ISOLanguageCodeCollection> jsonSerializationService = new JsonSerializationService <ISOLanguageCodeCollection>(); IMKVMergeLanguageService languageService = new MKVMergeLanguageService(jsonSerializationService); IMKVMergeDefaultSettingsService mkvMergeDefaultSettingsService = new MKVMergeDefaultSettingsService(_eac3ToConfiguration, Program.ApplicationSettings, _bluRaySummaryInfo, languageService, _audioService); mkvMergeDefaultSettingsService.SetAudioDefaultSettings(); mkvMergeDefaultSettingsService.SetSubtitleDefaultSettings(); } catch (Exception ex) { _displayErrorMessageService.LogAndDisplayError(new ErrorMessage() { DisplayMessage = "There was a problem setting the mkvmerge defaults!", DisplayTitle = "Error.", Exception = ex, MethodNameWhereExceptionOccurred = MethodBase.GetCurrentMethod().Name }); } }
private void LoadMKVMergeLangugeItemsDropDown() { try { IJsonSerializationService <ISOLanguageCodeCollection> jsonSerializationService = new JsonSerializationService <ISOLanguageCodeCollection>(); IMKVMergeLanguageService service = new MKVMergeLanguageService(jsonSerializationService); foreach (MKVMergeLanguageItem item in service.GetLanguages()) { _bindingListMKVMergeLanguageItem.Add(item); } bsMKVMergeLanguageItem.DataSource = _bindingListMKVMergeLanguageItem; _bindingListMKVMergeLanguageItem.AllowEdit = false; } catch (Exception ex) { _displayErrorMessageService.LogAndDisplayError(new ErrorMessage() { DisplayMessage = "There was a problem loading the mkvmerge languages!", DisplayTitle = "Error.", Exception = ex, MethodNameWhereExceptionOccurred = MethodBase.GetCurrentMethod().Name }); } }
static void Main(string[] args) { //config string batchFilePath = @"C:\temp\My Encodes\Blu-ray"; string bluRayDiscPath = @"C:\temp\My Encodes\Blu-ray\DISC\D1"; string eac3ToPath = @"C:\exe\eac3to\eac3to.exe"; EAC3ToConfiguration eac3toConfiguation = new EAC3ToConfiguration() { BatchFilePath = batchFilePath, EAC3ToPath = eac3ToPath, IsExtractForRemux = false }; //Main object List <BluRayDiscInfo> bluRayDiscList = new List <BluRayDiscInfo>(); BluRayDiscInfo bluRayDisc = new BluRayDiscInfo() { Id = 1, IsSelected = true, BluRayPath = bluRayDiscPath }; bluRayDiscList.Add(bluRayDisc); //Build command line for blu ray summary ie eac3to disc CommandLineProcessStartInfo commandLineProcessStartInfoSummary = new CommandLineProcessStartInfo() { FileName = eac3ToPath, Arguments = string.Format("\"{0}\"", bluRayDiscPath) }; //Service will allow you to get each line outputted on the screen ICommandLineProcessService commandLineProcessServiceSummary = new CommandLineProcessService(commandLineProcessStartInfoSummary); //Checking eac3to errors if (commandLineProcessServiceSummary.Errors.Count() == 0) { //Get line items outputted on screen for blu ray summary List <ProcessOutputLineItem> processOutputLineItemsSummary = commandLineProcessServiceSummary.GetProcessOutputLineItems(); foreach (var line in processOutputLineItemsSummary) { //System.Console.WriteLine(line.Text); //write out if we choose too } //Group the summary line items ie 1), 2) etc etc ILineItemIdentifierService lineItemServiceSummary = new BluRaySummaryLineItemIdentifierService(); IBluRaySummaryParserService parserServiceSummary = new BluRaySummaryParserService(lineItemServiceSummary, processOutputLineItemsSummary); bluRayDisc.BluRaySummaryInfoList = parserServiceSummary.GetSummaryList(); //Loop and output summary list if we choose foreach (var summary in bluRayDisc.BluRaySummaryInfoList) { //System.Console.WriteLine(string.Format("Header: {0}",summary.HeaderText)); //write out if we choose //System.Console.WriteLine(string.Format("Detail: {0}", summary.DetailText)); //write out if we choose } //Build command line for blu ray title ie eac3to disc1 1) CommandLineProcessStartInfo commandLineProcessStartInfoTitle = new CommandLineProcessStartInfo() { FileName = eac3ToPath, Arguments = string.Format("\"{0}\" {1}", bluRayDiscPath, bluRayDisc.BluRaySummaryInfoList[1].Eac3ToId) }; //Service will allow you to get each line outputted on the screen ICommandLineProcessService commandLineProcessServiceTitle = new CommandLineProcessService(commandLineProcessStartInfoTitle); //Check for errors if (commandLineProcessServiceTitle.Errors.Count() == 0) { //Get outputted lines List <ProcessOutputLineItem> processOutputLineItemsTitle = commandLineProcessServiceTitle.GetProcessOutputLineItems(); //Loop and output lines if we choose too foreach (var line in processOutputLineItemsTitle) { //System.Console.WriteLine(line.Text); //write out if we choose too } //language service IJsonSerializationService <ISOLanguageCodeCollection> jsonSerializationService = new JsonSerializationService <ISOLanguageCodeCollection>(); IMKVMergeLanguageService languageService = new MKVMergeLanguageService(jsonSerializationService); //This service is used to identify the title line type ie audio, video, subtitle etc etc ILineItemIdentifierService lineItemServiceTitle = new BluRayTitleLineItemIdentifierService(); //This service will parse the line items and return an info object that tells about the specific title IBluRayTitleParserService parserServiceTitle = new BluRayTitleParserService(lineItemServiceTitle, processOutputLineItemsTitle, languageService); //Get the title info object bluRayDisc.BluRaySummaryInfoList[1].BluRayTitleInfo = parserServiceTitle.GetTitleInfo(); if (bluRayDisc.BluRaySummaryInfoList[1].BluRayTitleInfo != null) { //System.Console.WriteLine(string.Format("Title: {0}",bluRayDisc.BluRaySummaryInfoList[1].BluRayTitleInfo.HeaderText)); //print header text if we choose too //System.Console.WriteLine(string.Format("Chapters Id: {0}", bluRayDisc.BluRaySummaryInfoList[1].BluRayTitleInfo.Chapter.Id)); //print chapter id if we choose too //System.Console.WriteLine(string.Format("Video Id: {0}", bluRayDisc.BluRaySummaryInfoList[1].BluRayTitleInfo.Video.Id)); //print video id if we choose too //System.Console.WriteLine(string.Format("Audio1 ID and Language: {0} - {1}",bluRayDisc.BluRaySummaryInfoList[1].BluRayTitleInfo.AudioList[0].Id, bluRayDisc.BluRaySummaryInfoList[1].BluRayTitleInfo.AudioList[0].Language)); //print audio id/language if we choose too //System.Console.WriteLine(string.Format("Subtitle1 ID and Language: {0} - {1}", bluRayDisc.BluRaySummaryInfoList[1].BluRayTitleInfo.Subtitles[0].Id, bluRayDisc.BluRaySummaryInfoList[1].BluRayTitleInfo.Subtitles[0].Language)); //print subtitle id/language if we choose too //can also print out other fields for testing } //select/set items bluRayDiscList[0].IsSelected = true; bluRayDiscList[0].BluRaySummaryInfoList[1].IsSelected = true; bluRayDiscList[0].BluRaySummaryInfoList[1].BluRayTitleInfo.Video.IsSelected = true; bluRayDiscList[0].BluRaySummaryInfoList[1].BluRayTitleInfo.Chapter.IsSelected = true; bluRayDiscList[0].BluRaySummaryInfoList[1].BluRayTitleInfo.EpisodeNumber = "1"; foreach (BluRayTitleAudio audio in bluRayDiscList[0].BluRaySummaryInfoList[1].BluRayTitleInfo.AudioList) { audio.IsSelected = true; } foreach (BluRayTitleSubtitle subtitle in bluRayDiscList[0].BluRaySummaryInfoList[1].BluRayTitleInfo.Subtitles) { subtitle.IsSelected = true; } //now time to write out the batch file IDirectorySystemService directorySystemService = new DirectorySystemService(); IAudioService audioService = new AudioService(); AbstractEAC3ToOutputNamingService eac3ToOutputNamingService = new EncodeTemplate1EAC3ToOutputNamingService(audioService); IEAC3ToCommonRulesValidatorService eac3ToCommonRulesValidatorService = new EAC3ToCommonRulesValidatorService(eac3toConfiguation, directorySystemService, bluRayDiscList); IEAC3ToBatchFileWriteService batchFileWriteService = new EAC3ToBatchFileWriteService(eac3toConfiguation, directorySystemService, bluRayDiscList, audioService, eac3ToOutputNamingService, eac3ToCommonRulesValidatorService); batchFileWriteService.Write(); if (batchFileWriteService.Errors.Count() == 0) { System.Console.WriteLine("Batch file created successfully!"); } else { foreach (var error in batchFileWriteService.Errors) { System.Console.WriteLine(string.Format("Error: {0}", error.Description)); } } } else { //title parsing errors System.Console.WriteLine("The following errors were found:"); foreach (var error in commandLineProcessServiceTitle.Errors) { System.Console.WriteLine(error.Description); } } } else { //summary parsing errors System.Console.WriteLine("The following errors were found:"); foreach (var error in commandLineProcessServiceSummary.Errors) { System.Console.WriteLine(error.Description); } } System.Console.Read(); }