Beispiel #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("");
     }
 }
Beispiel #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;
        }
Beispiel #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
        }