Inheritance: BatchGuy.App.Eac3To.Abstracts.AbstractEAC3ToOutputNamingService
 public void eac3tobatchfilewriteservice_has_no_disc_selected_error_when_no_disc_selected_test()
 {
     List<BluRayDiscInfo> discList = new List<BluRayDiscInfo>() {new BluRayDiscInfo() { Id = 1, IsSelected = false, BluRayPath = @"c:\temp\disc1" }};
     EAC3ToConfiguration config = new EAC3ToConfiguration();
     var directorySystemServiceMock = new Mock<IDirectorySystemService>();
     directorySystemServiceMock.Setup(m => m.Exists(It.IsAny<string>())).Returns(true);
     IAudioService audioService = new AudioService();
     AbstractEAC3ToOutputNamingService eac3ToOutputNamingService = new EncodeTemplate1EAC3ToOutputNamingService(audioService);
     IEAC3ToCommonRulesValidatorService eac3ToCommonRulesValidatorService = new EAC3ToCommonRulesValidatorService(config, directorySystemServiceMock.Object, discList);
     IEAC3ToBatchFileWriteService service = new EAC3ToBatchFileWriteService(config,directorySystemServiceMock.Object, discList, audioService, eac3ToOutputNamingService, eac3ToCommonRulesValidatorService);
     bool isValid = service.IsValid();
     service.Errors[0].Description.Should().Be("No Disc was selected.");
 }
 public void eacoutputservice_can_set_eac3to_executable_path_test()
 {
     //given eac3to path
     EAC3ToConfiguration config = new EAC3ToConfiguration() { EAC3ToPath = "c:\\exe\\eac3to" };
     BluRaySummaryInfo bluRaySummaryInfo = new BluRaySummaryInfo() { Eac3ToId = "1)", BluRayTitleInfo = new BluRayTitleInfo() { EpisodeNumber = "1" } };
     IAudioService audioService = new AudioService();
     AbstractEAC3ToOutputNamingService eac3ToOutputNamingService = new EncodeTemplate1EAC3ToOutputNamingService(audioService);
     string bluRayPath = "c:\\temp";
     //when I want the output
     IEAC3ToOutputService service = new EAC3ToOutputService(config, eac3ToOutputNamingService, bluRayPath, bluRaySummaryInfo);
     //then the eac3to path is set
     string output = service.GetEAC3ToPathPart();
     output.Should().Contain(config.EAC3ToPath);
 }
 public void encodeTemplate1EAC3ToOutputNamingService_can_set_chapter_name_when_not_extract_for_remux_test()
 {
     //given not extract for remux
     EAC3ToConfiguration config = new EAC3ToConfiguration() { IsExtractForRemux = false };
     string filesOutputPath = "c:\\bluray";
     string paddedEpisodeNumber = "01";
     string episodeName = string.Empty;
     //when i get the chapter name
     IAudioService audioService = new AudioService();
     AbstractEAC3ToOutputNamingService service = new EncodeTemplate1EAC3ToOutputNamingService(audioService);
     string chapterName = service.GetChapterName(config, filesOutputPath, paddedEpisodeNumber, episodeName);
     //then chapter name should be hard coded for workflow
     chapterName.Should().Be("\"c:\\bluray\\chapters01.txt\"");
 }
 public void eac3tobatchfilewriteservice_has_invalid_bluray_directory_error_when_some_bluray_disc_directories_dont_exist_test()
 {
     List<BluRayDiscInfo> discList = new List<BluRayDiscInfo>() { new BluRayDiscInfo() { Id = 1, IsSelected = true,BluRayPath = @"c:\temp\disc1",
         BluRaySummaryInfoList = new List<BluRaySummaryInfo>() { new BluRaySummaryInfo() { IsSelected = true,
      BluRayTitleInfo = new BluRayTitleInfo() { EpisodeNumber = "1", Video = new BluRayTitleVideo() { IsSelected = true} }} } } };
     EAC3ToConfiguration config = new EAC3ToConfiguration();
     var directorySystemServiceMock = new Mock<IDirectorySystemService>();
     directorySystemServiceMock.Setup(m => m.Exists(It.IsAny<string>())).Returns(false);
     IAudioService audioService = new AudioService();
     AbstractEAC3ToOutputNamingService eac3ToOutputNamingService = new EncodeTemplate1EAC3ToOutputNamingService(audioService);
     IEAC3ToCommonRulesValidatorService eac3ToCommonRulesValidatorService = new EAC3ToCommonRulesValidatorService(config, directorySystemServiceMock.Object, discList);
     IEAC3ToBatchFileWriteService service = new EAC3ToBatchFileWriteService(config, directorySystemServiceMock.Object, discList, audioService, eac3ToOutputNamingService, eac3ToCommonRulesValidatorService);
     bool isValid = service.IsValid();
     service.Errors[0].Description.Should().Be("Invalid Blu-ray disc directories found.");
 }
 public void eac3tobatchfilewriteservice_has_episode_number_not_set_for_all_titles_error_when_some_episodes_numbers_not_set_test()
 {
     List<BluRayDiscInfo> discList = new List<BluRayDiscInfo>() { new BluRayDiscInfo() { Id = 1, IsSelected = true,BluRayPath = @"c:\temp\disc1",
         BluRaySummaryInfoList = new List<BluRaySummaryInfo>() { new BluRaySummaryInfo() { IsSelected = true,
      BluRayTitleInfo = new BluRayTitleInfo() { Video = new BluRayTitleVideo() { IsSelected = true} }} } } };
     EAC3ToConfiguration config = new EAC3ToConfiguration();
     var directorySystemServiceMock = new Mock<IDirectorySystemService>();
     directorySystemServiceMock.Setup(m => m.Exists(It.IsAny<string>())).Returns(true);
     IAudioService audioService = new AudioService();
     AbstractEAC3ToOutputNamingService eac3ToOutputNamingService = new EncodeTemplate1EAC3ToOutputNamingService(audioService);
     IEAC3ToCommonRulesValidatorService eac3ToCommonRulesValidatorService = new EAC3ToCommonRulesValidatorService(config, directorySystemServiceMock.Object, discList);
     IEAC3ToBatchFileWriteService service = new EAC3ToBatchFileWriteService(config, directorySystemServiceMock.Object, discList, audioService, eac3ToOutputNamingService, eac3ToCommonRulesValidatorService);
     bool isValid = service.IsValid();
     service.Errors[0].Description.Should().Be("Episode number not set for all selected titles.");
 }
 public void eacoutputservice_can_set_dtsexpress_audio_settings_test()
 {
     //given dts and audio settings
     EAC3ToConfiguration config = new EAC3ToConfiguration() {  BatchFilePath = "c:\\temp" };
     BluRaySummaryInfo summaryInfo = new BluRaySummaryInfo() { Eac3ToId = "1)", BluRayTitleInfo = new BluRayTitleInfo() { EpisodeNumber = "1", AudioList = new List<BluRayTitleAudio>() { new BluRayTitleAudio() {Id="3:", AudioType = EnumAudioType.DTSEXPRESS, IsSelected = true, Arguments = "-core"}}} };
     string bluRayPath = "c:\\disc";
     IAudioService audioService = new AudioService();
     AbstractEAC3ToOutputNamingService eac3ToOutputNamingService = new EncodeTemplate1EAC3ToOutputNamingService(audioService);
     //when I want the output
     IEAC3ToOutputService service = new EAC3ToOutputService(config, eac3ToOutputNamingService, bluRayPath, summaryInfo);
     //then the dts audio is set
     string output = service.GetAudioStreamPart();
     output.Should().Contain(".dts");
     output.Should().Contain("-core");
 }
 public void eacoutputservice_can_set_bluray_stream_test()
 {
     //given bluray folder and stream#
     string bluRayPath = "c:\\disc";
     EAC3ToConfiguration config = new EAC3ToConfiguration();
     BluRaySummaryInfo bluRaySummaryInfo = new BluRaySummaryInfo() { Eac3ToId = "1)", BluRayTitleInfo = new BluRayTitleInfo() { EpisodeNumber = "1" }  };
     IAudioService audioService = new AudioService();
     AbstractEAC3ToOutputNamingService eac3ToOutputNamingService = new EncodeTemplate1EAC3ToOutputNamingService(audioService);
     //when I want the output
     IEAC3ToOutputService service = new EAC3ToOutputService(config,eac3ToOutputNamingService, bluRayPath, bluRaySummaryInfo);
     //then the bluray path/stream# is set
     string output = service.GetBluRayStreamPart();
     output.Should().Contain(bluRayPath);
     output.Should().Contain("1)");
 }
 public void encodeTemplate1EAC3ToOutputNamingService_can_set_audio_name_when_not_extract_for_remux_test()
 {
     //given not extract for remux
     EAC3ToConfiguration config = new EAC3ToConfiguration() { IsExtractForRemux = false };
     string filesOutputPath = "c:\\bluray";
     string paddedEpisodeNumber = "01";
     string episodeName = string.Empty;
     BluRayTitleAudio audio = new BluRayTitleAudio() { Id = "13:", AudioType = EnumAudioType.DTSMA, Language = "english" };
     //when i get the audio name
     IAudioService audioService = new AudioService();
     AbstractEAC3ToOutputNamingService service = new EncodeTemplate1EAC3ToOutputNamingService(audioService);
     string audioName = service.GetAudioName(config, audio, filesOutputPath, paddedEpisodeNumber, episodeName);
     //then audio name should be hard coded for workflow
     audioName.Should().Be("\"c:\\bluray\\english01-13.dtsma\"");
 }
 private void WriteToMkvMergeBatchFile()
 {
     _batchGuyEAC3ToSettings.EAC3ToSettings.IsVideoNameForEncodeMkvMerge = true;
     gbScreen.SetEnabled(false);
     IDirectorySystemService directorySystemService = new DirectorySystemService();
     IAudioService audioService = new AudioService();
     AbstractEAC3ToOutputNamingService eac3ToOutputNamingService = new EncodeTemplate1EAC3ToOutputNamingService(audioService);
     IEAC3ToCommonRulesValidatorService eac3ToCommonRulesValidatorService = new EAC3ToCommonRulesValidatorService(_batchGuyEAC3ToSettings.EAC3ToSettings, directorySystemService, _batchGuyEAC3ToSettings.BluRayDiscs);
     IMKVMergeBatchFileWriteService batchFileWriteService = new MKVMergeBatchFileWriteForEncodeService(_batchGuyEAC3ToSettings, directorySystemService, audioService, eac3ToOutputNamingService, eac3ToCommonRulesValidatorService);
     bgwMkvMergeWriteBatchFile.RunWorkerAsync(batchFileWriteService);
 }
 public void eacoutputservice_can_set_progress_numbers_false_settings_test()
 {
     //given
     EAC3ToConfiguration config = new EAC3ToConfiguration() { BatchFilePath = "c:\\temp", ShowProgressNumbers = false };
     BluRaySummaryInfo summaryInfo = new BluRaySummaryInfo() { Eac3ToId = "1)", BluRayTitleInfo = new BluRayTitleInfo() { EpisodeNumber = "1", AudioList = new List<BluRayTitleAudio>() { new BluRayTitleAudio() { Id = "3:", AudioType = EnumAudioType.DTSEXPRESS, IsSelected = true, Arguments = "-core" } } } };
     string bluRayPath = "c:\\disc";
     IAudioService audioService = new AudioService();
     AbstractEAC3ToOutputNamingService eac3ToOutputNamingService = new EncodeTemplate1EAC3ToOutputNamingService(audioService);
     //when
     IEAC3ToOutputService service = new EAC3ToOutputService(config, eac3ToOutputNamingService, bluRayPath, summaryInfo);
     //then
     string output = service.GetShowProgressNumbersPart();
     output.Should().Be("");
 }
