From e9db0fc14a6f724a73309399e674ddd00c2aaab8 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Sun, 26 Jan 2014 16:09:44 -0800 Subject: [PATCH] Fixes after rebase --- .../MappingTests/ResourceMappingFixture.cs | 1 - src/NzbDrone.Api/Series/SeriesResource.cs | 2 ++ .../DiskProviderTests/IsParentFixtureBase.cs | 7 +++---- src/NzbDrone.Common/Disk/DiskProviderBase.cs | 7 ------- src/NzbDrone.Common/Disk/IDiskProvider.cs | 1 - .../CleanupOrphanedMetadataFilesFixture.cs | 3 +-- .../MediaFiles/ImportApprovedEpisodesFixture.cs | 9 --------- .../MediaFiles/MediaFileTableCleanupService.cs | 2 +- src/NzbDrone.Core/MetaData/Consumers/Fake/Fake.cs | 1 + .../MetaData/Consumers/Xbmc/XbmcMetadata.cs | 15 ++++++++------- .../Metadata/ExistingMetadataService.cs | 1 + .../Metadata/Files/MetadataFileService.cs | 1 + src/NzbDrone.Core/Metadata/MetadataBase.cs | 1 + src/NzbDrone.Core/Parser/ParsingService.cs | 2 +- .../DiskProviderTests/IsParentFixture.cs | 14 -------------- src/NzbDrone.Mono.Test/NzbDrone.Mono.Test.csproj | 1 - .../DiskProviderTests/IsParentFixture.cs | 14 -------------- .../NzbDrone.Windows.Test.csproj | 1 - 18 files changed, 20 insertions(+), 63 deletions(-) delete mode 100644 src/NzbDrone.Mono.Test/DiskProviderTests/IsParentFixture.cs delete mode 100644 src/NzbDrone.Windows.Test/DiskProviderTests/IsParentFixture.cs diff --git a/src/NzbDrone.Api.Test/MappingTests/ResourceMappingFixture.cs b/src/NzbDrone.Api.Test/MappingTests/ResourceMappingFixture.cs index 1cff8601f..54d0e8dcc 100644 --- a/src/NzbDrone.Api.Test/MappingTests/ResourceMappingFixture.cs +++ b/src/NzbDrone.Api.Test/MappingTests/ResourceMappingFixture.cs @@ -50,7 +50,6 @@ namespace NzbDrone.Api.Test.MappingTests MappingValidation.ValidateMapping(modelType, resourceType); } - [Test] public void should_map_lay_loaded_values_should_not_be_inject_if_not_loaded() { diff --git a/src/NzbDrone.Api/Series/SeriesResource.cs b/src/NzbDrone.Api/Series/SeriesResource.cs index dc7cc3479..3e09fd3cf 100644 --- a/src/NzbDrone.Api/Series/SeriesResource.cs +++ b/src/NzbDrone.Api/Series/SeriesResource.cs @@ -59,5 +59,7 @@ namespace NzbDrone.Api.Series public String ImdbId { get; set; } public String TitleSlug { get; set; } public String RootFolderPath { get; set; } + public String Certification { get; set; } + public List Genres { get; set; } } } diff --git a/src/NzbDrone.Common.Test/DiskProviderTests/IsParentFixtureBase.cs b/src/NzbDrone.Common.Test/DiskProviderTests/IsParentFixtureBase.cs index 73d783af2..a9bc32930 100644 --- a/src/NzbDrone.Common.Test/DiskProviderTests/IsParentFixtureBase.cs +++ b/src/NzbDrone.Common.Test/DiskProviderTests/IsParentFixtureBase.cs @@ -5,7 +5,6 @@ using NzbDrone.Test.Common; namespace NzbDrone.Common.Test.DiskProviderTests { - public class IsParentFixtureBase : TestBase where TSubject : class, IDiskProvider public class IsParentFixture : TestBase { private string _parent = @"C:\Test".AsOsAgnostic(); @@ -15,7 +14,7 @@ namespace NzbDrone.Common.Test.DiskProviderTests { var path = @"C:\Another Folder".AsOsAgnostic(); - DiskProvider.IsParent(_parent, path).Should().BeFalse(); + DiskProviderBase.IsParent(_parent, path).Should().BeFalse(); } [Test] @@ -23,7 +22,7 @@ namespace NzbDrone.Common.Test.DiskProviderTests { var path = @"C:\Test\TV".AsOsAgnostic(); - DiskProvider.IsParent(_parent, path).Should().BeTrue(); + DiskProviderBase.IsParent(_parent, path).Should().BeTrue(); } [Test] @@ -31,7 +30,7 @@ namespace NzbDrone.Common.Test.DiskProviderTests { var path = @"C:\Test\30.Rock.S01E01.Pilot.avi".AsOsAgnostic(); - DiskProvider.IsParent(_parent, path).Should().BeTrue(); + DiskProviderBase.IsParent(_parent, path).Should().BeTrue(); } } } diff --git a/src/NzbDrone.Common/Disk/DiskProviderBase.cs b/src/NzbDrone.Common/Disk/DiskProviderBase.cs index c5063a268..a9ba52e26 100644 --- a/src/NzbDrone.Common/Disk/DiskProviderBase.cs +++ b/src/NzbDrone.Common/Disk/DiskProviderBase.cs @@ -12,7 +12,6 @@ namespace NzbDrone.Common.Disk { public abstract class DiskProviderBase : IDiskProvider { - void CopyFile(string source, string destination, bool overwrite = false); enum TransferAction { Copy, @@ -26,7 +25,6 @@ namespace NzbDrone.Common.Disk public abstract void SetPermissions(string path, string mask, string user, string group); public abstract long? GetTotalSize(string path); - //TODO: this needs tests public static string GetRelativePath(string parentPath, string childPath) { if (!IsParent(parentPath, childPath)) @@ -272,11 +270,6 @@ namespace NzbDrone.Common.Disk File.Move(source, destination); } - public void CopyFile(string source, string destination, bool overwrite = false) - { - File.Copy(source, destination, overwrite); - } - public void DeleteFolder(string path, bool recursive) { Ensure.That(path, () => path).IsValidPath(); diff --git a/src/NzbDrone.Common/Disk/IDiskProvider.cs b/src/NzbDrone.Common/Disk/IDiskProvider.cs index 0bb415452..098e451d7 100644 --- a/src/NzbDrone.Common/Disk/IDiskProvider.cs +++ b/src/NzbDrone.Common/Disk/IDiskProvider.cs @@ -37,7 +37,6 @@ namespace NzbDrone.Common.Disk string GetPathRoot(string path); string GetParentFolder(string path); void SetPermissions(string filename, WellKnownSidType accountSid, FileSystemRights rights, AccessControlType controlType); - bool IsParent(string parentPath, string childPath); void SetFolderWriteTime(string path, DateTime time); FileAttributes GetFileAttributes(string path); void EmptyFolder(string path); diff --git a/src/NzbDrone.Core.Test/Housekeeping/Housekeepers/CleanupOrphanedMetadataFilesFixture.cs b/src/NzbDrone.Core.Test/Housekeeping/Housekeepers/CleanupOrphanedMetadataFilesFixture.cs index 1eed6de95..0e6bb9fc6 100644 --- a/src/NzbDrone.Core.Test/Housekeeping/Housekeepers/CleanupOrphanedMetadataFilesFixture.cs +++ b/src/NzbDrone.Core.Test/Housekeeping/Housekeepers/CleanupOrphanedMetadataFilesFixture.cs @@ -1,5 +1,4 @@ -using System.Linq; -using FizzWare.NBuilder; +using FizzWare.NBuilder; using FluentAssertions; using NUnit.Framework; using NzbDrone.Core.Housekeeping.Housekeepers; diff --git a/src/NzbDrone.Core.Test/MediaFiles/ImportApprovedEpisodesFixture.cs b/src/NzbDrone.Core.Test/MediaFiles/ImportApprovedEpisodesFixture.cs index 59aa51f1c..a1c9a22e1 100644 --- a/src/NzbDrone.Core.Test/MediaFiles/ImportApprovedEpisodesFixture.cs +++ b/src/NzbDrone.Core.Test/MediaFiles/ImportApprovedEpisodesFixture.cs @@ -122,15 +122,6 @@ namespace NzbDrone.Core.Test.MediaFiles Times.Never()); } - [Test] - public void should_not_trigger_EpisodeImportedEvent_for_existing_files() - { - Subject.Import(new List { _approvedDecisions.First() }); - - Mocker.GetMock() - .Verify(v => v.PublishEvent(It.IsAny()), Times.Never()); - } - [Test] public void should_import_larger_files_first() { diff --git a/src/NzbDrone.Core/MediaFiles/MediaFileTableCleanupService.cs b/src/NzbDrone.Core/MediaFiles/MediaFileTableCleanupService.cs index 1c5f1c89b..735b80400 100644 --- a/src/NzbDrone.Core/MediaFiles/MediaFileTableCleanupService.cs +++ b/src/NzbDrone.Core/MediaFiles/MediaFileTableCleanupService.cs @@ -48,7 +48,7 @@ namespace NzbDrone.Core.MediaFiles continue; } - if (!DiskProvider.IsParent(series.Path, episodeFile.Path)) + if (!DiskProviderBase.IsParent(series.Path, episodeFile.Path)) { _logger.Trace("File [{0}] does not belong to this series, removing from db", episodeFile.Path); _mediaFileService.Delete(episodeFile); diff --git a/src/NzbDrone.Core/MetaData/Consumers/Fake/Fake.cs b/src/NzbDrone.Core/MetaData/Consumers/Fake/Fake.cs index 43361b552..2eeb539ac 100644 --- a/src/NzbDrone.Core/MetaData/Consumers/Fake/Fake.cs +++ b/src/NzbDrone.Core/MetaData/Consumers/Fake/Fake.cs @@ -7,6 +7,7 @@ using System.Xml; using System.Xml.Linq; using NLog; using NzbDrone.Common; +using NzbDrone.Common.Disk; using NzbDrone.Core.MediaFiles; using NzbDrone.Core.Metadata.Files; using NzbDrone.Core.Tv; diff --git a/src/NzbDrone.Core/MetaData/Consumers/Xbmc/XbmcMetadata.cs b/src/NzbDrone.Core/MetaData/Consumers/Xbmc/XbmcMetadata.cs index efad75344..a4d5ac080 100644 --- a/src/NzbDrone.Core/MetaData/Consumers/Xbmc/XbmcMetadata.cs +++ b/src/NzbDrone.Core/MetaData/Consumers/Xbmc/XbmcMetadata.cs @@ -8,6 +8,7 @@ using System.Xml; using System.Xml.Linq; using NLog; using NzbDrone.Common; +using NzbDrone.Common.Disk; using NzbDrone.Core.MediaCover; using NzbDrone.Core.MediaFiles; using NzbDrone.Core.Messaging.Events; @@ -91,7 +92,7 @@ namespace NzbDrone.Core.Metadata.Consumers.Xbmc { var metadataFiles = episodeFilesMetadata.Where(m => m.EpisodeFileId == episodeFile.Id).ToList(); var episodeFilenameWithoutExtension = - Path.GetFileNameWithoutExtension(DiskProvider.GetRelativePath(series.Path, episodeFile.Path)); + Path.GetFileNameWithoutExtension(DiskProviderBase.GetRelativePath(series.Path, episodeFile.Path)); foreach (var metadataFile in metadataFiles) { @@ -122,7 +123,7 @@ namespace NzbDrone.Core.Metadata.Consumers.Xbmc { SeriesId = series.Id, Consumer = GetType().Name, - RelativePath = DiskProvider.GetRelativePath(series.Path, path) + RelativePath = DiskProviderBase.GetRelativePath(series.Path, path) }; if (SeriesImagesRegex.IsMatch(filename)) @@ -235,7 +236,7 @@ namespace NzbDrone.Core.Metadata.Consumers.Xbmc SeriesId = series.Id, Consumer = GetType().Name, Type = MetadataType.SeriesMetadata, - RelativePath = DiskProvider.GetRelativePath(series.Path, path) + RelativePath = DiskProviderBase.GetRelativePath(series.Path, path) }; _eventAggregator.PublishEvent(new MetadataFileUpdated(metadata)); @@ -264,7 +265,7 @@ namespace NzbDrone.Core.Metadata.Consumers.Xbmc SeriesId = series.Id, Consumer = GetType().Name, Type = MetadataType.SeriesImage, - RelativePath = DiskProvider.GetRelativePath(series.Path, destination) + RelativePath = DiskProviderBase.GetRelativePath(series.Path, destination) }; _eventAggregator.PublishEvent(new MetadataFileUpdated(metadata)); @@ -296,7 +297,7 @@ namespace NzbDrone.Core.Metadata.Consumers.Xbmc SeasonNumber = season.SeasonNumber, Consumer = GetType().Name, Type = MetadataType.SeriesMetadata, - RelativePath = DiskProvider.GetRelativePath(series.Path, path) + RelativePath = DiskProviderBase.GetRelativePath(series.Path, path) }; _eventAggregator.PublishEvent(new MetadataFileUpdated(metadata)); @@ -355,7 +356,7 @@ namespace NzbDrone.Core.Metadata.Consumers.Xbmc EpisodeFileId = episodeFile.Id, Consumer = GetType().Name, Type = MetadataType.SeasonImage, - RelativePath = DiskProvider.GetRelativePath(series.Path, filename) + RelativePath = DiskProviderBase.GetRelativePath(series.Path, filename) }; _eventAggregator.PublishEvent(new MetadataFileUpdated(metadata)); @@ -375,7 +376,7 @@ namespace NzbDrone.Core.Metadata.Consumers.Xbmc EpisodeFileId = episodeFile.Id, Consumer = GetType().Name, Type = MetadataType.SeasonImage, - RelativePath = DiskProvider.GetRelativePath(series.Path, filename) + RelativePath = DiskProviderBase.GetRelativePath(series.Path, filename) }; _eventAggregator.PublishEvent(new MetadataFileUpdated(metadata)); diff --git a/src/NzbDrone.Core/Metadata/ExistingMetadataService.cs b/src/NzbDrone.Core/Metadata/ExistingMetadataService.cs index 31c7d4947..8331c03a2 100644 --- a/src/NzbDrone.Core/Metadata/ExistingMetadataService.cs +++ b/src/NzbDrone.Core/Metadata/ExistingMetadataService.cs @@ -3,6 +3,7 @@ using System.IO; using System.Linq; using NLog; using NzbDrone.Common; +using NzbDrone.Common.Disk; using NzbDrone.Core.MediaFiles; using NzbDrone.Core.Messaging.Events; using NzbDrone.Core.Metadata.Files; diff --git a/src/NzbDrone.Core/Metadata/Files/MetadataFileService.cs b/src/NzbDrone.Core/Metadata/Files/MetadataFileService.cs index 37177a8d1..f888bfdb8 100644 --- a/src/NzbDrone.Core/Metadata/Files/MetadataFileService.cs +++ b/src/NzbDrone.Core/Metadata/Files/MetadataFileService.cs @@ -4,6 +4,7 @@ using System.IO; using System.Linq; using NLog; using NzbDrone.Common; +using NzbDrone.Common.Disk; using NzbDrone.Core.MediaFiles.Events; using NzbDrone.Core.Messaging.Events; using NzbDrone.Core.Tv; diff --git a/src/NzbDrone.Core/Metadata/MetadataBase.cs b/src/NzbDrone.Core/Metadata/MetadataBase.cs index 29dc9a420..dbd613f1d 100644 --- a/src/NzbDrone.Core/Metadata/MetadataBase.cs +++ b/src/NzbDrone.Core/Metadata/MetadataBase.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Net; using NLog; using NzbDrone.Common; +using NzbDrone.Common.Disk; using NzbDrone.Core.MediaFiles; using NzbDrone.Core.Metadata.Files; using NzbDrone.Core.ThingiProvider; diff --git a/src/NzbDrone.Core/Parser/ParsingService.cs b/src/NzbDrone.Core/Parser/ParsingService.cs index d9910edda..f8053db3d 100644 --- a/src/NzbDrone.Core/Parser/ParsingService.cs +++ b/src/NzbDrone.Core/Parser/ParsingService.cs @@ -64,7 +64,7 @@ namespace NzbDrone.Core.Parser Episodes = episodes, Path = filename, ParsedEpisodeInfo = parsedEpisodeInfo, - ExistingFile = DiskProvider.IsParent(series.Path, filename) + ExistingFile = DiskProviderBase.IsParent(series.Path, filename) }; } diff --git a/src/NzbDrone.Mono.Test/DiskProviderTests/IsParentFixture.cs b/src/NzbDrone.Mono.Test/DiskProviderTests/IsParentFixture.cs deleted file mode 100644 index 179727ffb..000000000 --- a/src/NzbDrone.Mono.Test/DiskProviderTests/IsParentFixture.cs +++ /dev/null @@ -1,14 +0,0 @@ -using NUnit.Framework; -using NzbDrone.Common.Test.DiskProviderTests; - -namespace NzbDrone.Mono.Test.DiskProviderTests -{ - [TestFixture] - public class IsParentFixtureFixture : IsParentFixtureBase - { - public IsParentFixtureFixture() - { - LinuxOnly(); - } - } -} diff --git a/src/NzbDrone.Mono.Test/NzbDrone.Mono.Test.csproj b/src/NzbDrone.Mono.Test/NzbDrone.Mono.Test.csproj index 6b5b32c5b..ee7bd9dd5 100644 --- a/src/NzbDrone.Mono.Test/NzbDrone.Mono.Test.csproj +++ b/src/NzbDrone.Mono.Test/NzbDrone.Mono.Test.csproj @@ -68,7 +68,6 @@ - diff --git a/src/NzbDrone.Windows.Test/DiskProviderTests/IsParentFixture.cs b/src/NzbDrone.Windows.Test/DiskProviderTests/IsParentFixture.cs deleted file mode 100644 index 00b6aa4c2..000000000 --- a/src/NzbDrone.Windows.Test/DiskProviderTests/IsParentFixture.cs +++ /dev/null @@ -1,14 +0,0 @@ -using NUnit.Framework; -using NzbDrone.Common.Test.DiskProviderTests; - -namespace NzbDrone.Windows.Test.DiskProviderTests -{ - [TestFixture] - public class IsParentFixtureFixture : IsParentFixtureBase - { - public IsParentFixtureFixture() - { - WindowsOnly(); - } - } -} diff --git a/src/NzbDrone.Windows.Test/NzbDrone.Windows.Test.csproj b/src/NzbDrone.Windows.Test/NzbDrone.Windows.Test.csproj index 309005f99..65daabdf6 100644 --- a/src/NzbDrone.Windows.Test/NzbDrone.Windows.Test.csproj +++ b/src/NzbDrone.Windows.Test/NzbDrone.Windows.Test.csproj @@ -67,7 +67,6 @@ -