예제 #1
0
 private void langCode_TextChanged(object sender, EventArgs e)
 {
     if (langCode.TextLength == 3)
     {
         try
         {
             langBox.Text = ISO639_3.GetLanguageName(langCode.Text);
         }
         catch (Exception)
         {
             MessageBox.Show(Localise.GetPhrase("Invalid language code, reverting to <Default> language"), Localise.GetPhrase("Invalid Language Code"));
             langBox.Text = ISO639_3.GetLanguageName("");
         }
     }
     else if (langCode.Text == "")
     {
         langBox.Text = ISO639_3.GetLanguageName("");
     }
 }
예제 #2
0
        /// <summary>
        /// Show the media information
        /// </summary>
        /// <param name="mParams">MediaInfoFormParams object</param>
        public void ShowMediaInfo(object mParams)
        {
            MediaInfoFormParams mediaParams = (MediaInfoFormParams)mParams;
            string    sourceVideo           = mediaParams.sourceVideo;
            MediaInfo mediaInfo             = mediaParams.mediaInfo;
            ToolTip   toolTip = mediaParams.toolTip;

            // Video Name
            mediaSpace.SelectionAlignment = HorizontalAlignment.Center;
            mediaSpace.SelectionFont      = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(2)));
            mediaSpace.AppendText(Path.GetFileName(sourceVideo) + "\n");
            mediaSpace.SelectionFont = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(2)));

            // Video information
            TimeSpan t        = TimeSpan.FromSeconds(mediaInfo.VideoInfo.Duration);
            string   duration = string.Format("{0:D2}h : {1:D2}m : {2:D2}s",
                                              t.Hours,
                                              t.Minutes,
                                              t.Seconds);

            mediaSpace.AppendText("\n");
            mediaSpace.SelectionFont      = new System.Drawing.Font("Microsoft Sans Serif", 8.5F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(2)));
            mediaSpace.SelectionAlignment = HorizontalAlignment.Center;
            mediaSpace.AppendText(Localise.GetPhrase("Video") + "\n");
            mediaSpace.SelectionFont      = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(2)));
            mediaSpace.SelectionAlignment = HorizontalAlignment.Left;
            mediaSpace.AppendText("------------------------------------------------------------------------------");
            mediaSpace.AppendText("\n" + Localise.GetPhrase("Codec") + "\t  :  " + mediaInfo.VideoInfo.VideoCodec);
            mediaSpace.AppendText("\n" + Localise.GetPhrase("Duration") + "\t  :  " + duration);
            mediaSpace.AppendText("\n" + Localise.GetPhrase("Height") + "\t  :  " + mediaInfo.VideoInfo.Height.ToString().Replace("-1", "-"));
            mediaSpace.AppendText("\n" + Localise.GetPhrase("Width") + "\t  :  " + mediaInfo.VideoInfo.Width.ToString().Replace("-1", "-"));
            mediaSpace.AppendText("\n" + Localise.GetPhrase("FPS") + "\t  :  " + mediaInfo.VideoInfo.FPS.ToString(System.Globalization.CultureInfo.InvariantCulture));

            // Audio Information
            if (mediaInfo.AudioInfo != null)
            {
                for (int i = 0; i < mediaInfo.AudioInfo.Count; i++)
                {
                    mediaSpace.AppendText("\n\n");
                    mediaSpace.SelectionFont      = new System.Drawing.Font("Microsoft Sans Serif", 8.5F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(2)));
                    mediaSpace.SelectionAlignment = HorizontalAlignment.Center;
                    mediaSpace.AppendText(Localise.GetPhrase("Audio") + " " + (i + 1).ToString() + "\n");
                    mediaSpace.SelectionFont      = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(2)));
                    mediaSpace.SelectionAlignment = HorizontalAlignment.Left;
                    mediaSpace.AppendText("------------------------------------------------------------------------------");
                    try
                    {
                        mediaSpace.AppendText(Localise.GetPhrase("Language") + " :  " + ISO639_3.GetLanguageName(mediaInfo.AudioInfo[i].Language));
                        if (!String.IsNullOrEmpty(mediaInfo.AudioInfo[i].Language))
                        {
                            mediaSpace.AppendText("  (" + mediaInfo.AudioInfo[i].Language + ")");
                        }
                        if (mediaInfo.AudioInfo[i].Impaired)
                        {
                            mediaSpace.AppendText("  (" + Localise.GetPhrase("Impaired") + ")");
                        }
                    }
                    catch
                    {
                        mediaSpace.AppendText(Localise.GetPhrase("Language") + " :  " + Localise.GetPhrase("Unknown")); // Exception thrown if the language code is not known
                        if (mediaInfo.AudioInfo[i].Impaired)
                        {
                            mediaSpace.AppendText("  (" + Localise.GetPhrase("Impaired") + ")");
                        }
                    }
                    mediaSpace.AppendText("\n" + Localise.GetPhrase("Codec") + "\t :  " + mediaInfo.AudioInfo[i].AudioCodec);
                    mediaSpace.AppendText("\n" + Localise.GetPhrase("Channels") + "  :  " + mediaInfo.AudioInfo[i].Channels.ToString().Replace("-1", "-"));
                }
            }

            // Subtitle Information - no need to show, we don't use it in MCEBuddy
            if (mediaInfo.SubtitleInfo != null)
            {
                for (int i = 0; i < mediaInfo.SubtitleInfo.Count; i++)
                {
                    mediaSpace.AppendText("\n\n");
                    mediaSpace.SelectionFont      = new System.Drawing.Font("Microsoft Sans Serif", 8.5F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(2)));
                    mediaSpace.SelectionAlignment = HorizontalAlignment.Center;
                    mediaSpace.AppendText(Localise.GetPhrase("Subtitle") + " " + (i + 1).ToString() + "\n");
                    mediaSpace.SelectionFont      = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(2)));
                    mediaSpace.SelectionAlignment = HorizontalAlignment.Left;
                    mediaSpace.AppendText("------------------------------------------------------------------------------");

                    try
                    {
                        mediaSpace.AppendText(Localise.GetPhrase("Language") + " :  " + ISO639_3.GetLanguageName(mediaInfo.SubtitleInfo[i].Language));
                        if (!String.IsNullOrEmpty(mediaInfo.SubtitleInfo[i].Language))
                        {
                            mediaSpace.AppendText("  (" + mediaInfo.SubtitleInfo[i].Language + ")");
                        }
                    }
                    catch
                    {
                        mediaSpace.AppendText(Localise.GetPhrase("Language") + " :  " + Localise.GetPhrase("Unknown")); // Exception thrown if the language code is not known
                    }
                    mediaSpace.AppendText("\n" + Localise.GetPhrase("Codec") + "\t :  " + mediaInfo.SubtitleInfo[i].Name);
                }
            }

            mediaSpace.Height = 170 + 78 * (mediaInfo.AudioInfo == null ? 0 : mediaInfo.AudioInfo.Count) + 60 * (mediaInfo.SubtitleInfo == null ? 0 : mediaInfo.SubtitleInfo.Count); // Name+Video 170, Audio 75, Subtitle 60 each
            this.Height       = mediaSpace.Bottom + 10;                                                                                                                              // Window height buffer from edge
            LocaliseForms.LocaliseForm(this, toolTip);                                                                                                                               // Localize the Text
            ShowDialog();
            Focus();

            return;
        }
