├── .gitignore ├── README.md ├── Todo.md ├── assets ├── AboutScreen.png ├── BatchGuyMenuScreen.png ├── BatchGuySettingsScreen.png ├── Blu-rayTitleInfoScreen.png ├── CreateAviSynthFilesScreen.png ├── CreateEac3toBatchFileScreen.png ├── CreateX264BatchFileScreen.png ├── ExternalSubtitlesScreen.png ├── HowToBatchEncodeAviSynthFiles.png ├── HowToBatchEncodeAviSynthScript.png ├── HowToBatchEncodeBatchGuySettingsScreen.png ├── HowToBatchEncodeBlu-rayTitleInfoScreen.png ├── HowToBatchEncodeBluRayTitleInfoScreenWithExternalSubtitlesScreen.png ├── HowToBatchEncodeCreateAviSynthFilesScreen.png ├── HowToBatchEncodeCreateEac3ToBatchFileScreen.png ├── HowToBatchEncodeCreateX264BatchFileScreen.png ├── HowToBatchEncodeEac3ToBatchFileDirectory.png ├── HowToBatchEncodeEncodeAndLogFiles.png ├── HowToBatchEncodeEpisodeFolders.png ├── HowToBatchEncodeExternalSubtitlesScreen.png ├── HowToBatchEncodeInsideEpisodeFolder.png ├── HowToBatchEncodeMKVMergeBatchFile.png ├── HowToBatchEncodeMKVMergeFiles.png ├── HowToBatchEncodeX264BatchFile.png ├── HowToRemuxBatchGuySettingsScreen.png ├── HowToRemuxBlu-rayTitleInfoScreen.png ├── HowToRemuxCreateEac3ToBatchFileScreen.png ├── HowToRemuxEac3ToBatchFileDirectory.png ├── HowToRemuxEpisodeFilesDirectory.png ├── HowToRemuxEpisodeFoldersDirectory.png ├── HowToRemuxExternalSubtitlesScreen.png ├── HowToRemuxMKVMergeBatchFileDirectory.png ├── HowToRemuxMoviesBatchGuySettingsScreen.png ├── HowToRemuxMoviesBlu-rayTitleInfoScreen.png ├── HowToRemuxMoviesCreateEac3ToBatchFileScreenMovie1.png ├── HowToRemuxMoviesCreateEac3ToBatchFileScreenMovie2.png ├── HowToRemuxMoviesEac3ToBatchFileDirectory.png ├── HowToRemuxMoviesExternalSubtitlesScreen.png ├── HowToRemuxMoviesMKVMergeBatchFileDirectory.png ├── HowToRemuxMoviesMovie1FilesDirectory.png ├── HowToRemuxMoviesMovie2FilesDirectory.png ├── HowToRemuxMoviesMovieFoldersDirectory.png ├── HowToRemuxMoviesRemuxedFilesDirectory.png ├── HowToRemuxRemuxFilesDirectory.png ├── HowToRemuxRemuxedFilesDirectory.png ├── x264LogFileSelectionScreen.png └── x264LogFileSummaryDisplayScreen.png ├── publish └── ilmerge.bat └── src ├── .nuget ├── NuGet.Config ├── NuGet.exe └── NuGet.targets ├── BatchGuy.App ├── AboutForm.Designer.cs ├── AboutForm.cs ├── AboutForm.resx ├── App.config ├── AviSynth │ ├── Interfaces │ │ ├── IAviSynthFileService.cs │ │ ├── IAviSynthValidationService.cs │ │ └── IAviSynthWriteService.cs │ ├── Models │ │ ├── AviSynthBatchSettings.cs │ │ ├── AviSynthFile.cs │ │ └── AviSynthTemplateScript.cs │ └── Services │ │ ├── AviSynthFileService.cs │ │ ├── AviSynthValidationService.cs │ │ ├── AviSynthWriteService.cs │ │ ├── IAVSService.cs │ │ ├── IFileService.cs │ │ └── IValidationService.cs ├── BatchGuy.App.csproj ├── BluRayTitleInfoExternalSubtitleForm.Designer.cs ├── BluRayTitleInfoExternalSubtitleForm.cs ├── BluRayTitleInfoExternalSubtitleForm.resx ├── BluRayTitleInfoForm.Designer.cs ├── BluRayTitleInfoForm.cs ├── BluRayTitleInfoForm.resx ├── Bootstrap │ └── Logging.cs ├── Constants │ └── Constant.cs ├── CreateAviSynthFilesForm.Designer.cs ├── CreateAviSynthFilesForm.cs ├── CreateAviSynthFilesForm.resx ├── CreateEAC3ToBatchForm.Designer.cs ├── CreateEAC3ToBatchForm.cs ├── CreateEAC3ToBatchForm.resx ├── CreateX264BatchFileForm.Designer.cs ├── CreateX264BatchFileForm.cs ├── CreateX264BatchFileForm.resx ├── Eac3To │ ├── Abstracts │ │ ├── AbstractEAC3ToOutputNamingService.cs │ │ └── AbstractEAC3ToOutputNamingServiceFactory.cs │ ├── Interfaces │ │ ├── IBatchGuyEAC3ToSettingsService.cs │ │ ├── IDirectorySystemService.cs │ │ ├── IEAC3ToBatchFileWriteService.cs │ │ ├── IEAC3ToBatchFileWriteWarningService.cs │ │ └── IEAC3ToOutputService.cs │ ├── Models │ │ ├── BatchGuyEAC3ToSettings.cs │ │ ├── EAC3ToConfiguration.cs │ │ └── EAC3ToRemuxFileNameTemplate.cs │ └── Services │ │ ├── BatchGuyEAC3ToSettingsService.cs │ │ ├── DirectorySystemService.cs │ │ ├── EAC3ToBatchFileWriteForMovieService.cs │ │ ├── EAC3ToBatchFileWriteService.cs │ │ ├── EAC3ToBatchFileWriteWarningService.cs │ │ ├── EAC3ToOutputService.cs │ │ ├── EncodeTemplate1EAC3ToOutputNamingService.cs │ │ ├── MovieRemuxTemplate1EAC3ToOutputNamingService.cs │ │ ├── RemuxTemplate1EAC3ToOutputNamingService.cs │ │ ├── RemuxTemplate2EAC3ToOutputNamingService.cs │ │ └── RemuxTemplate3EAC3ToOutputNamingService.cs ├── Enums │ └── Enums.cs ├── Extensions │ └── ExtensionMethods.cs ├── FFMSIndex │ ├── Interfaces │ │ ├── IFFMSIndexBatchFileWriteService.cs │ │ └── IFFMSIndexOutputService.cs │ └── Services │ │ ├── FFMSIndexBatchFileWriteService.cs │ │ └── FFMSIndexOutputService.cs ├── Helpers │ └── HelperFunctions.cs ├── Icons │ ├── Avosoft-Warm-Toolbar-Folder-open.ico │ ├── Custom-Icon-Design-Flatastic-10-New-file.ico │ ├── Custom-Icon-Design-Flatastic-10-Open-file.ico │ ├── Custom-Icon-Design-Flatastic-2-Process-accept.ico │ ├── Custom-Icon-Design-Pretty-Office-7-Extract-object.ico │ ├── Everaldo-Crystal-Clear-App-edit.ico │ ├── Fasticon-Green-Ville-2-File.ico │ ├── Fatcow-Farm-Fresh-Script-add.ico │ ├── Iconfinder-1472897142_DeleteRed.ico │ ├── Icontexto-Webdev-Webdev-config.ico │ ├── close_red.ico │ ├── label_new_green.ico │ └── webdev-config-icon.png ├── MKVMerge │ ├── Interfaces │ │ ├── IMKVMergeBatchFileWriteService.cs │ │ ├── IMKVMergeLanguageService.cs │ │ └── IMKVMergeOutputService.cs │ ├── Models │ │ ├── ISOLanguageCode.cs │ │ ├── ISOLanguageCodeCollection.cs │ │ ├── MKVMergeItem.cs │ │ └── MKVMergeLanguageItem.cs │ └── Services │ │ ├── MKVMergeBatchFileWriteForEncodeService.cs │ │ ├── MKVMergeBatchFileWriteForMovieService.cs │ │ ├── MKVMergeBatchFileWriteService.cs │ │ ├── MKVMergeLanguageService.cs │ │ └── MKVMergeOutputService.cs ├── MainForm.Designer.cs ├── MainForm.cs ├── MainForm.resx ├── Parser │ ├── Interfaces │ │ ├── IBluRaySummaryParserService.cs │ │ ├── IBluRayTitleParserService.cs │ │ ├── ICommandLineProcessService.cs │ │ └── ILineItemIdentifierService.cs │ ├── Models │ │ ├── BluRayDiscInfo.cs │ │ ├── BluRaySummaryInfo.cs │ │ ├── BluRayTitleAudio.cs │ │ ├── BluRayTitleChapter.cs │ │ ├── BluRayTitleInfo.cs │ │ ├── BluRayTitleSubtitle.cs │ │ ├── BluRayTitleVideo.cs │ │ ├── CommandLineProcessStartInfo.cs │ │ └── ProcessOutputLineItem.cs │ └── Services │ │ ├── BluRaySummaryLineItemIdentifierService.cs │ │ ├── BluRaySummaryParserService.cs │ │ ├── BluRayTitleLineItemIdentifierService.cs │ │ ├── BluRayTitleParserService.cs │ │ └── CommandLineProcessService.cs ├── Program.cs ├── Properties │ ├── AssemblyInfo.cs │ ├── DataSources │ │ ├── BatchGuy.App.MKVMerge.Models.MKVMergeLanguageItem.datasource │ │ ├── BatchGuy.App.Parser.Models.BluRayDiscInfo.datasource │ │ ├── BatchGuy.App.Parser.Models.BluRaySummaryInfo.datasource │ │ ├── BatchGuy.App.Parser.Models.BluRayTitleAudio.datasource │ │ ├── BatchGuy.App.Parser.Models.BluRayTitleChapter.datasource │ │ ├── BatchGuy.App.Parser.Models.BluRayTitleInfo.datasource │ │ ├── BatchGuy.App.Parser.Models.BluRayTitleSubtitle.datasource │ │ ├── BatchGuy.App.Parser.Models.BluRayTitleVideo.datasource │ │ ├── BatchGuy.App.Settings.Models.BluRayTitleInfoDefaultSettingsAudio.datasource │ │ ├── BatchGuy.App.Shared.Models.CountryCodeItem.datasource │ │ ├── BatchGuy.App.Shared.Models.DropDownListItem.datasource │ │ ├── BatchGuy.App.Shared.Models.Setting.datasource │ │ ├── BatchGuy.App.X264.Models.X264File.datasource │ │ └── BatchGuy.App.X264Log.Models.X264LogFile.datasource │ ├── Resources.Designer.cs │ ├── Resources.resx │ ├── Settings.Designer.cs │ └── Settings.settings ├── Settings │ ├── Interface │ │ ├── IApplicationSettingsService.cs │ │ ├── IBluRayTitleInfoDefaultSettingsService.cs │ │ └── IMKVMergeDefaultSettingsService.cs │ ├── Models │ │ ├── ApplicationSettings.cs │ │ ├── AudioMKVMergeDefaultSettings.cs │ │ ├── BatchGuyLatestVersionInfo.cs │ │ ├── BluRayTitleInfoDefaultSettings.cs │ │ ├── BluRayTitleInfoDefaultSettingsAudio.cs │ │ ├── EAC3ToDefaultSettings.cs │ │ ├── Setting.cs │ │ └── SubtitlesMKVMergeDefaultSettings.cs │ └── Services │ │ ├── ApplicationSettingsService.cs │ │ ├── BluRayTitleInfoDefaultSettingsService.cs │ │ ├── MKVMergeDefaultSettingsService.cs │ │ └── SettingsDefaultSeedDataService.cs ├── SettingsForm.Designer.cs ├── SettingsForm.cs ├── SettingsForm.resx ├── Shared │ ├── Events │ │ └── DialogInitialDirectoryChangedEventArgs.cs │ ├── Interfaces │ │ ├── IAudioService.cs │ │ ├── IBatchGuyNotificationService.cs │ │ ├── IBindingListSortService.cs │ │ ├── ICountryCodeService.cs │ │ ├── IDisplayErrorMessageService.cs │ │ ├── IEAC3ToCommonRulesValidatorService.cs │ │ ├── IJsonSerializationService.cs │ │ ├── ILoggingService.cs │ │ └── ISortService.cs │ ├── Models │ │ ├── CountryCodeItem.cs │ │ ├── DropDownListItem.cs │ │ ├── Error.cs │ │ ├── ErrorCollection.cs │ │ ├── ErrorMessage.cs │ │ ├── ISOCountryCode.cs │ │ ├── ISOCountryCodeCollection.cs │ │ ├── MovieYearItem.cs │ │ ├── SortConfiguration.cs │ │ ├── SortConfigurationColumnOverride.cs │ │ ├── Warning.cs │ │ └── WarningCollection.cs │ └── Services │ │ ├── AudioService.cs │ │ ├── BatchGuyNotificationService.cs │ │ ├── BindingListSortService.cs │ │ ├── CountryCodeService.cs │ │ ├── DisplayErrorMessageService.cs │ │ ├── EAC3ToCommonRulesValidatorService.cs │ │ ├── JsonSerializationService.cs │ │ ├── LoggingService.cs │ │ └── SortService.cs ├── ThirdParty │ ├── DataGridViewCheckBoxHeader │ │ └── DatagridViewCheckBoxHeaderCell.cs │ └── FolderSelectDialog │ │ ├── FolderSelectDialog.cs │ │ └── Reflector.cs ├── X264 │ ├── Interfaces │ │ ├── IX264EncodeService.cs │ │ └── IX264ValidationService.cs │ ├── Models │ │ ├── X264File.cs │ │ └── X264FileSettings.cs │ └── Services │ │ ├── X264EncodeService.cs │ │ └── X264ValidationService.cs ├── X264Log │ ├── Interfaces │ │ ├── IX264LogLineItemIdentifierService.cs │ │ └── IX264LogParserService.cs │ ├── Models │ │ ├── X264LogFile.cs │ │ └── X264LogFileSettings.cs │ └── Services │ │ ├── X264LogLineItemIdentifierService.cs │ │ └── X264LogParserService.cs ├── X264LogFileDisplayForm.Designer.cs ├── X264LogFileDisplayForm.cs ├── X264LogFileDisplayForm.resx ├── X264LogFileForm.Designer.cs ├── X264LogFileForm.cs ├── X264LogFileForm.resx └── packages.config ├── BatchGuy.Eac3to.Parser.Example.Console.App ├── App.config ├── BatchGuy.Eac3to.Parser.Example.Console.App.csproj ├── Icontexto-Webdev-Webdev-config.ico ├── Program.cs └── Properties │ └── AssemblyInfo.cs ├── BatchGuy.Settings.Serialization.Example.Console.App ├── App.config ├── BatchGuy.Settings.Serialization.Example.Console.App.csproj ├── Program.cs ├── Properties │ └── AssemblyInfo.cs └── packages.config ├── BatchGuy.X264Log.Parser.Example.Console.App ├── App.config ├── BatchGuy.X264Log.Parser.Example.Console.App.csproj ├── Program.cs └── Properties │ └── AssemblyInfo.cs ├── BatchGuy.sln ├── packages └── repositories.config └── tests └── BatchGuy.Unit.Tests ├── BatchGuy.Unit.Tests.csproj ├── ExtensionMethods └── ExtensionMethodTests.cs ├── HelperFunctions ├── GetVideoExtensionTests.cs └── PadNumberWithZerosTests.cs ├── Icontexto-Webdev-Webdev-config.ico ├── Models ├── BluRayTitleAudioTests.cs └── BluRayTitleSubtitleTests.cs ├── Properties └── AssemblyInfo.cs ├── Services ├── AviSynth │ ├── FileServiceTests.cs │ └── ValidationServiceTests.cs ├── Eac3to │ ├── AbstractEAC3ToOutputNamingServiceFactoryTests.cs │ ├── EAC3ToBatchFileWriteServiceTests.cs │ ├── EAC3ToBatchFileWriteWarningServiceTests.cs │ ├── EAC3ToOutputServiceTests.cs │ ├── EncodeTemplate1EAC3ToOutputNamingServiceTests.cs │ ├── MovieRemuxTemplate1EAC3ToOutputNamingServiceTests.cs │ ├── RemuxTemplate1EAC3ToOutputNamingServiceTests.cs │ ├── RemuxTemplate2EAC3ToOutputNamingServiceTests.cs │ └── RemuxTemplate3EAC3ToOutputNamingServiceTests.cs ├── MKVMerge │ ├── MKVMergeLanguageServiceTests.cs │ └── MKVMergeOutputServiceTests.cs ├── Parser │ ├── BluRaySummaryLineItemIdentifierServiceTests.cs │ ├── BluRaySummaryParserServiceTests.cs │ ├── BluRayTitleLineItemIdentifierServiceTests.cs │ ├── BluRayTitleParserServiceTests.cs │ └── CommandLineProcessServiceTests.cs ├── Settings │ └── BluRayTitleInfoDefaultSettingsServiceTests.cs ├── Shared │ ├── AudioServiceTests.cs │ ├── CountryCodeServiceTests.cs │ ├── EAC3ToCommonRulesValidatorServiceTests.cs │ └── SortServiceTests.cs └── X264Log │ └── X264LogLineItemIdentifierServiceTests.cs └── packages.config /.gitignore: -------------------------------------------------------------------------------- 1 | *.suo 2 | *.user 3 | 4 | /src/.vs 5 | 6 | /src/packages/* 7 | !/src/packages/repositories.config 8 | 9 | /publish/* 10 | !/publish/ilmerge.bat 11 | 12 | src/BatchGuy.App/bin 13 | src/BatchGuy.App/obj 14 | 15 | /src/BatchGuy.Eac3to.Parser.Example.Console.App/bin 16 | /src/BatchGuy.Eac3to.Parser.Example.Console.App/obj 17 | 18 | /src/BatchGuy.Settings.Serialization.Example.Console.App/bin 19 | /src/BatchGuy.Settings.Serialization.Example.Console.App/obj 20 | 21 | /src/BatchGuy.X264Log.Parser.Example.Console.App/bin 22 | /src/BatchGuy.X264Log.Parser.Example.Console.App/obj 23 | 24 | /src/tests/BatchGuy.Unit.Tests/bin 25 | /src/tests/BatchGuy.Unit.Tests/obj -------------------------------------------------------------------------------- /Todo.md: -------------------------------------------------------------------------------- 1 | # Overview 2 | 3 | The Todo.md document serves to keep track of items *todo*. 4 | 5 | ## Todo / Nice to Have Items 6 | 7 | - Use async/wait where applicable 8 | 9 | - Put video in a grid for mkvmerge editing 10 | 11 | - Add External audio 12 | 13 | - Think about tackling the multiple vidoes in a single playlist (labyrinth) 14 | 15 | - ExtensionMethods.NumberOfEpisodes needs to filter on summary.episodenumber != null as well for cases where isselected by no episode number. Not changing it now due to not knowing what the effects are 16 | 17 | - Default the MKVToolNixGUI Track Name to "Commentary" if commentary checkbox is checked 18 | 19 | - When a single file contains multiple episodes : 20 | - Go by the actually episode number entered in the loop 21 | - Validate on the screen 22 | 23 | - Create a batchguy log file that indicates how many files were processed and how long it took 24 | 25 | - Rename EnumBluRayLineItemType to have eac3to in the title, to prepare for tsMuxeR OR Make the identifylineitem service generic to pass in any enum or a combo of these 26 | 27 | - Research and start laying down the foundation for tsMuxeR 28 | - Understand the cli 29 | - Understand that you have to now introduce mkvmerge cli to mux the .h264 file into an mkv 30 | - Understand that 2 new exes have be tracked, mkvmerge and tsMuxeR 31 | - Understand that you will have to use eac3to for .wav 32 | 33 | - Maybe add a check all checkbox to grids with is selected 34 | - http://dotnetvisio.blogspot.com/2015/08/create-select-all-checkbox-column.html 35 | 36 | - Figure out a better solution to inform of the status of long running tasks 37 | 38 | - Ability to create sample.avs/sample.encode.bat 39 | 40 | - Ability to set the video variable for avisynth for advanced scripting -------------------------------------------------------------------------------- /assets/AboutScreen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaboy58/BatchGuy/e1e74591403bdc337c6814fc02fde7cefc81935d/assets/AboutScreen.png -------------------------------------------------------------------------------- /assets/BatchGuyMenuScreen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaboy58/BatchGuy/e1e74591403bdc337c6814fc02fde7cefc81935d/assets/BatchGuyMenuScreen.png -------------------------------------------------------------------------------- /assets/BatchGuySettingsScreen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaboy58/BatchGuy/e1e74591403bdc337c6814fc02fde7cefc81935d/assets/BatchGuySettingsScreen.png -------------------------------------------------------------------------------- /assets/Blu-rayTitleInfoScreen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaboy58/BatchGuy/e1e74591403bdc337c6814fc02fde7cefc81935d/assets/Blu-rayTitleInfoScreen.png -------------------------------------------------------------------------------- /assets/CreateAviSynthFilesScreen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaboy58/BatchGuy/e1e74591403bdc337c6814fc02fde7cefc81935d/assets/CreateAviSynthFilesScreen.png -------------------------------------------------------------------------------- /assets/CreateEac3toBatchFileScreen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaboy58/BatchGuy/e1e74591403bdc337c6814fc02fde7cefc81935d/assets/CreateEac3toBatchFileScreen.png -------------------------------------------------------------------------------- /assets/CreateX264BatchFileScreen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaboy58/BatchGuy/e1e74591403bdc337c6814fc02fde7cefc81935d/assets/CreateX264BatchFileScreen.png -------------------------------------------------------------------------------- /assets/ExternalSubtitlesScreen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaboy58/BatchGuy/e1e74591403bdc337c6814fc02fde7cefc81935d/assets/ExternalSubtitlesScreen.png -------------------------------------------------------------------------------- /assets/HowToBatchEncodeAviSynthFiles.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaboy58/BatchGuy/e1e74591403bdc337c6814fc02fde7cefc81935d/assets/HowToBatchEncodeAviSynthFiles.png -------------------------------------------------------------------------------- /assets/HowToBatchEncodeAviSynthScript.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaboy58/BatchGuy/e1e74591403bdc337c6814fc02fde7cefc81935d/assets/HowToBatchEncodeAviSynthScript.png -------------------------------------------------------------------------------- /assets/HowToBatchEncodeBatchGuySettingsScreen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaboy58/BatchGuy/e1e74591403bdc337c6814fc02fde7cefc81935d/assets/HowToBatchEncodeBatchGuySettingsScreen.png -------------------------------------------------------------------------------- /assets/HowToBatchEncodeBlu-rayTitleInfoScreen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaboy58/BatchGuy/e1e74591403bdc337c6814fc02fde7cefc81935d/assets/HowToBatchEncodeBlu-rayTitleInfoScreen.png -------------------------------------------------------------------------------- /assets/HowToBatchEncodeBluRayTitleInfoScreenWithExternalSubtitlesScreen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaboy58/BatchGuy/e1e74591403bdc337c6814fc02fde7cefc81935d/assets/HowToBatchEncodeBluRayTitleInfoScreenWithExternalSubtitlesScreen.png -------------------------------------------------------------------------------- /assets/HowToBatchEncodeCreateAviSynthFilesScreen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaboy58/BatchGuy/e1e74591403bdc337c6814fc02fde7cefc81935d/assets/HowToBatchEncodeCreateAviSynthFilesScreen.png -------------------------------------------------------------------------------- /assets/HowToBatchEncodeCreateEac3ToBatchFileScreen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaboy58/BatchGuy/e1e74591403bdc337c6814fc02fde7cefc81935d/assets/HowToBatchEncodeCreateEac3ToBatchFileScreen.png -------------------------------------------------------------------------------- /assets/HowToBatchEncodeCreateX264BatchFileScreen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaboy58/BatchGuy/e1e74591403bdc337c6814fc02fde7cefc81935d/assets/HowToBatchEncodeCreateX264BatchFileScreen.png -------------------------------------------------------------------------------- /assets/HowToBatchEncodeEac3ToBatchFileDirectory.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaboy58/BatchGuy/e1e74591403bdc337c6814fc02fde7cefc81935d/assets/HowToBatchEncodeEac3ToBatchFileDirectory.png -------------------------------------------------------------------------------- /assets/HowToBatchEncodeEncodeAndLogFiles.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaboy58/BatchGuy/e1e74591403bdc337c6814fc02fde7cefc81935d/assets/HowToBatchEncodeEncodeAndLogFiles.png -------------------------------------------------------------------------------- /assets/HowToBatchEncodeEpisodeFolders.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaboy58/BatchGuy/e1e74591403bdc337c6814fc02fde7cefc81935d/assets/HowToBatchEncodeEpisodeFolders.png -------------------------------------------------------------------------------- /assets/HowToBatchEncodeExternalSubtitlesScreen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaboy58/BatchGuy/e1e74591403bdc337c6814fc02fde7cefc81935d/assets/HowToBatchEncodeExternalSubtitlesScreen.png -------------------------------------------------------------------------------- /assets/HowToBatchEncodeInsideEpisodeFolder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaboy58/BatchGuy/e1e74591403bdc337c6814fc02fde7cefc81935d/assets/HowToBatchEncodeInsideEpisodeFolder.png -------------------------------------------------------------------------------- /assets/HowToBatchEncodeMKVMergeBatchFile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaboy58/BatchGuy/e1e74591403bdc337c6814fc02fde7cefc81935d/assets/HowToBatchEncodeMKVMergeBatchFile.png -------------------------------------------------------------------------------- /assets/HowToBatchEncodeMKVMergeFiles.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaboy58/BatchGuy/e1e74591403bdc337c6814fc02fde7cefc81935d/assets/HowToBatchEncodeMKVMergeFiles.png -------------------------------------------------------------------------------- /assets/HowToBatchEncodeX264BatchFile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaboy58/BatchGuy/e1e74591403bdc337c6814fc02fde7cefc81935d/assets/HowToBatchEncodeX264BatchFile.png -------------------------------------------------------------------------------- /assets/HowToRemuxBatchGuySettingsScreen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaboy58/BatchGuy/e1e74591403bdc337c6814fc02fde7cefc81935d/assets/HowToRemuxBatchGuySettingsScreen.png -------------------------------------------------------------------------------- /assets/HowToRemuxBlu-rayTitleInfoScreen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaboy58/BatchGuy/e1e74591403bdc337c6814fc02fde7cefc81935d/assets/HowToRemuxBlu-rayTitleInfoScreen.png -------------------------------------------------------------------------------- /assets/HowToRemuxCreateEac3ToBatchFileScreen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaboy58/BatchGuy/e1e74591403bdc337c6814fc02fde7cefc81935d/assets/HowToRemuxCreateEac3ToBatchFileScreen.png -------------------------------------------------------------------------------- /assets/HowToRemuxEac3ToBatchFileDirectory.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaboy58/BatchGuy/e1e74591403bdc337c6814fc02fde7cefc81935d/assets/HowToRemuxEac3ToBatchFileDirectory.png -------------------------------------------------------------------------------- /assets/HowToRemuxEpisodeFilesDirectory.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaboy58/BatchGuy/e1e74591403bdc337c6814fc02fde7cefc81935d/assets/HowToRemuxEpisodeFilesDirectory.png -------------------------------------------------------------------------------- /assets/HowToRemuxEpisodeFoldersDirectory.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaboy58/BatchGuy/e1e74591403bdc337c6814fc02fde7cefc81935d/assets/HowToRemuxEpisodeFoldersDirectory.png -------------------------------------------------------------------------------- /assets/HowToRemuxExternalSubtitlesScreen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaboy58/BatchGuy/e1e74591403bdc337c6814fc02fde7cefc81935d/assets/HowToRemuxExternalSubtitlesScreen.png -------------------------------------------------------------------------------- /assets/HowToRemuxMKVMergeBatchFileDirectory.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaboy58/BatchGuy/e1e74591403bdc337c6814fc02fde7cefc81935d/assets/HowToRemuxMKVMergeBatchFileDirectory.png -------------------------------------------------------------------------------- /assets/HowToRemuxMoviesBatchGuySettingsScreen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaboy58/BatchGuy/e1e74591403bdc337c6814fc02fde7cefc81935d/assets/HowToRemuxMoviesBatchGuySettingsScreen.png -------------------------------------------------------------------------------- /assets/HowToRemuxMoviesBlu-rayTitleInfoScreen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaboy58/BatchGuy/e1e74591403bdc337c6814fc02fde7cefc81935d/assets/HowToRemuxMoviesBlu-rayTitleInfoScreen.png -------------------------------------------------------------------------------- /assets/HowToRemuxMoviesCreateEac3ToBatchFileScreenMovie1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaboy58/BatchGuy/e1e74591403bdc337c6814fc02fde7cefc81935d/assets/HowToRemuxMoviesCreateEac3ToBatchFileScreenMovie1.png -------------------------------------------------------------------------------- /assets/HowToRemuxMoviesCreateEac3ToBatchFileScreenMovie2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaboy58/BatchGuy/e1e74591403bdc337c6814fc02fde7cefc81935d/assets/HowToRemuxMoviesCreateEac3ToBatchFileScreenMovie2.png -------------------------------------------------------------------------------- /assets/HowToRemuxMoviesEac3ToBatchFileDirectory.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaboy58/BatchGuy/e1e74591403bdc337c6814fc02fde7cefc81935d/assets/HowToRemuxMoviesEac3ToBatchFileDirectory.png -------------------------------------------------------------------------------- /assets/HowToRemuxMoviesExternalSubtitlesScreen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaboy58/BatchGuy/e1e74591403bdc337c6814fc02fde7cefc81935d/assets/HowToRemuxMoviesExternalSubtitlesScreen.png -------------------------------------------------------------------------------- /assets/HowToRemuxMoviesMKVMergeBatchFileDirectory.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaboy58/BatchGuy/e1e74591403bdc337c6814fc02fde7cefc81935d/assets/HowToRemuxMoviesMKVMergeBatchFileDirectory.png -------------------------------------------------------------------------------- /assets/HowToRemuxMoviesMovie1FilesDirectory.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaboy58/BatchGuy/e1e74591403bdc337c6814fc02fde7cefc81935d/assets/HowToRemuxMoviesMovie1FilesDirectory.png -------------------------------------------------------------------------------- /assets/HowToRemuxMoviesMovie2FilesDirectory.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaboy58/BatchGuy/e1e74591403bdc337c6814fc02fde7cefc81935d/assets/HowToRemuxMoviesMovie2FilesDirectory.png -------------------------------------------------------------------------------- /assets/HowToRemuxMoviesMovieFoldersDirectory.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaboy58/BatchGuy/e1e74591403bdc337c6814fc02fde7cefc81935d/assets/HowToRemuxMoviesMovieFoldersDirectory.png -------------------------------------------------------------------------------- /assets/HowToRemuxMoviesRemuxedFilesDirectory.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaboy58/BatchGuy/e1e74591403bdc337c6814fc02fde7cefc81935d/assets/HowToRemuxMoviesRemuxedFilesDirectory.png -------------------------------------------------------------------------------- /assets/HowToRemuxRemuxFilesDirectory.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaboy58/BatchGuy/e1e74591403bdc337c6814fc02fde7cefc81935d/assets/HowToRemuxRemuxFilesDirectory.png -------------------------------------------------------------------------------- /assets/HowToRemuxRemuxedFilesDirectory.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaboy58/BatchGuy/e1e74591403bdc337c6814fc02fde7cefc81935d/assets/HowToRemuxRemuxedFilesDirectory.png -------------------------------------------------------------------------------- /assets/x264LogFileSelectionScreen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaboy58/BatchGuy/e1e74591403bdc337c6814fc02fde7cefc81935d/assets/x264LogFileSelectionScreen.png -------------------------------------------------------------------------------- /assets/x264LogFileSummaryDisplayScreen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaboy58/BatchGuy/e1e74591403bdc337c6814fc02fde7cefc81935d/assets/x264LogFileSummaryDisplayScreen.png -------------------------------------------------------------------------------- /publish/ilmerge.bat: -------------------------------------------------------------------------------- 1 | SET version="v7.1" 2 | 3 | "..\src\packages\ilmerge.2.14.1208\tools\ILMerge.exe" "..\src\BatchGuy.App\bin\Release\BatchGuy.App.exe" "..\src\packages\System.Linq.Dynamic.1.0.4\lib\net40\System.Linq.Dynamic.dll" "..\src\packages\log4net.2.0.4\lib\net45-full\log4net.dll" "..\src\packages\Newtonsoft.Json.7.0.1\\lib\net45\Newtonsoft.Json.dll" /out:"BatchGuy-%version%.exe" /target:winexe /targetplatform:v4 /ndebug -------------------------------------------------------------------------------- /src/.nuget/NuGet.Config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/.nuget/NuGet.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaboy58/BatchGuy/e1e74591403bdc337c6814fc02fde7cefc81935d/src/.nuget/NuGet.exe -------------------------------------------------------------------------------- /src/BatchGuy.App/AboutForm.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows.Forms; 3 | 4 | namespace BatchGuy.App 5 | { 6 | public partial class AboutForm : Form 7 | { 8 | public AboutForm() 9 | { 10 | InitializeComponent(); 11 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; 12 | } 13 | 14 | private void AboutForm_Load(object sender, EventArgs e) 15 | { 16 | lblVersion.Text = Program.GetApplicationVersion(); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/BatchGuy.App/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/BatchGuy.App/AviSynth/Interfaces/IAviSynthFileService.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using BatchGuy.App.AviSynth.Models; 3 | 4 | namespace BatchGuy.App.AviSynth.Interfaces 5 | { 6 | public interface IAviSynthFileService 7 | { 8 | List CreateAVSFileList(); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/BatchGuy.App/AviSynth/Interfaces/IAviSynthValidationService.cs: -------------------------------------------------------------------------------- 1 | using BatchGuy.App.Shared.Models; 2 | 3 | namespace BatchGuy.App.AviSynth.Interfaces 4 | { 5 | public interface IAviSynthValidationService 6 | { 7 | ErrorCollection Validate(); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/BatchGuy.App/AviSynth/Interfaces/IAviSynthWriteService.cs: -------------------------------------------------------------------------------- 1 | using BatchGuy.App.Shared.Models; 2 | 3 | namespace BatchGuy.App.AviSynth.Interfaces 4 | { 5 | public interface IAviSynthWriteService 6 | { 7 | ErrorCollection CreateAVSFiles(); 8 | void Delete(); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/BatchGuy.App/AviSynth/Models/AviSynthBatchSettings.cs: -------------------------------------------------------------------------------- 1 | using BatchGuy.App.Enums; 2 | 3 | namespace BatchGuy.App.AviSynth.Models 4 | { 5 | public class AviSynthBatchSettings 6 | { 7 | public string AviSynthFilesOutputDirectoryPath { get; set; } 8 | public string NamingConvention { get; set; } 9 | public int NumberOfFiles { get; set; } 10 | public string VideoFilter { get; set; } 11 | public EnumDirectoryType VideoToEncodeDirectoryType { get; set; } 12 | 13 | public string VideoToEncodeDirectory { get; set; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/BatchGuy.App/AviSynth/Models/AviSynthFile.cs: -------------------------------------------------------------------------------- 1 | namespace BatchGuy.App.AviSynth.Models 2 | { 3 | public class AviSynthFile 4 | { 5 | public string FileNameOnly { get; set; } 6 | public string FullPath { get; set; } 7 | public string AviSynthScript { get; set; } 8 | public int Number { get; set; } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/BatchGuy.App/AviSynth/Models/AviSynthTemplateScript.cs: -------------------------------------------------------------------------------- 1 | namespace BatchGuy.App.AviSynth.Models 2 | { 3 | public class AviSynthTemplateScript 4 | { 5 | public string Script { get; set; } 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/BatchGuy.App/AviSynth/Services/AviSynthFileService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using BatchGuy.App.Helpers; 5 | using BatchGuy.App.AviSynth.Models; 6 | using BatchGuy.App.AviSynth.Interfaces; 7 | using BatchGuy.App.Enums; 8 | 9 | namespace BatchGuy.App.AviSynth.Services 10 | { 11 | public class AviSynthFileService : IAviSynthFileService 12 | { 13 | private AviSynthBatchSettings _avsBatchSettings; 14 | private List _avsFiles; 15 | private AviSynthTemplateScript _avsTemplateScript; 16 | 17 | public AviSynthFileService(AviSynthBatchSettings avsBatchSettings, AviSynthTemplateScript avsTemplateScript) 18 | { 19 | _avsBatchSettings = avsBatchSettings; 20 | _avsTemplateScript = avsTemplateScript; 21 | _avsFiles = new List(); 22 | } 23 | 24 | public List CreateAVSFileList() 25 | { 26 | CreateList(); 27 | CreateAVSScript(); 28 | return _avsFiles; 29 | } 30 | 31 | private void CreateList() 32 | { 33 | for (int i = 1; i <= _avsBatchSettings.NumberOfFiles; i++) 34 | { 35 | string fileNameOnly = string.Format("{0}{1}.avs", _avsBatchSettings.NamingConvention, HelperFunctions.PadNumberWithZeros(_avsBatchSettings.NumberOfFiles, i)); 36 | string directoryPath = String.Format("{0}\\{1}", _avsBatchSettings.AviSynthFilesOutputDirectoryPath, fileNameOnly); 37 | AviSynthFile avsFile = new AviSynthFile() { FileNameOnly = fileNameOnly, FullPath = directoryPath}; 38 | avsFile.Number = i; 39 | _avsFiles.Add(avsFile); 40 | } 41 | } 42 | 43 | private void CreateAVSScript() 44 | { 45 | foreach (AviSynthFile file in _avsFiles) 46 | { 47 | StringBuilder sb = new StringBuilder(); 48 | string paddedNumber = HelperFunctions.PadNumberWithZeros(_avsBatchSettings.NumberOfFiles, file.Number); 49 | string encodeFileFolder = string.Format("episode{0}", paddedNumber); 50 | string encodeFile = string.Format("video{0}.mkv", paddedNumber); //hardcoded to mkv 51 | if (_avsBatchSettings.VideoToEncodeDirectoryType == EnumDirectoryType.DirectoryPerEpisode) 52 | { 53 | sb.Append(string.Format("{0}(\"{1}\\{2}\\{3}\")", _avsBatchSettings.VideoFilter, _avsBatchSettings.VideoToEncodeDirectory, encodeFileFolder, encodeFile)); 54 | } 55 | else 56 | { 57 | sb.Append(string.Format("{0}(\"{1}\\{2}\")", _avsBatchSettings.VideoFilter, _avsBatchSettings.VideoToEncodeDirectory, encodeFile)); 58 | } 59 | sb.Append(string.Format("{0}{1}",Environment.NewLine,_avsTemplateScript.Script)); 60 | file.AviSynthScript = sb.ToString(); 61 | } 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /src/BatchGuy.App/AviSynth/Services/AviSynthValidationService.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using BatchGuy.App.AviSynth.Models; 3 | using BatchGuy.App.AviSynth.Interfaces; 4 | using BatchGuy.App.Shared.Models; 5 | 6 | namespace BatchGuy.App.AviSynth.Services 7 | { 8 | public class AviSynthValidationService : IAviSynthValidationService 9 | { 10 | private AviSynthBatchSettings _avsBatchSettings; 11 | private ErrorCollection _errors; 12 | 13 | public AviSynthValidationService(AviSynthBatchSettings avsBatchSettings) 14 | { 15 | _avsBatchSettings = avsBatchSettings; 16 | _errors = new ErrorCollection(); 17 | } 18 | 19 | public ErrorCollection Validate() 20 | { 21 | this.BatchDirectoryIsNotEmpty(); 22 | this.BatchDirectoryIsValid(); 23 | this.NamingConventionIsNotEmpty(); 24 | return _errors; 25 | } 26 | 27 | private void BatchDirectoryIsNotEmpty() 28 | { 29 | if (_avsBatchSettings.AviSynthFilesOutputDirectoryPath == string.Empty) 30 | { 31 | _errors.Add(new Error() { Id = 0, Description = "Batch Directory is required!"}); 32 | } 33 | } 34 | 35 | private void BatchDirectoryIsValid() 36 | { 37 | if (!Directory.Exists(_avsBatchSettings.AviSynthFilesOutputDirectoryPath)) 38 | { 39 | _errors.Add(new Error() { Id = 0, Description = "Batch Directory does not exist!" }); 40 | } 41 | } 42 | 43 | private void NamingConventionIsNotEmpty() 44 | { 45 | if (_avsBatchSettings.NamingConvention == string.Empty) 46 | { 47 | _errors.Add(new Error() { Id = 0, Description = "Naming Convention is required" }); 48 | } 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/BatchGuy.App/AviSynth/Services/AviSynthWriteService.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.IO; 3 | using BatchGuy.App.AviSynth.Models; 4 | using BatchGuy.App.AviSynth.Interfaces; 5 | using BatchGuy.App.Shared.Models; 6 | 7 | namespace BatchGuy.App.AviSynth.Services 8 | { 9 | public class AviSynthWriteService : IAviSynthWriteService 10 | { 11 | private ErrorCollection _errors; 12 | private IAviSynthFileService _fileService; 13 | private IAviSynthValidationService _validationService; 14 | private List _avsFiles; 15 | private AviSynthTemplateScript _avsScript; 16 | private AviSynthBatchSettings _avsBatchSettings; 17 | 18 | public AviSynthWriteService(IAviSynthFileService fileService, IAviSynthValidationService validationService, AviSynthTemplateScript avsScript, AviSynthBatchSettings avsBatchSettings) 19 | { 20 | _fileService = fileService; 21 | _validationService = validationService; 22 | _avsScript = avsScript; 23 | _avsBatchSettings = avsBatchSettings; 24 | } 25 | 26 | public ErrorCollection CreateAVSFiles() 27 | { 28 | _errors = _validationService.Validate(); 29 | if (_errors.Count == 0) 30 | { 31 | _avsFiles = _fileService.CreateAVSFileList(); 32 | this.Delete(); 33 | this.WriteAVSStreams(); 34 | } 35 | 36 | return _errors; 37 | } 38 | 39 | private void WriteAVSStreams() 40 | { 41 | foreach (var file in _avsFiles) 42 | { 43 | using (StreamWriter sw = new StreamWriter(file.FullPath)) 44 | { 45 | sw.WriteLine(file.AviSynthScript); 46 | } 47 | } 48 | } 49 | 50 | public void Delete() 51 | { 52 | if (_avsFiles != null) 53 | { 54 | foreach (var file in _avsFiles) 55 | { 56 | if (File.Exists(file.FullPath)) 57 | File.Delete(file.FullPath); 58 | } 59 | } 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /src/BatchGuy.App/AviSynth/Services/IAVSService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using BatchGuy.App.AVS; 7 | using BatchGuy.App.AVS.Models; 8 | using BatchGuy.App.Models; 9 | 10 | namespace BatchGuy.App.AVS.Services 11 | { 12 | public interface IAVSService 13 | { 14 | List CreateAVSFiles(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/BatchGuy.App/AviSynth/Services/IFileService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using BatchGuy.App.AVS; 7 | using BatchGuy.App.AVS.Models; 8 | 9 | namespace BatchGuy.App.AVS.Services 10 | { 11 | public interface IFileService 12 | { 13 | List CreateAVSFileList(); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/BatchGuy.App/AviSynth/Services/IValidationService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using BatchGuy.App.AVS; 7 | using BatchGuy.App.AVS.Models; 8 | using BatchGuy.App.Models; 9 | 10 | namespace BatchGuy.App.AVS.Services 11 | { 12 | public interface IValidationService 13 | { 14 | List Validate(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/BatchGuy.App/Bootstrap/Logging.cs: -------------------------------------------------------------------------------- 1 | using log4net; 2 | using log4net.Appender; 3 | using log4net.Core; 4 | using log4net.Layout; 5 | using log4net.Repository.Hierarchy; 6 | 7 | namespace BatchGuy.App.Bootstrap 8 | { 9 | public class Logging 10 | { 11 | public static void Register() 12 | { 13 | Hierarchy hierarchy = (Hierarchy)LogManager.GetRepository(); 14 | 15 | PatternLayout patternLayout = new PatternLayout(); 16 | patternLayout.ConversionPattern = "%date [%thread] %-5level %logger - %message%newline"; 17 | patternLayout.ActivateOptions(); 18 | 19 | RollingFileAppender roller = new RollingFileAppender(); 20 | roller.AppendToFile = true; 21 | roller.File = @"Logs\logfile.log"; 22 | roller.Layout = patternLayout; 23 | roller.MaxSizeRollBackups = 5; 24 | roller.MaximumFileSize = "30MB"; 25 | roller.RollingStyle = RollingFileAppender.RollingMode.Size; 26 | roller.StaticLogFileName = true; 27 | roller.ActivateOptions(); 28 | hierarchy.Root.AddAppender(roller); 29 | 30 | MemoryAppender memory = new MemoryAppender(); 31 | memory.ActivateOptions(); 32 | hierarchy.Root.AddAppender(memory); 33 | 34 | hierarchy.Root.Level = Level.Info; 35 | hierarchy.Configured = true; 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/BatchGuy.App/Constants/Constant.cs: -------------------------------------------------------------------------------- 1 | namespace BatchGuy.App.Constants 2 | { 3 | public static class Constant 4 | { 5 | public const string FeatureCreateEac3toBatchFileFormSaveEac3ToBatchFileDirectory = "create-eac3to-batch-file-Form-save-eac3to-batch-file-directory"; 6 | public const string FeatureCreateAviSynthFilesFormSaveAviSynthFilesDirectory = "create-avisynth-files-form-save-avisynth-files-directory"; 7 | public const string FeatureCreateX264BatchFileFormSaveX264BatchFileDirectory = "create-x264-batch-file-form-save-x264-batch-file-directory"; 8 | public const string FeatureCreateEac3toBatchFileFormMKVMergeOutputDirectory = "create-eac3to-batch-file-form-mkvmerge-output-directory"; 9 | public const string FeatureCreateEac3toBatchFileFormSaveMKVMergeBatchFileDirectory = "create-eac3to-batch-file-form-save-mkvmerge-batch-file-directory"; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/BatchGuy.App/Eac3To/Abstracts/AbstractEAC3ToOutputNamingService.cs: -------------------------------------------------------------------------------- 1 | using BatchGuy.App.Eac3to.Models; 2 | using BatchGuy.App.Eac3To.Models; 3 | using BatchGuy.App.Enums; 4 | using BatchGuy.App.Extensions; 5 | using BatchGuy.App.Helpers; 6 | using BatchGuy.App.Parser.Models; 7 | using BatchGuy.App.Shared.Interfaces; 8 | 9 | namespace BatchGuy.App.Eac3To.Abstracts 10 | { 11 | public abstract class AbstractEAC3ToOutputNamingService 12 | { 13 | protected IAudioService _audioService; 14 | protected EnumEAC3ToNamingConventionType _enumEAC3ToNamingConventionType; 15 | protected BluRaySummaryInfo _currentBluRaySummaryInfo; 16 | protected EAC3ToRemuxFileNameTemplate _currentMovieRemuxTemplate; 17 | 18 | public EnumEAC3ToNamingConventionType EnumEAC3ToNamingConventionType { get { return _enumEAC3ToNamingConventionType; } } 19 | 20 | public AbstractEAC3ToOutputNamingService(IAudioService audioService) 21 | { 22 | _audioService = audioService; 23 | } 24 | 25 | public void SetCurrentBluRaySummaryInfo(BluRaySummaryInfo currentBluRaySummaryInfo) 26 | { 27 | _currentBluRaySummaryInfo = currentBluRaySummaryInfo; 28 | _currentMovieRemuxTemplate = _currentBluRaySummaryInfo.RemuxFileNameForMovieTemplate; 29 | } 30 | protected string GetAudioCommentary(BluRayTitleAudio audio) 31 | { 32 | string commentary = string.Empty; 33 | if (audio.IsCommentary) 34 | commentary = "-commentary"; 35 | return commentary; 36 | } 37 | protected string GetSubtitleCommentary(BluRayTitleSubtitle subtitle) 38 | { 39 | string commentary = string.Empty; 40 | if (subtitle.IsCommentary) 41 | commentary = "-commentary"; 42 | return commentary; 43 | } 44 | protected string AddWordSeparator(bool isExtractForRemux, bool usePeriodsInFileName, string episodeName) 45 | { 46 | if (isExtractForRemux && usePeriodsInFileName) 47 | return episodeName.ReplaceSpacesWithPeriods(); 48 | else 49 | return episodeName; 50 | } 51 | protected string PadNumberWithZeros(int batchCount, int number) 52 | { 53 | return HelperFunctions.PadNumberWithZeros(batchCount, number); 54 | } 55 | public abstract string GetChapterName(EAC3ToConfiguration eac3toConfiguration, string filesOutputPath, string paddedEpisodeNumber, string episodeName); 56 | public abstract string GetVideoName(EAC3ToConfiguration eac3toConfiguration, string filesOutputPath, string paddedEpisodeNumber, string episodeName, string extension); 57 | public abstract string GetAudioName(EAC3ToConfiguration eac3toConfiguration, BluRayTitleAudio audio, string filesOutputPath, string paddedEpisodeNumber, string episodeName); 58 | public abstract string GetSubtitleName(EAC3ToConfiguration eac3toConfiguration, BluRayTitleSubtitle subtitle, string filesOutputPath, string paddedEpisodeNumber, string episodeName); 59 | public abstract string GetLogName(EAC3ToConfiguration eac3toConfiguration, string filesOutputPath, string paddedEpisodeNumber, string episodeName); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /src/BatchGuy.App/Eac3To/Abstracts/AbstractEAC3ToOutputNamingServiceFactory.cs: -------------------------------------------------------------------------------- 1 | using BatchGuy.App.Eac3To.Services; 2 | using BatchGuy.App.Shared.Interfaces; 3 | 4 | namespace BatchGuy.App.Eac3To.Abstracts 5 | { 6 | public class AbstractEAC3ToOutputNamingServiceFactory 7 | { 8 | protected IAudioService _audioService; 9 | public AbstractEAC3ToOutputNamingServiceFactory(IAudioService audioService) 10 | { 11 | _audioService = audioService; 12 | } 13 | public AbstractEAC3ToOutputNamingService CreateNewEncodeTemplate1EAC3ToOutputNamingService() 14 | { 15 | return new EncodeTemplate1EAC3ToOutputNamingService(_audioService); 16 | } 17 | public AbstractEAC3ToOutputNamingService CreateNewRemuxTemplate1EAC3ToOutputNamingService() 18 | { 19 | return new RemuxTemplate1EAC3ToOutputNamingService(_audioService); 20 | } 21 | public AbstractEAC3ToOutputNamingService CreateNewRemuxTemplate2EAC3ToOutputNamingService() 22 | { 23 | return new RemuxTemplate2EAC3ToOutputNamingService(_audioService); 24 | } 25 | 26 | public AbstractEAC3ToOutputNamingService CreateNewRemuxTemplate3EAC3ToOutputNamingService() 27 | { 28 | return new RemuxTemplate3EAC3ToOutputNamingService(_audioService); 29 | } 30 | public AbstractEAC3ToOutputNamingService CreateNewMovieRemuxTemplate1EAC3ToOutputNamingServiceService() 31 | { 32 | return new MovieRemuxTemplate1EAC3ToOutputNamingService(_audioService); 33 | } 34 | 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/BatchGuy.App/Eac3To/Interfaces/IBatchGuyEAC3ToSettingsService.cs: -------------------------------------------------------------------------------- 1 | using BatchGuy.App.Eac3To.Models; 2 | using BatchGuy.App.Shared.Models; 3 | 4 | namespace BatchGuy.App.Eac3To.Interfaces 5 | { 6 | public interface IBatchGuyEAC3ToSettingsService 7 | { 8 | ErrorCollection Errors { get; } 9 | 10 | void Save(string settingsFile, BatchGuyEAC3ToSettings batchGuyEAC3ToSettings); 11 | 12 | BatchGuyEAC3ToSettings GetBatchGuyEAC3ToSettings(string settingsFile); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/BatchGuy.App/Eac3To/Interfaces/IDirectorySystemService.cs: -------------------------------------------------------------------------------- 1 | namespace BatchGuy.App.Eac3To.Interfaces 2 | { 3 | public interface IDirectorySystemService 4 | { 5 | bool Exists(string path); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/BatchGuy.App/Eac3To/Interfaces/IEAC3ToBatchFileWriteService.cs: -------------------------------------------------------------------------------- 1 | using BatchGuy.App.Shared.Models; 2 | 3 | namespace BatchGuy.App.Eac3To.Interfaces 4 | { 5 | public interface IEAC3ToBatchFileWriteService 6 | { 7 | ErrorCollection Errors { get;} 8 | ErrorCollection Write(); 9 | bool IsValid(); 10 | void Delete(); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/BatchGuy.App/Eac3To/Interfaces/IEAC3ToBatchFileWriteWarningService.cs: -------------------------------------------------------------------------------- 1 | using BatchGuy.App.Shared.Models; 2 | 3 | namespace BatchGuy.App.Eac3To.Interfaces 4 | { 5 | public interface IEAC3ToBatchFileWriteWarningService 6 | { 7 | WarningCollection GetWarnings(); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/BatchGuy.App/Eac3To/Interfaces/IEAC3ToOutputService.cs: -------------------------------------------------------------------------------- 1 | namespace BatchGuy.App.Eac3to.Interfaces 2 | { 3 | public interface IEAC3ToOutputService 4 | { 5 | string GetEAC3ToPathPart(); 6 | string GetBluRayStreamPart(); 7 | string GetChapterStreamPart(); 8 | string GetVideoStreamPart(); 9 | string GetAudioStreamPart(); 10 | string GetSubtitleStreamPart(); 11 | string GetLogPart(); 12 | string GetShowProgressNumbersPart(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/BatchGuy.App/Eac3To/Models/BatchGuyEAC3ToSettings.cs: -------------------------------------------------------------------------------- 1 | using BatchGuy.App.Eac3to.Models; 2 | using System.Collections.Generic; 3 | using BatchGuy.App.Parser.Models; 4 | using BatchGuy.App.X264.Models; 5 | using BatchGuy.App.AviSynth.Models; 6 | 7 | namespace BatchGuy.App.Eac3To.Models 8 | { 9 | public class BatchGuyEAC3ToSettings 10 | { 11 | public EAC3ToConfiguration EAC3ToSettings { get; set; } 12 | public List BluRayDiscs { get; set; } 13 | public X264FileSettings X264FileSettings { get; set; } 14 | public List X264Files { get; set; } 15 | public AviSynthTemplateScript AVSScript { get; set; } 16 | public AviSynthBatchSettings AVSBatchSettings { get; set; } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/BatchGuy.App/Eac3To/Models/EAC3ToConfiguration.cs: -------------------------------------------------------------------------------- 1 | using BatchGuy.App.Eac3To.Models; 2 | using BatchGuy.App.Enums; 3 | 4 | namespace BatchGuy.App.Eac3to.Models 5 | { 6 | public class EAC3ToConfiguration 7 | { 8 | public string EAC3ToPath { get; set; } 9 | public string BatchFilePath { get; set; } 10 | public string EAC3ToOutputPath { get; set; } 11 | public EnumDirectoryType OutputDirectoryType { get; set; } 12 | public bool IsExtractForRemux { get; set; } 13 | public EAC3ToRemuxFileNameTemplate RemuxFileNameTemplate { get; set; } 14 | public int NumberOfEpisodes { get; set; } 15 | public string MKVMergeOutputPath { get; set; } 16 | public string MKVMergePath { get; set; } 17 | public string MKVMergeBatchFilePath { get; set; } 18 | public bool ShowProgressNumbers { get; set; } 19 | public bool IsVideoNameForEncodeMkvMerge { get; set; } 20 | public bool IgnoreInternalSubtitles { get; set; } 21 | public string FFMSIndextBatchFilePath { get; set; } 22 | public string FFMSIndexPath { get; set; } 23 | public bool IfIsExtractForRemuxIsItForAMovie { get; set; } 24 | public string DirectoryPerEpisodeDirectoryName 25 | { 26 | get 27 | { 28 | if (this.OutputDirectoryType == EnumDirectoryType.DirectoryPerEpisode && this.IsExtractForRemux && this.IfIsExtractForRemuxIsItForAMovie) 29 | return "movie"; 30 | else 31 | return "episode"; 32 | } 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/BatchGuy.App/Eac3To/Models/EAC3ToRemuxFileNameTemplate.cs: -------------------------------------------------------------------------------- 1 | namespace BatchGuy.App.Eac3To.Models 2 | { 3 | public class EAC3ToRemuxFileNameTemplate 4 | { 5 | public string SeriesName { get; set; } 6 | public string SeasonNumber { get; set; } 7 | public string SeasonYear { get; set; } 8 | public string VideoResolution { get; set; } 9 | public string AudioType { get; set; } 10 | public string Tag { get; set; } 11 | public string Medium { get; set; } 12 | public string VideoFormat { get; set; } 13 | public bool UsePeriodsInFileName { get; set; } 14 | public string Country { get; set; } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/BatchGuy.App/Eac3To/Services/BatchGuyEAC3ToSettingsService.cs: -------------------------------------------------------------------------------- 1 | using BatchGuy.App.Eac3To.Interfaces; 2 | using BatchGuy.App.Eac3To.Models; 3 | using BatchGuy.App.Shared.Interface; 4 | using BatchGuy.App.Shared.Models; 5 | using log4net; 6 | using System; 7 | using System.Reflection; 8 | 9 | namespace BatchGuy.App.Eac3To.Services 10 | { 11 | public class BatchGuyEAC3ToSettingsService : IBatchGuyEAC3ToSettingsService 12 | { 13 | private ErrorCollection _errors; 14 | private IJsonSerializationService _jsonSerializationService; 15 | 16 | public ErrorCollection Errors 17 | { 18 | get { return _errors; } 19 | } 20 | 21 | public static readonly ILog _log = LogManager.GetLogger(typeof(BatchGuyEAC3ToSettingsService)); 22 | 23 | public BatchGuyEAC3ToSettingsService(IJsonSerializationService jsonSerializationService) 24 | { 25 | _jsonSerializationService = jsonSerializationService; 26 | _errors = new ErrorCollection(); 27 | } 28 | 29 | public void Save(string settingsFile, BatchGuyEAC3ToSettings batchGuyEAC3ToSettings) 30 | { 31 | try 32 | { 33 | _jsonSerializationService.WriteToJsonFile(settingsFile, batchGuyEAC3ToSettings, false); 34 | } 35 | catch (Exception ex) 36 | { 37 | _log.ErrorFormat(Program.GetLogErrorFormat(), ex.Message, ex.StackTrace, MethodBase.GetCurrentMethod().Name); 38 | _errors.Add(new Error() { Description = "There was a problem saving the BatchGuy eac3to Settings File" }); 39 | } 40 | } 41 | 42 | public BatchGuyEAC3ToSettings GetBatchGuyEAC3ToSettings(string settingsFile) 43 | { 44 | BatchGuyEAC3ToSettings batchGuyEAC3ToSettings = null; 45 | try 46 | { 47 | batchGuyEAC3ToSettings = _jsonSerializationService.ReadFromJsonFile(settingsFile); 48 | } 49 | catch (Exception ex) 50 | { 51 | _log.ErrorFormat(Program.GetLogErrorFormat(), ex.Message, ex.StackTrace, MethodBase.GetCurrentMethod().Name); 52 | _errors.Add(new Error() { Description = "There was a problem loading the BatchGuy eac3to Settings File" }); 53 | } 54 | return batchGuyEAC3ToSettings; 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/BatchGuy.App/Eac3To/Services/DirectorySystemService.cs: -------------------------------------------------------------------------------- 1 | using BatchGuy.App.Eac3To.Interfaces; 2 | using System.IO; 3 | 4 | namespace BatchGuy.App.Eac3To.Services 5 | { 6 | public class DirectorySystemService : IDirectorySystemService 7 | { 8 | public bool Exists(string path) 9 | { 10 | return Directory.Exists(path); 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/BatchGuy.App/Eac3To/Services/EncodeTemplate1EAC3ToOutputNamingService.cs: -------------------------------------------------------------------------------- 1 | using BatchGuy.App.Eac3To.Abstracts; 2 | using System.Text; 3 | using BatchGuy.App.Eac3to.Models; 4 | using BatchGuy.App.Parser.Models; 5 | using BatchGuy.App.Shared.Interfaces; 6 | using BatchGuy.App.Extensions; 7 | using BatchGuy.App.Enums; 8 | 9 | namespace BatchGuy.App.Eac3To.Services 10 | { 11 | public class EncodeTemplate1EAC3ToOutputNamingService : AbstractEAC3ToOutputNamingService 12 | { 13 | public EncodeTemplate1EAC3ToOutputNamingService(IAudioService audioService) : base(audioService) 14 | { 15 | _enumEAC3ToNamingConventionType = EnumEAC3ToNamingConventionType.EncodeNamingConventionTemplate1; 16 | } 17 | 18 | public override string GetAudioName(EAC3ToConfiguration eac3toConfiguration, BluRayTitleAudio audio, string filesOutputPath, string paddedEpisodeNumber, string episodeName) 19 | { 20 | StringBuilder sb = new StringBuilder(); 21 | if (eac3toConfiguration.IsExtractForRemux != true) 22 | { 23 | sb.Append(string.Format("\"{0}\\{1}{2}-{3}{4}.{5}\"", filesOutputPath, audio.Language, paddedEpisodeNumber, audio.Id.RemoveColons(), this.GetAudioCommentary(audio), 24 | _audioService.GetAudioExtension(audio.AudioType))); 25 | } 26 | return sb.ToString(); 27 | } 28 | 29 | public override string GetChapterName(EAC3ToConfiguration eac3toConfiguration, string filesOutputPath, string paddedEpisodeNumber, string episodeName) 30 | { 31 | StringBuilder sb = new StringBuilder(); 32 | if (eac3toConfiguration.IsExtractForRemux != true) 33 | { 34 | sb.Append(string.Format("\"{0}\\chapters{1}.txt\"", filesOutputPath, paddedEpisodeNumber)); 35 | } 36 | return sb.ToString(); 37 | } 38 | 39 | public override string GetLogName(EAC3ToConfiguration eac3toConfiguration, string filesOutputPath, string paddedEpisodeNumber, string episodeName) 40 | { 41 | StringBuilder sb = new StringBuilder(); 42 | if (eac3toConfiguration.IsExtractForRemux != true) 43 | { 44 | sb.Append(string.Format(" -log=\"{0}\\log{1}.log\"", filesOutputPath, paddedEpisodeNumber)); 45 | } 46 | return sb.ToString(); 47 | } 48 | 49 | public override string GetSubtitleName(EAC3ToConfiguration eac3toConfiguration, BluRayTitleSubtitle subtitle, string filesOutputPath, string paddedEpisodeNumber, string episodeName) 50 | { 51 | StringBuilder sb = new StringBuilder(); 52 | if (eac3toConfiguration.IsExtractForRemux != true) 53 | { 54 | sb.Append(string.Format("\"{0}\\{1}{2}-{3}{4}.sup\"", filesOutputPath, subtitle.Language, paddedEpisodeNumber, subtitle.Id.RemoveColons(), this.GetSubtitleCommentary(subtitle))); 55 | } 56 | return sb.ToString(); 57 | } 58 | 59 | public override string GetVideoName(EAC3ToConfiguration eac3toConfiguration, string filesOutputPath, string paddedEpisodeNumber, string episodeName, string extension) 60 | { 61 | StringBuilder sb = new StringBuilder(); 62 | if (eac3toConfiguration.IsExtractForRemux != true) 63 | { 64 | if (eac3toConfiguration.IsVideoNameForEncodeMkvMerge == false) 65 | sb.Append(string.Format("\"{0}\\video{1}.{2}\"", filesOutputPath, paddedEpisodeNumber, extension)); 66 | else 67 | sb.Append(string.Format("\"{0}\"", episodeName)); 68 | } 69 | return sb.ToString(); 70 | } 71 | 72 | 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /src/BatchGuy.App/Enums/Enums.cs: -------------------------------------------------------------------------------- 1 | namespace BatchGuy.App.Enums 2 | { 3 | public enum EnumEncodeType 4 | { 5 | CRF = 1, 6 | TwoPass = 2 7 | } 8 | 9 | public enum EnumAudioType 10 | { 11 | AC3 = 1, 12 | FLAC = 2, 13 | TrueHD = 3, 14 | MPA = 4, 15 | DTSMA = 5, 16 | LPCM = 6, 17 | DTSEXPRESS = 7, 18 | M4A = 8 19 | } 20 | 21 | public enum EnumBluRayLineItemType 22 | { 23 | BluRaySummaryHeaderLine = 1, 24 | BluRaySummaryDetailLine = 2, 25 | BluRaySummaryEmptyLine = 3, 26 | BluRayTitleHeaderLine = 4, 27 | BluRayTitleEmptyLine = 5, 28 | BluRayTitleChapterLine = 6, 29 | BluRayTitleVideoLine = 7, 30 | BluRayTitleAudioLine = 8, 31 | BluRayTitleSubtitleLine = 9, 32 | BluRayError = 10 33 | } 34 | 35 | public enum EnumSortDirection 36 | { 37 | Asc = 1, 38 | Desc =2 39 | } 40 | 41 | public enum EnumDirectoryType 42 | { 43 | SingleDirectory = 1, 44 | DirectoryPerEpisode = 2 45 | } 46 | 47 | public enum EnumX264LogLineItemType 48 | { 49 | IFrame = 1, 50 | PFrame = 2, 51 | BFrame = 3, 52 | ConsecutiveBFrames = 4, 53 | EncodedFrames = 5, 54 | None = 6 55 | } 56 | 57 | public enum EnumEAC3ToNamingConventionType 58 | { 59 | EncodeNamingConventionTemplate1 = 1, //video## 60 | RemuxNamingConventionTemplate1 = 2, //TV Show S01E01 Episode Name 1080p Remux AVC FLAC5.1-Tag.mkv 61 | RemuxNamingConventionTemplate2 = 3, //TV Show, S01E01 (Year).mkv 62 | RemuxNamingConventionTemplate3 = 4, //2x01 Episode Name.mkv 63 | MovieRemuxNamingConventionTemplate1 = 5 //movie remux 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /src/BatchGuy.App/FFMSIndex/Interfaces/IFFMSIndexBatchFileWriteService.cs: -------------------------------------------------------------------------------- 1 | using BatchGuy.App.Shared.Models; 2 | 3 | namespace BatchGuy.App.FFMSIndex.Interfaces 4 | { 5 | public interface IFFMSIndexBatchFileWriteService 6 | { 7 | ErrorCollection Errors { get; } 8 | ErrorCollection Write(); 9 | bool IsValid(); 10 | void Delete(); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/BatchGuy.App/FFMSIndex/Interfaces/IFFMSIndexOutputService.cs: -------------------------------------------------------------------------------- 1 | namespace BatchGuy.App.FFMSIndex.Interfaces 2 | { 3 | public interface IFFMSIndexOutputService 4 | { 5 | string GetFFMSIndexPathPart(); 6 | string GetVideoStreamPart(); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/BatchGuy.App/FFMSIndex/Services/FFMSIndexOutputService.cs: -------------------------------------------------------------------------------- 1 | using BatchGuy.App.Eac3to.Models; 2 | using BatchGuy.App.Eac3To.Abstracts; 3 | using BatchGuy.App.Enums; 4 | using BatchGuy.App.Extensions; 5 | using BatchGuy.App.FFMSIndex.Interfaces; 6 | using BatchGuy.App.Helpers; 7 | using BatchGuy.App.Parser.Models; 8 | using BatchGuy.App.Shared.Models; 9 | using System.Text; 10 | 11 | namespace BatchGuy.App.FFMSIndex.Services 12 | { 13 | public class FFMSIndexOutputService : IFFMSIndexOutputService 14 | { 15 | private EAC3ToConfiguration _eac3ToConfiguration; 16 | private ErrorCollection _errors = new ErrorCollection(); 17 | private string _filesOutputPath; 18 | private string _paddedEpisodeNumber; 19 | private string _bluRayPath; 20 | private BluRaySummaryInfo _bluRaySummaryInfo; 21 | private AbstractEAC3ToOutputNamingService _eac3ToOutputNamingService; 22 | 23 | public FFMSIndexOutputService(EAC3ToConfiguration config, AbstractEAC3ToOutputNamingService eac3ToOutputNamingService, string bluRayPath, BluRaySummaryInfo bluRaySummaryInfo) 24 | { 25 | _eac3ToConfiguration = config; 26 | _eac3ToOutputNamingService = eac3ToOutputNamingService; 27 | _bluRayPath = bluRayPath; 28 | _bluRaySummaryInfo = bluRaySummaryInfo; 29 | this.Init(); 30 | } 31 | 32 | private void Init() 33 | { 34 | _paddedEpisodeNumber = HelperFunctions.PadNumberWithZeros(_eac3ToConfiguration.NumberOfEpisodes, _bluRaySummaryInfo.BluRayTitleInfo.EpisodeNumber.StringToInt()); 35 | if (_eac3ToConfiguration.OutputDirectoryType == EnumDirectoryType.DirectoryPerEpisode) 36 | { 37 | string folderName = string.Format("episode{0}", _paddedEpisodeNumber); 38 | _filesOutputPath = string.Format("{0}\\{1}", _eac3ToConfiguration.EAC3ToOutputPath, folderName); 39 | } 40 | else 41 | { 42 | _filesOutputPath = string.Format("{0}", _eac3ToConfiguration.EAC3ToOutputPath); 43 | } 44 | } 45 | 46 | public string GetFFMSIndexPathPart() 47 | { 48 | return string.Format("\"{0}\" -f -v", _eac3ToConfiguration.FFMSIndexPath); 49 | } 50 | 51 | public string GetVideoStreamPart() 52 | { 53 | StringBuilder sb = new StringBuilder(); 54 | string extension = HelperFunctions.GetVideoExtension(_bluRaySummaryInfo.BluRayTitleInfo.Video.Text); 55 | if (_bluRaySummaryInfo.BluRayTitleInfo.Video != null) 56 | { 57 | if (_bluRaySummaryInfo.BluRayTitleInfo.Video.IsSelected) 58 | { 59 | sb.Append(_eac3ToOutputNamingService.GetVideoName(_eac3ToConfiguration, _filesOutputPath, _paddedEpisodeNumber, _bluRaySummaryInfo.BluRayTitleInfo.EpisodeName, extension)); 60 | } 61 | } 62 | return sb.ToString(); 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /src/BatchGuy.App/Helpers/HelperFunctions.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | 3 | namespace BatchGuy.App.Helpers 4 | { 5 | public static class HelperFunctions 6 | { 7 | public static string PadNumberWithZeros(int batchCount, int number) 8 | { 9 | string paddedNumber = string.Empty; 10 | string batchCountString = batchCount.ToString(); 11 | 12 | if (batchCountString.Length == 1) 13 | { 14 | paddedNumber = number.ToString().PadLeft(2, '0'); 15 | } 16 | else 17 | { 18 | if (number.ToString().Length < batchCountString.Length) 19 | { 20 | paddedNumber = number.ToString().PadLeft(batchCountString.Length, '0'); 21 | } 22 | else 23 | { 24 | paddedNumber = number.ToString(); 25 | } 26 | } 27 | return paddedNumber; 28 | } 29 | 30 | public static string GetVideoExtension(string text) 31 | { 32 | string[] values = new string[] { "hevc", "h265", "2160" }; 33 | 34 | bool isHevc = values.Any(v => text.ToLower().Contains(v)); 35 | 36 | if (string.IsNullOrEmpty(text) || isHevc == false) 37 | return "mkv"; 38 | else 39 | return "h265"; 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/BatchGuy.App/Icons/Avosoft-Warm-Toolbar-Folder-open.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaboy58/BatchGuy/e1e74591403bdc337c6814fc02fde7cefc81935d/src/BatchGuy.App/Icons/Avosoft-Warm-Toolbar-Folder-open.ico -------------------------------------------------------------------------------- /src/BatchGuy.App/Icons/Custom-Icon-Design-Flatastic-10-New-file.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaboy58/BatchGuy/e1e74591403bdc337c6814fc02fde7cefc81935d/src/BatchGuy.App/Icons/Custom-Icon-Design-Flatastic-10-New-file.ico -------------------------------------------------------------------------------- /src/BatchGuy.App/Icons/Custom-Icon-Design-Flatastic-10-Open-file.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaboy58/BatchGuy/e1e74591403bdc337c6814fc02fde7cefc81935d/src/BatchGuy.App/Icons/Custom-Icon-Design-Flatastic-10-Open-file.ico -------------------------------------------------------------------------------- /src/BatchGuy.App/Icons/Custom-Icon-Design-Flatastic-2-Process-accept.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaboy58/BatchGuy/e1e74591403bdc337c6814fc02fde7cefc81935d/src/BatchGuy.App/Icons/Custom-Icon-Design-Flatastic-2-Process-accept.ico -------------------------------------------------------------------------------- /src/BatchGuy.App/Icons/Custom-Icon-Design-Pretty-Office-7-Extract-object.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaboy58/BatchGuy/e1e74591403bdc337c6814fc02fde7cefc81935d/src/BatchGuy.App/Icons/Custom-Icon-Design-Pretty-Office-7-Extract-object.ico -------------------------------------------------------------------------------- /src/BatchGuy.App/Icons/Everaldo-Crystal-Clear-App-edit.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaboy58/BatchGuy/e1e74591403bdc337c6814fc02fde7cefc81935d/src/BatchGuy.App/Icons/Everaldo-Crystal-Clear-App-edit.ico -------------------------------------------------------------------------------- /src/BatchGuy.App/Icons/Fasticon-Green-Ville-2-File.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaboy58/BatchGuy/e1e74591403bdc337c6814fc02fde7cefc81935d/src/BatchGuy.App/Icons/Fasticon-Green-Ville-2-File.ico -------------------------------------------------------------------------------- /src/BatchGuy.App/Icons/Fatcow-Farm-Fresh-Script-add.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaboy58/BatchGuy/e1e74591403bdc337c6814fc02fde7cefc81935d/src/BatchGuy.App/Icons/Fatcow-Farm-Fresh-Script-add.ico -------------------------------------------------------------------------------- /src/BatchGuy.App/Icons/Iconfinder-1472897142_DeleteRed.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaboy58/BatchGuy/e1e74591403bdc337c6814fc02fde7cefc81935d/src/BatchGuy.App/Icons/Iconfinder-1472897142_DeleteRed.ico -------------------------------------------------------------------------------- /src/BatchGuy.App/Icons/Icontexto-Webdev-Webdev-config.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaboy58/BatchGuy/e1e74591403bdc337c6814fc02fde7cefc81935d/src/BatchGuy.App/Icons/Icontexto-Webdev-Webdev-config.ico -------------------------------------------------------------------------------- /src/BatchGuy.App/Icons/close_red.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaboy58/BatchGuy/e1e74591403bdc337c6814fc02fde7cefc81935d/src/BatchGuy.App/Icons/close_red.ico -------------------------------------------------------------------------------- /src/BatchGuy.App/Icons/label_new_green.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaboy58/BatchGuy/e1e74591403bdc337c6814fc02fde7cefc81935d/src/BatchGuy.App/Icons/label_new_green.ico -------------------------------------------------------------------------------- /src/BatchGuy.App/Icons/webdev-config-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaboy58/BatchGuy/e1e74591403bdc337c6814fc02fde7cefc81935d/src/BatchGuy.App/Icons/webdev-config-icon.png -------------------------------------------------------------------------------- /src/BatchGuy.App/MKVMerge/Interfaces/IMKVMergeBatchFileWriteService.cs: -------------------------------------------------------------------------------- 1 | using BatchGuy.App.Shared.Models; 2 | 3 | namespace BatchGuy.App.MKVMerge.Interfaces 4 | { 5 | public interface IMKVMergeBatchFileWriteService 6 | { 7 | ErrorCollection Errors { get; } 8 | ErrorCollection Write(); 9 | bool IsValid(); 10 | void Delete(); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/BatchGuy.App/MKVMerge/Interfaces/IMKVMergeLanguageService.cs: -------------------------------------------------------------------------------- 1 | using BatchGuy.App.MKVMerge.Models; 2 | using System.Collections.Generic; 3 | 4 | namespace BatchGuy.App.MKVMerge.Interfaces 5 | { 6 | public interface IMKVMergeLanguageService 7 | { 8 | List GetLanguages(); 9 | 10 | MKVMergeLanguageItem GetLanguageByName(string name); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/BatchGuy.App/MKVMerge/Interfaces/IMKVMergeOutputService.cs: -------------------------------------------------------------------------------- 1 | namespace BatchGuy.App.MKVMerge.Interfaces 2 | { 3 | public interface IMKVMergeOutputService 4 | { 5 | string GetMKVMergePathPart(); 6 | string GetOutputPart(); 7 | string GetChaptersPart(); 8 | string GetVideoPart(); 9 | string GetAudioPart(); 10 | string GetSubtitlePart(); 11 | string GetTrackOrderPart(); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/BatchGuy.App/MKVMerge/Models/ISOLanguageCode.cs: -------------------------------------------------------------------------------- 1 | namespace BatchGuy.App.MKVMerge.Models 2 | { 3 | public class ISOLanguageCode 4 | { 5 | public string alpha3b { get; set; } 6 | public string alpha3t { get; set; } 7 | public string alpha2 { get; set; } 8 | public string English { get; set; } 9 | public string French { get; set; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/BatchGuy.App/MKVMerge/Models/ISOLanguageCodeCollection.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace BatchGuy.App.MKVMerge.Models 4 | { 5 | public class ISOLanguageCodeCollection : List 6 | { 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/BatchGuy.App/MKVMerge/Models/MKVMergeItem.cs: -------------------------------------------------------------------------------- 1 | namespace BatchGuy.App.MKVMerge.Models 2 | { 3 | public class MKVMergeItem 4 | { 5 | public string TrackName { get; set; } 6 | public MKVMergeLanguageItem Language { get; set; } 7 | public string DefaultTrackFlag { get; set; } 8 | public string ForcedTrackFlag { get; set; } 9 | public string Compression { get; set; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/BatchGuy.App/MKVMerge/Models/MKVMergeLanguageItem.cs: -------------------------------------------------------------------------------- 1 | namespace BatchGuy.App.MKVMerge.Models 2 | { 3 | public class MKVMergeLanguageItem 4 | { 5 | public string Name { get; set; } 6 | public string Value { get; set; } 7 | 8 | public string Language { get; set; } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/BatchGuy.App/Parser/Interfaces/IBluRaySummaryParserService.cs: -------------------------------------------------------------------------------- 1 | using BatchGuy.App.Parser.Models; 2 | using BatchGuy.App.Shared.Models; 3 | using System.Collections.Generic; 4 | 5 | namespace BatchGuy.App.Parser.Interfaces 6 | { 7 | public interface IBluRaySummaryParserService 8 | { 9 | ErrorCollection Errors { get; } 10 | List GetSummaryList(); 11 | string GetId(ProcessOutputLineItem lineItem); 12 | string RemoveEac3ToIdFromHeaderLineItem(ProcessOutputLineItem lineItem); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/BatchGuy.App/Parser/Interfaces/IBluRayTitleParserService.cs: -------------------------------------------------------------------------------- 1 | using BatchGuy.App.Enums; 2 | using BatchGuy.App.Parser.Models; 3 | 4 | namespace BatchGuy.App.Parser.Interfaces 5 | { 6 | public interface IBluRayTitleParserService 7 | { 8 | BluRayTitleInfo GetTitleInfo(); 9 | string GetId(ProcessOutputLineItem lineItem); 10 | EnumAudioType GetAudioType(ProcessOutputLineItem lineItem); 11 | string GetLanguage(ProcessOutputLineItem lineItem); 12 | bool IsAudioType(ProcessOutputLineItem processOutputLineItem, string criteria); 13 | bool IsIdValid(string id); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/BatchGuy.App/Parser/Interfaces/ICommandLineProcessService.cs: -------------------------------------------------------------------------------- 1 | using BatchGuy.App.Parser.Models; 2 | using BatchGuy.App.Shared.Models; 3 | using System.Collections.Generic; 4 | 5 | namespace BatchGuy.App.Parser.Interfaces 6 | { 7 | public interface ICommandLineProcessService 8 | { 9 | ErrorCollection Errors { get;} 10 | List GetProcessOutputLineItems(); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/BatchGuy.App/Parser/Interfaces/ILineItemIdentifierService.cs: -------------------------------------------------------------------------------- 1 | using BatchGuy.App.Enums; 2 | using BatchGuy.App.Parser.Models; 3 | 4 | namespace BatchGuy.App.Parser.Interfaces 5 | { 6 | public interface ILineItemIdentifierService 7 | { 8 | EnumBluRayLineItemType GetLineItemType(ProcessOutputLineItem processOutputLineItem); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/BatchGuy.App/Parser/Models/BluRayDiscInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.IO; 3 | 4 | namespace BatchGuy.App.Parser.Models 5 | { 6 | public class BluRayDiscInfo 7 | { 8 | public int Id { get; set; } 9 | public bool IsSelected { get; set; } 10 | public List BluRaySummaryInfoList { get; set; } 11 | public string BluRayPath { get; set; } 12 | public string DiscName 13 | { 14 | get 15 | { 16 | if (this.BluRayPath != null) 17 | return new DirectoryInfo(this.BluRayPath).Name; 18 | else 19 | return string.Empty; 20 | } 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/BatchGuy.App/Parser/Models/BluRaySummaryInfo.cs: -------------------------------------------------------------------------------- 1 | using BatchGuy.App.Extensions; 2 | using BatchGuy.App.Eac3To.Models; 3 | 4 | namespace BatchGuy.App.Parser.Models 5 | { 6 | public class BluRaySummaryInfo 7 | { 8 | public BluRaySummaryInfo() 9 | { 10 | RemuxFileNameForMovieTemplate = new EAC3ToRemuxFileNameTemplate(); 11 | } 12 | 13 | public string Eac3ToId { get; set; } 14 | public string HeaderText { get; set; } 15 | public string DetailText { get; set; } 16 | public bool IsSelected { get; set; } 17 | public BluRayTitleInfo BluRayTitleInfo { get; set; } 18 | public int? EpisodeNumber 19 | { 20 | get 21 | { 22 | if (this.BluRayTitleInfo == null) 23 | return null; 24 | else 25 | return this.BluRayTitleInfo.EpisodeNumber.StringToNullInt(); 26 | } 27 | } 28 | public EAC3ToRemuxFileNameTemplate RemuxFileNameForMovieTemplate { get; set; } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/BatchGuy.App/Parser/Models/BluRayTitleAudio.cs: -------------------------------------------------------------------------------- 1 | using BatchGuy.App.Enums; 2 | using BatchGuy.App.MKVMerge.Models; 3 | using BatchGuy.App.Extensions; 4 | 5 | namespace BatchGuy.App.Parser.Models 6 | { 7 | public class BluRayTitleAudio 8 | { 9 | private int _idNumber; 10 | public string Id { get; set; } 11 | public EnumAudioType AudioType { get; set; } 12 | public string Language { get; set; } 13 | public string Arguments { get; set; } 14 | public bool IsSelected { get; set; } 15 | public string Text { get; set; } 16 | public bool IsCommentary { get; set; } 17 | public MKVMergeItem MKVMergeItem { get; set; } 18 | public EnumAudioType OriginalAudioType { get; set; } 19 | public bool IsLossless { get; set; } 20 | public int IdNumber 21 | { 22 | get 23 | { 24 | if (_idNumber > 0) 25 | return _idNumber; 26 | if (string.IsNullOrEmpty(Id) == true) 27 | return _idNumber; 28 | 29 | _idNumber = Id.RemoveColons().StringToInt(); 30 | return _idNumber; 31 | } 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/BatchGuy.App/Parser/Models/BluRayTitleChapter.cs: -------------------------------------------------------------------------------- 1 | namespace BatchGuy.App.Parser.Models 2 | { 3 | public class BluRayTitleChapter 4 | { 5 | public string Id { get; set; } 6 | public bool IsSelected { get; set; } 7 | public string Text { get; set; } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/BatchGuy.App/Parser/Models/BluRayTitleInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace BatchGuy.App.Parser.Models 4 | { 5 | public class BluRayTitleInfo 6 | { 7 | public string EpisodeNumber { get; set; } 8 | public string EpisodeName { get; set; } 9 | public string HeaderText { get; set; } 10 | public BluRayTitleChapter Chapter { get; set; } 11 | public BluRayTitleVideo Video { get; set; } 12 | public List AudioList { get; set; } 13 | public List Subtitles { get; set; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/BatchGuy.App/Parser/Models/BluRayTitleSubtitle.cs: -------------------------------------------------------------------------------- 1 | using BatchGuy.App.MKVMerge.Models; 2 | using System.IO; 3 | using BatchGuy.App.Extensions; 4 | 5 | namespace BatchGuy.App.Parser.Models 6 | { 7 | public class BluRayTitleSubtitle 8 | { 9 | private int _idNumber; 10 | public string Id { get; set; } 11 | public string Language { get; set; } 12 | public bool IsSelected { get; set; } 13 | public string Text { get; set; } 14 | public bool IsCommentary { get; set; } 15 | public MKVMergeItem MKVMergeItem { get; set; } 16 | public string ExternalSubtitlePath { get; set; } 17 | public string ExternalSubtitleNameOnly 18 | { 19 | get 20 | { 21 | if (this.ExternalSubtitlePath != null && this.ExternalSubtitlePath != string.Empty) 22 | return Path.GetFileName(this.ExternalSubtitlePath); 23 | else 24 | return string.Empty; 25 | } 26 | } 27 | public bool CanEdit { get; set; } 28 | public bool IsExternal { get; set; } 29 | public int IdNumber 30 | { 31 | get 32 | { 33 | if (_idNumber > 0) 34 | return _idNumber; 35 | if (string.IsNullOrEmpty(Id) == true) 36 | return _idNumber; 37 | 38 | _idNumber = Id.RemoveColons().StringToInt(); 39 | return _idNumber; 40 | } 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/BatchGuy.App/Parser/Models/BluRayTitleVideo.cs: -------------------------------------------------------------------------------- 1 | namespace BatchGuy.App.Parser.Models 2 | { 3 | public class BluRayTitleVideo 4 | { 5 | public string Id { get; set; } 6 | public bool IsSelected { get; set; } 7 | public string Text { get; set; } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/BatchGuy.App/Parser/Models/CommandLineProcessStartInfo.cs: -------------------------------------------------------------------------------- 1 | namespace BatchGuy.App.Parser.Models 2 | { 3 | public class CommandLineProcessStartInfo 4 | { 5 | public string FileName { get; set; } 6 | public string Arguments { get; set; } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/BatchGuy.App/Parser/Models/ProcessOutputLineItem.cs: -------------------------------------------------------------------------------- 1 | namespace BatchGuy.App.Parser.Models 2 | { 3 | public class ProcessOutputLineItem 4 | { 5 | public int Id { get; set; } 6 | public string Text { get; set; } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/BatchGuy.App/Parser/Services/BluRaySummaryLineItemIdentifierService.cs: -------------------------------------------------------------------------------- 1 | using BatchGuy.App.Enums; 2 | using BatchGuy.App.Parser.Interfaces; 3 | using BatchGuy.App.Parser.Models; 4 | using System.Linq; 5 | 6 | namespace BatchGuy.App.Parser.Services 7 | { 8 | public class BluRaySummaryLineItemIdentifierService : ILineItemIdentifierService 9 | { 10 | public EnumBluRayLineItemType GetLineItemType(ProcessOutputLineItem processOutputLineItem) 11 | { 12 | EnumBluRayLineItemType type; 13 | 14 | if (this.IsHeaderLine(processOutputLineItem)) 15 | { 16 | type = EnumBluRayLineItemType.BluRaySummaryHeaderLine; 17 | } 18 | else if (this.IsDetailLine(processOutputLineItem)) 19 | { 20 | type = EnumBluRayLineItemType.BluRaySummaryDetailLine; 21 | } 22 | else if (this.IsEmptyLine(processOutputLineItem)) 23 | { 24 | type = EnumBluRayLineItemType.BluRaySummaryEmptyLine; 25 | } 26 | else 27 | { 28 | type = EnumBluRayLineItemType.BluRayError; 29 | } 30 | 31 | return type; 32 | } 33 | 34 | private bool IsHeaderLine(ProcessOutputLineItem processOutputLineItem) 35 | { 36 | string[] values = new string[] { ".mpls", ".m2ts" }; 37 | 38 | bool isHeader = values.Any(v => processOutputLineItem.Text.ToLower().Contains(v)); 39 | 40 | return isHeader; 41 | } 42 | 43 | private bool IsDetailLine(ProcessOutputLineItem processOutputLineItem) 44 | { 45 | string[] values = new string[] { "chapters", "hevc", "h265", "h264", "dts", "ac3", "pcm", "stero", "raw","truehd","avc","mpeg2","vc-1" }; 46 | 47 | bool isDetail = values.Any(v => processOutputLineItem.Text.ToLower().Contains(v)); 48 | 49 | return isDetail; 50 | } 51 | 52 | private bool IsEmptyLine(ProcessOutputLineItem processOutputLineItem) 53 | { 54 | if (processOutputLineItem.Text == "") 55 | return true; 56 | else 57 | return false; 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/BatchGuy.App/Parser/Services/BluRayTitleLineItemIdentifierService.cs: -------------------------------------------------------------------------------- 1 | using BatchGuy.App.Enums; 2 | using BatchGuy.App.Parser.Interfaces; 3 | using BatchGuy.App.Parser.Models; 4 | using System.Linq; 5 | 6 | namespace BatchGuy.App.Parser.Services 7 | { 8 | public class BluRayTitleLineItemIdentifierService : ILineItemIdentifierService 9 | { 10 | public EnumBluRayLineItemType GetLineItemType(ProcessOutputLineItem processOutputLineItem) 11 | { 12 | EnumBluRayLineItemType type; 13 | 14 | if (this.IsHeaderLine(processOutputLineItem)) 15 | { 16 | type = EnumBluRayLineItemType.BluRayTitleHeaderLine; 17 | } 18 | else if (this.IsChapterLine(processOutputLineItem)) 19 | { 20 | type = EnumBluRayLineItemType.BluRayTitleChapterLine; 21 | } 22 | else if (this.IsVideoLine(processOutputLineItem)) 23 | { 24 | type = EnumBluRayLineItemType.BluRayTitleVideoLine; 25 | } 26 | else if (this.IsAudioLine(processOutputLineItem)) 27 | { 28 | type = EnumBluRayLineItemType.BluRayTitleAudioLine; 29 | } 30 | else if (this.IsSubtitleLine(processOutputLineItem)) 31 | { 32 | type = EnumBluRayLineItemType.BluRayTitleSubtitleLine; 33 | } 34 | else 35 | { 36 | type = EnumBluRayLineItemType.BluRayTitleEmptyLine; 37 | } 38 | return type; 39 | } 40 | 41 | private bool IsHeaderLine(ProcessOutputLineItem processOutputLineItem) 42 | { 43 | string[] values = new string[] { "track" }; 44 | 45 | bool isHeader = values.Any(v => processOutputLineItem.Text.ToLower().Contains(v)); 46 | 47 | return isHeader; 48 | } 49 | 50 | private bool IsChapterLine(ProcessOutputLineItem processOutputLineItem) 51 | { 52 | string[] values = new string[] { "chapters" }; 53 | 54 | bool isChapter = values.Any(v => processOutputLineItem.Text.ToLower().Contains(v)); 55 | 56 | return isChapter; 57 | } 58 | 59 | private bool IsVideoLine(ProcessOutputLineItem processOutputLineItem) 60 | { 61 | string[] values = new string[] { "hevc", "h265", "2160", "h264","avc","1080", "mpeg-4", "mpeg2" }; 62 | 63 | bool isVideo = values.Any(v => processOutputLineItem.Text.ToLower().Contains(v)); 64 | 65 | return isVideo; 66 | } 67 | 68 | private bool IsAudioLine(ProcessOutputLineItem processOutputLineItem) 69 | { 70 | string[] values = new string[] { "dts", "audio", "channels", "ac3", "pcm", "truehd" }; 71 | 72 | bool isAudio = values.Any(v => processOutputLineItem.Text.ToLower().Contains(v)); 73 | 74 | return isAudio; 75 | } 76 | 77 | private bool IsSubtitleLine(ProcessOutputLineItem processOutputLineItem) 78 | { 79 | string[] values = new string[] { "pgs" }; 80 | 81 | bool isSubtitle = values.Any(v => processOutputLineItem.Text.ToLower().Contains(v)); 82 | 83 | return isSubtitle; 84 | } 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /src/BatchGuy.App/Parser/Services/CommandLineProcessService.cs: -------------------------------------------------------------------------------- 1 | using BatchGuy.App.Parser.Models; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Diagnostics; 5 | using System.IO; 6 | using BatchGuy.App.Parser.Interfaces; 7 | using BatchGuy.App.Shared.Models; 8 | using BatchGuy.App.Extensions; 9 | using log4net; 10 | using System.Reflection; 11 | 12 | namespace BatchGuy.App.Parser.Services 13 | { 14 | public class CommandLineProcessService : ICommandLineProcessService 15 | { 16 | private CommandLineProcessStartInfo _commandLineProcessStartInfo; 17 | private readonly ErrorCollection _errors; 18 | 19 | public static readonly ILog _log = LogManager.GetLogger(typeof(CommandLineProcessService)); 20 | 21 | public CommandLineProcessService(CommandLineProcessStartInfo commandLineProcessStartInfo) 22 | { 23 | _commandLineProcessStartInfo = commandLineProcessStartInfo; 24 | _errors = new ErrorCollection(); 25 | this.CheckErrors(); 26 | } 27 | 28 | public ErrorCollection Errors 29 | { 30 | get { return _errors; } 31 | } 32 | 33 | public List GetProcessOutputLineItems() 34 | { 35 | List processOutputLineItems = new List(); 36 | try 37 | { 38 | int id = 1; 39 | ProcessStartInfo cmdStartInfo = new ProcessStartInfo(); 40 | cmdStartInfo.FileName = _commandLineProcessStartInfo.FileName; 41 | cmdStartInfo.WindowStyle = ProcessWindowStyle.Normal; 42 | cmdStartInfo.Arguments = _commandLineProcessStartInfo.Arguments; 43 | cmdStartInfo.RedirectStandardOutput = true; 44 | cmdStartInfo.RedirectStandardError = true; 45 | cmdStartInfo.UseShellExecute = false; 46 | 47 | Process process = Process.Start(cmdStartInfo); 48 | using (StreamReader streamReader = process.StandardOutput) 49 | { 50 | string output = streamReader.ReadToEnd(); 51 | string[] splitted = output.Split('\n'); 52 | foreach (string item in splitted) 53 | { 54 | processOutputLineItems.Add(new ProcessOutputLineItem() { Id = id, Text = item.RemoveBackspaces() }); 55 | id++; 56 | } 57 | } 58 | 59 | using (StreamReader streamReader = process.StandardError) 60 | { 61 | throw new Exception(streamReader.ReadToEnd()); 62 | } 63 | } 64 | catch (Exception ex) 65 | { 66 | _log.ErrorFormat(Program.GetLogErrorFormat(), ex.Message, ex.StackTrace, MethodBase.GetCurrentMethod().Name); 67 | _errors.Add(new Error() { Description = "There was an error while trying to execute the cli executable" }); 68 | } 69 | 70 | return processOutputLineItems; 71 | } 72 | 73 | private ErrorCollection CheckErrors() 74 | { 75 | this.CheckFileName(); 76 | this.CheckArguments(); 77 | 78 | return _errors; 79 | } 80 | 81 | 82 | private void CheckFileName() 83 | { 84 | if (_commandLineProcessStartInfo.FileName == string.Empty || _commandLineProcessStartInfo.FileName == null) 85 | { 86 | _errors.Add(new Error() { Description = "Invalid file name" }); 87 | } 88 | } 89 | 90 | private void CheckArguments() 91 | { 92 | if (_commandLineProcessStartInfo.Arguments == string.Empty || _commandLineProcessStartInfo.Arguments == null) 93 | { 94 | _errors.Add(new Error() { Description = "Invalid arguments" }); 95 | } 96 | } 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /src/BatchGuy.App/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("BatchGuy")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("BatchGuy")] 13 | [assembly: AssemblyCopyright("Copyright © 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("0a3d5b89-ec18-4f88-a9c1-c6c3b8954634")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("7.1.0.0")] 36 | [assembly: AssemblyFileVersion("7.1.0.0")] 37 | -------------------------------------------------------------------------------- /src/BatchGuy.App/Properties/DataSources/BatchGuy.App.MKVMerge.Models.MKVMergeLanguageItem.datasource: -------------------------------------------------------------------------------- 1 |  2 | 8 | 9 | BatchGuy.App.MKVMerge.Models.MKVMergeLanguageItem, BatchGuy.App, Version=2.6.0.0, Culture=neutral, PublicKeyToken=null 10 | -------------------------------------------------------------------------------- /src/BatchGuy.App/Properties/DataSources/BatchGuy.App.Parser.Models.BluRayDiscInfo.datasource: -------------------------------------------------------------------------------- 1 |  2 | 8 | 9 | BatchGuy.App.Parser.Models.BluRayDiscInfo, BatchGuy.App, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null 10 | -------------------------------------------------------------------------------- /src/BatchGuy.App/Properties/DataSources/BatchGuy.App.Parser.Models.BluRaySummaryInfo.datasource: -------------------------------------------------------------------------------- 1 |  2 | 8 | 9 | BatchGuy.App.Parser.Models.BluRaySummaryInfo, BatchGuy.App, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null 10 | -------------------------------------------------------------------------------- /src/BatchGuy.App/Properties/DataSources/BatchGuy.App.Parser.Models.BluRayTitleAudio.datasource: -------------------------------------------------------------------------------- 1 |  2 | 8 | 9 | BatchGuy.App.Parser.Models.BluRayTitleAudio, BatchGuy.App, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null 10 | -------------------------------------------------------------------------------- /src/BatchGuy.App/Properties/DataSources/BatchGuy.App.Parser.Models.BluRayTitleChapter.datasource: -------------------------------------------------------------------------------- 1 |  2 | 8 | 9 | BatchGuy.App.Parser.Models.BluRayTitleChapter, BatchGuy.App, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null 10 | -------------------------------------------------------------------------------- /src/BatchGuy.App/Properties/DataSources/BatchGuy.App.Parser.Models.BluRayTitleInfo.datasource: -------------------------------------------------------------------------------- 1 |  2 | 8 | 9 | BatchGuy.App.Parser.Models.BluRayTitleInfo, BatchGuy.App, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null 10 | -------------------------------------------------------------------------------- /src/BatchGuy.App/Properties/DataSources/BatchGuy.App.Parser.Models.BluRayTitleSubtitle.datasource: -------------------------------------------------------------------------------- 1 |  2 | 8 | 9 | BatchGuy.App.Parser.Models.BluRayTitleSubtitle, BatchGuy.App, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null 10 | -------------------------------------------------------------------------------- /src/BatchGuy.App/Properties/DataSources/BatchGuy.App.Parser.Models.BluRayTitleVideo.datasource: -------------------------------------------------------------------------------- 1 |  2 | 8 | 9 | BatchGuy.App.Parser.Models.BluRayTitleVideo, BatchGuy.App, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null 10 | -------------------------------------------------------------------------------- /src/BatchGuy.App/Properties/DataSources/BatchGuy.App.Settings.Models.BluRayTitleInfoDefaultSettingsAudio.datasource: -------------------------------------------------------------------------------- 1 |  2 | 8 | 9 | BatchGuy.App.Settings.Models.BluRayTitleInfoDefaultSettingsAudio, BatchGuy.App, Version=3.2.0.0, Culture=neutral, PublicKeyToken=null 10 | -------------------------------------------------------------------------------- /src/BatchGuy.App/Properties/DataSources/BatchGuy.App.Shared.Models.CountryCodeItem.datasource: -------------------------------------------------------------------------------- 1 |  2 | 8 | 9 | BatchGuy.App.Shared.Models.CountryCodeItem, BatchGuy.App, Version=6.1.0.0, Culture=neutral, PublicKeyToken=null 10 | -------------------------------------------------------------------------------- /src/BatchGuy.App/Properties/DataSources/BatchGuy.App.Shared.Models.DropDownListItem.datasource: -------------------------------------------------------------------------------- 1 |  2 | 8 | 9 | BatchGuy.App.Shared.Models.DropDownListItem, BatchGuy.App, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null 10 | -------------------------------------------------------------------------------- /src/BatchGuy.App/Properties/DataSources/BatchGuy.App.Shared.Models.Setting.datasource: -------------------------------------------------------------------------------- 1 |  2 | 8 | 9 | BatchGuy.App.Shared.Models.Setting, BatchGuy.App, Version=4.3.0.0, Culture=neutral, PublicKeyToken=null 10 | -------------------------------------------------------------------------------- /src/BatchGuy.App/Properties/DataSources/BatchGuy.App.X264.Models.X264File.datasource: -------------------------------------------------------------------------------- 1 |  2 | 8 | 9 | BatchGuy.App.X264.Models.X264File, BatchGuy.App, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null 10 | -------------------------------------------------------------------------------- /src/BatchGuy.App/Properties/DataSources/BatchGuy.App.X264Log.Models.X264LogFile.datasource: -------------------------------------------------------------------------------- 1 |  2 | 8 | 9 | BatchGuy.App.X264Log.Models.X264LogFile, BatchGuy.App, Version=1.4.0.0, Culture=neutral, PublicKeyToken=null 10 | -------------------------------------------------------------------------------- /src/BatchGuy.App/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace BatchGuy.App.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.3.0.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 | 20 | public static Settings Default { 21 | get { 22 | return defaultInstance; 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/BatchGuy.App/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /src/BatchGuy.App/Settings/Interface/IApplicationSettingsService.cs: -------------------------------------------------------------------------------- 1 | using BatchGuy.App.Shared.Models; 2 | 3 | namespace BatchGuy.App.Settings.Interface 4 | { 5 | public interface IApplicationSettingsService 6 | { 7 | ErrorCollection Errors { get; } 8 | 9 | void Save(ApplicationSettings applicationSettings); 10 | 11 | ApplicationSettings GetApplicationSettings(); 12 | 13 | Setting GetSettingByName(string settingName); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/BatchGuy.App/Settings/Interface/IBluRayTitleInfoDefaultSettingsService.cs: -------------------------------------------------------------------------------- 1 | namespace BatchGuy.App.Settings.Interface 2 | { 3 | public interface IBluRayTitleInfoDefaultSettingsService 4 | { 5 | void SetSubtitleDefaultSettings(); 6 | void SetAudioDefaultSettings(); 7 | void SetChaptersDefaultSettings(); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/BatchGuy.App/Settings/Interface/IMKVMergeDefaultSettingsService.cs: -------------------------------------------------------------------------------- 1 | namespace BatchGuy.App.Settings.Interface 2 | { 3 | public interface IMKVMergeDefaultSettingsService 4 | { 5 | void SetSubtitleDefaultSettings(); 6 | void SetAudioDefaultSettings(); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/BatchGuy.App/Settings/Models/ApplicationSettings.cs: -------------------------------------------------------------------------------- 1 | using BatchGuy.App.Enums; 2 | using BatchGuy.App.Settings.Models; 3 | using System; 4 | using System.Collections.Generic; 5 | 6 | namespace BatchGuy.App.Shared.Models 7 | { 8 | [Serializable] 9 | public class ApplicationSettings 10 | { 11 | public string ApplicationDirectory { get; set; } 12 | public List Settings { get; set; } 13 | 14 | public string SettingsFile { get { return string.Format("{0}\\config.batchGuySettings", this.ApplicationDirectory); } } 15 | 16 | public BluRayTitleInfoDefaultSettings BluRayTitleInfoDefaultSettings { get; set; } 17 | 18 | public EAC3ToDefaultSettings EAC3ToDefaultSettings { get; set; } 19 | 20 | public SubtitlesMKVMergeDefaultSettings SubtitlesMKVMergeDefaultSettings { get; set; } 21 | 22 | public bool SubtitleLanguageAlwaysSelectedEnabled { get; set; } 23 | 24 | public bool AudioLanguageAlwaysSelectedEnabled { get; set; } 25 | 26 | public AudioMKVMergeDefaultSettings AudioMKVMergeDefaultSettings { get; set; } 27 | 28 | public EnumEAC3ToNamingConventionType EnumEAC3ToNamingConventionType { get; set; } 29 | 30 | public bool CheckForNewBatchGuyVersions { get; set; } 31 | 32 | public ApplicationSettings() 33 | { 34 | Settings = new List(); 35 | EnumEAC3ToNamingConventionType = EnumEAC3ToNamingConventionType.RemuxNamingConventionTemplate1; 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/BatchGuy.App/Settings/Models/AudioMKVMergeDefaultSettings.cs: -------------------------------------------------------------------------------- 1 | using BatchGuy.App.MKVMerge.Models; 2 | 3 | namespace BatchGuy.App.Settings.Models 4 | { 5 | public class AudioMKVMergeDefaultSettings 6 | { 7 | public MKVMergeItem DefaultMKVMergeItem { get; set; } 8 | 9 | public string AudioTypeFilterCriteria { get; set; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/BatchGuy.App/Settings/Models/BatchGuyLatestVersionInfo.cs: -------------------------------------------------------------------------------- 1 | namespace BatchGuy.App.Settings.Models 2 | { 3 | public class BatchGuyLatestVersionInfo 4 | { 5 | public string TagName { get; set; } 6 | public bool IsNewVersion { get; set; } 7 | public string LatestGithubUrl { get; set; } 8 | public string Name { get; set; } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/BatchGuy.App/Settings/Models/BluRayTitleInfoDefaultSettings.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace BatchGuy.App.Settings.Models 5 | { 6 | [Serializable] 7 | public class BluRayTitleInfoDefaultSettings 8 | { 9 | public BluRayTitleInfoDefaultSettings() 10 | { 11 | this.Audio = new List(); 12 | } 13 | public bool Enabled { get; set; } 14 | 15 | public bool SelectChapters { get; set; } 16 | 17 | public bool SelectAllSubtitles { get; set; } 18 | 19 | public List Audio { get; set; } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/BatchGuy.App/Settings/Models/BluRayTitleInfoDefaultSettingsAudio.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using BatchGuy.App.Enums; 3 | 4 | namespace BatchGuy.App.Settings.Models 5 | { 6 | [Serializable] 7 | public class BluRayTitleInfoDefaultSettingsAudio 8 | { 9 | public EnumAudioType Type { get; set; } 10 | 11 | public string Name { get; set; } 12 | 13 | public string Arguments { get; set; } 14 | 15 | public string DefaultType { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/BatchGuy.App/Settings/Models/EAC3ToDefaultSettings.cs: -------------------------------------------------------------------------------- 1 | namespace BatchGuy.App.Settings.Models 2 | { 3 | public class EAC3ToDefaultSettings 4 | { 5 | public bool ShowProgressNumbers { get; set; } 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/BatchGuy.App/Settings/Models/Setting.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace BatchGuy.App.Shared.Models 4 | { 5 | [Serializable] 6 | public class Setting 7 | { 8 | public string Name { get; set; } 9 | public string Value { get; set; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/BatchGuy.App/Settings/Models/SubtitlesMKVMergeDefaultSettings.cs: -------------------------------------------------------------------------------- 1 | using BatchGuy.App.MKVMerge.Models; 2 | 3 | namespace BatchGuy.App.Settings.Models 4 | { 5 | public class SubtitlesMKVMergeDefaultSettings 6 | { 7 | public MKVMergeItem DefaultMKVMergeItem { get; set; } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/BatchGuy.App/Settings/Services/ApplicationSettingsService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | using BatchGuy.App.Shared.Interface; 4 | using BatchGuy.App.Shared.Models; 5 | using System.IO; 6 | using log4net; 7 | using BatchGuy.App.Settings.Interface; 8 | using System.Reflection; 9 | using BatchGuy.App.Shared.Interfaces; 10 | 11 | namespace BatchGuy.App.Settings.Services 12 | { 13 | public class ApplicationSettingsService : IApplicationSettingsService 14 | { 15 | private ErrorCollection _errors; 16 | private IJsonSerializationService _jsonSerializationService; 17 | private ApplicationSettings _applicationSettings; 18 | private string _applicationDirectory; 19 | private IAudioService _audioService; 20 | 21 | 22 | public ErrorCollection Errors 23 | { 24 | get { return _errors; } 25 | } 26 | 27 | public static readonly ILog _log = LogManager.GetLogger(typeof(ApplicationSettingsService)); 28 | 29 | public ApplicationSettingsService(IJsonSerializationService jsonSerializationService, IAudioService audioService) 30 | { 31 | _errors = new ErrorCollection(); 32 | _jsonSerializationService = jsonSerializationService; 33 | _audioService = audioService; 34 | Uri uri = new Uri(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().CodeBase)); 35 | _applicationDirectory = uri.LocalPath; 36 | _applicationSettings = new ApplicationSettings() { ApplicationDirectory = _applicationDirectory }; 37 | 38 | if (File.Exists(_applicationSettings.SettingsFile)) 39 | { 40 | this.LoadSettingsFromConfigFile(); 41 | } 42 | 43 | new SettingsDefaultSeedDataService(_applicationSettings, _audioService).Create(); 44 | } 45 | 46 | public ApplicationSettings GetApplicationSettings() 47 | { 48 | return _applicationSettings; 49 | } 50 | 51 | public void Save(ApplicationSettings applicationSettings) 52 | { 53 | try 54 | { 55 | _errors.Clear(); 56 | _jsonSerializationService.WriteToJsonFile(applicationSettings.SettingsFile, applicationSettings, false); 57 | _applicationSettings = applicationSettings; 58 | } 59 | catch (Exception ex) 60 | { 61 | _log.ErrorFormat(Program.GetLogErrorFormat(), ex.Message, ex.StackTrace, MethodBase.GetCurrentMethod().Name); 62 | _errors.Add(new Error() {Description = "There was a problem saving the Application Settings File"}); 63 | } 64 | } 65 | 66 | private void LoadSettingsFromConfigFile() 67 | { 68 | try 69 | { 70 | _errors.Clear(); 71 | _applicationSettings = _jsonSerializationService.ReadFromJsonFile(_applicationSettings.SettingsFile); 72 | } 73 | catch (Exception ex) 74 | { 75 | _log.ErrorFormat(Program.GetLogErrorFormat(), ex.Message, ex.StackTrace, MethodBase.GetCurrentMethod().Name); 76 | _errors.Add(new Error() { Description = "There was a problem loading the Application Settings File" }); 77 | } 78 | } 79 | 80 | public Setting GetSettingByName(string settingName) 81 | { 82 | return _applicationSettings.Settings.SingleOrDefault(s => s.Name == settingName); 83 | } 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /src/BatchGuy.App/Settings/Services/BluRayTitleInfoDefaultSettingsService.cs: -------------------------------------------------------------------------------- 1 | using BatchGuy.App.Enums; 2 | using BatchGuy.App.Parser.Models; 3 | using BatchGuy.App.Settings.Interface; 4 | using BatchGuy.App.Shared.Interfaces; 5 | using BatchGuy.App.Shared.Models; 6 | using System.Linq; 7 | 8 | namespace BatchGuy.App.Settings.Services 9 | { 10 | public class BluRayTitleInfoDefaultSettingsService : IBluRayTitleInfoDefaultSettingsService 11 | { 12 | private ApplicationSettings _applicationSettings; 13 | private BluRaySummaryInfo _bluRaySummaryInfo; 14 | private IAudioService _audioService; 15 | 16 | public BluRayTitleInfoDefaultSettingsService(ApplicationSettings applicationSettings, BluRaySummaryInfo bluRaySummaryInfo, IAudioService audioService) 17 | { 18 | _applicationSettings = applicationSettings; 19 | _bluRaySummaryInfo = bluRaySummaryInfo; 20 | _audioService = audioService; 21 | } 22 | public void SetAudioDefaultSettings() 23 | { 24 | if (_bluRaySummaryInfo.BluRayTitleInfo.AudioList != null) 25 | { 26 | foreach (BluRayTitleAudio audio in _bluRaySummaryInfo.BluRayTitleInfo.AudioList) 27 | { 28 | var defaultSetting = _applicationSettings.BluRayTitleInfoDefaultSettings.Audio.First(a => a.Type == audio.AudioType); 29 | audio.Arguments = defaultSetting.Arguments; 30 | audio.AudioType = _audioService.GetAudioTypeByName(defaultSetting.DefaultType); 31 | } 32 | 33 | if (_applicationSettings.AudioLanguageAlwaysSelectedEnabled) 34 | { 35 | foreach (BluRayTitleAudio audio in _bluRaySummaryInfo.BluRayTitleInfo.AudioList.Where(a => a.Text.ToLower().Contains(_applicationSettings.AudioMKVMergeDefaultSettings.DefaultMKVMergeItem.Language.Language.ToLower()))) 36 | { 37 | if (_applicationSettings.AudioMKVMergeDefaultSettings.AudioTypeFilterCriteria == "Any Type") 38 | { 39 | audio.IsSelected = true; 40 | } 41 | else if (_applicationSettings.AudioMKVMergeDefaultSettings.AudioTypeFilterCriteria == "Lossless") 42 | { 43 | if (audio.IsLossless) 44 | { 45 | audio.IsSelected = true; 46 | } 47 | } 48 | else 49 | { 50 | EnumAudioType audioTypeFilter = _audioService.GetAudioTypeByName(_applicationSettings.AudioMKVMergeDefaultSettings.AudioTypeFilterCriteria); 51 | if (audioTypeFilter == audio.OriginalAudioType) 52 | { 53 | audio.IsSelected = true; 54 | } 55 | } 56 | } 57 | } 58 | } 59 | } 60 | 61 | public void SetChaptersDefaultSettings() 62 | { 63 | if (_bluRaySummaryInfo.BluRayTitleInfo.Chapter != null) 64 | { 65 | _bluRaySummaryInfo.BluRayTitleInfo.Chapter.IsSelected = _applicationSettings.BluRayTitleInfoDefaultSettings.SelectChapters; 66 | } 67 | } 68 | 69 | public void SetSubtitleDefaultSettings() 70 | { 71 | if (_bluRaySummaryInfo.BluRayTitleInfo.Subtitles != null) 72 | { 73 | _bluRaySummaryInfo.BluRayTitleInfo.Subtitles.ForEach(s => s.IsSelected = _applicationSettings.BluRayTitleInfoDefaultSettings.SelectAllSubtitles); 74 | 75 | if (_applicationSettings.SubtitleLanguageAlwaysSelectedEnabled) 76 | { 77 | foreach (BluRayTitleSubtitle subtitle in _bluRaySummaryInfo.BluRayTitleInfo.Subtitles.Where(a => a.Text.ToLower().Contains(_applicationSettings.SubtitlesMKVMergeDefaultSettings.DefaultMKVMergeItem.Language.Language.ToLower()))) 78 | { 79 | subtitle.IsSelected = true; 80 | } 81 | } 82 | } 83 | } 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /src/BatchGuy.App/Shared/Events/DialogInitialDirectoryChangedEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace BatchGuy.App.Shared.Events 4 | { 5 | public class DialogInitialDirectoryChangedEventArgs : EventArgs 6 | { 7 | public string FeatureName { get; set; } 8 | public string DirectoryPath { get; set; } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/BatchGuy.App/Shared/Interfaces/IAudioService.cs: -------------------------------------------------------------------------------- 1 | using BatchGuy.App.Enums; 2 | using System.Collections.Generic; 3 | 4 | namespace BatchGuy.App.Shared.Interfaces 5 | { 6 | public interface IAudioService 7 | { 8 | string GetAudioTypeName(EnumAudioType audioType); 9 | 10 | EnumAudioType GetAudioTypeByName(string name); 11 | 12 | string GetAudioExtension(EnumAudioType audioType); 13 | 14 | List GetBluRayAudioTypes(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/BatchGuy.App/Shared/Interfaces/IBatchGuyNotificationService.cs: -------------------------------------------------------------------------------- 1 | using BatchGuy.App.Settings.Models; 2 | using System.Threading.Tasks; 3 | 4 | namespace BatchGuy.App.Shared.Interfaces 5 | { 6 | internal interface IBatchGuyNotificationService 7 | { 8 | Task GetLatestVersionInfo(); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/BatchGuy.App/Shared/Interfaces/IBindingListSortService.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | 3 | namespace BatchGuy.App.Shared.Interfaces 4 | { 5 | public interface IBindingListSortService 6 | { 7 | BindingList Sort(); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/BatchGuy.App/Shared/Interfaces/ICountryCodeService.cs: -------------------------------------------------------------------------------- 1 | using BatchGuy.App.Shared.Models; 2 | using System.Collections.Generic; 3 | 4 | namespace BatchGuy.App.Shared.Interfaces 5 | { 6 | public interface ICountryCodeService 7 | { 8 | List GetCountryCodes(); 9 | CountryCodeItem GetCountryCodeByISOLongCode(string isoLongCode); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/BatchGuy.App/Shared/Interfaces/IDisplayErrorMessageService.cs: -------------------------------------------------------------------------------- 1 | using BatchGuy.App.Shared.Models; 2 | 3 | namespace BatchGuy.App.Shared.Interfaces 4 | { 5 | public interface IDisplayErrorMessageService 6 | { 7 | void LogAndDisplayError(ErrorMessage message); 8 | void DisplayError(ErrorMessage message); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/BatchGuy.App/Shared/Interfaces/IEAC3ToCommonRulesValidatorService.cs: -------------------------------------------------------------------------------- 1 | using BatchGuy.App.Shared.Models; 2 | 3 | namespace BatchGuy.App.Shared.Interfaces 4 | { 5 | public interface IEAC3ToCommonRulesValidatorService 6 | { 7 | ErrorCollection Errors { get; } 8 | bool IsAtLeastOneDiscSelected(); 9 | bool IsAtLeastOneSummarySelected(); 10 | bool WhenSummarySelectedAtLeastOneStreamSelected(); 11 | bool IsAllBluRayPathsValid(); 12 | bool IsAllEpisodeNumbersSet(); 13 | bool AllMoviesHaveNames(); 14 | bool IsAllMovieNameYearCombinationUnique(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/BatchGuy.App/Shared/Interfaces/IJsonSerializationService.cs: -------------------------------------------------------------------------------- 1 | namespace BatchGuy.App.Shared.Interface 2 | { 3 | public interface IJsonSerializationService 4 | { 5 | void WriteToJsonFile(string filePath, T objectToWrite, bool append = false); 6 | T ReadFromJsonFile(string filePath); 7 | 8 | T ReadFromJsonString(string json); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/BatchGuy.App/Shared/Interfaces/ILoggingService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace BatchGuy.App.Shared.Interfaces 4 | { 5 | public interface ILoggingService 6 | { 7 | void LogErrorFormat(Exception exception, string methodName); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/BatchGuy.App/Shared/Interfaces/ISortService.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace BatchGuy.App.Shared.Interfaces 4 | { 5 | public interface ISortService 6 | { 7 | List Sort(); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/BatchGuy.App/Shared/Models/CountryCodeItem.cs: -------------------------------------------------------------------------------- 1 | namespace BatchGuy.App.Shared.Models 2 | { 3 | public class CountryCodeItem 4 | { 5 | public string Name { get; set; } 6 | public string Value { get; set; } 7 | public string CountryCode { get; set; } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/BatchGuy.App/Shared/Models/DropDownListItem.cs: -------------------------------------------------------------------------------- 1 | namespace BatchGuy.App.Shared.Models 2 | { 3 | public class DropDownListItem 4 | { 5 | public string DisplayMember { get; set; } 6 | public string ValueMember { get; set; } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/BatchGuy.App/Shared/Models/Error.cs: -------------------------------------------------------------------------------- 1 | namespace BatchGuy.App.Shared.Models 2 | { 3 | public class Error 4 | { 5 | public int Id { get; set; } 6 | public string Description { get; set; } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/BatchGuy.App/Shared/Models/ErrorCollection.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | 5 | namespace BatchGuy.App.Shared.Models 6 | { 7 | public class ErrorCollection : List 8 | { 9 | public string GetErrorMessage() 10 | { 11 | if (this != null && this.Count() > 0) 12 | return string.Format("{0} Errors found: {1}", this.Count() ,string.Join(Environment.NewLine,this.Select(e => e.Description))); 13 | else 14 | return string.Empty; 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/BatchGuy.App/Shared/Models/ErrorMessage.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace BatchGuy.App.Shared.Models 4 | { 5 | public class ErrorMessage 6 | { 7 | public string DisplayMessage { get; set; } 8 | public string DisplayTitle { get; set; } 9 | public Exception Exception { get; set; } 10 | public string MethodNameWhereExceptionOccurred { get; set; } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/BatchGuy.App/Shared/Models/ISOCountryCode.cs: -------------------------------------------------------------------------------- 1 | namespace BatchGuy.App.Shared.Models 2 | { 3 | public class ISOCountryCode 4 | { 5 | public string name { get; set; } 6 | public string alpha3 { get; set; } 7 | public string countrycode { get; set; } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/BatchGuy.App/Shared/Models/ISOCountryCodeCollection.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace BatchGuy.App.Shared.Models 4 | { 5 | public class ISOCountryCodeCollection : List 6 | { 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/BatchGuy.App/Shared/Models/MovieYearItem.cs: -------------------------------------------------------------------------------- 1 | namespace BatchGuy.App.Shared.Models 2 | { 3 | public class MovieYearItem 4 | { 5 | public string Name { get; set; } 6 | public string Year { get; set; } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/BatchGuy.App/Shared/Models/SortConfiguration.cs: -------------------------------------------------------------------------------- 1 | using BatchGuy.App.Enums; 2 | using System.Collections.Generic; 3 | 4 | namespace BatchGuy.App.Shared.Models 5 | { 6 | public class SortConfiguration 7 | { 8 | private List _columnOverrides; 9 | public SortConfiguration(List columnOverrides) 10 | { 11 | _columnOverrides = columnOverrides; 12 | } 13 | public string SortByColumnName { get; set; } 14 | public EnumSortDirection SortDirection { get; set; } 15 | public string LastSortByColumnName { get; set; } 16 | public List ColumnOverrides 17 | { 18 | get 19 | { 20 | return _columnOverrides; 21 | } 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/BatchGuy.App/Shared/Models/SortConfigurationColumnOverride.cs: -------------------------------------------------------------------------------- 1 | namespace BatchGuy.App.Shared.Models 2 | { 3 | public class SortConfigurationColumnOverride 4 | { 5 | public string SortByColumnName { get; set; } 6 | public string OverrideColumnName { get; set; } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/BatchGuy.App/Shared/Models/Warning.cs: -------------------------------------------------------------------------------- 1 | namespace BatchGuy.App.Shared.Models 2 | { 3 | public class Warning 4 | { 5 | public int Id { get; set; } 6 | public string Description { get; set; } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/BatchGuy.App/Shared/Models/WarningCollection.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | 5 | namespace BatchGuy.App.Shared.Models 6 | { 7 | public class WarningCollection : List 8 | { 9 | public string GetWarningMessage() 10 | { 11 | if (this != null && this.Count() > 0) 12 | return string.Format("{0} Warnings found:{1}{2}", this.Count(),Environment.NewLine ,string.Join(Environment.NewLine,this.Select(e => e.Description))); 13 | else 14 | return string.Empty; 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/BatchGuy.App/Shared/Services/BatchGuyNotificationService.cs: -------------------------------------------------------------------------------- 1 | using BatchGuy.App.Settings.Models; 2 | using BatchGuy.App.Shared.Interfaces; 3 | using Newtonsoft.Json.Linq; 4 | using System; 5 | using System.Net.Http; 6 | using System.Net.Http.Headers; 7 | using System.Reflection; 8 | using System.Threading.Tasks; 9 | 10 | namespace BatchGuy.App.Shared.Services 11 | { 12 | internal class BatchGuyNotificationService : IBatchGuyNotificationService 13 | { 14 | private string _currentTagName = string.Empty; 15 | private ILoggingService _loggingService; 16 | 17 | public BatchGuyNotificationService(string currentTagName, ILoggingService loggingService) 18 | { 19 | _currentTagName = currentTagName; 20 | _loggingService = loggingService; 21 | } 22 | public async Task GetLatestVersionInfo() 23 | { 24 | var task = await this.ContactGithubLatestReleaseApi(); 25 | 26 | 27 | return task; 28 | } 29 | 30 | private async Task ContactGithubLatestReleaseApi() 31 | { 32 | BatchGuyLatestVersionInfo batchGuyLatestVersionSettings = null; 33 | string latestTag = string.Empty; 34 | 35 | try 36 | { 37 | using (HttpClient client = new HttpClient()) 38 | { 39 | client.DefaultRequestHeaders.Clear(); 40 | client.DefaultRequestHeaders.Add("User-Agent", "BatchGuy"); 41 | client.DefaultRequestHeaders.Accept.Clear(); 42 | client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); 43 | HttpResponseMessage response = await client.GetAsync("https://api.github.com/repos/yaboy58/batchguy/releases/latest"); 44 | if (response.IsSuccessStatusCode) 45 | { 46 | var json = await response.Content.ReadAsStringAsync(); 47 | JObject token = JObject.Parse(json); 48 | var tagName = token.SelectToken("tag_name"); 49 | var htmlUrl = token.SelectToken("html_url"); 50 | var name = token.SelectToken("name"); 51 | 52 | batchGuyLatestVersionSettings = new BatchGuyLatestVersionInfo() 53 | { 54 | LatestGithubUrl = htmlUrl == null ? string.Empty : htmlUrl.ToString(), 55 | TagName = tagName == null ? string.Empty : tagName.ToString(), 56 | Name = name == null ? string.Empty : name.ToString() 57 | }; 58 | 59 | if (tagName != null && string.IsNullOrEmpty(tagName.ToString()) == false) 60 | { 61 | if (tagName.ToString() != _currentTagName) 62 | batchGuyLatestVersionSettings.IsNewVersion = true; 63 | else 64 | batchGuyLatestVersionSettings.IsNewVersion = false; 65 | } 66 | else 67 | batchGuyLatestVersionSettings.IsNewVersion = false; 68 | } 69 | } 70 | } 71 | catch (Exception ex) 72 | { 73 | _loggingService.LogErrorFormat(ex, MethodBase.GetCurrentMethod().Name); 74 | } 75 | return batchGuyLatestVersionSettings; 76 | } 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /src/BatchGuy.App/Shared/Services/BindingListSortService.cs: -------------------------------------------------------------------------------- 1 | using BatchGuy.App.Shared.Interfaces; 2 | using BatchGuy.App.Shared.Models; 3 | using System.Collections.Generic; 4 | using System.ComponentModel; 5 | using System.Windows.Forms; 6 | 7 | namespace BatchGuy.App.Shared.Services 8 | { 9 | public class BindingListSortService : IBindingListSortService 10 | { 11 | private List _unsortedList; 12 | private DataGridView _grid; 13 | private SortConfiguration _sortConfiguration; 14 | private ISortService _sortService; 15 | 16 | public BindingListSortService(List unsortedList, DataGridView grid, SortConfiguration sortConfiguration, ISortService sortService) 17 | { 18 | _unsortedList = unsortedList; 19 | _grid = grid; 20 | _sortConfiguration = sortConfiguration; 21 | _sortService = sortService; 22 | } 23 | 24 | public BindingList Sort() 25 | { 26 | _grid.CommitEdit(DataGridViewDataErrorContexts.CurrentCellChange); 27 | 28 | ISortService sortService = new SortService(_sortConfiguration, _unsortedList); 29 | List sortedList = sortService.Sort(); 30 | 31 | _unsortedList.Clear(); 32 | 33 | BindingList sortedBindingList = new BindingList(); 34 | foreach (T item in sortedList) 35 | { 36 | _unsortedList.Add(item); 37 | sortedBindingList.Add(item); 38 | } 39 | return sortedBindingList; 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/BatchGuy.App/Shared/Services/DisplayErrorMessageService.cs: -------------------------------------------------------------------------------- 1 | using BatchGuy.App.Shared.Interfaces; 2 | using BatchGuy.App.Shared.Models; 3 | using System.Windows.Forms; 4 | 5 | namespace BatchGuy.App.Shared.Services 6 | { 7 | public class DisplayErrorMessageService : IDisplayErrorMessageService 8 | { 9 | private ILoggingService _loggingService = new LoggingService(Program.GetLogErrorFormat()); 10 | 11 | public void DisplayError(ErrorMessage message) 12 | { 13 | MessageBox.Show(string.Format("{0}. Please view the error log for more details.", message.DisplayMessage), message.DisplayTitle, MessageBoxButtons.OK, MessageBoxIcon.Error); 14 | } 15 | 16 | public void LogAndDisplayError(ErrorMessage message) 17 | { 18 | _loggingService.LogErrorFormat(message.Exception, message.MethodNameWhereExceptionOccurred); 19 | MessageBox.Show(string.Format("{0}. Please view the error log for more details.",message.DisplayMessage), message.DisplayTitle, MessageBoxButtons.OK, MessageBoxIcon.Error); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/BatchGuy.App/Shared/Services/JsonSerializationService.cs: -------------------------------------------------------------------------------- 1 | using BatchGuy.App.Shared.Interface; 2 | using System.IO; 3 | 4 | namespace BatchGuy.App.Shared.Services 5 | { 6 | /// 7 | /// Functions for performing common Json Serialization operations. 8 | /// Requires the Newtonsoft.Json assembly (Json.Net package in NuGet Gallery) to be referenced in your project. 9 | /// Only public properties and variables will be serialized. 10 | /// Use the [JsonIgnore] attribute to ignore specific public properties or variables. 11 | /// Object to be serialized must have a parameterless constructor. 12 | /// 13 | public class JsonSerializationService : IJsonSerializationService 14 | { 15 | /// 16 | /// Writes the given object instance to a Json file. 17 | /// Object type must have a parameterless constructor. 18 | /// Only Public properties and variables will be written to the file. These can be any type though, even other classes. 19 | /// If there are public properties/variables that you do not want written to the file, decorate them with the [JsonIgnore] attribute. 20 | /// 21 | /// The type of object being written to the file. 22 | /// The file path to write the object instance to. 23 | /// The object instance to write to the file. 24 | /// If false the file will be overwritten if it already exists. If true the contents will be appended to the file. 25 | public void WriteToJsonFile(string filePath, T objectToWrite, bool append = false) 26 | { 27 | TextWriter writer = null; 28 | try 29 | { 30 | var contentsToWriteToFile = Newtonsoft.Json.JsonConvert.SerializeObject(objectToWrite); 31 | writer = new StreamWriter(filePath, append); 32 | writer.Write(contentsToWriteToFile); 33 | } 34 | finally 35 | { 36 | if (writer != null) 37 | writer.Close(); 38 | } 39 | } 40 | 41 | /// 42 | /// Reads an object instance from an Json file. 43 | /// Object type must have a parameterless constructor. 44 | /// 45 | /// The type of object to read from the file. 46 | /// The file path to read the object instance from. 47 | /// Returns a new instance of the object read from the Json file. 48 | public T ReadFromJsonFile(string filePath) 49 | { 50 | TextReader reader = null; 51 | try 52 | { 53 | reader = new StreamReader(filePath); 54 | var fileContents = reader.ReadToEnd(); 55 | return Newtonsoft.Json.JsonConvert.DeserializeObject(fileContents); 56 | } 57 | finally 58 | { 59 | if (reader != null) 60 | reader.Close(); 61 | } 62 | } 63 | 64 | public T ReadFromJsonString(string json) 65 | { 66 | var collection = Newtonsoft.Json.JsonConvert.DeserializeObject(json); 67 | return collection; 68 | } 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /src/BatchGuy.App/Shared/Services/LoggingService.cs: -------------------------------------------------------------------------------- 1 | using BatchGuy.App.Shared.Interfaces; 2 | using log4net; 3 | using System; 4 | 5 | namespace BatchGuy.App.Shared.Services 6 | { 7 | public class LoggingService : ILoggingService 8 | { 9 | private static readonly ILog _log = LogManager.GetLogger(typeof(LoggingService)); 10 | private string _logErrorFormat = string.Empty; 11 | 12 | public LoggingService(string logErrorFormat) 13 | { 14 | _logErrorFormat = logErrorFormat; 15 | } 16 | 17 | public void LogErrorFormat(Exception exception, string methodName) 18 | { 19 | _log.ErrorFormat(_logErrorFormat, exception.Message, exception.StackTrace, methodName); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/BatchGuy.App/Shared/Services/SortService.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | using BatchGuy.App.Shared.Interfaces; 4 | using BatchGuy.App.Shared.Models; 5 | using System.Linq.Dynamic; 6 | using BatchGuy.App.Enums; 7 | 8 | namespace BatchGuy.App.Shared.Services 9 | { 10 | public class SortService : ISortService 11 | { 12 | private List _unSortedList; 13 | private SortConfiguration _sortConfiguration; 14 | 15 | public SortService(SortConfiguration sortConfiguration, List unSortedList) 16 | { 17 | _sortConfiguration = sortConfiguration; 18 | _unSortedList = unSortedList; 19 | } 20 | 21 | public List Sort() 22 | { 23 | List sortedList = new List(); 24 | 25 | if (_sortConfiguration.LastSortByColumnName == _sortConfiguration.SortByColumnName) 26 | _sortConfiguration.SortDirection = _sortConfiguration.SortDirection == EnumSortDirection.Asc ? EnumSortDirection.Desc : EnumSortDirection.Asc; 27 | else 28 | _sortConfiguration.SortDirection = EnumSortDirection.Asc; 29 | 30 | 31 | string orderBy = this.GetOrderBy(); 32 | _sortConfiguration.LastSortByColumnName = _sortConfiguration.SortByColumnName; 33 | 34 | foreach (T item in _unSortedList.OrderBy(orderBy)) 35 | { 36 | sortedList.Add(item); 37 | } 38 | 39 | return sortedList; 40 | } 41 | 42 | private string GetOrderBy() 43 | { 44 | string orderby = string.Empty; 45 | 46 | if (_sortConfiguration.ColumnOverrides != null && _sortConfiguration.ColumnOverrides.Count() > 0 && 47 | _sortConfiguration.ColumnOverrides.Where(c => c.SortByColumnName == _sortConfiguration.SortByColumnName).Count() > 0) 48 | { 49 | SortConfigurationColumnOverride columnOverride = _sortConfiguration.ColumnOverrides.Where(c => c.SortByColumnName == _sortConfiguration.SortByColumnName).Single(); 50 | orderby = string.Format("{0} {1}", columnOverride.OverrideColumnName, this.GetSortDirectionString()); 51 | } 52 | else 53 | { 54 | orderby = string.Format("{0} {1}", _sortConfiguration.SortByColumnName, this.GetSortDirectionString()); 55 | } 56 | return orderby; 57 | } 58 | 59 | private string GetSortDirectionString() 60 | { 61 | string sortDirection; 62 | switch (_sortConfiguration.SortDirection) 63 | { 64 | case BatchGuy.App.Enums.EnumSortDirection.Asc: 65 | sortDirection = "asc"; 66 | break; 67 | case BatchGuy.App.Enums.EnumSortDirection.Desc: 68 | sortDirection = "desc"; 69 | break; 70 | default: 71 | sortDirection = "asc"; 72 | break; 73 | } 74 | return sortDirection; 75 | } 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /src/BatchGuy.App/ThirdParty/DataGridViewCheckBoxHeader/DatagridViewCheckBoxHeaderCell.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Drawing; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using System.Windows.Forms; 8 | 9 | namespace BatchGuy.App.ThirdParty.DataGridViewCheckBoxHeader 10 | { 11 | public delegate void CheckBoxClickedHandler(bool state); 12 | public class DataGridViewCheckBoxHeaderCellEventArgs : EventArgs 13 | { 14 | bool _bChecked; 15 | public DataGridViewCheckBoxHeaderCellEventArgs(bool bChecked) 16 | { 17 | _bChecked = bChecked; 18 | } 19 | public bool Checked 20 | { 21 | get { return _bChecked; } 22 | } 23 | } 24 | class DataGridViewCheckBoxHeaderCell : DataGridViewColumnHeaderCell 25 | { 26 | Point checkBoxLocation; 27 | Size checkBoxSize; 28 | bool _checked = false; 29 | Point _cellLocation = new Point(); 30 | System.Windows.Forms.VisualStyles.CheckBoxState _cbState = 31 | System.Windows.Forms.VisualStyles.CheckBoxState.UncheckedNormal; 32 | public event CheckBoxClickedHandler OnCheckBoxClicked; 33 | 34 | public DataGridViewCheckBoxHeaderCell() 35 | { 36 | } 37 | 38 | protected override void Paint(System.Drawing.Graphics graphics, 39 | System.Drawing.Rectangle clipBounds, 40 | System.Drawing.Rectangle cellBounds, 41 | int rowIndex, 42 | DataGridViewElementStates dataGridViewElementState, 43 | object value, 44 | object formattedValue, 45 | string errorText, 46 | DataGridViewCellStyle cellStyle, 47 | DataGridViewAdvancedBorderStyle advancedBorderStyle, 48 | DataGridViewPaintParts paintParts) 49 | { 50 | base.Paint(graphics, clipBounds, cellBounds, rowIndex, 51 | dataGridViewElementState, value, 52 | formattedValue, errorText, cellStyle, 53 | advancedBorderStyle, paintParts); 54 | Point p = new Point(); 55 | Size s = CheckBoxRenderer.GetGlyphSize(graphics, 56 | System.Windows.Forms.VisualStyles.CheckBoxState.UncheckedNormal); 57 | p.X = cellBounds.Location.X + 58 | (cellBounds.Width / 2) - (s.Width / 2); 59 | p.Y = cellBounds.Location.Y + 60 | (cellBounds.Height / 2) - (s.Height / 2); 61 | _cellLocation = cellBounds.Location; 62 | checkBoxLocation = p; 63 | checkBoxSize = s; 64 | if (_checked) 65 | _cbState = System.Windows.Forms.VisualStyles. 66 | CheckBoxState.CheckedNormal; 67 | else 68 | _cbState = System.Windows.Forms.VisualStyles. 69 | CheckBoxState.UncheckedNormal; 70 | CheckBoxRenderer.DrawCheckBox 71 | (graphics, checkBoxLocation, _cbState); 72 | } 73 | 74 | protected override void OnMouseClick(DataGridViewCellMouseEventArgs e) 75 | { 76 | Point p = new Point(e.X + _cellLocation.X, e.Y + _cellLocation.Y); 77 | if (p.X >= checkBoxLocation.X && p.X <= 78 | checkBoxLocation.X + checkBoxSize.Width 79 | && p.Y >= checkBoxLocation.Y && p.Y <= 80 | checkBoxLocation.Y + checkBoxSize.Height) 81 | { 82 | _checked = !_checked; 83 | if (OnCheckBoxClicked != null) 84 | { 85 | OnCheckBoxClicked(_checked); 86 | this.DataGridView.InvalidateCell(this); 87 | } 88 | 89 | } 90 | base.OnMouseClick(e); 91 | } 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /src/BatchGuy.App/X264/Interfaces/IX264EncodeService.cs: -------------------------------------------------------------------------------- 1 | using BatchGuy.App.Shared.Models; 2 | 3 | namespace BatchGuy.App.X264.Interfaces 4 | { 5 | public interface IX264EncodeService 6 | { 7 | ErrorCollection CreateX264File(); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/BatchGuy.App/X264/Interfaces/IX264ValidationService.cs: -------------------------------------------------------------------------------- 1 | using BatchGuy.App.Shared.Models; 2 | 3 | namespace BatchGuy.App.X264.Interfaces 4 | { 5 | public interface IX264ValidationService 6 | { 7 | ErrorCollection Validate(); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/BatchGuy.App/X264/Models/X264File.cs: -------------------------------------------------------------------------------- 1 | namespace BatchGuy.App.X264.Models 2 | { 3 | public class X264File 4 | { 5 | public int Id { get; set; } 6 | public string AviSynthFileNameOnly { get; set; } 7 | public string AviSynthFilePath { get; set; } 8 | public string EncodeName { get; set; } 9 | public string EpisodeNumber { get; set; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/BatchGuy.App/X264/Models/X264FileSettings.cs: -------------------------------------------------------------------------------- 1 | using BatchGuy.App.Enums; 2 | 3 | namespace BatchGuy.App.X264.Models 4 | { 5 | public class X264FileSettings 6 | { 7 | public string vfw4x264Exe { get; set; } 8 | public EnumEncodeType EncodeType { get; set; } 9 | public string X264Template { get; set; } 10 | public string X264BatchFilePath { get; set; } 11 | public string X264EncodeAndLogFileOutputDirectoryPath { get; set; } 12 | public EnumDirectoryType X264EncodeAndLogFileOutputDirectoryPathType { get; set; } 13 | public bool SaveX264LogFileToDifferentDirectory { get; set; } 14 | public string X264LogFileOutputDirectoryPath { get; set; } 15 | 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/BatchGuy.App/X264Log/Interfaces/IX264LogLineItemIdentifierService.cs: -------------------------------------------------------------------------------- 1 | using BatchGuy.App.Enums; 2 | 3 | namespace BatchGuy.App.X264Log.Interfaces 4 | { 5 | public interface IX264LogLineItemIdentifierService 6 | { 7 | EnumX264LogLineItemType GetLineItemType(string lineItem); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/BatchGuy.App/X264Log/Interfaces/IX264LogParserService.cs: -------------------------------------------------------------------------------- 1 | using BatchGuy.App.Shared.Models; 2 | 3 | namespace BatchGuy.App.X264Log.Interfaces 4 | { 5 | public interface IX264LogParserService 6 | { 7 | ErrorCollection Errors { get; } 8 | string Logs { get; } 9 | string GetLogs(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/BatchGuy.App/X264Log/Models/X264LogFile.cs: -------------------------------------------------------------------------------- 1 | namespace BatchGuy.App.X264Log.Models 2 | { 3 | public class X264LogFile 4 | { 5 | public string FileNameOnly { get; set; } 6 | public string FilePath { get; set; } 7 | public string Log { get; set; } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/BatchGuy.App/X264Log/Models/X264LogFileSettings.cs: -------------------------------------------------------------------------------- 1 | namespace BatchGuy.App.X264Log.Models 2 | { 3 | public class X264LogFileSettings 4 | { 5 | public bool BBCodeHiddenAroundLogs { get; set; } 6 | public bool BBCodeBoldLogFileName { get; set; } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/BatchGuy.App/X264Log/Services/X264LogLineItemIdentifierService.cs: -------------------------------------------------------------------------------- 1 | using BatchGuy.App.Enums; 2 | using BatchGuy.App.X264Log.Interfaces; 3 | 4 | namespace BatchGuy.App.X264Log.Services 5 | { 6 | public class X264LogLineItemIdentifierService : IX264LogLineItemIdentifierService 7 | { 8 | public EnumX264LogLineItemType GetLineItemType(string lineItem) 9 | { 10 | if (this.IsIFrame(lineItem)) 11 | return EnumX264LogLineItemType.IFrame; 12 | if (this.IsPFrame(lineItem)) 13 | return EnumX264LogLineItemType.PFrame; 14 | if (this.IsBFrame(lineItem)) 15 | return EnumX264LogLineItemType.BFrame; 16 | if (this.IsConsecutiveBFrames(lineItem)) 17 | return EnumX264LogLineItemType.ConsecutiveBFrames; 18 | if (this.IsEncodeFrames(lineItem)) 19 | return EnumX264LogLineItemType.EncodedFrames; 20 | 21 | return EnumX264LogLineItemType.None; 22 | } 23 | 24 | private bool IsIFrame(string lineItem) 25 | { 26 | if (lineItem.Contains("frame I")) 27 | return true; 28 | else 29 | return false; 30 | } 31 | 32 | private bool IsPFrame(string lineItem) 33 | { 34 | if (lineItem.Contains("frame P")) 35 | return true; 36 | else 37 | return false; 38 | } 39 | 40 | private bool IsBFrame(string lineItem) 41 | { 42 | if (lineItem.Contains("frame B")) 43 | return true; 44 | else 45 | return false; 46 | } 47 | 48 | private bool IsConsecutiveBFrames(string lineItem) 49 | { 50 | if (lineItem.Contains("consecutive B-frames")) 51 | return true; 52 | else 53 | return false; 54 | } 55 | 56 | private bool IsEncodeFrames(string lineItem) 57 | { 58 | if (lineItem.Contains("encoded")) 59 | return true; 60 | else 61 | return false; 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /src/BatchGuy.App/X264Log/Services/X264LogParserService.cs: -------------------------------------------------------------------------------- 1 | using BatchGuy.App.Shared.Models; 2 | using BatchGuy.App.X264Log.Interfaces; 3 | using BatchGuy.App.X264Log.Models; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Linq; 7 | using System.Text; 8 | using System.IO; 9 | using BatchGuy.App.Enums; 10 | using log4net; 11 | using System.Reflection; 12 | 13 | namespace BatchGuy.App.X264Log.Services 14 | { 15 | public class X264LogParserService : IX264LogParserService 16 | { 17 | private ErrorCollection _errors; 18 | private IX264LogLineItemIdentifierService _x264LogLineItemIdentifierService; 19 | private X264LogFileSettings _x264LogFileSerttings; 20 | private List _logFiles; 21 | private string _logs = string.Empty; 22 | 23 | public static readonly ILog _log = LogManager.GetLogger(typeof(X264LogParserService)); 24 | 25 | public ErrorCollection Errors 26 | { 27 | get { return _errors; } 28 | } 29 | 30 | public string Logs 31 | { 32 | get { return _logs; } 33 | } 34 | 35 | public X264LogParserService(IX264LogLineItemIdentifierService x264LogLineItemIdentifierService, X264LogFileSettings x264LogFileSerttings, List logFiles) 36 | { 37 | _x264LogLineItemIdentifierService = x264LogLineItemIdentifierService; 38 | _x264LogFileSerttings = x264LogFileSerttings; 39 | _logFiles = logFiles; 40 | _errors = new ErrorCollection(); 41 | } 42 | public string GetLogs() 43 | { 44 | StringBuilder sb = new StringBuilder(); 45 | 46 | try 47 | { 48 | sb.AppendLine("[pre]"); 49 | sb.AppendLine("[quote]"); 50 | sb.AppendLine("[b]x264 Logs[/b]"); 51 | sb.AppendLine(); 52 | 53 | if (_x264LogFileSerttings.BBCodeHiddenAroundLogs) 54 | sb.AppendLine("[hide]"); 55 | 56 | foreach (X264LogFile logFile in _logFiles.OrderBy(l => l.FileNameOnly)) 57 | { 58 | if (_x264LogFileSerttings.BBCodeBoldLogFileName) 59 | sb.AppendLine(string.Format("[b]{0}[/b]", logFile.FileNameOnly)); 60 | else 61 | sb.AppendLine(string.Format("{0}", logFile.FileNameOnly)); 62 | 63 | sb.AppendLine(); 64 | 65 | using (StreamReader sw = new StreamReader(logFile.FilePath)) 66 | { 67 | while (true) 68 | { 69 | string line = sw.ReadLine(); 70 | if (line != null) 71 | { 72 | EnumX264LogLineItemType lineItemType = _x264LogLineItemIdentifierService.GetLineItemType(line); 73 | if (lineItemType != EnumX264LogLineItemType.None) 74 | { 75 | sb.AppendLine(line); 76 | } 77 | } 78 | else 79 | { 80 | break; 81 | } 82 | } 83 | sb.AppendLine(); 84 | } 85 | } 86 | 87 | if (_x264LogFileSerttings.BBCodeHiddenAroundLogs) 88 | sb.AppendLine("[/hide]"); 89 | 90 | sb.AppendLine("[/quote]"); 91 | sb.AppendLine("[/pre]"); 92 | } 93 | catch (Exception ex) 94 | { 95 | _log.ErrorFormat(Program.GetLogErrorFormat(), ex.Message, ex.StackTrace, MethodBase.GetCurrentMethod().Name); 96 | _errors.Add(new Error() { Description = string.Format("Error: {0}", ex.Message) }); 97 | } 98 | 99 | _logs = sb.ToString(); 100 | 101 | return sb.ToString(); 102 | } 103 | } 104 | } 105 | -------------------------------------------------------------------------------- /src/BatchGuy.App/X264LogFileDisplayForm.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace BatchGuy.App 2 | { 3 | partial class X264LogFileDisplayForm 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(X264LogFileDisplayForm)); 32 | this.txtLogs = new System.Windows.Forms.TextBox(); 33 | this.btnClose = new System.Windows.Forms.Button(); 34 | this.lblVersion = new System.Windows.Forms.Label(); 35 | this.SuspendLayout(); 36 | // 37 | // txtLogs 38 | // 39 | this.txtLogs.Location = new System.Drawing.Point(12, 12); 40 | this.txtLogs.Multiline = true; 41 | this.txtLogs.Name = "txtLogs"; 42 | this.txtLogs.ScrollBars = System.Windows.Forms.ScrollBars.Both; 43 | this.txtLogs.Size = new System.Drawing.Size(1005, 521); 44 | this.txtLogs.TabIndex = 1; 45 | // 46 | // btnClose 47 | // 48 | this.btnClose.Location = new System.Drawing.Point(870, 538); 49 | this.btnClose.Name = "btnClose"; 50 | this.btnClose.Size = new System.Drawing.Size(147, 23); 51 | this.btnClose.TabIndex = 0; 52 | this.btnClose.Text = "Close"; 53 | this.btnClose.UseVisualStyleBackColor = true; 54 | this.btnClose.Click += new System.EventHandler(this.btnClose_Click); 55 | // 56 | // lblVersion 57 | // 58 | this.lblVersion.AutoSize = true; 59 | this.lblVersion.Location = new System.Drawing.Point(12, 543); 60 | this.lblVersion.Name = "lblVersion"; 61 | this.lblVersion.Size = new System.Drawing.Size(42, 13); 62 | this.lblVersion.TabIndex = 33; 63 | this.lblVersion.Text = "Version"; 64 | // 65 | // X264LogFileDisplayForm 66 | // 67 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 68 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 69 | this.ClientSize = new System.Drawing.Size(1028, 573); 70 | this.Controls.Add(this.lblVersion); 71 | this.Controls.Add(this.btnClose); 72 | this.Controls.Add(this.txtLogs); 73 | this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); 74 | this.MaximizeBox = false; 75 | this.Name = "X264LogFileDisplayForm"; 76 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; 77 | this.Text = "x264 Log File Summary Display"; 78 | this.Load += new System.EventHandler(this.X264LogFileDisplayForm_Load); 79 | this.ResumeLayout(false); 80 | this.PerformLayout(); 81 | 82 | } 83 | 84 | #endregion 85 | 86 | private System.Windows.Forms.TextBox txtLogs; 87 | private System.Windows.Forms.Button btnClose; 88 | private System.Windows.Forms.Label lblVersion; 89 | } 90 | } -------------------------------------------------------------------------------- /src/BatchGuy.App/X264LogFileDisplayForm.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows.Forms; 3 | 4 | namespace BatchGuy.App 5 | { 6 | public partial class X264LogFileDisplayForm : Form 7 | { 8 | private string _logs = string.Empty; 9 | public X264LogFileDisplayForm() 10 | { 11 | InitializeComponent(); 12 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; 13 | } 14 | 15 | public void SetLogs(string logs) 16 | { 17 | _logs = logs; 18 | } 19 | 20 | private void X264LogFileDisplayForm_Load(object sender, EventArgs e) 21 | { 22 | lblVersion.Text = Program.GetApplicationVersion(); 23 | txtLogs.Text = _logs; 24 | } 25 | 26 | private void btnClose_Click(object sender, EventArgs e) 27 | { 28 | this.Close(); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/BatchGuy.App/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /src/BatchGuy.Eac3to.Parser.Example.Console.App/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/BatchGuy.Eac3to.Parser.Example.Console.App/BatchGuy.Eac3to.Parser.Example.Console.App.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {7C31EBC1-0B88-4722-9C16-8819A551DD5C} 8 | Exe 9 | Properties 10 | BatchGuy.Eac3to.Parser.Example.Console.App 11 | BatchGuy.Eac3to.Parser.Example.Console.App 12 | v4.6.1 13 | 512 14 | 15 | 16 | 17 | AnyCPU 18 | true 19 | full 20 | false 21 | bin\Debug\ 22 | DEBUG;TRACE 23 | prompt 24 | 4 25 | 26 | 27 | AnyCPU 28 | pdbonly 29 | true 30 | bin\Release\ 31 | TRACE 32 | prompt 33 | 4 34 | 35 | 36 | Icontexto-Webdev-Webdev-config.ico 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | {e9703e89-ae3a-46e6-bf68-30313a3f5e1a} 57 | BatchGuy.App 58 | 59 | 60 | 61 | 62 | 63 | 64 | 71 | -------------------------------------------------------------------------------- /src/BatchGuy.Eac3to.Parser.Example.Console.App/Icontexto-Webdev-Webdev-config.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaboy58/BatchGuy/e1e74591403bdc337c6814fc02fde7cefc81935d/src/BatchGuy.Eac3to.Parser.Example.Console.App/Icontexto-Webdev-Webdev-config.ico -------------------------------------------------------------------------------- /src/BatchGuy.Eac3to.Parser.Example.Console.App/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("BatchGuy.Eac3to.Parser.Example.Console.App")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("BatchGuy.Eac3to.Parser.Example.Console.App")] 13 | [assembly: AssemblyCopyright("Copyright © 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("f028c038-d870-4c69-a732-1ebf8ca87a64")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("7.1.0.0")] 36 | [assembly: AssemblyFileVersion("7.1.0.0")] 37 | -------------------------------------------------------------------------------- /src/BatchGuy.Settings.Serialization.Example.Console.App/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/BatchGuy.Settings.Serialization.Example.Console.App/Program.cs: -------------------------------------------------------------------------------- 1 | using BatchGuy.App.Settings.Interface; 2 | using BatchGuy.App.Settings.Services; 3 | using BatchGuy.App.Shared.Interface; 4 | using BatchGuy.App.Shared.Interfaces; 5 | using BatchGuy.App.Shared.Models; 6 | using BatchGuy.App.Shared.Services; 7 | 8 | namespace BatchGuy.Settings.Serialization.Example.Console.App 9 | { 10 | class Program 11 | { 12 | static void Main(string[] args) 13 | { 14 | //initialize services 15 | IJsonSerializationService jsonSerializationService = new JsonSerializationService(); //serialization service 16 | IAudioService audioService = new AudioService(); //audio service 17 | IApplicationSettingsService applicationSettingsService = new ApplicationSettingsService(jsonSerializationService, audioService); //application service 18 | 19 | //get current application settings 20 | ApplicationSettings applicationSettings = applicationSettingsService.GetApplicationSettings(); 21 | 22 | //add 23 | applicationSettings.Settings.Add(new Setting() { Name = "eac3to", Value = @"c:\exe\eac3to.exe" }); 24 | //save to disc 25 | applicationSettingsService.Save(applicationSettings); 26 | 27 | var errors = applicationSettingsService.Errors; 28 | 29 | //get settings 30 | applicationSettings = applicationSettingsService.GetApplicationSettings(); 31 | 32 | errors = applicationSettingsService.Errors; 33 | 34 | System.Console.ReadLine(); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/BatchGuy.Settings.Serialization.Example.Console.App/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("BatchGuy.Settings.Serialization.Example.Console.App")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("BatchGuy.Settings.Serialization.Example.Console.App")] 13 | [assembly: AssemblyCopyright("Copyright © 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("8ce6c4ad-0771-4586-ad79-d318c4da46ce")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("7.1.0.0")] 36 | [assembly: AssemblyFileVersion("7.1.0.0")] 37 | -------------------------------------------------------------------------------- /src/BatchGuy.Settings.Serialization.Example.Console.App/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /src/BatchGuy.X264Log.Parser.Example.Console.App/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/BatchGuy.X264Log.Parser.Example.Console.App/BatchGuy.X264Log.Parser.Example.Console.App.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {432AE3F6-92AF-46AB-A5E5-4D68F68D17B8} 8 | Exe 9 | Properties 10 | BatchGuy.X264Log.Parser.Example.Console.App 11 | BatchGuy.X264Log.Parser.Example.Console.App 12 | v4.6.1 13 | 512 14 | 15 | 16 | 17 | AnyCPU 18 | true 19 | full 20 | false 21 | bin\Debug\ 22 | DEBUG;TRACE 23 | prompt 24 | 4 25 | 26 | 27 | AnyCPU 28 | pdbonly 29 | true 30 | bin\Release\ 31 | TRACE 32 | prompt 33 | 4 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | {e9703e89-ae3a-46e6-bf68-30313a3f5e1a} 54 | BatchGuy.App 55 | 56 | 57 | 58 | 65 | -------------------------------------------------------------------------------- /src/BatchGuy.X264Log.Parser.Example.Console.App/Program.cs: -------------------------------------------------------------------------------- 1 | using BatchGuy.App.X264Log.Interfaces; 2 | using BatchGuy.App.X264Log.Models; 3 | using BatchGuy.App.X264Log.Services; 4 | using System.Collections.Generic; 5 | using System.Diagnostics; 6 | using System.Linq; 7 | 8 | namespace BatchGuy.X264Log.Parser.Example.Console.App 9 | { 10 | class Program 11 | { 12 | static void Main(string[] args) 13 | { 14 | //line item identifier service used to identify the line type read from log file 15 | IX264LogLineItemIdentifierService x264LogLineItemIdentifierService = new X264LogLineItemIdentifierService(); 16 | 17 | //x264 log file settings 18 | X264LogFileSettings x264LogFileSerttings = new X264LogFileSettings() { BBCodeBoldLogFileName = true, BBCodeHiddenAroundLogs = true }; 19 | 20 | //log files 21 | List logFiles = new List() { 22 | new X264LogFile() { FileNameOnly = "Les Revenants S02E01 The Child 720p BluRay DTS x264.mkv.x264.log", FilePath = @"C:\temp\My Encodes\Blu-ray\Les Revenants S02E01 The Child 720p BluRay DTS x264.mkv.x264.log" }, 23 | new X264LogFile() { FileNameOnly = "Les Revenants S02E02 Milan 720p BluRay DTS x264.mkv.x264.log", FilePath = @"C:\temp\My Encodes\Blu-ray\Les Revenants S02E02 Milan 720p BluRay DTS x264.mkv.x264.log" }, 24 | new X264LogFile() { FileNameOnly = "Les Revenants S02E03 Morgane 720p BluRay DTS x264.mkv.x264.log", FilePath = @"C:\temp\My Encodes\Blu-ray\Les Revenants S02E03 Morgane 720p BluRay DTS x264.mkv.x264.log" }, 25 | new X264LogFile() { FileNameOnly = "Les Revenants S02E04 Virgil 720p BluRay DTS x264.mkv.x264.log", FilePath = @"C:\temp\My Encodes\Blu-ray\Les Revenants S02E04 Virgil 720p BluRay DTS x264.mkv.x264.log" }, 26 | new X264LogFile() { FileNameOnly = "Les Revenants S02E05 Madame Costa 720p BluRay DTS x264.mkv.x264.log", FilePath = @"C:\temp\My Encodes\Blu-ray\Les Revenants S02E05 Madame Costa 720p BluRay DTS x264.mkv.x264.log" }, 27 | new X264LogFile() { FileNameOnly = "Les Revenants S02E06 Esther 720p BluRay DTS x264.mkv.x264.log", FilePath = @"C:\temp\My Encodes\Blu-ray\Les Revenants S02E06 Esther 720p BluRay DTS x264.mkv.x264.log" }, 28 | new X264LogFile() { FileNameOnly = "Les Revenants S02E07 Étienne 720p BluRay DTS x264.mkv.x264.log", FilePath = @"C:\temp\My Encodes\Blu-ray\Les Revenants S02E07 Étienne 720p BluRay DTS x264.mkv.x264.log" }, 29 | new X264LogFile() { FileNameOnly = "Les Revenants S02E08 Les Revenants 720p BluRay DTS x264.mkv.x264.log", FilePath = @"C:\temp\My Encodes\Blu-ray\Les Revenants S02E08 Les Revenants 720p BluRay DTS x264.mkv.x264.log" }}; 30 | 31 | //parser service 32 | IX264LogParserService parserService = new X264LogParserService(x264LogLineItemIdentifierService, x264LogFileSerttings, logFiles); 33 | 34 | Stopwatch watch = new Stopwatch(); 35 | watch.Start(); 36 | 37 | //get log text 38 | string logs = parserService.GetLogs(); 39 | 40 | if (parserService.Errors.Count() == 0) 41 | { 42 | System.Console.WriteLine(logs); 43 | } 44 | else 45 | { 46 | System.Console.WriteLine(parserService.Errors[0].Description); 47 | } 48 | watch.Stop(); 49 | 50 | System.Console.WriteLine(string.Format("The process took {0} seconds", watch.Elapsed.TotalSeconds.ToString())); 51 | 52 | System.Console.ReadLine(); 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/BatchGuy.X264Log.Parser.Example.Console.App/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("BatchGuy.X264Log.Parser.Example.Console.App")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("BatchGuy.X264Log.Parser.Example.Console.App")] 13 | [assembly: AssemblyCopyright("Copyright © 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("01e235ed-1e49-4514-8453-ce80fc8857ff")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("7.1.0.0")] 36 | [assembly: AssemblyFileVersion("7.1.0.0")] 37 | -------------------------------------------------------------------------------- /src/BatchGuy.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | VisualStudioVersion = 12.0.40629.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BatchGuy.App", "BatchGuy.App\BatchGuy.App.csproj", "{E9703E89-AE3A-46E6-BF68-30313A3F5E1A}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BatchGuy.Unit.Tests", "tests\BatchGuy.Unit.Tests\BatchGuy.Unit.Tests.csproj", "{55FED224-7E36-44A3-A66B-4E7526633E17}" 9 | EndProject 10 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{BB993579-70BC-4D8F-91F9-50933887303D}" 11 | ProjectSection(SolutionItems) = preProject 12 | .nuget\NuGet.Config = .nuget\NuGet.Config 13 | .nuget\NuGet.exe = .nuget\NuGet.exe 14 | .nuget\NuGet.targets = .nuget\NuGet.targets 15 | EndProjectSection 16 | EndProject 17 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BatchGuy.Eac3to.Parser.Example.Console.App", "BatchGuy.Eac3to.Parser.Example.Console.App\BatchGuy.Eac3to.Parser.Example.Console.App.csproj", "{7C31EBC1-0B88-4722-9C16-8819A551DD5C}" 18 | EndProject 19 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BatchGuy.Settings.Serialization.Example.Console.App", "BatchGuy.Settings.Serialization.Example.Console.App\BatchGuy.Settings.Serialization.Example.Console.App.csproj", "{B66B70ED-E06A-4D88-8473-D089C5D6C69F}" 20 | EndProject 21 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BatchGuy.X264Log.Parser.Example.Console.App", "BatchGuy.X264Log.Parser.Example.Console.App\BatchGuy.X264Log.Parser.Example.Console.App.csproj", "{432AE3F6-92AF-46AB-A5E5-4D68F68D17B8}" 22 | EndProject 23 | Global 24 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 25 | Debug|Any CPU = Debug|Any CPU 26 | Release|Any CPU = Release|Any CPU 27 | EndGlobalSection 28 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 29 | {E9703E89-AE3A-46E6-BF68-30313A3F5E1A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 30 | {E9703E89-AE3A-46E6-BF68-30313A3F5E1A}.Debug|Any CPU.Build.0 = Debug|Any CPU 31 | {E9703E89-AE3A-46E6-BF68-30313A3F5E1A}.Release|Any CPU.ActiveCfg = Release|Any CPU 32 | {E9703E89-AE3A-46E6-BF68-30313A3F5E1A}.Release|Any CPU.Build.0 = Release|Any CPU 33 | {55FED224-7E36-44A3-A66B-4E7526633E17}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 34 | {55FED224-7E36-44A3-A66B-4E7526633E17}.Debug|Any CPU.Build.0 = Debug|Any CPU 35 | {55FED224-7E36-44A3-A66B-4E7526633E17}.Release|Any CPU.ActiveCfg = Release|Any CPU 36 | {55FED224-7E36-44A3-A66B-4E7526633E17}.Release|Any CPU.Build.0 = Release|Any CPU 37 | {7C31EBC1-0B88-4722-9C16-8819A551DD5C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 38 | {7C31EBC1-0B88-4722-9C16-8819A551DD5C}.Debug|Any CPU.Build.0 = Debug|Any CPU 39 | {7C31EBC1-0B88-4722-9C16-8819A551DD5C}.Release|Any CPU.ActiveCfg = Release|Any CPU 40 | {7C31EBC1-0B88-4722-9C16-8819A551DD5C}.Release|Any CPU.Build.0 = Release|Any CPU 41 | {B66B70ED-E06A-4D88-8473-D089C5D6C69F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 42 | {B66B70ED-E06A-4D88-8473-D089C5D6C69F}.Debug|Any CPU.Build.0 = Debug|Any CPU 43 | {B66B70ED-E06A-4D88-8473-D089C5D6C69F}.Release|Any CPU.ActiveCfg = Release|Any CPU 44 | {B66B70ED-E06A-4D88-8473-D089C5D6C69F}.Release|Any CPU.Build.0 = Release|Any CPU 45 | {432AE3F6-92AF-46AB-A5E5-4D68F68D17B8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 46 | {432AE3F6-92AF-46AB-A5E5-4D68F68D17B8}.Debug|Any CPU.Build.0 = Debug|Any CPU 47 | {432AE3F6-92AF-46AB-A5E5-4D68F68D17B8}.Release|Any CPU.ActiveCfg = Release|Any CPU 48 | {432AE3F6-92AF-46AB-A5E5-4D68F68D17B8}.Release|Any CPU.Build.0 = Release|Any CPU 49 | EndGlobalSection 50 | GlobalSection(SolutionProperties) = preSolution 51 | HideSolutionNode = FALSE 52 | EndGlobalSection 53 | EndGlobal 54 | -------------------------------------------------------------------------------- /src/packages/repositories.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/tests/BatchGuy.Unit.Tests/ExtensionMethods/ExtensionMethodTests.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using NUnit.Framework; 3 | using FluentAssertions; 4 | using BatchGuy.App.Parser.Models; 5 | using BatchGuy.App.Extensions; 6 | 7 | 8 | namespace BatchGuy.Unit.Tests.ExtensionMethods 9 | { 10 | [TestFixture] 11 | public class ExtensionMethodTests 12 | { 13 | [Test] 14 | public void extensionmethods_listofbluraydiscinfo_numberofepisodes_test() 15 | { 16 | List discs = new List() { new BluRayDiscInfo() { IsSelected = true, BluRaySummaryInfoList = new List() { new BluRaySummaryInfo() { IsSelected = true}, new BluRaySummaryInfo() { IsSelected = false} }}, 17 | new BluRayDiscInfo() { IsSelected = true, BluRaySummaryInfoList = new List() {new BluRaySummaryInfo() {IsSelected = true}, new BluRaySummaryInfo() { IsSelected = true}}} }; 18 | 19 | discs.NumberOfEpisodes().Should().Be(3); 20 | } 21 | 22 | [Test] 23 | public void extensionmethods_removecolons_test() 24 | { 25 | //given a string with a colon in it 26 | string stringWithColon = "1:"; 27 | //when i attempt to remove colons 28 | string stringWithNoColon = stringWithColon.RemoveColons(); 29 | //then colons should be removed 30 | stringWithNoColon.Should().Be("1"); 31 | } 32 | 33 | [Test] 34 | public void extensionmethods_replacespaceswithperiods_test() 35 | { 36 | //given 37 | string episodeWithSpaces = "The First 48 S01E01 First Episode 1080p Remux AVC FLAC7.1-BatchGuy.mkv"; 38 | //when 39 | string episodeWithPeriods = episodeWithSpaces.ReplaceSpacesWithPeriods(); 40 | //then 41 | episodeWithPeriods.Should().Be("The.First.48.S01E01.First.Episode.1080p.Remux.AVC.FLAC7.1-BatchGuy.mkv"); 42 | } 43 | 44 | [Test] 45 | public void extensionmethods_subtitlefileextension__test() 46 | { 47 | //given 48 | string file = @"c:\external subtitles\my tv show episode.ssa"; 49 | //when 50 | string extension = file.SubtitleFileExtension(); 51 | //then 52 | extension.Should().Be("ssa"); 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/tests/BatchGuy.Unit.Tests/HelperFunctions/GetVideoExtensionTests.cs: -------------------------------------------------------------------------------- 1 | using BatchGuy.App.Helpers; 2 | using NUnit.Framework; 3 | using FluentAssertions; 4 | 5 | namespace BatchGuy.Unit.Tests 6 | { 7 | [TestFixture] 8 | public class GetVideoExtensionTests 9 | { 10 | [Test] 11 | public void extension_is_mkv_when_video_text_is_empty_test() 12 | { 13 | string text = string.Empty; 14 | //given empty text 15 | //when I get the extension 16 | string extension = HelperFunctions.GetVideoExtension(text); 17 | //then the extension is mkv 18 | extension.Should().Be("mkv"); 19 | } 20 | 21 | [Test] 22 | public void extension_is_h265_when_video_text_contains_hevc_test() 23 | { 24 | string text = "2: HEVC, (16:9), 10 bits"; 25 | //given hevc text 26 | //when I get the extension 27 | string extension = HelperFunctions.GetVideoExtension(text); 28 | //then the extension is h265 29 | extension.Should().Be("h265"); 30 | } 31 | 32 | [Test] 33 | public void extension_is_h265_when_video_text_contains_h265_test() 34 | { 35 | string text = "2: h265 (16:9), 10 bits"; 36 | //given h265 text 37 | //when I get the extension 38 | string extension = HelperFunctions.GetVideoExtension(text); 39 | //then the extension is h265 40 | extension.Should().Be("h265"); 41 | } 42 | 43 | [Test] 44 | public void extension_is_h265_when_video_text_contains_2160_test() 45 | { 46 | string text = "2: 2160p24 (16:9), 10 bits"; 47 | //given 2160 text 48 | //when I get the extension 49 | string extension = HelperFunctions.GetVideoExtension(text); 50 | //then the extension is h265 51 | extension.Should().Be("h265"); 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/tests/BatchGuy.Unit.Tests/HelperFunctions/PadNumberWithZerosTests.cs: -------------------------------------------------------------------------------- 1 | using BatchGuy.App.Helpers; 2 | using NUnit.Framework; 3 | using FluentAssertions; 4 | 5 | namespace BatchGuy.Unit.Tests 6 | { 7 | [TestFixture] 8 | public class PadNumberWithZerosTests 9 | { 10 | [Test] 11 | public void can_pad_number_with_batch_count_less_than_ten_test() 12 | { 13 | int batchCount, fileNumber; 14 | //given a batch count less than ten 15 | batchCount = 9; 16 | fileNumber = 7; 17 | //when I get the padded number 18 | string paddedNumber = HelperFunctions.PadNumberWithZeros(batchCount, fileNumber); 19 | //then the padded number is correct 20 | paddedNumber.Should().Be("07"); 21 | } 22 | 23 | [Test] 24 | public void can_pad_number_with_batch_count_greater_than_ten_and_file_number_single_digit_test() 25 | { 26 | int batchCount, fileNumber; 27 | //given a batch count greater than ten and file number in sigle digit 28 | batchCount = 22; 29 | fileNumber = 9; 30 | //when I get the padded number 31 | string paddedNumber = HelperFunctions.PadNumberWithZeros(batchCount, fileNumber); 32 | //then the padded number is correct 33 | paddedNumber.Should().Be("09"); 34 | } 35 | 36 | [Test] 37 | public void can_pad_number_with_batch_count_greater_than_ten_and_file_number_double_digit_test() 38 | { 39 | int batchCount, fileNumber; 40 | //given a batch count greater than ten and file number in double digit 41 | batchCount = 22; 42 | fileNumber = 21; 43 | //when I get the padded number 44 | string paddedNumber = HelperFunctions.PadNumberWithZeros(batchCount, fileNumber); 45 | //then the padded number is correct 46 | paddedNumber.Should().Be("21"); 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/tests/BatchGuy.Unit.Tests/Icontexto-Webdev-Webdev-config.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yaboy58/BatchGuy/e1e74591403bdc337c6814fc02fde7cefc81935d/src/tests/BatchGuy.Unit.Tests/Icontexto-Webdev-Webdev-config.ico -------------------------------------------------------------------------------- /src/tests/BatchGuy.Unit.Tests/Models/BluRayTitleAudioTests.cs: -------------------------------------------------------------------------------- 1 | using NUnit.Framework; 2 | using FluentAssertions; 3 | using BatchGuy.App.Parser.Models; 4 | 5 | namespace BatchGuy.Unit.Tests.Models 6 | { 7 | [TestFixture] 8 | public class BluRayTitleAudioTests 9 | { 10 | [Test] 11 | public void bluraytitleaudio_idnumber_set_to_zero_when_id_empty_test() 12 | { 13 | //given 14 | BluRayTitleAudio audio = new BluRayTitleAudio() { Id = "" }; 15 | //when 16 | int idNumber = audio.IdNumber; 17 | //then 18 | idNumber.Should().Be(0); 19 | } 20 | 21 | [Test] 22 | public void bluraytitleaudio_idnumber_converted_to_valid_int_when_id_is_not_empty_test() 23 | { 24 | //given 25 | BluRayTitleAudio audio = new BluRayTitleAudio() { Id = "18:" }; 26 | //when 27 | int idNumber = audio.IdNumber; 28 | //then 29 | idNumber.Should().Be(18); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/tests/BatchGuy.Unit.Tests/Models/BluRayTitleSubtitleTests.cs: -------------------------------------------------------------------------------- 1 | using NUnit.Framework; 2 | using FluentAssertions; 3 | using BatchGuy.App.Parser.Models; 4 | 5 | namespace BatchGuy.Unit.Tests.Models 6 | { 7 | [TestFixture] 8 | public class BluRayTitleSubtitleTests 9 | { 10 | [Test] 11 | public void bluraytitlesubtitle_idnumber_set_to_zero_when_id_empty_test() 12 | { 13 | //given 14 | BluRayTitleSubtitle subtitle = new BluRayTitleSubtitle() { Id = "" }; 15 | //when 16 | int idNumber = subtitle.IdNumber; 17 | //then 18 | idNumber.Should().Be(0); 19 | } 20 | 21 | [Test] 22 | public void bluraytitlesubtitle_idnumber_converted_to_valid_int_when_id_is_not_empty_test() 23 | { 24 | //given 25 | BluRayTitleSubtitle subtitle = new BluRayTitleSubtitle() { Id = "18:" }; 26 | //when 27 | int idNumber = subtitle.IdNumber; 28 | //then 29 | idNumber.Should().Be(18); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/tests/BatchGuy.Unit.Tests/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("BatchGuy.Unit.Tests")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("BatchGuy Unit Tests")] 13 | [assembly: AssemblyCopyright("Copyright © 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("cfc3724c-0165-443f-9533-4da9657fc373")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("7.1.0.0")] 36 | [assembly: AssemblyFileVersion("7.1.0.0")] 37 | -------------------------------------------------------------------------------- /src/tests/BatchGuy.Unit.Tests/Services/AviSynth/FileServiceTests.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using NUnit.Framework; 3 | using FluentAssertions; 4 | using BatchGuy.App.AviSynth.Models; 5 | using BatchGuy.App.AviSynth.Services; 6 | using BatchGuy.App.AviSynth.Interfaces; 7 | 8 | namespace BatchGuy.Unit.Tests.Services.AviSynth 9 | { 10 | [TestFixture] 11 | public class FileServiceTests 12 | { 13 | [Test] 14 | public void avsfile_has_correct_name_test() 15 | { 16 | AviSynthBatchSettings avsBatchSettings; 17 | IAviSynthFileService fileService; 18 | AviSynthTemplateScript avsTemplateScript; 19 | 20 | //given correct settings 21 | avsBatchSettings = new AviSynthBatchSettings() { AviSynthFilesOutputDirectoryPath = "C:\\Temp", NamingConvention = "encode", NumberOfFiles = 9 }; 22 | avsTemplateScript = new AviSynthTemplateScript() { Script = string.Empty}; 23 | //when I create the avs file batch 24 | fileService = new AviSynthFileService(avsBatchSettings, avsTemplateScript); 25 | List avsFiles = fileService.CreateAVSFileList(); 26 | //then error list contains error 27 | avsFiles[0].FileNameOnly.Should().Be("encode01.avs"); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/tests/BatchGuy.Unit.Tests/Services/AviSynth/ValidationServiceTests.cs: -------------------------------------------------------------------------------- 1 | using BatchGuy.App.AviSynth.Models; 2 | using BatchGuy.App.AviSynth.Services; 3 | using NUnit.Framework; 4 | using BatchGuy.App.AviSynth.Interfaces; 5 | using BatchGuy.App.Shared.Models; 6 | 7 | namespace BatchGuy.Unit.Tests.Services.AviSynth 8 | { 9 | [TestFixture] 10 | public class ValidationServiceTests 11 | { 12 | [Test] 13 | public void batch_directory_is_empty_test() 14 | { 15 | AviSynthBatchSettings avsBatchSettings; 16 | IAviSynthValidationService validationService; 17 | 18 | //given an empty batch directory 19 | avsBatchSettings = new AviSynthBatchSettings() { AviSynthFilesOutputDirectoryPath = string.Empty, NamingConvention = "NamingConvention", NumberOfFiles = 1 }; 20 | //when I validate 21 | validationService = new AviSynthValidationService(avsBatchSettings); 22 | ErrorCollection errors = validationService.Validate(); 23 | //then error list contains error 24 | Assert.AreEqual(errors[0].Description, "Batch Directory is required!"); 25 | } 26 | 27 | [Test] 28 | public void batch_directory_is_invalid_directory_test() 29 | { 30 | AviSynthBatchSettings avsBatchSettings; 31 | IAviSynthValidationService validationService; 32 | 33 | //given an empty batch directory 34 | avsBatchSettings = new AviSynthBatchSettings() { AviSynthFilesOutputDirectoryPath = "BatchDirectory", NamingConvention = "NamingConvention", NumberOfFiles = 1 }; 35 | //when I validate 36 | validationService = new AviSynthValidationService(avsBatchSettings); 37 | ErrorCollection errors = validationService.Validate(); 38 | //then error list contains error 39 | Assert.AreEqual(errors[0].Description, "Batch Directory does not exist!"); 40 | } 41 | 42 | [Test] 43 | public void naming_convention_is_empty_test() 44 | { 45 | AviSynthBatchSettings avsBatchSettings; 46 | IAviSynthValidationService validationService; 47 | 48 | //given an empty batch directory 49 | avsBatchSettings = new AviSynthBatchSettings() { AviSynthFilesOutputDirectoryPath = "C:\\temp", NamingConvention = string.Empty, NumberOfFiles = 1 }; 50 | //when I validate 51 | validationService = new AviSynthValidationService(avsBatchSettings); 52 | ErrorCollection errors = validationService.Validate(); 53 | //then error list contains error 54 | Assert.AreEqual(errors[0].Description, "Naming Convention is required"); 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/tests/BatchGuy.Unit.Tests/Services/Eac3to/AbstractEAC3ToOutputNamingServiceFactoryTests.cs: -------------------------------------------------------------------------------- 1 | using BatchGuy.App.Eac3To.Abstracts; 2 | using BatchGuy.App.Enums; 3 | using BatchGuy.App.Shared.Services; 4 | using FluentAssertions; 5 | using NUnit.Framework; 6 | 7 | 8 | namespace BatchGuy.Unit.Tests.Services.Eac3to 9 | { 10 | [TestFixture] 11 | public class AbstractEAC3ToOutputNamingServiceFactoryTests 12 | { 13 | [Test] 14 | public void abstractEAC3ToOutputNamingServiceFactory_CreateNewEncodeTemplate1EAC3ToOutputNamingService_test() 15 | { 16 | //given 17 | AbstractEAC3ToOutputNamingServiceFactory factory = new AbstractEAC3ToOutputNamingServiceFactory(new AudioService()); 18 | //when 19 | AbstractEAC3ToOutputNamingService service = factory.CreateNewEncodeTemplate1EAC3ToOutputNamingService(); 20 | //then 21 | service.EnumEAC3ToNamingConventionType.Should().Be(EnumEAC3ToNamingConventionType.EncodeNamingConventionTemplate1); 22 | } 23 | 24 | [Test] 25 | public void abstractEAC3ToOutputNamingServiceFactory_CreateNewRemuxTemplate1EAC3ToOutputNamingService_test() 26 | { 27 | //given 28 | AbstractEAC3ToOutputNamingServiceFactory factory = new AbstractEAC3ToOutputNamingServiceFactory(new AudioService()); 29 | //when 30 | AbstractEAC3ToOutputNamingService service = factory.CreateNewRemuxTemplate1EAC3ToOutputNamingService(); 31 | //then 32 | service.EnumEAC3ToNamingConventionType.Should().Be(EnumEAC3ToNamingConventionType.RemuxNamingConventionTemplate1); 33 | } 34 | 35 | [Test] 36 | public void abstractEAC3ToOutputNamingServiceFactory_CreateNewRemuxTemplate2EAC3ToOutputNamingService_test() 37 | { 38 | //given 39 | AbstractEAC3ToOutputNamingServiceFactory factory = new AbstractEAC3ToOutputNamingServiceFactory(new AudioService()); 40 | //when 41 | AbstractEAC3ToOutputNamingService service = factory.CreateNewRemuxTemplate2EAC3ToOutputNamingService(); 42 | //then 43 | service.EnumEAC3ToNamingConventionType.Should().Be(EnumEAC3ToNamingConventionType.RemuxNamingConventionTemplate2); 44 | } 45 | 46 | [Test] 47 | public void abstractEAC3ToOutputNamingServiceFactory_CreateNewRemuxTemplate3EAC3ToOutputNamingService_test() 48 | { 49 | //given 50 | AbstractEAC3ToOutputNamingServiceFactory factory = new AbstractEAC3ToOutputNamingServiceFactory(new AudioService()); 51 | //when 52 | AbstractEAC3ToOutputNamingService service = factory.CreateNewRemuxTemplate3EAC3ToOutputNamingService(); 53 | //then 54 | service.EnumEAC3ToNamingConventionType.Should().Be(EnumEAC3ToNamingConventionType.RemuxNamingConventionTemplate3); 55 | } 56 | 57 | [Test] 58 | public void abstractEAC3ToOutputNamingServiceFactory_CreateNewMovieRemuxTemplate1EAC3ToOutputNamingServiceService_test() 59 | { 60 | //given 61 | AbstractEAC3ToOutputNamingServiceFactory factory = new AbstractEAC3ToOutputNamingServiceFactory(new AudioService()); 62 | //when 63 | AbstractEAC3ToOutputNamingService service = factory.CreateNewMovieRemuxTemplate1EAC3ToOutputNamingServiceService(); 64 | //then 65 | service.EnumEAC3ToNamingConventionType.Should().Be(EnumEAC3ToNamingConventionType.MovieRemuxNamingConventionTemplate1); 66 | } 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /src/tests/BatchGuy.Unit.Tests/Services/MKVMerge/MKVMergeLanguageServiceTests.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | using NUnit.Framework; 3 | using BatchGuy.App.MKVMerge.Interfaces; 4 | using BatchGuy.App.MKVMerge.Services; 5 | using FluentAssertions; 6 | using BatchGuy.App.MKVMerge.Models; 7 | using BatchGuy.App.Shared.Services; 8 | using BatchGuy.App.Shared.Interface; 9 | 10 | namespace BatchGuy.Unit.Tests.Services.MKVMerge 11 | { 12 | [TestFixture] 13 | public class MKVMergeLanguageServiceTests 14 | { 15 | [Test] 16 | public void mkvmergelanguageservice_can_get_languages_test() 17 | { 18 | //given 19 | IJsonSerializationService jsonSerializationService = new JsonSerializationService(); 20 | IMKVMergeLanguageService service = new MKVMergeLanguageService(jsonSerializationService); 21 | //when 22 | var languages = service.GetLanguages(); 23 | //then 24 | languages.Count().Should().BeGreaterThan(0); 25 | } 26 | 27 | [Test] 28 | public void mkvmergelanguageservice_returns_undetermined_when_language_not_found_test() 29 | { 30 | //given 31 | IJsonSerializationService jsonSerializationService = new JsonSerializationService(); 32 | IMKVMergeLanguageService service = new MKVMergeLanguageService(jsonSerializationService); 33 | //when 34 | var language = service.GetLanguageByName("nolanguage"); 35 | //then 36 | language.Value.Should().Be("und"); 37 | } 38 | 39 | [Test] 40 | public void mkvmergelanguageservice_returns_correct_language_test() 41 | { 42 | //given 43 | IJsonSerializationService jsonSerializationService = new JsonSerializationService(); 44 | IMKVMergeLanguageService service = new MKVMergeLanguageService(jsonSerializationService); 45 | //when 46 | var language = service.GetLanguageByName("English"); 47 | //then 48 | language.Value.Should().Be("eng"); 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/tests/BatchGuy.Unit.Tests/Services/MKVMerge/MKVMergeOutputServiceTests.cs: -------------------------------------------------------------------------------- 1 | using NUnit.Framework; 2 | using FluentAssertions; 3 | using BatchGuy.App.Eac3to.Models; 4 | using BatchGuy.App.Parser.Models; 5 | using BatchGuy.App.Eac3To.Services; 6 | using BatchGuy.App.MKVMerge.Interfaces; 7 | using BatchGuy.App.MKVMerge.Services; 8 | using BatchGuy.App.Shared.Interfaces; 9 | using BatchGuy.App.Shared.Services; 10 | using BatchGuy.App.Eac3To.Abstracts; 11 | 12 | namespace BatchGuy.Unit.Tests.Services.MKVMerge 13 | { 14 | [TestFixture] 15 | public class MKVMergeOutputServiceTests 16 | { 17 | [Test] 18 | public void mkvmergeoutputservice_can_getmkvmergepathPart_Tests() 19 | { 20 | //given 21 | EAC3ToConfiguration config = new EAC3ToConfiguration() { MKVMergePath = "c:\\exe\\mkvmerge.exe" }; 22 | BluRaySummaryInfo bluRaySummaryInfo = new BluRaySummaryInfo() { Eac3ToId = "1)", BluRayTitleInfo = new BluRayTitleInfo() { EpisodeNumber = "1" } }; 23 | IAudioService audioService = new AudioService(); 24 | AbstractEAC3ToOutputNamingService eac3ToOutputNamingService = new RemuxTemplate1EAC3ToOutputNamingService(audioService); 25 | //when 26 | IMKVMergeOutputService mkvMergeOutputService = new MKVMergeOutputService(config, eac3ToOutputNamingService, @"c:\temp", bluRaySummaryInfo); 27 | var mkvmergepath = mkvMergeOutputService.GetMKVMergePathPart(); 28 | //then 29 | mkvmergepath.Should().Be("\"c:\\exe\\mkvmerge.exe\""); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/tests/BatchGuy.Unit.Tests/Services/Parser/BluRaySummaryLineItemIdentifierServiceTests.cs: -------------------------------------------------------------------------------- 1 | using NUnit.Framework; 2 | using FluentAssertions; 3 | using BatchGuy.App.Parser.Models; 4 | using BatchGuy.App.Parser.Services; 5 | using BatchGuy.App.Parser.Interfaces; 6 | using BatchGuy.App.Enums; 7 | 8 | namespace BatchGuy.Unit.Tests.Services.Parser 9 | { 10 | [TestFixture] 11 | public class BluRaySummaryLineItemIdentifierServiceTests 12 | { 13 | [Test] 14 | public void bluraysummarylineitemidentifierservice_can_identify_bluray_header_line_item_test() 15 | { 16 | ProcessOutputLineItem lineItem = new ProcessOutputLineItem() { Id =1 , Text = "1) 00010.mpls, 3:04:31" }; 17 | ILineItemIdentifierService service = new BluRaySummaryLineItemIdentifierService(); 18 | EnumBluRayLineItemType type = service.GetLineItemType(lineItem); 19 | type.Should().Be(EnumBluRayLineItemType.BluRaySummaryHeaderLine); 20 | } 21 | 22 | public void bluraysummarylineitemidentifierservice_can_identify_bluray_detail_line_item_test() 23 | { 24 | ProcessOutputLineItem lineItem = new ProcessOutputLineItem() { Id = 1, Text = "- DTS Master Audio, Swedish, multi-channel, 48kHz" }; 25 | ILineItemIdentifierService service = new BluRaySummaryLineItemIdentifierService(); 26 | EnumBluRayLineItemType type = service.GetLineItemType(lineItem); 27 | type.Should().Be(EnumBluRayLineItemType.BluRaySummaryDetailLine); 28 | } 29 | 30 | public void bluraysummarylineitemidentifierservice_can_identify_bluray_empty_line_item_test() 31 | { 32 | ProcessOutputLineItem lineItem = new ProcessOutputLineItem() { Id = 1, Text = "" }; 33 | ILineItemIdentifierService service = new BluRaySummaryLineItemIdentifierService(); 34 | EnumBluRayLineItemType type = service.GetLineItemType(lineItem); 35 | type.Should().Be(EnumBluRayLineItemType.BluRaySummaryEmptyLine); 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/tests/BatchGuy.Unit.Tests/Services/Parser/BluRaySummaryParserServiceTests.cs: -------------------------------------------------------------------------------- 1 | using NUnit.Framework; 2 | using System.Collections.Generic; 3 | using FluentAssertions; 4 | using BatchGuy.App.Parser.Models; 5 | using BatchGuy.App.Parser.Services; 6 | using BatchGuy.App.Parser.Interfaces; 7 | 8 | 9 | namespace BatchGuy.Unit.Tests.Services.Parser 10 | { 11 | [TestFixture] 12 | public class BluRaySummaryParserServiceTests 13 | { 14 | [Test] 15 | public void bluraysummaryparserservice_can_set_summary_id_test() 16 | { 17 | List lineItems = new List 18 | { 19 | new ProcessOutputLineItem() { Id = 1, Text = "1) 00010.mpls, 3:04:31" }, 20 | new ProcessOutputLineItem() { Id = 2, Text = "- [0+3+4+5].m2ts" }, 21 | new ProcessOutputLineItem() { Id = 3, Text = "- h264/AVC, 1080p24 /1.001 (16:9)" }, 22 | new ProcessOutputLineItem() { Id = 4, Text = "- DTS Master Audio, Swedish, multi-channel, 48kHz" } , 23 | new ProcessOutputLineItem() { Id = 5, Text = "- AC3, Swedish, multi-channel, 48kHz" }, 24 | new ProcessOutputLineItem() { Id = 6, Text = "" } 25 | }; 26 | ILineItemIdentifierService lineItemService = new BluRaySummaryLineItemIdentifierService(); 27 | IBluRaySummaryParserService parserService = new BluRaySummaryParserService(lineItemService, lineItems); 28 | List summaryList = parserService.GetSummaryList(); 29 | 30 | summaryList[0].Eac3ToId.Should().Be("1)"); 31 | } 32 | 33 | [Test] 34 | public void bluraysummaryparserservice_can_remove_eac3toid_from_headertext_test() 35 | { 36 | List lineItems = new List 37 | { 38 | new ProcessOutputLineItem() { Id = 1, Text = "1) 00010.mpls, 3:04:31" } 39 | }; 40 | 41 | ILineItemIdentifierService lineItemService = new BluRaySummaryLineItemIdentifierService(); 42 | IBluRaySummaryParserService parserService = new BluRaySummaryParserService(lineItemService, lineItems); 43 | string headerText = parserService.RemoveEac3ToIdFromHeaderLineItem(lineItems[0]); 44 | 45 | headerText.Should().Be("00010.mpls, 3:04:31"); 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/tests/BatchGuy.Unit.Tests/Services/Parser/BluRayTitleLineItemIdentifierServiceTests.cs: -------------------------------------------------------------------------------- 1 | using BatchGuy.App.Enums; 2 | using BatchGuy.App.Parser.Interfaces; 3 | using BatchGuy.App.Parser.Models; 4 | using BatchGuy.App.Parser.Services; 5 | using NUnit.Framework; 6 | using FluentAssertions; 7 | 8 | namespace BatchGuy.Unit.Tests.Services.Parser 9 | { 10 | [TestFixture] 11 | public class BluRayTitleLineItemIdentifierServiceTests 12 | { 13 | [Test] 14 | public void bluraytitlelineitemidentifierservice_can_identify_bluray_header_line_item_test() 15 | { 16 | ProcessOutputLineItem lineItem = new ProcessOutputLineItem() { Id = 1, Text = "M2TS, 1 video track, 1 audio track, 1 subtitle track, 0:58:28, 50i" }; 17 | ILineItemIdentifierService service = new BluRayTitleLineItemIdentifierService(); 18 | EnumBluRayLineItemType type = service.GetLineItemType(lineItem); 19 | type.Should().Be(EnumBluRayLineItemType.BluRayTitleHeaderLine); 20 | } 21 | 22 | [Test] 23 | public void bluraytitlelineitemidentifierservice_can_identify_bluray_chapter_line_item_test() 24 | { 25 | ProcessOutputLineItem lineItem = new ProcessOutputLineItem() { Id = 1, Text = "1: Chapters, 6 chapters" }; 26 | ILineItemIdentifierService service = new BluRayTitleLineItemIdentifierService(); 27 | EnumBluRayLineItemType type = service.GetLineItemType(lineItem); 28 | type.Should().Be(EnumBluRayLineItemType.BluRayTitleChapterLine); 29 | } 30 | 31 | [Test] 32 | public void bluraytitlelineitemidentifierservice_can_identify_bluray_video_line_item_test() 33 | { 34 | ProcessOutputLineItem lineItem = new ProcessOutputLineItem() { Id = 1, Text = "2: h264/AVC, 1080i50 (16:9)" }; 35 | ILineItemIdentifierService service = new BluRayTitleLineItemIdentifierService(); 36 | EnumBluRayLineItemType type = service.GetLineItemType(lineItem); 37 | type.Should().Be(EnumBluRayLineItemType.BluRayTitleVideoLine); 38 | } 39 | 40 | [Test] 41 | public void bluraytitlelineitemidentifierservice_can_identify_bluray_audio_line_item_test() 42 | { 43 | ProcessOutputLineItem lineItem = new ProcessOutputLineItem() { Id = 1, Text = "3: DTS Master Audio, French, 5.1 channels, 24 bits, 48kHz" }; 44 | ILineItemIdentifierService service = new BluRayTitleLineItemIdentifierService(); 45 | EnumBluRayLineItemType type = service.GetLineItemType(lineItem); 46 | type.Should().Be(EnumBluRayLineItemType.BluRayTitleAudioLine); 47 | } 48 | 49 | [Test] 50 | public void bluraytitlelineitemidentifierservice_can_identify_bluray_subtitle_line_item_test() 51 | { 52 | ProcessOutputLineItem lineItem = new ProcessOutputLineItem() { Id = 1, Text = "4: Subtitle (pgs), French" }; 53 | ILineItemIdentifierService service = new BluRayTitleLineItemIdentifierService(); 54 | EnumBluRayLineItemType type = service.GetLineItemType(lineItem); 55 | type.Should().Be(EnumBluRayLineItemType.BluRayTitleSubtitleLine); 56 | } 57 | 58 | [Test] 59 | public void bluraytitlelineitemidentifierservice_can_identify_bluray_empty_line_item_test() 60 | { 61 | ProcessOutputLineItem lineItem = new ProcessOutputLineItem() { Id = 1, Text = "" }; 62 | ILineItemIdentifierService service = new BluRayTitleLineItemIdentifierService(); 63 | EnumBluRayLineItemType type = service.GetLineItemType(lineItem); 64 | type.Should().Be(EnumBluRayLineItemType.BluRayTitleEmptyLine); 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /src/tests/BatchGuy.Unit.Tests/Services/Parser/CommandLineProcessServiceTests.cs: -------------------------------------------------------------------------------- 1 | using BatchGuy.App.Parser.Models; 2 | using BatchGuy.App.Parser.Services; 3 | using NUnit.Framework; 4 | using FluentAssertions; 5 | using BatchGuy.App.Parser.Interfaces; 6 | using BatchGuy.App.Shared.Models; 7 | 8 | namespace BatchGuy.Unit.Tests.Services.Parser 9 | { 10 | [TestFixture] 11 | public class CommandLineProcessServiceTests 12 | { 13 | [Test] 14 | public void commandlineprocessservice_has_no_process_start_info_filename_in_error_test() 15 | { 16 | ICommandLineProcessService service = new CommandLineProcessService(new CommandLineProcessStartInfo() { Arguments = "someargument" }); 17 | ErrorCollection errors = service.Errors; 18 | errors[0].Description.Should().Be("Invalid file name"); 19 | } 20 | 21 | [Test] 22 | public void commandlineprocessservice_has_no_process_start_info_arguments_in_error_test() 23 | { 24 | ICommandLineProcessService service = new CommandLineProcessService(new CommandLineProcessStartInfo() { FileName = "somefilename" }); 25 | ErrorCollection errors = service.Errors; 26 | errors[0].Description.Should().Be("Invalid arguments"); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/tests/BatchGuy.Unit.Tests/Services/Settings/BluRayTitleInfoDefaultSettingsServiceTests.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | using NUnit.Framework; 4 | using FluentAssertions; 5 | using BatchGuy.App.Parser.Models; 6 | using BatchGuy.App.Settings.Models; 7 | using BatchGuy.App.Settings.Interface; 8 | using BatchGuy.App.Settings.Services; 9 | using BatchGuy.App.Shared.Interfaces; 10 | using BatchGuy.App.Shared.Services; 11 | using BatchGuy.App.Shared.Models; 12 | 13 | namespace BatchGuy.Unit.Tests.Services.Settings 14 | { 15 | [TestFixture] 16 | public class BluRayTitleInfoDefaultSettingsServiceTests 17 | { 18 | [Test] 19 | public void bluraytitleinfodefaultsettingsservice_can_mark_all_subtitles_as_selected_as_default_Test() 20 | { 21 | //given 22 | ApplicationSettings applicationSettings = new ApplicationSettings() { BluRayTitleInfoDefaultSettings = new BluRayTitleInfoDefaultSettings() { SelectAllSubtitles = true } }; 23 | BluRaySummaryInfo bluraySummaryInfo = new BluRaySummaryInfo() { BluRayTitleInfo = new BluRayTitleInfo() 24 | { Subtitles = new List() { new BluRayTitleSubtitle() { IsSelected = false }, 25 | new BluRayTitleSubtitle() { IsSelected = false } } } }; 26 | IAudioService audioService = new AudioService(); 27 | IBluRayTitleInfoDefaultSettingsService service = new BluRayTitleInfoDefaultSettingsService(applicationSettings, bluraySummaryInfo, audioService); 28 | //when 29 | service.SetSubtitleDefaultSettings(); 30 | //then 31 | bluraySummaryInfo.BluRayTitleInfo.Subtitles.Where(s => s.IsSelected == true).Count().Should().Be(2); 32 | } 33 | 34 | [Test] 35 | public void bluraytitleinfodefaultsettingsservice_can_mark_all_chapter_as_selected_as_default_Test() 36 | { 37 | //given 38 | ApplicationSettings applicationSettings = new ApplicationSettings() { BluRayTitleInfoDefaultSettings = new BluRayTitleInfoDefaultSettings() { SelectChapters = true} }; 39 | BluRaySummaryInfo bluraySummaryInfo = new BluRaySummaryInfo() { BluRayTitleInfo = new BluRayTitleInfo() { Chapter = new BluRayTitleChapter() { IsSelected = false } } }; 40 | BluRayTitleInfoDefaultSettings defaultSettings = new BluRayTitleInfoDefaultSettings() { SelectChapters = true }; 41 | IAudioService audioService = new AudioService(); 42 | IBluRayTitleInfoDefaultSettingsService service = new BluRayTitleInfoDefaultSettingsService(applicationSettings, bluraySummaryInfo, audioService); 43 | //when 44 | service.SetChaptersDefaultSettings(); 45 | //then 46 | bluraySummaryInfo.BluRayTitleInfo.Chapter.IsSelected.Should().BeTrue(); 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/tests/BatchGuy.Unit.Tests/Services/Shared/CountryCodeServiceTests.cs: -------------------------------------------------------------------------------- 1 | using BatchGuy.App.Shared.Interfaces; 2 | using BatchGuy.App.Shared.Models; 3 | using BatchGuy.App.Shared.Services; 4 | using NUnit.Framework; 5 | using FluentAssertions; 6 | 7 | namespace BatchGuy.Unit.Tests.Services.Shared 8 | { 9 | [TestFixture] 10 | public class CountryCodeServiceTests 11 | { 12 | [Test] 13 | public void countrycodeservice_can_get_country_codes_test() 14 | { 15 | //given 16 | ICountryCodeService service = new CountryCodeService(new JsonSerializationService()); 17 | //when 18 | var countryCodes = service.GetCountryCodes(); 19 | //then 20 | countryCodes.Should().NotBeNull(); 21 | } 22 | 23 | [Test] 24 | public void countrycodeservice_can_get_country_code_by_iso_long_code_test() 25 | { 26 | //given 27 | ICountryCodeService service = new CountryCodeService(new JsonSerializationService()); 28 | string isoLongCode = "PNG"; 29 | //when 30 | var countryCode = service.GetCountryCodeByISOLongCode(isoLongCode); 31 | //then 32 | countryCode.Value.Should().Be("PNG"); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/tests/BatchGuy.Unit.Tests/Services/X264Log/X264LogLineItemIdentifierServiceTests.cs: -------------------------------------------------------------------------------- 1 | using NUnit.Framework; 2 | using FluentAssertions; 3 | using BatchGuy.App.X264Log.Interfaces; 4 | using BatchGuy.App.X264Log.Services; 5 | using BatchGuy.App.Enums; 6 | 7 | namespace BatchGuy.Unit.Tests.Services.X264Log 8 | { 9 | [TestFixture] 10 | public class X264LogLineItemIdentifierServiceTests 11 | { 12 | [Test] 13 | public void x264loglineitemidentifierservice_can_identify_iframe_lineitem_test() 14 | { 15 | //given a iframe line item 16 | string lineItem = "x264 [info]: frame I:417 Avg QP:12.56 size:134237"; 17 | //when i attempt to identify it 18 | IX264LogLineItemIdentifierService service = new X264LogLineItemIdentifierService(); 19 | EnumX264LogLineItemType lineItemType = service.GetLineItemType(lineItem); 20 | //then line item type is iframe 21 | lineItemType.Should().Be(EnumX264LogLineItemType.IFrame); 22 | } 23 | 24 | [Test] 25 | public void x264loglineitemidentifierservice_can_identify_pframe_lineitem_test() 26 | { 27 | //given a pframe line item 28 | string lineItem = "x264 [info]: frame P:14240 Avg QP:14.42 size: 52055"; 29 | //when i attempt to identify it 30 | IX264LogLineItemIdentifierService service = new X264LogLineItemIdentifierService(); 31 | EnumX264LogLineItemType lineItemType = service.GetLineItemType(lineItem); 32 | //then line item type is pframe 33 | lineItemType.Should().Be(EnumX264LogLineItemType.PFrame); 34 | } 35 | 36 | [Test] 37 | public void x264loglineitemidentifierservice_can_identify_bframe_lineitem_test() 38 | { 39 | //given a bframe line item 40 | string lineItem = "x264 [info]: frame B:59868 Avg QP:16.37 size: 19269"; 41 | //when i attempt to identify it 42 | IX264LogLineItemIdentifierService service = new X264LogLineItemIdentifierService(); 43 | EnumX264LogLineItemType lineItemType = service.GetLineItemType(lineItem); 44 | //then line item type is bframe 45 | lineItemType.Should().Be(EnumX264LogLineItemType.BFrame); 46 | } 47 | 48 | [Test] 49 | public void x264loglineitemidentifierservice_can_identify_consecutivebframes_lineitem_test() 50 | { 51 | //given a consecutive b frames line item 52 | string lineItem = "x264 [info]: consecutive B-frames: 1.1% 1.7% 5.0% 8.2% 17.7% 47.3% 11.8% 3.3% 3.8%"; 53 | //when i attempt to identify it 54 | IX264LogLineItemIdentifierService service = new X264LogLineItemIdentifierService(); 55 | EnumX264LogLineItemType lineItemType = service.GetLineItemType(lineItem); 56 | //then line item type is consecutive b frames 57 | lineItemType.Should().Be(EnumX264LogLineItemType.ConsecutiveBFrames); 58 | } 59 | 60 | [Test] 61 | public void x264loglineitemidentifierservice_can_identify_encodedframes_lineitem_test() 62 | { 63 | //given a encoded frames line item 64 | string lineItem = "encoded 74525 frames, 2.48 fps, 5235.46 kb/s"; 65 | //when i attempt to identify it 66 | IX264LogLineItemIdentifierService service = new X264LogLineItemIdentifierService(); 67 | EnumX264LogLineItemType lineItemType = service.GetLineItemType(lineItem); 68 | //then line item type is encode frames 69 | lineItemType.Should().Be(EnumX264LogLineItemType.EncodedFrames); 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /src/tests/BatchGuy.Unit.Tests/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | --------------------------------------------------------------------------------