diff options
author | Sverrir Sigmundarson <[email protected]> | 2015-11-23 15:10:37 +0100 |
---|---|---|
committer | Sverrir Sigmundarson <[email protected]> | 2015-11-23 15:10:37 +0100 |
commit | 70e6b6257736722684294f79cb467b54960dd21a (patch) | |
tree | 76b2733daa80a2466e96dbee1162eb2db0b61b8d /win | |
parent | 4137a887b8fad760eb0c90d3ca90303aa3674740 (diff) |
Minor fixes to chapterdb.org support that were lost in a merge-gone-wrong.
Diffstat (limited to 'win')
6 files changed, 30 insertions, 6 deletions
diff --git a/win/CS/HandBrakeWPF/Properties/Resources.Designer.cs b/win/CS/HandBrakeWPF/Properties/Resources.Designer.cs index d5265941a..70ff7170c 100644 --- a/win/CS/HandBrakeWPF/Properties/Resources.Designer.cs +++ b/win/CS/HandBrakeWPF/Properties/Resources.Designer.cs @@ -545,7 +545,8 @@ namespace HandBrakeWPF.Properties { /// <summary>
/// Looks up a localized string similar to The reported duration of the chapters on the source media
- ///and the duration of chapters in the input file differ drastically.
+ ///and the duration of chapters in the input file differ greatly.
+ ///
///It is very likely that this chapter file was produced from a different source media.
///
///Are you sure you want to import the chapter names?.
diff --git a/win/CS/HandBrakeWPF/Properties/Resources.resx b/win/CS/HandBrakeWPF/Properties/Resources.resx index 304b8f961..09f221101 100644 --- a/win/CS/HandBrakeWPF/Properties/Resources.resx +++ b/win/CS/HandBrakeWPF/Properties/Resources.resx @@ -777,7 +777,8 @@ Do you still want to import the chapter names?</value> </data>
<data name="ChaptersViewModel_ValidateImportedChapters_ChapterDurationMismatchMsg" xml:space="preserve">
<value>The reported duration of the chapters on the source media
-and the duration of chapters in the input file differ drastically.
+and the duration of chapters in the input file differ greatly.
+
It is very likely that this chapter file was produced from a different source media.
Are you sure you want to import the chapter names?</value>
diff --git a/win/CS/HandBrakeWPF/Utilities/Input/ChapterImporterCsv.cs b/win/CS/HandBrakeWPF/Utilities/Input/ChapterImporterCsv.cs index 906eae510..8317f4c1a 100644 --- a/win/CS/HandBrakeWPF/Utilities/Input/ChapterImporterCsv.cs +++ b/win/CS/HandBrakeWPF/Utilities/Input/ChapterImporterCsv.cs @@ -16,8 +16,16 @@ namespace HandBrakeWPF.Utilities.Input /// </summary> internal class ChapterImporterCsv { + /// <summary> + /// The file filter value for the OpenFileDialog + /// </summary> public static string FileFilter => "CSV files (*.csv;*.tsv)|*.csv;*.tsv"; + /// <summary> + /// Imports all chapter information from the given <see cref="filename"/> into the <see cref="chapterMap"/> dictionary. + /// </summary> + /// <param name="filename">The full path and filename of the chapter marker file to import</param> + /// <param name="chapterMap">The dictionary that should be populated with parsed chapter markers</param> public static void Import(string filename, ref Dictionary<int, Tuple<string, TimeSpan>> importedChapters) { using (TextFieldParser csv = new TextFieldParser(filename) diff --git a/win/CS/HandBrakeWPF/Utilities/Input/ChapterImporterTxt.cs b/win/CS/HandBrakeWPF/Utilities/Input/ChapterImporterTxt.cs index 678abb20a..55b24b7a1 100644 --- a/win/CS/HandBrakeWPF/Utilities/Input/ChapterImporterTxt.cs +++ b/win/CS/HandBrakeWPF/Utilities/Input/ChapterImporterTxt.cs @@ -10,10 +10,22 @@ namespace HandBrakeWPF.Utilities.Input using HandBrakeWPF.Helpers; + /// <summary> + /// Imports chapter markers in the ChaptersDb.org TXT format + /// More info: http://www.chapterdb.org/docs + /// </summary> public class ChapterImporterTxt { + /// <summary> + /// The file filter value for the OpenFileDialog + /// </summary> public static string FileFilter => "Text files (*.txt)|*.txt"; + /// <summary> + /// Imports all chapter information from the given <see cref="filename"/> into the <see cref="chapterMap"/> dictionary. + /// </summary> + /// <param name="filename">The full path and filename of the chapter marker file to import</param> + /// <param name="chapterMap">The dictionary that should be populated with parsed chapter markers</param> public static void Import(string filename, ref Dictionary<int, Tuple<string, TimeSpan>> chapterMap) { using (var file = new StreamReader(filename)) diff --git a/win/CS/HandBrakeWPF/Utilities/Output/CsvHelper.cs b/win/CS/HandBrakeWPF/Utilities/Output/CsvHelper.cs index cf2d7a38d..48a0bcf63 100644 --- a/win/CS/HandBrakeWPF/Utilities/Output/CsvHelper.cs +++ b/win/CS/HandBrakeWPF/Utilities/Output/CsvHelper.cs @@ -13,7 +13,7 @@ namespace HandBrakeWPF.Utilities.Output { private const string QUOTE = "\""; private const string ESCAPED_QUOTE = "\"\""; - private static readonly char[] CHARACTERS_THAT_MUST_BE_QUOTED = { ',', '"', '\n' }; + private static readonly char[] CHARACTERS_THAT_MUST_BE_QUOTED = { ',', '"', '\n', '\t' }; /// <summary> /// Properly escapes a string value containing reserved characters with double quotes "..." before it is written to a CSV file. diff --git a/win/CS/HandBrakeWPF/ViewModels/ChaptersViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/ChaptersViewModel.cs index e92656f97..1948a2443 100644 --- a/win/CS/HandBrakeWPF/ViewModels/ChaptersViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/ChaptersViewModel.cs @@ -28,8 +28,6 @@ namespace HandBrakeWPF.ViewModels using HandBrakeWPF.Utilities.Output;
using HandBrakeWPF.ViewModels.Interfaces;
- using Microsoft.VisualBasic.FileIO;
-
using ChapterMarker = HandBrakeWPF.Services.Encode.Model.Models.ChapterMarker;
using EncodeTask = HandBrakeWPF.Services.Encode.Model.EncodeTask;
using GeneralApplicationException = HandBrakeWPF.Exceptions.GeneralApplicationException;
@@ -174,7 +172,8 @@ namespace HandBrakeWPF.ViewModels // Execute the importer based on the file extension
switch (fileExtension)
{
- case ".csv":
+ case ".csv": // comma separated file
+ case ".tsv": // tab separated file
ChapterImporterCsv.Import(filename, ref importedChapters);
break;
case ".xml":
@@ -199,6 +198,9 @@ namespace HandBrakeWPF.ViewModels {
if( !string.IsNullOrEmpty(validationErrorMessage))
throw new GeneralApplicationException(Resources.ChaptersViewModel_ValidationFailedWarning, validationErrorMessage);
+
+ // The user has cancelled the import, so exit
+ return;
}
// Now iterate over each chatper we have, and set it's name
|