This project is read-only.

Timed/Scheduled encoding

May 10, 2012 at 2:36 AM

Added a new menu item, Tools, sub item Scheduled Encoding.  Implemented as a time scheduler for encoding at a later time when the PC is not being used.

Two new forms were added to get the scheduled time or duration from the user and to show the timer running.  These need to be converted to other languages as needed by someone capable.

A function to verify setup of all user input needs to be implemented before this release is pushed out though, otherwise the scheduled run will probably not start because of simple errors in setup.

Code will be pushed out as soon as I do a little testing. 

May 10, 2012 at 8:32 PM
That sounds like a useful feature.
I will take care of the translations :-)

Kind regards

Steven Hawkes (Mobile)
May 10, 2012 at 8:36 PM

I just pushed the code out.  I didn't implement a method to verify user input yet though. 

May 10, 2012 at 10:03 PM
I will have a look at it tomorrow for you.

Kind regards

Steven Hawkes (Mobile)


On May 10, 2012, at 21:36, "joeh100"<notifications@codeplex.com> wrote:

From: joeh100

I just pushed the code out. I didn't implement a method to verify user input yet though.

May 11, 2012 at 11:50 AM
Edited May 11, 2012 at 1:11 PM

Proposal for input verification, does this meet with what you had in mind?

1.    Dont allow the user to enter the Time dialog if the validations fail.

2.    Proposed validations

           Ensure the Handbrake CLI app link is set

           Ensure there are source files to be copied

           Ensure the destination output location is set or the check box use the same as the source is selected

3.    After the time is set, minimise the app to get it out of the way

4.    Once the timer fires, bring it back into the foreground

3.   Anything I missed?

May 11, 2012 at 1:22 PM
Edited May 11, 2012 at 1:41 PM

Exactly.  Here's my solution for review.  I didn't push it out because I didn't know if you were already working on it.

 

private void scheduleEncodingToolStripMenuItem1_Click(object sender, EventArgs e)
{
	if (!File.Exists(handBrakeCLILocationTextBox.Text))
	{
		MessageBox.Show("Unable to find the Handbrake application.  Plese set the location" +
				" before scheduling an encode time.", "Can not find HandBrake", MessageBoxButtons.OK, MessageBoxIcon.Information);
		if (handBrakeCLILocationTextBox.Text == "") handBrakeCLILocationTextBox.Text = "Please set the Handbrake CLI Location";
		handBrakeCLILocationTextBox.SelectAll();
				
		return;
	}

	if (folderFileListBox.Items.Count < 1)
	{
		MessageBox.Show("Please select files to be encoded before scheduling an encode time.",
				"Empty File List.", MessageBoxButtons.OK, MessageBoxIcon.Information);

		return;
	}

	if (!validateDestSourceLocations())
	{
		Log.Error("The Source or Destination locations validation check failed when scheduling an encode time.");
		MessageBox.Show("Error with a Source or Destination Location" +
				" Ensure these locations are correct before scheduling an encode time.",
				"Locations Invalid", MessageBoxButtons.OK, MessageBoxIcon.Information);
		return;
	}

			
	// Get the time to start from the user
	var scheduleForm = new FormScheduler();
	if (scheduleForm.ShowDialog() == DialogResult.Cancel) return;

	// If the user gave a time to start then open the timer form
	var runTimerForm = new FormRunOnTimer(scheduleForm.timeToStart);
	scheduleForm.Dispose(); // dispose of the previous form

	// Start Timing
	var runOnTimerForm = new FormRunOnTimer(scheduleForm.timeToStart);
	if (runTimerForm.ShowDialog() == DialogResult.OK) StartEncoding();
			
}
May 11, 2012 at 3:10 PM

OK. I have checked in the validation routine as discussed.

I noticed a bug with the timer operation you may want to have a look at.

I selected the timer dialog and it just showed 3:00:00 but it is actually 15:00:00.

I then added 2 minutes and start the timer and it told me there was 23: 58 before

it will start.

Seems to be a mix up with the 12 and 24 hrs clock.

Kind regards

Steve

May 11, 2012 at 3:15 PM

That is funny.   At one time you are working alone on the project and now we are both that keen we fight to do the changes :-) :-)

Your inplementation is the same as mine (yours written better)  so just ignore my checkin and take yours.

Sorry about that.  I leave it to you now to complete this functionality :-)

Bye for now

May 11, 2012 at 4:59 PM

Done.