예제 #3
0
        /// <summary>
        /// Reads the settings from the conversion job options and populates the form
        /// </summary>
        /// <param name="cjo">Refernce to a cjo object, will create a new object if it is null</param>
        private void ReadSettings(ref ConversionJobOptions cjo)
        {
            // Load the languages list
            for (int i = 0; i < ISO639_3.ISOLanguageCodesLength; i++)
            {
                if (!langBox.Items.Contains(ISO639_3.ISOLanguageCodes[i, 2]))
                {
                    langBox.Items.Add(ISO639_3.ISOLanguageCodes[i, 2]);
                }
            }

            profileCbo.Items.Clear(); // We need to clear the list and start over other the "-----" getting messed up
            foreach (string[] profileSummary in StatusForm.profilesSummary)
            {
                profileCbo.Items.Add(profileSummary[0]); // Name of profile
            }

            if (cjo != null)
            {
                taskNameTxt.Text = cjo.taskName;
                if (!_newTask)
                {
                    taskNameTxt.ReadOnly = true; // Mark read only for an existing task
                }
                string profile = cjo.profile;
                if (profileCbo.Items.Contains(profile))
                {
                    profileCbo.SelectedItem = profile;
                }
                else
                {
                    MessageBox.Show(Localise.GetPhrase("Cannot find selected profile in profiles.conf"), Localise.GetPhrase("Profile Error"), MessageBoxButtons.OK, MessageBoxIcon.Error);
                    profileCbo.SelectedIndex = 0;
                }

                destinationPathTxt.Text = cjo.destinationPath;
                string newPath = Util.Net.GetUNCPath(destinationPathTxt.Text);
                if (newPath != destinationPathTxt.Text)
                {
                    destinationPathTxt.Text = newPath;
                }
                setConnectionCredentials.Enabled = (Net.IsUNCPath(newPath));

                maxWidthTxt.Text = cjo.maxWidth.ToString(System.Globalization.CultureInfo.InvariantCulture);

                double qualityMultiplier = cjo.qualityMultiplier;
                qualityBar.Value = QualityToRange(qualityMultiplier);
                UpdateQualityLabel();

                double volumeMultiplier = cjo.volumeMultiplier;
                volumeBar.Value = VolumeToRange(volumeMultiplier);
                UpdateVolumeLabel();

                singleAudioTrackChk.Checked = cjo.encoderSelectBestAudioTrack;

                detectAdsCbo.SelectedIndex = (int)cjo.commercialRemoval;
                if (cjo.commercialRemoval != CommercialRemovalOptions.None) // Only if commercial detection is enabled, we check for commercial skip cutting
                {
                    if (!cjo.renameOnly)
                    {
                        commercialSkipCutChk.Enabled = true;
                    }
                    else
                    {
                        commercialSkipCutChk.Enabled = false;
                    }
                    commercialSkipCutChk.Checked = cjo.commercialSkipCut;
                }
                else
                {
                    commercialSkipCutChk.Enabled = commercialSkipCutChk.Checked = false;
                }

                fileMatchTxt.Text        = cjo.fileSelection;
                metaShowMatchTxt.Text    = cjo.metaShowSelection;
                metaNetworkMatchTxt.Text = cjo.metaNetworkSelection;
                switch (cjo.metaShowTypeSelection)
                {
                case ShowType.Movie:
                    metaShowTypeCbo.SelectedIndex = 1;
                    break;

                case ShowType.Series:
                    metaShowTypeCbo.SelectedIndex = 2;
                    break;

                case ShowType.Sports:
                    metaShowTypeCbo.SelectedIndex = 3;
                    break;

                case ShowType.Default:
                default:
                    metaShowTypeCbo.SelectedIndex = 0;
                    break;     // No show type meta selection
                }

                langBox.Text = ISO639_3.GetLanguageName(cjo.audioLanguage);

                string extractCCOpts = cjo.extractCC;
                if (String.IsNullOrEmpty(extractCCOpts))
                {
                    extractCC.Checked = false;
                }
                else
                {
                    extractCC.Checked = true;
                }

                multiChannelAudioChk.Checked = !cjo.stereoAudio;
                autoDeinterlaceChk.Checked   = cjo.autoDeInterlace;

                addiTunesChk.Checked = cjo.addToiTunes;
                addToWMPChk.Checked  = cjo.addToWMP;

                // Do these in the end since they control other check boxes
                renameOnlyChk.Checked        = cjo.renameOnly;
                altRenameBySeriesChk.Checked = cjo.altRenameBySeries;
                string renamePattern = cjo.customRenameBySeries;
                if (renamePattern != "")
                {
                    customReNamingChk.Checked    = true;
                    customFileRenamePattern.Text = renamePattern;
                }

                renameBySeriesChk.Checked = cjo.renameBySeries; // Last one to be set
            }
            else
            {
                cjo      = new ConversionJobOptions();
                _newTask = true;                                                    // this is a new task and will remain until we hit OK

                profileCbo.SelectedIndex   = 0;                                     // profile
                detectAdsCbo.SelectedIndex = (int)CommercialRemovalOptions.Comskip; // Comskip
                langBox.Text = ISO639_3.GetLanguageName("");
                UpdateVolumeLabel();
                UpdateQualityLabel();
                cjo.altRenameBySeries = cjo.preferHardwareEncoding = cjo.downloadSeriesDetails = cjo.downloadBanner = cjo.writeMetadata = cjo.encoderSelectBestAudioTrack = cjo.drc = true;
                double.TryParse(GlobalDefs.DEFAULT_CC_OFFSET, System.Globalization.NumberStyles.Float, CultureInfo.InvariantCulture, out cjo.ccOffset);
                metaShowTypeCbo.SelectedIndex = 0; // All shows
            }

            CheckNetDrive(false); // No pop up while reading
        }
