From 7d4db30e380c22ab3e39aaa50ed8544c1181cbdb Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Sun, 17 Feb 2013 17:45:14 -0800 Subject: [PATCH] Add existing series uses existing path now --- NzbDrone.Api/RootFolders/RootFolderModule.cs | 6 +++--- NzbDrone.Backbone/NzbDrone.Backbone.csproj | 4 ++-- NzbDrone.Core/NzbDrone.Core.csproj | 1 + NzbDrone.Core/RootFolders/RootFolder.cs | 2 +- NzbDrone.Core/RootFolders/RootFolderService.cs | 9 +++++---- NzbDrone.Core/RootFolders/UnmappedFolder.cs | 12 ++++++++++++ .../AddSeries/Existing/ImportSeriesView.js | 8 ++++++-- .../UnmappedFolderCompositeViewTemplatate.html | 2 +- .../AddSeries/Existing/UnmappedFolderModel.js | 2 -- .../AddSeries/RootFolders/RootFolderCollection.js | 6 ++---- .../_backboneApp/Series/SeriesCollectionView.js | 2 +- 11 files changed, 34 insertions(+), 20 deletions(-) create mode 100644 NzbDrone.Core/RootFolders/UnmappedFolder.cs diff --git a/NzbDrone.Api/RootFolders/RootFolderModule.cs b/NzbDrone.Api/RootFolders/RootFolderModule.cs index ed44fe195..1b156c52b 100644 --- a/NzbDrone.Api/RootFolders/RootFolderModule.cs +++ b/NzbDrone.Api/RootFolders/RootFolderModule.cs @@ -7,12 +7,12 @@ using NzbDrone.Core.RootFolders; namespace NzbDrone.Api.RootFolders { - public class RootDirModule : NzbDroneApiModule + public class RootFolderModule : NzbDroneApiModule { private readonly RootFolderService _rootFolderService; - public RootDirModule(RootFolderService rootFolderService) - : base("//rootdir") + public RootFolderModule(RootFolderService rootFolderService) + : base("/rootfolder") { _rootFolderService = rootFolderService; diff --git a/NzbDrone.Backbone/NzbDrone.Backbone.csproj b/NzbDrone.Backbone/NzbDrone.Backbone.csproj index 0d7cfdfc8..664c89bc2 100644 --- a/NzbDrone.Backbone/NzbDrone.Backbone.csproj +++ b/NzbDrone.Backbone/NzbDrone.Backbone.csproj @@ -70,9 +70,9 @@ - True + False True - 0 + 55352 / http://localhost:55352/ False diff --git a/NzbDrone.Core/NzbDrone.Core.csproj b/NzbDrone.Core/NzbDrone.Core.csproj index 3083ab5e0..fc9364587 100644 --- a/NzbDrone.Core/NzbDrone.Core.csproj +++ b/NzbDrone.Core/NzbDrone.Core.csproj @@ -559,6 +559,7 @@ Code + Code diff --git a/NzbDrone.Core/RootFolders/RootFolder.cs b/NzbDrone.Core/RootFolders/RootFolder.cs index d3a258c38..a14f233ba 100644 --- a/NzbDrone.Core/RootFolders/RootFolder.cs +++ b/NzbDrone.Core/RootFolders/RootFolder.cs @@ -11,6 +11,6 @@ namespace NzbDrone.Core.RootFolders [Ignore] public ulong FreeSpace { get; set; } - public List UnmappedFolders { get; set; } + public List UnmappedFolders { get; set; } } } \ No newline at end of file diff --git a/NzbDrone.Core/RootFolders/RootFolderService.cs b/NzbDrone.Core/RootFolders/RootFolderService.cs index e7fd3a6ab..7dd1afb07 100644 --- a/NzbDrone.Core/RootFolders/RootFolderService.cs +++ b/NzbDrone.Core/RootFolders/RootFolderService.cs @@ -14,7 +14,7 @@ namespace NzbDrone.Core.RootFolders List All(); RootFolder Add(RootFolder rootDir); void Remove(int rootDirId); - List GetUnmappedFolders(string path); + List GetUnmappedFolders(string path); Dictionary FreeSpaceOnDrives(); } @@ -71,13 +71,13 @@ namespace NzbDrone.Core.RootFolders _rootFolderRepository.Delete(rootDirId); } - public virtual List GetUnmappedFolders(string path) + public virtual List GetUnmappedFolders(string path) { Logger.Debug("Generating list of unmapped folders"); if (String.IsNullOrEmpty(path)) throw new ArgumentException("Invalid path provided", "path"); - var results = new List(); + var results = new List(); if (!_diskProvider.FolderExists(path)) { @@ -89,7 +89,8 @@ namespace NzbDrone.Core.RootFolders { if (!_seriesProvider.SeriesPathExists(seriesFolder)) { - results.Add(new DirectoryInfo(seriesFolder.Normalize()).Name); + var di = new DirectoryInfo(seriesFolder.Normalize()); + results.Add(new UnmappedFolder{ Name = di.Name, Path = di.FullName }); } } diff --git a/NzbDrone.Core/RootFolders/UnmappedFolder.cs b/NzbDrone.Core/RootFolders/UnmappedFolder.cs new file mode 100644 index 000000000..fcb43fdc5 --- /dev/null +++ b/NzbDrone.Core/RootFolders/UnmappedFolder.cs @@ -0,0 +1,12 @@ +using System.Collections.Generic; +using NzbDrone.Core.Datastore; +using Sqo.Attributes; + +namespace NzbDrone.Core.RootFolders +{ + public class UnmappedFolder + { + public string Name { get; set; } + public string Path { get; set; } + } +} \ No newline at end of file diff --git a/NzbDrone.Web/_backboneApp/AddSeries/Existing/ImportSeriesView.js b/NzbDrone.Web/_backboneApp/AddSeries/Existing/ImportSeriesView.js index dcfce5fd7..724ec00fd 100644 --- a/NzbDrone.Web/_backboneApp/AddSeries/Existing/ImportSeriesView.js +++ b/NzbDrone.Web/_backboneApp/AddSeries/Existing/ImportSeriesView.js @@ -18,7 +18,10 @@ define([ var seriesId = this.model.get('id'); var title = this.model.get('seriesName'); var quality = this.options.qualityProfile.val(); - var path = this.options.rootFolder + "\\" + title; + + //Todo: WTF - Why are we changing the series path if the path already exists on disk? + //Todo: This wiil create an invalid path on linux... + var path = this.options.folder.path; var model = new NzbDrone.Series.SeriesModel({ seriesId:seriesId, @@ -88,7 +91,8 @@ define([ itemViewOptions:function () { return { qualityProfile:this.ui.profileList, - rootFolder:this.model.get('rootFolder') + rootFolder: this.model.get('rootFolder'), + folder: this.model.get('folder') }; } diff --git a/NzbDrone.Web/_backboneApp/AddSeries/Existing/UnmappedFolderCompositeViewTemplatate.html b/NzbDrone.Web/_backboneApp/AddSeries/Existing/UnmappedFolderCompositeViewTemplatate.html index eb199b5ba..15936d413 100644 --- a/NzbDrone.Web/_backboneApp/AddSeries/Existing/UnmappedFolderCompositeViewTemplatate.html +++ b/NzbDrone.Web/_backboneApp/AddSeries/Existing/UnmappedFolderCompositeViewTemplatate.html @@ -1,7 +1,7 @@ 
- +