diff --git a/NzbDrone.Core.Test/Files/Media/H264_sample.mp4 b/NzbDrone.Core.Test/Files/Media/H264_sample.mp4 new file mode 100644 index 000000000..35bc6b353 Binary files /dev/null and b/NzbDrone.Core.Test/Files/Media/H264_sample.mp4 differ diff --git a/NzbDrone.Core.Test/MediaFiles/EpisodeImport/Specifications/NotSampleSpecificationFixture.cs b/NzbDrone.Core.Test/MediaFiles/EpisodeImport/Specifications/NotSampleSpecificationFixture.cs index 06b62fefd..c3f5b0429 100644 --- a/NzbDrone.Core.Test/MediaFiles/EpisodeImport/Specifications/NotSampleSpecificationFixture.cs +++ b/NzbDrone.Core.Test/MediaFiles/EpisodeImport/Specifications/NotSampleSpecificationFixture.cs @@ -5,6 +5,7 @@ using FluentAssertions; using Moq; using NUnit.Framework; using NzbDrone.Core.MediaFiles.EpisodeImport.Specifications; +using NzbDrone.Core.MediaFiles.MediaInfo; using NzbDrone.Core.Parser.Model; using NzbDrone.Core.Providers; using NzbDrone.Core.Test.Framework; diff --git a/NzbDrone.Core.Test/MediaFiles/MediaInfo/VideoFileInfoReaderFixture.cs b/NzbDrone.Core.Test/MediaFiles/MediaInfo/VideoFileInfoReaderFixture.cs new file mode 100644 index 000000000..c3267089b --- /dev/null +++ b/NzbDrone.Core.Test/MediaFiles/MediaInfo/VideoFileInfoReaderFixture.cs @@ -0,0 +1,22 @@ +using System.IO; +using FluentAssertions; +using NUnit.Framework; +using NzbDrone.Core.MediaFiles.MediaInfo; +using NzbDrone.Core.Test.Framework; +using NzbDrone.Test.Common.Categories; + +namespace NzbDrone.Core.Test.MediaFiles.MediaInfo +{ + [TestFixture] + [DiskAccessTest] + public class VideoFileInfoReaderFixture : CoreTest + { + [Test] + public void get_runtime() + { + var path = Path.Combine(Directory.GetCurrentDirectory(), "Files", "Media", "H264_sample.mp4"); + + Subject.GetRunTime(path).Seconds.Should().Be(10); + } + } +} \ No newline at end of file diff --git a/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj b/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj index faa0352c8..68f5bd6b3 100644 --- a/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj +++ b/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj @@ -141,6 +141,7 @@ + @@ -240,6 +241,9 @@ Always + + Always + Always diff --git a/NzbDrone.Core/MediaFiles/EpisodeImport/Specifications/NotSampleSpecification.cs b/NzbDrone.Core/MediaFiles/EpisodeImport/Specifications/NotSampleSpecification.cs index 51561b005..3d2901974 100644 --- a/NzbDrone.Core/MediaFiles/EpisodeImport/Specifications/NotSampleSpecification.cs +++ b/NzbDrone.Core/MediaFiles/EpisodeImport/Specifications/NotSampleSpecification.cs @@ -1,6 +1,7 @@ using System; using System.IO; using NLog; +using NzbDrone.Core.MediaFiles.MediaInfo; using NzbDrone.Core.Parser.Model; using NzbDrone.Core.Providers; using NzbDrone.Core.Tv; diff --git a/NzbDrone.Core/Providers/VideoFileInfoReader.cs b/NzbDrone.Core/MediaFiles/MediaInfo/VideoFileInfoReader.cs similarity index 96% rename from NzbDrone.Core/Providers/VideoFileInfoReader.cs rename to NzbDrone.Core/MediaFiles/MediaInfo/VideoFileInfoReader.cs index beb87c79c..a2f1143e2 100644 --- a/NzbDrone.Core/Providers/VideoFileInfoReader.cs +++ b/NzbDrone.Core/MediaFiles/MediaInfo/VideoFileInfoReader.cs @@ -5,7 +5,7 @@ using NLog; using NzbDrone.Common; using NzbDrone.Core.Model; -namespace NzbDrone.Core.Providers +namespace NzbDrone.Core.MediaFiles.MediaInfo { public interface IVideoFileInfoReader { @@ -31,7 +31,7 @@ namespace NzbDrone.Core.Providers if (!_diskProvider.FileExists(filename)) throw new FileNotFoundException("Media file does not exist: " + filename); - var mediaInfo = new MediaInfo(); + var mediaInfo = new MediaInfoLib.MediaInfo(); try { @@ -112,10 +112,10 @@ namespace NzbDrone.Core.Providers public TimeSpan GetRunTime(string filename) { - MediaInfo mediaInfo = null; + MediaInfoLib.MediaInfo mediaInfo = null; try { - mediaInfo = new MediaInfo(); + mediaInfo = new MediaInfoLib.MediaInfo(); _logger.Trace("Getting media info from {0}", filename); mediaInfo.Option("ParseSpeed", "0.2"); diff --git a/NzbDrone.Core/NzbDrone.Core.csproj b/NzbDrone.Core/NzbDrone.Core.csproj index 197d06090..00914e182 100644 --- a/NzbDrone.Core/NzbDrone.Core.csproj +++ b/NzbDrone.Core/NzbDrone.Core.csproj @@ -228,6 +228,7 @@ + @@ -416,7 +417,6 @@ - diff --git a/NzbDrone.Test.Common/Categories/DiskAccessTestAttribute.cs b/NzbDrone.Test.Common/Categories/DiskAccessTestAttribute.cs new file mode 100644 index 000000000..faccff30d --- /dev/null +++ b/NzbDrone.Test.Common/Categories/DiskAccessTestAttribute.cs @@ -0,0 +1,13 @@ +using NUnit.Framework; + +namespace NzbDrone.Test.Common.Categories +{ + public class DiskAccessTestAttribute : CategoryAttribute + { + public DiskAccessTestAttribute() + : base("DiskAccessTest") + { + + } + } +} \ No newline at end of file diff --git a/NzbDrone.Test.Common/NzbDrone.Test.Common.csproj b/NzbDrone.Test.Common/NzbDrone.Test.Common.csproj index 4e85ec162..dd6ffc0fe 100644 --- a/NzbDrone.Test.Common/NzbDrone.Test.Common.csproj +++ b/NzbDrone.Test.Common/NzbDrone.Test.Common.csproj @@ -76,6 +76,7 @@ + diff --git a/NzbDrone.ncrunchsolution b/NzbDrone.ncrunchsolution index 81e25e1f2..098d74afe 100644 --- a/NzbDrone.ncrunchsolution +++ b/NzbDrone.ncrunchsolution @@ -7,7 +7,7 @@ Disabled Disabled Disabled - Run all tests automatically:BFRydWU=;Run all tests manually:BUZhbHNl;Run impacted tests automatically, others manually (experimental!):CklzSW1wYWN0ZWQ=;Run pinned tests automatically, others manually:CElzUGlubmVk;Fast:DlN0cnVjdHVyYWxOb2RlAwAAABNEb2VzTm90SGF2ZUNhdGVnb3J5D0ludGVncmF0aW9uVGVzdBNEb2VzTm90SGF2ZUNhdGVnb3J5BkRiVGVzdApJc0ltcGFjdGVkAAAAAAAAAAA= + Run all tests automatically:BFRydWU=;Run all tests manually:BUZhbHNl;Run impacted tests automatically, others manually (experimental!):CklzSW1wYWN0ZWQ=;Run pinned tests automatically, others manually:CElzUGlubmVk;Fast:DlN0cnVjdHVyYWxOb2RlBAAAABNEb2VzTm90SGF2ZUNhdGVnb3J5D0ludGVncmF0aW9uVGVzdBNEb2VzTm90SGF2ZUNhdGVnb3J5BkRiVGVzdApJc0ltcGFjdGVkE0RvZXNOb3RIYXZlQ2F0ZWdvcnkORGlza0FjY2Vzc1Rlc3QAAAAAAAAAAAAAAAA= \ No newline at end of file