예제 #4
0
 private void langBox_SelectedIndexChanged(object sender, EventArgs e)
 {
     langCode.Text = ISO639_3.GetLanguageCode(langBox.Text);
 }
예제 #5
0
        /// <summary>
        /// Writes the settings to the cjo object
        /// </summary>
        /// <param name="save">True if you want to save the settings to the Global MCE object</param>
        private void WriteSettings(ConversionJobOptions cjo, bool save)
        {
            cjo.taskName        = taskNameTxt.Text.Trim();
            cjo.profile         = profileCbo.SelectedItem.ToString();
            cjo.destinationPath = destinationPathTxt.Text;
            cjo.addToiTunes     = addiTunesChk.Checked;
            cjo.addToWMP        = addToWMPChk.Checked;
            int.TryParse(maxWidthTxt.Text.ToString(), out cjo.maxWidth);
            cjo.encoderSelectBestAudioTrack = singleAudioTrackChk.Checked;
            cjo.volumeMultiplier            = RangeValToVolume(volumeBar.Value);
            cjo.qualityMultiplier           = RangeValToQuality(qualityBar.Value);
            cjo.commercialRemoval           = (CommercialRemovalOptions)detectAdsCbo.SelectedIndex;
            cjo.commercialSkipCut           = commercialSkipCutChk.Checked;
            cjo.renameBySeries       = renameBySeriesChk.Checked;
            cjo.altRenameBySeries    = altRenameBySeriesChk.Checked;
            cjo.renameOnly           = renameOnlyChk.Checked;
            cjo.fileSelection        = fileMatchTxt.Text;
            cjo.metaShowSelection    = metaShowMatchTxt.Text;
            cjo.metaNetworkSelection = metaNetworkMatchTxt.Text;
            cjo.audioLanguage        = ISO639_3.GetLanguageCode(langBox.Text);
            cjo.stereoAudio          = !multiChannelAudioChk.Checked;
            cjo.autoDeInterlace      = autoDeinterlaceChk.Checked;
            cjo.enabled = true; // By default tasks are enabled

            switch (metaShowTypeCbo.SelectedIndex)
            {
            case 1:
                cjo.metaShowTypeSelection = ShowType.Movie;
                break;

            case 2:
                cjo.metaShowTypeSelection = ShowType.Series;
                break;

            case 3:
                cjo.metaShowTypeSelection = ShowType.Sports;
                break;

            case 0:
            default:
                cjo.metaShowTypeSelection = ShowType.Default;
                break;
            }

            if (detectAdsCbo.SelectedIndex == (int)CommercialRemovalOptions.None) // Write this only if commercial detection is enabled, default is false
            {
                cjo.commercialSkipCut = false;
            }

            if (customReNamingChk.Checked && customFileRenamePattern.Text != "")
            {
                cjo.customRenameBySeries = customFileRenamePattern.Text;
            }
            else
            {
                cjo.customRenameBySeries = "";
            }

            if (extractCC.Checked == false)
            {
                cjo.extractCC = "";
            }

            // SANITY CHECKS:
            if ((detectAdsCbo.SelectedIndex != (int)CommercialRemovalOptions.None) && renameOnlyChk.Checked) // If we are naming only, then we need to ensure CommercialSkipCut is enabled if commercial detection is enabled
            {
                cjo.commercialSkipCut = true;
            }

            if (save) // Are we asked to save them
            {
                _mceOptions.AddOrUpdateConversionTask(cjo, false);
            }
        }