summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsr55 <[email protected]>2011-06-15 17:45:06 +0000
committersr55 <[email protected]>2011-06-15 17:45:06 +0000
commitb957ee1aaba01b06d9f8b3f26e0385eba061baf2 (patch)
tree6ca577f1f7cb978c1311b444be9bcac5da4ad373
parent4d7216fba8652a83821be49cd16cc851b5cc4cd2 (diff)
WinGui:
- Correctly set the number of previews to generate during Scan - Fix an issue where the CLI query is not printed to the log window. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4061 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r--win/CS/Controls/Filters.resx4
-rw-r--r--win/CS/HandBrake.ApplicationServices/Services/Base/EncodeBase.cs12
-rw-r--r--win/CS/HandBrake.ApplicationServices/Services/Interfaces/IScan.cs13
-rw-r--r--win/CS/HandBrake.ApplicationServices/Services/LibScan.cs30
-rw-r--r--win/CS/HandBrake.ApplicationServices/Services/ScanService.cs41
-rw-r--r--win/CS/HandBrake.ApplicationServices/Utilities/GeneralUtilities.cs11
-rw-r--r--win/CS/frmMain.cs2
7 files changed, 77 insertions, 36 deletions
diff --git a/win/CS/Controls/Filters.resx b/win/CS/Controls/Filters.resx
index ff31a6db5..c7e0d4bdf 100644
--- a/win/CS/Controls/Filters.resx
+++ b/win/CS/Controls/Filters.resx
@@ -112,9 +112,9 @@
<value>2.0</value>
</resheader>
<resheader name="reader">
- <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
- <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root> \ No newline at end of file
diff --git a/win/CS/HandBrake.ApplicationServices/Services/Base/EncodeBase.cs b/win/CS/HandBrake.ApplicationServices/Services/Base/EncodeBase.cs
index ca9558175..978d4c9af 100644
--- a/win/CS/HandBrake.ApplicationServices/Services/Base/EncodeBase.cs
+++ b/win/CS/HandBrake.ApplicationServices/Services/Base/EncodeBase.cs
@@ -46,7 +46,7 @@ namespace HandBrake.ApplicationServices.Services.Base
/// <summary>
/// The Log File Header
/// </summary>
- private StringBuilder header = GeneralUtilities.CreateCliLogHeader(null);
+ private StringBuilder header = GeneralUtilities.CreateCliLogHeader();
#endregion
@@ -244,8 +244,11 @@ namespace HandBrake.ApplicationServices.Services.Base
try
{
this.logBuffer = new StringBuilder();
+ this.logBuffer.AppendLine(String.Format("CLI Query: {0}", encodeQueueTask.Query));
+ this.logBuffer.AppendLine(String.Format("User Query: {0}", encodeQueueTask.CustomQuery));
+ this.logBuffer.AppendLine();
- // Clear the current Encode Logs
+ // Clear the current Encode Logs)
if (File.Exists(logFile))
{
File.Delete(logFile);
@@ -257,7 +260,10 @@ namespace HandBrake.ApplicationServices.Services.Base
}
this.fileWriter = new StreamWriter(logFile) { AutoFlush = true };
- this.fileWriter.WriteLine(GeneralUtilities.CreateCliLogHeader(encodeQueueTask));
+ this.fileWriter.WriteLine(GeneralUtilities.CreateCliLogHeader());
+ this.fileWriter.WriteLine(String.Format("CLI Query: {0}", encodeQueueTask.Query));
+ this.fileWriter.WriteLine(String.Format("User Query: {0}", encodeQueueTask.CustomQuery));
+ this.fileWriter.WriteLine();
}
catch (Exception)
{
diff --git a/win/CS/HandBrake.ApplicationServices/Services/Interfaces/IScan.cs b/win/CS/HandBrake.ApplicationServices/Services/Interfaces/IScan.cs
index 6cbce5273..fbbebfe27 100644
--- a/win/CS/HandBrake.ApplicationServices/Services/Interfaces/IScan.cs
+++ b/win/CS/HandBrake.ApplicationServices/Services/Interfaces/IScan.cs
@@ -71,9 +71,16 @@ namespace HandBrake.ApplicationServices.Services.Interfaces
/// Scan a Source Path.
/// Title 0: scan all
/// </summary>
- /// <param name="sourcePath">Path to the file to scan</param>
- /// <param name="title">int title number. 0 for scan all</param>
- void Scan(string sourcePath, int title);
+ /// <param name="sourcePath">
+ /// Path to the file to scan
+ /// </param>
+ /// <param name="title">
+ /// int title number. 0 for scan all
+ /// </param>
+ /// <param name="previewCount">
+ /// The preview Count.
+ /// </param>
+ void Scan(string sourcePath, int title, int previewCount);
/// <summary>
/// Kill the scan
diff --git a/win/CS/HandBrake.ApplicationServices/Services/LibScan.cs b/win/CS/HandBrake.ApplicationServices/Services/LibScan.cs
index 1d93162a1..5022763eb 100644
--- a/win/CS/HandBrake.ApplicationServices/Services/LibScan.cs
+++ b/win/CS/HandBrake.ApplicationServices/Services/LibScan.cs
@@ -118,11 +118,18 @@ namespace HandBrake.ApplicationServices.Services
/// Scan a Source Path.
/// Title 0: scan all
/// </summary>
- /// <param name="sourcePath">Path to the file to scan</param>
- /// <param name="title">int title number. 0 for scan all</param>
- public void Scan(string sourcePath, int title)
+ /// <param name="sourcePath">
+ /// Path to the file to scan
+ /// </param>
+ /// <param name="title">
+ /// int title number. 0 for scan all
+ /// </param>
+ /// <param name="previewCount">
+ /// The preview Count.
+ /// </param>
+ public void Scan(string sourcePath, int title, int previewCount)
{
- Thread t = new Thread(unused => this.ScanSource(sourcePath, title));
+ Thread t = new Thread(unused => this.ScanSource(sourcePath, title, previewCount));
t.Start();
}
@@ -141,12 +148,21 @@ namespace HandBrake.ApplicationServices.Services
/// <summary>
/// Start a scan for a given source path and title
/// </summary>
- /// <param name="sourcePath">Path to the source file</param>
- /// <param name="title">the title number to look at</param>
- private void ScanSource(object sourcePath, int title)
+ /// <param name="sourcePath">
+ /// Path to the source file
+ /// </param>
+ /// <param name="title">
+ /// the title number to look at
+ /// </param>
+ /// <param name="previewCount">
+ /// The preview Count.
+ /// </param>
+ private void ScanSource(object sourcePath, int title, int previewCount)
{
try
{
+ // TODO Support Preview Count
+
IsScanning = true;
if (this.ScanStared != null)
this.ScanStared(this, new EventArgs());
diff --git a/win/CS/HandBrake.ApplicationServices/Services/ScanService.cs b/win/CS/HandBrake.ApplicationServices/Services/ScanService.cs
index b4b2c7484..84d2a53d5 100644
--- a/win/CS/HandBrake.ApplicationServices/Services/ScanService.cs
+++ b/win/CS/HandBrake.ApplicationServices/Services/ScanService.cs
@@ -42,7 +42,7 @@ namespace HandBrake.ApplicationServices.Services
/// <summary>
/// The Log File Header
/// </summary>
- StringBuilder header = GeneralUtilities.CreateCliLogHeader(null);
+ StringBuilder header = GeneralUtilities.CreateCliLogHeader();
#endregion
@@ -104,11 +104,18 @@ namespace HandBrake.ApplicationServices.Services
/// Scan a Source Path.
/// Title 0: scan all
/// </summary>
- /// <param name="sourcePath">Path to the file to scan</param>
- /// <param name="title">int title number. 0 for scan all</param>
- public void Scan(string sourcePath, int title)
+ /// <param name="sourcePath">
+ /// Path to the file to scan
+ /// </param>
+ /// <param name="title">
+ /// int title number. 0 for scan all
+ /// </param>
+ /// <param name="previewCount">
+ /// The preview Count.
+ /// </param>
+ public void Scan(string sourcePath, int title, int previewCount)
{
- Thread t = new Thread(unused => this.ScanSource(sourcePath, title));
+ Thread t = new Thread(unused => this.ScanSource(sourcePath, title, previewCount));
t.Start();
}
@@ -142,9 +149,16 @@ namespace HandBrake.ApplicationServices.Services
/// <summary>
/// Start a scan for a given source path and title
/// </summary>
- /// <param name="sourcePath">Path to the source file</param>
- /// <param name="title">the title number to look at</param>
- private void ScanSource(object sourcePath, int title)
+ /// <param name="sourcePath">
+ /// Path to the source file
+ /// </param>
+ /// <param name="title">
+ /// the title number to look at
+ /// </param>
+ /// <param name="previewCount">
+ /// The preview Count.
+ /// </param>
+ private void ScanSource(object sourcePath, int title, int previewCount)
{
try
{
@@ -170,9 +184,16 @@ namespace HandBrake.ApplicationServices.Services
}
string extraArguments = string.Empty;
+
+ if (previewCount != 10)
+ {
+ extraArguments += " --previews " + previewCount;
+ }
+
+
if (Properties.Settings.Default.DisableLibDvdNav)
{
- extraArguments = " --no-dvdnav";
+ extraArguments += " --no-dvdnav";
}
if (title > 0)
@@ -210,7 +231,7 @@ namespace HandBrake.ApplicationServices.Services
// Only write the log file to disk if it's less than 100MB.
if (this.readData.Buffer.Length < 100000000)
{
- scanLog.WriteLine(GeneralUtilities.CreateCliLogHeader(null));
+ scanLog.WriteLine(GeneralUtilities.CreateCliLogHeader());
scanLog.Write(this.readData.Buffer);
this.logBuffer.AppendLine(this.readData.Buffer.ToString());
}
diff --git a/win/CS/HandBrake.ApplicationServices/Utilities/GeneralUtilities.cs b/win/CS/HandBrake.ApplicationServices/Utilities/GeneralUtilities.cs
index 61aeef1d7..0ad9b6a8d 100644
--- a/win/CS/HandBrake.ApplicationServices/Utilities/GeneralUtilities.cs
+++ b/win/CS/HandBrake.ApplicationServices/Utilities/GeneralUtilities.cs
@@ -99,13 +99,10 @@ namespace HandBrake.ApplicationServices.Utilities
/// <summary>
/// Add the CLI Query to the Log File.
/// </summary>
- /// <param name="encJob">
- /// The Encode Job Object
- /// </param>
/// <returns>
/// The create cli log header.
/// </returns>
- public static StringBuilder CreateCliLogHeader(QueueTask encJob)
+ public static StringBuilder CreateCliLogHeader()
{
StringBuilder logHeader = new StringBuilder();
@@ -118,12 +115,6 @@ namespace HandBrake.ApplicationServices.Utilities
logHeader.AppendLine(String.Format("Install Dir: {0}", Application.StartupPath));
logHeader.AppendLine(String.Format("Data Dir: {0}\n", Application.UserAppDataPath));
- if (encJob != null)
- {
- logHeader.AppendLine(String.Format("CLI Query: {0}", encJob.Query));
- logHeader.AppendLine(String.Format("User Query: {0}", encJob.CustomQuery));
- }
-
logHeader.AppendLine("-------------------------------------------");
return logHeader;
diff --git a/win/CS/frmMain.cs b/win/CS/frmMain.cs
index fb22a8d27..24cc41b57 100644
--- a/win/CS/frmMain.cs
+++ b/win/CS/frmMain.cs
@@ -2040,7 +2040,7 @@ namespace Handbrake
// Start the Scan
try
{
- SourceScan.Scan(sourcePath, title);
+ SourceScan.Scan(sourcePath, title, Properties.Settings.Default.previewScanCount);
}
catch (Exception exc)
{