/// <summary> /// checks if the files/folders can be processed as BluRay /// </summary> /// <returns>true if the files/folder can be processed as BluRay, false otherwise</returns> private bool getInputBluRayBased(OneClickSettings oSettings) { string path = Path.Combine(Path.Combine(this.strInput, "BDMV"), "PLAYLIST"); if (!Directory.Exists(path)) { return(false); } ChapterExtractor ex = new BlurayExtractor(); using (frmStreamSelect frm = new frmStreamSelect(ex, SelectionMode.MultiExtended)) { frm.Text = "Select your Titles"; ex.GetStreams(this.strInput); if (frm.ChapterCount == 1 || (frm.ChapterCount > 1 && frm.ShowDialog() == DialogResult.OK)) { List <ChapterInfo> oChapterList = frm.SelectedMultipleChapterInfo; if (oChapterList.Count > 0) { List <OneClickFilesToProcess> arrFilesToProcess = new List <OneClickFilesToProcess>(); MediaInfoFile iFile = null; foreach (ChapterInfo oChapterInfo in oChapterList) { string strFile = this.strInput + @"\BDMV\PLAYLIST\" + oChapterInfo.SourceName; if (iFile == null && File.Exists(strFile)) { iFile = new MediaInfoFile(strFile, ref _log); iFile.recommendIndexer(oSettings.IndexerPriority); } else { arrFilesToProcess.Add(new OneClickFilesToProcess(strFile, 1)); } } if (iFile != null) { oOneClickWindow.setInputData(iFile, arrFilesToProcess); return(true); } else { return(false); } } } } return(false); }
/// <summary> /// checks if the files/folders can be processed as DVD /// </summary> /// <returns>true if the files/folder can be processed as DVD, false otherwise</returns> private bool getInputDVDBased(OneClickSettings oSettings) { string videoIFO; string path; if (File.Exists(this.strInput) && Path.GetExtension(this.strInput).ToLowerInvariant().Equals(".ifo")) { path = Path.GetDirectoryName(this.strInput); videoIFO = this.strInput; } else if (File.Exists(this.strInput) && Path.GetExtension(this.strInput).ToLowerInvariant().Equals(".vob")) { path = Path.GetDirectoryName(this.strInput); if (Path.GetFileName(this.strInput).ToUpper(System.Globalization.CultureInfo.InvariantCulture).Substring(0, 4) == "VTS_") { videoIFO = this.strInput.Substring(0, this.strInput.LastIndexOf("_")) + "_0.IFO"; } else { videoIFO = Path.ChangeExtension(this.strInput, ".IFO"); } if (!File.Exists(videoIFO)) { return(false); } else { this.strInput = videoIFO; } } else if (Directory.Exists(this.strInput) && Directory.GetFiles(this.strInput, "*.ifo").Length > 0) { path = this.strInput; videoIFO = Path.Combine(path, "VIDEO_TS.IFO"); } else if (Directory.Exists(Path.Combine(this.strInput, "VIDEO_TS")) && Directory.GetFiles(Path.Combine(this.strInput, "VIDEO_TS"), "*.IFO").Length > 0) { path = Path.Combine(this.strInput, "VIDEO_TS"); videoIFO = Path.Combine(path, "VIDEO_TS.IFO"); } else { return(false); } ChapterExtractor ex = new DvdExtractor(); using (frmStreamSelect frm = new frmStreamSelect(ex, SelectionMode.MultiExtended)) { frm.Text = "Select your Titles"; ex.GetStreams(this.strInput); if (frm.ChapterCount == 1 || (frm.ChapterCount > 1 && frm.ShowDialog() == DialogResult.OK)) { List <ChapterInfo> oChapterList = frm.SelectedMultipleChapterInfo; if (oChapterList.Count > 0) { List <OneClickFilesToProcess> arrFilesToProcess = new List <OneClickFilesToProcess>(); MediaInfoFile iFile = null; int iTitleNumber = 1; foreach (ChapterInfo oChapterInfo in oChapterList) { string strVOBFile = Path.Combine(path, oChapterInfo.Title + "_1.VOB"); if (iFile == null && File.Exists(strVOBFile)) { MediaInfoFile iFileTemp = new MediaInfoFile(strVOBFile, ref _log, oChapterInfo.TitleNumber); if (iFileTemp.recommendIndexer(oSettings.IndexerPriority, false)) { iFile = iFileTemp; iTitleNumber = oChapterInfo.TitleNumber; } else { _log.LogEvent(strVOBFile + " cannot be processed as no indexer can be used. skipping..."); } } else { arrFilesToProcess.Add(new OneClickFilesToProcess(strVOBFile, oChapterInfo.TitleNumber)); } } if (iFile != null) { oOneClickWindow.setInputData(iFile, arrFilesToProcess); return(true); } else { return(false); } } } } return(false); }
/// <summary> /// checks if the files/folders can be processed as DVD/Blu-ray /// </summary> /// <returns>true if the files/folder can be processed as DVD or Blu-ray, false otherwise</returns> private bool getInputDVDorBlurayBased(OneClickSettings oSettings) { if (FileUtil.RegExMatch(this.strInput, @"\\playlist\\\d{5}\.mpls\z", true)) { // mpls file selected - if Blu-ray structure exists, the playlist will be directly openend string checkFolder = Path.Combine(Path.GetDirectoryName(Path.GetDirectoryName(this.strInput)), "STREAM"); if (Directory.Exists(checkFolder) && Directory.GetFiles(checkFolder, "*.m2ts").Length > 0) { return(false); } } using (frmStreamSelect frm = new frmStreamSelect(this.strInput, SelectionMode.MultiExtended)) { // check if playlists have been found if (frm.TitleCount == 0) { return(false); } // only continue if a DVD or Blu-ray structure is found if (!frm.IsDVDOrBluraySource) { return(false); } // open the selection window DialogResult dr = DialogResult.OK; dr = frm.ShowDialog(); if (dr != DialogResult.OK) { // abort as the user clicked not on OK this._bAbort = true; return(false); } // check how many playlists have been selected List <ChapterInfo> oChapterList = frm.SelectedMultipleChapterInfo; if (oChapterList.Count == 0) { return(false); } List <OneClickFilesToProcess> arrFilesToProcess = new List <OneClickFilesToProcess>(); MediaInfoFile iFile = null; foreach (ChapterInfo oChapterInfo in oChapterList) { string strSourceFile = string.Empty; if (frm.IsDVDSource) { strSourceFile = Path.Combine(Path.GetDirectoryName(oChapterInfo.SourceFilePath), oChapterInfo.Title + "_1.VOB"); } else { strSourceFile = oChapterInfo.SourceFilePath; } if (!File.Exists(strSourceFile)) { _log.LogEvent(strSourceFile + " cannot be found. skipping..."); continue; } if (iFile == null) { MediaInfoFile iFileTemp = new MediaInfoFile(strSourceFile, ref _log, frm.IsDVDSource ? oChapterInfo.PGCNumber : 1, frm.IsDVDSource ? oChapterInfo.AngleNumber : 0); if (iFileTemp.recommendIndexer(oSettings.IndexerPriority)) { iFile = iFileTemp; } else { _log.LogEvent(strSourceFile + " cannot be processed as no indexer can be used. skipping..."); } } else { arrFilesToProcess.Add(new OneClickFilesToProcess(strSourceFile, frm.IsDVDSource ? oChapterInfo.PGCNumber : 1, frm.IsDVDSource ? oChapterInfo.AngleNumber : 0)); } } if (iFile != null) { oOneClickWindow.setInputData(iFile, arrFilesToProcess); return(true); } else { return(false); } } }