private void DisplayeEventLog()
        {
            eventList.ListViewItemSorter = null; // Clear the sorter function to speed it up, else it sorts while adding
            eventList.Items.Clear();             // Clear the history

            foreach (EventLogEntry eventLogEntry in _eventLogEntries)
            {
                string message = "";

                foreach (string msg in eventLogEntry.ReplacementStrings)
                {
                    message += msg + "\n";
                }

                string[] evItem = new string[eventList.Columns.Count];                            // create list of Event Log entries
                evItem[eventList.Columns["type"].Index]     = eventLogEntry.EntryType.ToString(); // Type
                evItem[eventList.Columns["dateTime"].Index] = eventLogEntry.TimeGenerated.ToString("d-MMM-yyyy   h:mm tt", System.Globalization.CultureInfo.InvariantCulture);
                evItem[eventList.Columns["summary"].Index]  = message;
                eventList.Items.Add(new ListViewItem(evItem));
            }

            this.Text = Localise.GetPhrase("MCEBuddy Windows Event Log Viewer") + " - " + eventList.Items.Count + " " + Localise.GetPhrase("Entries");
            eventList.ListViewItemSorter = Sorter; // Set the sorter function
            Sorter.SortColumn            = 1;      // We need to sort by Date/Time
            Sorter.Order = SortOrder.Descending;   // We want to sort by latest logs first
            eventList.Sort();                      // Sort the logs
        }
        protected override void SetAudioLanguage()
        {
            // First clear any audio track selection if asked
            if (_encoderChooseBestAudioTrack) // We let the encoder choose the best audio track
            {
                _jobLog.WriteEntry(this, "Letting handbrake choose best audio track", Log.LogEntryType.Information);
                ParameterValueDelete("-a"); // Delete this parameter, let handbrake choose the best audio track
            }

            if (_videoFile.AudioTrack == -1)
            {
                _jobLog.WriteEntry(this, Localise.GetPhrase("Cannot get Audio and Video stream details, continuing with default Audio Language selection"), Log.LogEntryType.Warning);
            }
            else
            {
                // We need to compensate for zero channel audio tracks, which are ignored by handbrake
                // Cycle through and skip over zero channel tracks until we get the track we need
                int audioTrack = 1; // Baseline audio track for Handbrake is 1
                for (int i = 0; i < _videoFile.FFMPEGStreamInfo.AudioTracks; i++)
                {
                    if (_videoFile.AudioTrack == i) // We have reached the selected audio track limit
                    {
                        break;
                    }

                    if (_videoFile.FFMPEGStreamInfo.MediaInfo.AudioInfo[i].Channels != 0) // skip over 0 channel tracks until we reach the selected audio track
                    {
                        audioTrack++;
                    }
                }

                _jobLog.WriteEntry(this, "Selecting audio (normalized) track " + audioTrack.ToString(), Log.LogEntryType.Information);
                ParameterValueReplaceOrInsert("-a", audioTrack.ToString(System.Globalization.CultureInfo.InvariantCulture)); // Select the Audiotrack we had isolated earlier (1st Audio track is 1, FFMPEGStreamInfo is 0 based)
            }
        }
        private bool CheckValidEntries()
        {
            for (int i = 0; i < rowCount; i++)
            {
                string originalTitle  = ((TextBox)this.Controls.Find("originalTitleTxt" + i.ToString(), true)[0]).Text;
                string correctedTitle = ((TextBox)this.Controls.Find("correctedTitleTxt" + i.ToString(), true)[0]).Text;
                string tvdbSeriesId   = ((TextBox)this.Controls.Find("tvdbSeriesId" + i.ToString(), true)[0]).Text;
                string imdbSeriesId   = ((TextBox)this.Controls.Find("imdbSeriesId" + i.ToString(), true)[0]).Text;

                if (rowCount > 1) // If we have more than one entry, either enter a Corrected Title or enter a Series Id and MUST enter an original title
                {
                    if (String.IsNullOrWhiteSpace(originalTitle) ||
                        (String.IsNullOrWhiteSpace(correctedTitle) && String.IsNullOrWhiteSpace(tvdbSeriesId) && String.IsNullOrWhiteSpace(imdbSeriesId)) ||
                        (!String.IsNullOrWhiteSpace(correctedTitle) && (!String.IsNullOrWhiteSpace(tvdbSeriesId) || !String.IsNullOrWhiteSpace(imdbSeriesId))))
                    {
                        MessageBox.Show(Localise.GetPhrase("For each row, please enter the Original title to match the show name AND either a Corrected title or a TVDB/IMDB Series ID"), Localise.GetPhrase("Error"));
                        return(false);
                    }
                }
                else // We have only one entry, either enter a corrected title or a series id (original title is optional)
                {
                    if ((String.IsNullOrWhiteSpace(correctedTitle) && String.IsNullOrWhiteSpace(tvdbSeriesId) && String.IsNullOrWhiteSpace(imdbSeriesId)) ||
                        (!String.IsNullOrWhiteSpace(correctedTitle) && (!String.IsNullOrWhiteSpace(tvdbSeriesId) || !String.IsNullOrWhiteSpace(imdbSeriesId))))
                    {
                        MessageBox.Show(Localise.GetPhrase("Please enter either a Corrected title or a TVDB/IMDB Series ID"), Localise.GetPhrase("Error"));
                        return(false);
                    }
                }
            }

            return(true); // All good
        }