Exemple #11
0
        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();
        }
 private void WriteFFMSIndexBatchFile()
 {
     gbScreen.SetEnabled(false);
     IDirectorySystemService directorySystemService = new DirectorySystemService();
     IAudioService audioService = new AudioService();
     AbstractEAC3ToOutputNamingService eac3ToOutputNamingService = new EncodeTemplate1EAC3ToOutputNamingService(audioService);
     IFFMSIndexBatchFileWriteService batchFileWriteService = new FFMSIndexBatchFileWriteService(_batchGuyEAC3ToSettings.EAC3ToSettings, directorySystemService, _batchGuyEAC3ToSettings.BluRayDiscs, eac3ToOutputNamingService);
     bgwCreateFFMSIndexBatchFile.RunWorkerAsync(batchFileWriteService);
 }
 public void encodeTemplate1EAC3ToOutputNamingService_can_set_subtitle_name_when_not_extract_for_remux_test()
 {
     //given not extract for remux
     EAC3ToConfiguration config = new EAC3ToConfiguration() { IsExtractForRemux = false };
     string filesOutputPath = "c:\\bluray";
     string paddedEpisodeNumber = "01";
     string episodeName = string.Empty;
     BluRayTitleSubtitle subtitle = new BluRayTitleSubtitle() { Id = "3:", Language = "english" };
     //when i get the subtitle name
     IAudioService audioService = new AudioService();
     AbstractEAC3ToOutputNamingService service = new EncodeTemplate1EAC3ToOutputNamingService(audioService);
     string subtitleName = service.GetSubtitleName(config, subtitle, filesOutputPath, paddedEpisodeNumber, episodeName);
     //then subtitle name should be hard coded for workflow
     subtitleName.Should().Be("\"c:\\bluray\\english01-3.sup\"");
 }