Esempio n. 4
0
        private void reconvertFileBtn_Click(object sender, EventArgs e)
        {
            if (showHistoryList.SelectedItems.Count == 0)
            {
                return;
            }

            if (MessageBox.Show(Localise.GetPhrase("Are you sure you want to reconvert the selected files?"),
                                Localise.GetPhrase("Reconvert files"),
                                MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == System.Windows.Forms.DialogResult.Yes)
            {
                foreach (ListViewItem item in showHistoryList.SelectedItems)
                {
                    try
                    {
                        _pipeProxy.DeleteHistoryItem(item.Text);
                    }
                    catch (Exception e1)
                    {
                        MessageBox.Show(Localise.GetPhrase("Unable to communicate with engine."), Localise.GetPhrase("Communication Error"), MessageBoxButtons.OK, MessageBoxIcon.Error);
                        Log.WriteSystemEventLog(Localise.GetPhrase("MCEBuddy GUI: Unable to clear History File"), EventLogEntryType.Warning);
                        Log.WriteSystemEventLog(e1.ToString(), EventLogEntryType.Warning);
                    }
                }

                // Reload form
                GetAndDisplayHistoryLog();
            }
        }
Esempio n. 5
0
        private void testSettings_Click(object sender, EventArgs e)
        {
            // Validate settings
            if (CheckSettings() == false)
            {
                return;
            }

            GeneralOptions go = _go.Clone(); // Create a temporary object to test with

            WriteSettings(go);               // Update the temp GO object with the test settings, only testing it so we don't need to write main object

            if (MessageBox.Show(Localise.GetPhrase("MCEBuddy will send an eMail to test the server settings.\r\nThis can take upto 60 seconds.\r\nMCEBuddy may be unresponsive during this period."),
                                Localise.GetPhrase("Test eMail"),
                                MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Cancel)
            {
                return;
            }


            // Disable the control except for Ok and Cancel
            foreach (Control ctl in this.Controls)
            {
                ctl.Enabled = false;
            }
            oKcmd.Enabled = cmdCancel.Enabled = true;

            testSettings.Text        = Localise.GetPhrase("Testing");
            _testThread              = new Thread(() => eMail_SendTest(go)); // Send the eMail through a thead
            _testThread.IsBackground = true;                                 // Kill thread when object terminates
            _testThread.Start();
        }
Esempio n. 6
0
        private void disableToolStripMenuItem_Click(object sender, EventArgs e)
        {
            int enabledCount = 0;

            foreach (ListViewItem item in taskListLv.Items)
            {
                if (_mceOptions.GetConversionTaskByName(item.SubItems[0].Text).enabled)
                {
                    enabledCount++;
                }
            }

            // Cannot disable all conversion tasks
            if (enabledCount <= 1)
            {
                MessageBox.Show(Localise.GetPhrase("Atleast one Conversion Task must be enabled"), Localise.GetPhrase("Conversion Task"));
                return;
            }

            string selectedTaskName  = taskListLv.SelectedItems[0].SubItems[0].Text;
            ConversionJobOptions cjo = _mceOptions.GetConversionTaskByName(selectedTaskName);

            // Set it to disable in the config file
            cjo.enabled = false;
            _mceOptions.AddOrUpdateConversionTask(cjo, false);

            // Change the color
            taskListLv.SelectedItems[0].ForeColor = Color.LightGray;
        }
Esempio n. 7
0
        private void deleteConvertedChk_CheckedChanged(object sender, EventArgs e)
        {
            if (loading) // nothing to do if the form is loading
            {
                return;
            }

            if (deleteConvertedChk.Checked)
            {
                DialogResult result =
                    MessageBox.Show(
                        Localise.GetPhrase("Do you wish MCEBuddy to delete each converted file when the original file has been deleted?"),
                        Localise.GetPhrase("Confirm sync conversions?"),
                        MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
                if (result == DialogResult.Yes)
                {
                    deleteConvertedChk.Checked = true;
                    deleteOriginalChk.Checked  = archiveOriginalChk.Checked = false; //only delete or archive can be checked at a time
                }
                else
                {
                    deleteConvertedChk.Checked = false;
                }
            }
        }
Esempio n. 8
0
        private void deleteConversionTaskCmd_Click(object sender, EventArgs e)
        {
            if (taskListLv.SelectedItems.Count > 0)
            {
                int enabledCount = 0;

                foreach (ListViewItem item in taskListLv.Items)
                {
                    if (_mceOptions.GetConversionTaskByName(item.SubItems[0].Text).enabled)
                    {
                        enabledCount++;
                    }
                }

                // Cannot disable/delete all conversion tasks, if we are deleting a disabled task no issues (disable click handler will handle not allowing all tasks to be disabled)
                if (enabledCount <= 1 && _mceOptions.GetConversionTaskByName(taskListLv.SelectedItems[0].SubItems[0].Text).enabled)
                {
                    MessageBox.Show(Localise.GetPhrase("Atleast one Conversion Task must be enabled"), Localise.GetPhrase("Delete Task"));
                    return;
                }

                if (MessageBox.Show(
                        Localise.GetPhrase("Are you sure you want to delete this task?"),
                        Localise.GetPhrase("Delete Task"),
                        MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
                {
                    string selectedTaskName = taskListLv.SelectedItems[0].SubItems[0].Text;
                    _mceOptions.DeleteConversionTask(selectedTaskName, false);
                    ReadConversionTaskSettings();
                }
            }
        }
Esempio n. 9
0
        void eMail_SendTest(GeneralOptions go)
        {
            bool success = false;

            try
            {
                success = _pipeProxy.TestEmailSettings(go.eMailSettings.eMailBasicSettings);

                if (!success)
                {
                    MessageBox.Show(Localise.GetPhrase("Send eMail test failed! Please check your settings and internet connectivity"), Localise.GetPhrase("Test eMail Failed"));
                }
                else
                {
                    MessageBox.Show(Localise.GetPhrase("Send eMail test successful"), Localise.GetPhrase("Test eMail Success"));
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(Localise.GetPhrase("Unable to communicate with engine."), Localise.GetPhrase("Communication Error"), MessageBoxButtons.OK, MessageBoxIcon.Error);
                Log.WriteSystemEventLog(Localise.GetPhrase("MCEBuddy GUI: Unable to get pipe active status"), EventLogEntryType.Warning);
                Log.WriteSystemEventLog(e.ToString(), EventLogEntryType.Warning);
            }

            // Enable the controls
            foreach (Control ctl in this.Controls)
            {
                ctl.Enabled = true;
            }

            testSettings.Text = Localise.GetPhrase("Test");

            _testThread = null; // This is done
        }
        /// <summary>
        /// Write the EDL Box data to the EDL File
        /// </summary>
        /// <param name="edlFile">EdlFile to write to</param>
        /// <returns>True if successful</returns>
        private bool WriteEDL(string edlFile)
        {
            try
            {
                // Create an EDL File
                string edlEntries = "";
                foreach (CutStartEnd cut in edlCuts.Items)
                {
                    edlEntries += TimeSpan.ParseExact(cut.CutStart, @"hh\:mm\:ss\.fff", CultureInfo.InvariantCulture).TotalSeconds.ToString("0.000", CultureInfo.InvariantCulture) + "\t" + TimeSpan.ParseExact(cut.CutEnd, @"hh\:mm\:ss\.fff", CultureInfo.InvariantCulture).TotalSeconds.ToString("0.000", CultureInfo.InvariantCulture) + "\t" + "0" + "\r\n";
                }

                // Write to EDL file
                if (!String.IsNullOrWhiteSpace(edlEntries))                                      // Check if these is something to write
                {
                    System.IO.File.WriteAllText(edlFile, edlEntries, System.Text.Encoding.UTF8); // UTF format
                    MessageBox.Show(Localise.GetPhrase("Commercial cuts saved to EDL file") + "\r\n" + edlFile, Localise.GetPhrase("Save Complete"), MessageBoxButton.OK, MessageBoxImage.Information);
                    _savedEDLCuts = true;                                                        // We saved it
                }

                return(true);
            }
            catch (Exception e)
            {
                MessageBox.Show(Localise.GetPhrase("Error saving commercial cuts to EDL file") + "\r\n" + edlFile + "\r\n" + "Error : " + e.ToString(), Localise.GetPhrase("Save Error"), MessageBoxButton.OK, MessageBoxImage.Error);
                return(false);
            }
        }
        private bool ValidateSettings()
        {
            if (GetProcessorAffinityMask() == (IntPtr)(-1))
            {
                MessageBox.Show(Localise.GetPhrase("Select atleast one processor to use"), Localise.GetPhrase("Invalid Configuration"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return(false);
            }

            if (String.IsNullOrWhiteSpace(pollPeriodTxt.Text) || (pollPeriodTxt.Text == "0"))
            {
                MessageBox.Show(Localise.GetPhrase("Invalid poll period"), Localise.GetPhrase("Invalid Configuration"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return(false);
            }

            if (String.IsNullOrWhiteSpace(serverPortTxt.Text) || (serverPortTxt.Text == "0"))
            {
                MessageBox.Show(Localise.GetPhrase("Invalid server port"), Localise.GetPhrase("Invalid Configuration"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return(false);
            }

            if (!String.IsNullOrWhiteSpace(customProfileTxt.Text) && !File.Exists(customProfileTxt.Text))
            {
                MessageBox.Show(Localise.GetPhrase("Invalid custom profiles.conf"), Localise.GetPhrase("Invalid Configuration"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return(false);
            }

            return(true);
        }
        private void monitorConvertedChk_CheckedChanged(object sender, EventArgs e)
        {
            if (_loading) // nothing to do if the form is loading
            {
                return;
            }

            if (monitorConvertedChk.Checked)
            {
                DialogResult result =
                    MessageBox.Show(
                        Localise.GetPhrase("CHECK THIS BOX AT YOUR OWN RISK.\r\nDO NOT CHECK THIS BOX UNLESS YOU KNOW WHAT YOU ARE DOING.\r\nBy default Monitor Locations will ignore files that have already been converted.\r\nCheck this box if you also want to monitor converted files in the Monitor Path."),
                        Localise.GetPhrase("Are you sure you want to do this?"),
                        MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2);
                if (result == DialogResult.Yes)
                {
                    MessageBox.Show(
                        Localise.GetPhrase("To avoid an infinite conversion loop, it is recommended to setup your Monitor search pattern in a way such as to ensure that the converted files are not being monitored by this Monitor task."),
                        Localise.GetPhrase("Recommendation"),
                        MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    monitorConvertedChk.Checked = true;
                }
                else
                {
                    monitorConvertedChk.Checked = false;
                }
            }
        }
        private void reMonitorChk_CheckedChanged(object sender, EventArgs e)
        {
            if (_loading) // nothing to do if the form is loading
            {
                return;
            }

            if (reMonitorRecordedChk.Checked)
            {
                DialogResult result =
                    MessageBox.Show(
                        Localise.GetPhrase("CHECK THIS BOX AT YOUR OWN RISK.\r\nDO NOT CHECK THIS BOX UNLESS YOU KNOW WHAT YOU ARE DOING.\r\nBy default Monitor Locations will not remonitor recorded videos that have been processed.\r\nCheck this box if you want to remonitor and reconvert the recorded videos."),
                        Localise.GetPhrase("Are you sure you want to do this?"),
                        MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2);
                if (result == DialogResult.Yes)
                {
                    MessageBox.Show(
                        Localise.GetPhrase("To avoid an infinite conversion loop, it is recommended that you enable Delete original file option in the Settings page."),
                        Localise.GetPhrase("Recommendation"),
                        MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    reMonitorRecordedChk.Checked = true;
                }
                else
                {
                    reMonitorRecordedChk.Checked = false;
                }
            }
        }
        private void deleteOriginalChk_CheckedChanged(object sender, EventArgs e)
        {
            if (_loading) // nothing to do if the form is loading
            {
                return;
            }

            if (deleteOriginalChk.Checked)
            {
                DialogResult result =
                    MessageBox.Show(
                        Localise.GetPhrase("Only select this option if MCEBuddy has been converting your files reliably for an acceptable period of time. Do you wish MCEBuddy to delete each original file once it has been converted?"),
                        Localise.GetPhrase("Confirm delete originals?"),
                        MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
                if (result == DialogResult.Yes)
                {
                    deleteOriginalChk.Checked  = true;
                    archiveOriginalChk.Checked = false; //only delete or archive can be checked at a time
                }
                else
                {
                    deleteOriginalChk.Checked = false;
                }
            }
        }
Esempio n. 15
0
        private void conversionCbo_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (profileCbo.SelectedItem.ToString().Contains("-----"))
            {
                MessageBox.Show(Localise.GetPhrase("Please select a valid profile"), Localise.GetPhrase("Invalid Profile"));
                profileCbo.SelectedIndex = 0;
                return;
            }

            foreach (string[] profileSummary in StatusForm.profilesSummary)
            {
                if (profileCbo.SelectedItem.ToString() == profileSummary[0])
                {
                    conversionDescriptionTxt.Text = profileSummary[1];

                    // Check if we need scroll bars
                    Size tS = TextRenderer.MeasureText(conversionDescriptionTxt.Text, conversionDescriptionTxt.Font, new Size(conversionDescriptionTxt.Width, int.MaxValue), (TextFormatFlags.WordBreak | TextFormatFlags.TextBoxControl));

                    if (tS.Height > conversionDescriptionTxt.Height)
                    {
                        conversionDescriptionTxt.ScrollBars = ScrollBars.Vertical;
                    }
                    else
                    {
                        conversionDescriptionTxt.ScrollBars = ScrollBars.None;
                    }

                    return;
                }
            }
        }
 private void playStopCmd_Click(object sender, RoutedEventArgs e)
 {
     // Cut button is disabled while playing and enabled while paused
     if (!_playing) // Play
     {
         if (mediaPlayer.Position >= _totalVideoTime)
         {
             return; // We are at the end
         }
         playStopCmd.Content        = Localise.GetPhrase("Pause");
         cutStartCmd.IsEnabled      = cutEndCmd.IsEnabled = false;
         mediaPlayer.LoadedBehavior = MediaState.Manual;
         mediaPlayer.Play();
         _sliderUpdateTimer.Start();
         _playing = true;
     }
     else // Pause
     {
         mediaPlayer.LoadedBehavior = MediaState.Manual;
         mediaPlayer.Pause();
         _sliderUpdateTimer.Stop();
         playStopCmd.Content   = Localise.GetPhrase("Play");
         cutStartCmd.IsEnabled = (StartCut < 0);
         cutEndCmd.IsEnabled   = !(StartCut < 0);
         _playing = false;
     }
 }
Esempio n. 17
0
        private void OKButton_Click(object sender, EventArgs e)
        {
            DomainCheck();

            if (passwordTxt.Text != confirmPasswordTxt.Text)
            {
                MessageBox.Show(Localise.GetPhrase("Passwords do not match, please reenter the passwords"), Localise.GetPhrase("Password Mismatch"));
                return;
            }

            if (object.ReferenceEquals(options.GetType(), (new MonitorJobOptions()).GetType())) // Check type of object
            {
                MonitorJobOptions mjo = (MonitorJobOptions)options;
                mjo.domainName = domainNameTxt.Text.Trim();
                mjo.userName   = userNameTxt.Text.Trim();
                mjo.password   = passwordTxt.Text;
            }
            else if (object.ReferenceEquals(options.GetType(), (new ConversionJobOptions()).GetType())) // Check type of object
            {
                ConversionJobOptions cjo = (ConversionJobOptions)options;
                cjo.domainName           = domainNameTxt.Text.Trim();
                cjo.userName             = userNameTxt.Text.Trim();
                cjo.password             = passwordTxt.Text;
                cjo.fallbackToSourcePath = fallbackToSourceChk.Checked;
            }
            else if (object.ReferenceEquals(options.GetType(), (new GeneralOptions()).GetType())) // Check type of object
            {
                GeneralOptions go = (GeneralOptions)options;
                go.domainName = domainNameTxt.Text.Trim();
                go.userName   = userNameTxt.Text.Trim();
                go.password   = passwordTxt.Text;
            }

            this.Close();
        }
Esempio n. 18
0
        private bool CheckValidTimes()
        {
            // Check if atleast one day of the week is enabled
            if (!(sunChk.Checked || monChk.Checked || tueChk.Checked || wedChk.Checked || thuChk.Checked || friChk.Checked || satChk.Checked))
            {
                MessageBox.Show(Localise.GetPhrase("Atleast one day of the week must be enabled"), Localise.GetPhrase("Invalid Days of Week"));
                return(false);
            }

            // check if any of the times aren't entered
            if (((wakeCheck.Checked || startCheck.Checked) && ("" == wakeHourCbo.Text || "" == wakeMinuteCbo.Text || "" == wakeAMPMCbo.Text)) || ((stopChk.Checked) && ("" == stopHourCbo.Text || "" == stopMinuteCbo.Text || "" == stopAMPMCbo.Text)))
            {
                MessageBox.Show(Localise.GetPhrase("Please enter a valid time"), Localise.GetPhrase("Invalid Time"));
                return(false);
            }

            if (stopChk.Enabled) // check if end time > start time
            {
                DateTime rn        = DateTime.Now;
                DateTime startTime = new DateTime(rn.Year, rn.Month, rn.Day, GetHour(wakeHourCbo, wakeAMPMCbo), int.Parse(wakeMinuteCbo.Text), 0);
                DateTime endTime   = new DateTime(rn.Year, rn.Month, rn.Day, GetHour(stopHourCbo, stopAMPMCbo), int.Parse(stopMinuteCbo.Text), 0);

                if (startTime >= endTime)
                {
                    if (MessageBox.Show(Localise.GetPhrase("Stop time is after Start time. Assuming the Stop time is during the next day, is that correct?"),
                                        Localise.GetPhrase("Time Check"),
                                        MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == System.Windows.Forms.DialogResult.No)
                    {
                        return(false);
                    }
                }
            }

            return(true);
        }
Esempio n. 19
0
        /// <summary>
        /// Renames and moved the Remuxed file
        /// </summary>
        /// <returns></returns>
        private bool ReplaceTempRemuxed()
        {
            string newName = Path.Combine(_workingPath, Path.GetFileNameWithoutExtension(_originalFile) + _remuxTo);

            _jobLog.WriteEntry(this, Localise.GetPhrase("Changing rexumed file names") + " \nOriginalFile : " + _originalFile + " \nReMuxedFile : " + RemuxedTempFile + " \nConvertedFile : " + newName, Log.LogEntryType.Debug);
            try
            {
                FileIO.TryFileDelete(newName);                              // Incase it exists, delete it
                FileIO.MoveAndInheritPermissions(RemuxedTempFile, newName); // Change the name of the remuxed file

                // If the original file is in the working temp directory, then delete it
                if (Path.GetDirectoryName(_originalFile).ToLower() == _workingPath.ToLower())
                {
                    Util.FileIO.TryFileDelete(_originalFile);
                }

                _remuxedFile = newName; // Point it to the renamed file
            }
            catch (Exception e)
            {
                _jobLog.WriteEntry(this, Localise.GetPhrase("Unable to move remuxed file") + " " + RemuxedTempFile + "\r\nError : " + e.ToString(), Log.LogEntryType.Error);
                _jobStatus.ErrorMsg           = "Unable to move remux file";
                _jobStatus.PercentageComplete = 0;
                return(false);
            }

            return(true);
        }
Esempio n. 20
0
        protected override void SetAudioLanguage()
        {
            // First clear any audio track selection if asked
            if (_encoderChooseBestAudioTrack) // Nothing to do here, Mencoder does not support multiple audio tracks
            {
                _jobLog.WriteEntry(this, "Letting mencoder choose best audio track: Nothing to do, mencoder does not support multiple audio tracks", Log.LogEntryType.Debug);
            }

            if (_videoFile.AudioPID == -1)
            {
                _jobLog.WriteEntry(this, Localise.GetPhrase("Cannot get Audio and Video stream details, continuing with default Audio Language selection"), Log.LogEntryType.Warning);
            }
            else
            {
                if (String.IsNullOrWhiteSpace(ParameterValue("-aid")))
                {
                    _jobLog.WriteEntry(this, "Selecting audio PID " + _videoFile.AudioPID.ToString(), Log.LogEntryType.Information);
                    ParameterValueReplaceOrInsert("-aid", (_videoFile.AudioPID).ToString(System.Globalization.CultureInfo.InvariantCulture)); // Select the Audio track PID we had isolated earlier
                }
                else
                {
                    _jobLog.WriteEntry(this, Localise.GetPhrase("User has specified Audio language selection in profile, continuing without Audio Language selection"), Log.LogEntryType.Warning);
                }
            }
        }
Esempio n. 21
0
        protected override void SetVideoCropping()
        {
            if (!_skipCropping)
            {
                if (ParameterValue("-ovc") == "copy") // For copy video stream don't set video prcoessing parameters, it can break the conversion
                {
                    _jobLog.WriteEntry(this, "Video Copy codec detected, skipping cropping", Log.LogEntryType.Warning);
                    return;
                }

                // Check if we need to run cropping
                if (String.IsNullOrEmpty(_videoFile.CropString))
                {
                    _jobStatus.CurrentAction = Localise.GetPhrase("Analyzing video information");
                    _videoFile.UpdateCropInfo(_jobLog);
                }

                // Check if we have a valid crop string
                if (!String.IsNullOrWhiteSpace(_videoFile.CropString))
                {
                    ParameterReplaceOrInsertVideoFilter("crop", "=" + _videoFile.CropString);
                    _jobLog.WriteEntry(this, Localise.GetPhrase("MEncoder setting up video cropping"), Log.LogEntryType.Information);
                }
                else
                {
                    _jobLog.WriteEntry(this, Localise.GetPhrase("MEncoder found no video cropping"), Log.LogEntryType.Information);
                }
            }
            else
            {
                _jobLog.WriteEntry(this, Localise.GetPhrase("MEncoder Skipping video cropping"), Log.LogEntryType.Information);
            }
        }
        private void mediaPlayer_MediaFailed(object sender, ExceptionRoutedEventArgs e)
        {
            ResetMediaOpenButton();

            CheckAndStopPlay(); // If we are playing something first stop it

            MessageBox.Show(Localise.GetPhrase("Failed to load media file") + ", error:\r\n" + e.ErrorException, Localise.GetPhrase("Media Load Error"), MessageBoxButton.OK, MessageBoxImage.Error);
        }
        private void mediaLoadTimer_Tick(object sender, EventArgs e)
        {
            // If the media is not loaded by now abort
            if (!openMediaCmd.IsEnabled)
            {
                MessageBox.Show(Localise.GetPhrase("Failed to load media file"), Localise.GetPhrase("Media Load Error"), MessageBoxButton.OK, MessageBoxImage.Error);
                ResetMediaOpenButton();
            }

            _mediaLoadTimer.Stop(); // Stop the timer
        }
Esempio n. 24
0
        private void startCheck_CheckedChanged(object sender, EventArgs e)
        {
            CheckButtons();

            if (!loading)
            {
                if (startCheck.Checked || wakeCheck.Checked)
                {
                    MessageBox.Show(Localise.GetPhrase("Make sure you press 'Start' after closing this window, otherwise Scheduling and Wake will not work."), Localise.GetPhrase("Enabling Scheduling and Wake"), MessageBoxButtons.OK);
                }
            }
        }
Esempio n. 25
0
        private void OKButton_Click(object sender, EventArgs e)
        {
            if (engineNameTxt.Text == "" || portNoTxt.Text == "")
            {
                MessageBox.Show(Localise.GetPhrase("Please enter a valid Engine Name and Engine Port Number"), Localise.GetPhrase("Invalid Name/Port"));
                return;
            }

            Ini tempIni = new Ini(GlobalDefs.TempSettingsFile);

            tempIni.Write("Engine", "RemoteServerName", engineNameTxt.Text.Trim());
            tempIni.Write("Engine", "RemoteServerPort", portNoTxt.Text.Trim());
        }
        private void makKey_TextChanged(object sender, KeyPressEventArgs e)
        {
            if (!char.IsControl(e.KeyChar) && !char.IsDigit(e.KeyChar))
            {
                e.Handled = true;
            }

            if (char.IsDigit(e.KeyChar) && makKey.Text.Length >= 10)
            {
                MessageBox.Show(Localise.GetPhrase("The TiVO MAK key should be 10 digits"), Localise.GetPhrase("Invalid TiVO MAK Key"), MessageBoxButtons.OK, MessageBoxIcon.Error);
                e.Handled = true;
            }
        }
Esempio n. 27
0
        private void oKcmd_Click(object sender, EventArgs e)
        {
            //Not required, since it interfers with UNC paths with Username and Passwords, either way paths can be invalidated on the fly

            /*if (!System.IO.Directory.Exists(destinationPathTxt.Text))
             * {
             *  MessageBox.Show("Path " + destinationPathTxt.Text + " is invalid", "Invalid Path", MessageBoxButtons.OK,
             *                  MessageBoxIcon.Error);
             *  return;
             * }*/

            string taskName = taskNameTxt.Text.Trim();

            if (String.IsNullOrWhiteSpace(taskName))
            {
                MessageBox.Show(Localise.GetPhrase("Please supply a task name"), Localise.GetPhrase("No name supplied"), MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            destinationPathTxt.Text = destinationPathTxt.Text.Trim();
            if (String.IsNullOrWhiteSpace(destinationPathTxt.Text))
            {
                if (MessageBox.Show(Localise.GetPhrase("No destination directory provided, converted file will be placed in original video directory"),
                                    Localise.GetPhrase("No name supplied"),
                                    MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == System.Windows.Forms.DialogResult.Cancel)
                {
                    return;
                }
            }

            if (_newTask)
            {
                if ((_mceOptions.AllConversionTasks.FindIndex(item => item.taskName.ToLower() == taskName.ToLower()) >= 0) || (_mceOptions.AllMonitorTasks.FindIndex(item => item.taskName.ToLower() == taskName.ToLower()) >= 0))// Check if the name already exists (check both monitor and conversion task otherwise they might overright the same section in the INI file)
                {
                    MessageBox.Show(Localise.GetPhrase("A task name or section") + " " + taskNameTxt.Text + " " + Localise.GetPhrase("already exists\n\rPlease use another name"), Localise.GetPhrase("Duplicate Name"), MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }

            CheckNetDrive(true);

            // Quick validate the remaining settings with the ExpertForm
            ConversionTaskExpertSettingsForm expertSettings = new ConversionTaskExpertSettingsForm(_mceOptions.AllMonitorTasks, _cjo);

            expertSettings.WriteAndValidateSettings(); // Clean up expert settings to avoid conflicts

            // Now write the settings
            WriteSettings(_cjo, true);

            this.Close();
        }
Esempio n. 28
0
        private void ScanWithComskip()
        {
            string parameters = "";

            if (_convOptions.comskipIni != "") // Check for custom Ini file
            {
                if (File.Exists(_convOptions.comskipIni))
                {
                    parameters += "--ini=" + Util.FilePaths.FixSpaces(_convOptions.comskipIni);
                }
                else
                {
                    _jobLog.WriteEntry(this, Localise.GetPhrase("Custom Comskip INI file does not exist, Skipping custom INI"), Log.LogEntryType.Warning);
                }
            }

            parameters += " --output=" + Util.FilePaths.FixSpaces(_convOptions.workingPath); // Redirect all files to working folder (save issues with skipping copying original files and simulatenous scanning on same file)

            parameters += " " + Util.FilePaths.FixSpaces(_videoFileName);

            float Duration = 0;

            Duration = VideoParams.VideoDuration(_videoFileName);
            if (Duration <= 0)
            {
                FFmpegMediaInfo mediaInfo = new FFmpegMediaInfo(_videoFileName, _jobStatus, _jobLog);
                if (!mediaInfo.Success || mediaInfo.ParseError)
                {
                    _jobLog.WriteEntry(this, Localise.GetPhrase("Cannot read video duration"), Log.LogEntryType.Error);
                }

                if (mediaInfo.MediaInfo.VideoInfo.Duration == 0)
                {
                    _jobLog.WriteEntry(this, Localise.GetPhrase("Video duration 0"), Log.LogEntryType.Warning);
                }
                else
                {
                    Duration = mediaInfo.MediaInfo.VideoInfo.Duration;
                }
            }

            // Check for custom version of Comskip path
            Comskip comskip = new Comskip(_customComskipPath, parameters, Duration, _jobStatus, _jobLog); // Use custom comskip or fallback to default

            comskip.Run();
            if (!comskip.Success || !(File.Exists(WorkingEDLFilePath) || File.Exists(WorkingEDLPFilePath))) // Check if the EDL/EDLP file exists (here it is in working path), % does not always work
            {
                _jobLog.WriteEntry(this, "Comskip failed or no output EDL/EDLP file found", Log.LogEntryType.Warning);
                _jobStatus.PercentageComplete = 0;
            }
        }
        // NOTE: http://stackoverflow.com/questions/9511569/how-i-will-get-dropping-media-on-mediaelement-in-wpf
        private void mediaPlayer_DropFile(object sender, System.Windows.DragEventArgs e)
        {
            CheckAndStopPlay(); // If we are playing something first stop it

            if (!_savedEDLCuts && (edlCuts.Items.Count > 0))
            {
                if (MessageBox.Show(Localise.GetPhrase("Do you want to save the changes?"), Localise.GetPhrase("Unsaved EDL Cuts"), MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
                {
                    saveEDLCmd_Click(sender, e);
                }
            }

            string[] mediaFile = (string[])e.Data.GetData(DataFormats.FileDrop);
            LoadMediaFile(mediaFile[0]);
        }
        private void oKcmd_Click(object sender, EventArgs e)
        {
            if (makKey.Text.Length > 0)
            {
                if (makKey.Text.Length != 10)
                {
                    MessageBox.Show(Localise.GetPhrase("The TiVO MAK key should be 10 digits"), Localise.GetPhrase("Invalid TiVO MAK Key"), MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }

            WriteSettings(_cjo);

            this.Close();
        }