Add existing series uses existing path now

This commit is contained in:
Mark McDowall 2013-02-17 17:45:14 -08:00
parent e2314a7b17
commit 7d4db30e38
11 changed files with 34 additions and 20 deletions

View File

@ -7,12 +7,12 @@ using NzbDrone.Core.RootFolders;
namespace NzbDrone.Api.RootFolders namespace NzbDrone.Api.RootFolders
{ {
public class RootDirModule : NzbDroneApiModule public class RootFolderModule : NzbDroneApiModule
{ {
private readonly RootFolderService _rootFolderService; private readonly RootFolderService _rootFolderService;
public RootDirModule(RootFolderService rootFolderService) public RootFolderModule(RootFolderService rootFolderService)
: base("//rootdir") : base("/rootfolder")
{ {
_rootFolderService = rootFolderService; _rootFolderService = rootFolderService;

View File

@ -70,9 +70,9 @@
<VisualStudio> <VisualStudio>
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}"> <FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
<WebProjectProperties> <WebProjectProperties>
<UseIIS>True</UseIIS> <UseIIS>False</UseIIS>
<AutoAssignPort>True</AutoAssignPort> <AutoAssignPort>True</AutoAssignPort>
<DevelopmentServerPort>0</DevelopmentServerPort> <DevelopmentServerPort>55352</DevelopmentServerPort>
<DevelopmentServerVPath>/</DevelopmentServerVPath> <DevelopmentServerVPath>/</DevelopmentServerVPath>
<IISUrl>http://localhost:55352/</IISUrl> <IISUrl>http://localhost:55352/</IISUrl>
<NTLMAuthentication>False</NTLMAuthentication> <NTLMAuthentication>False</NTLMAuthentication>

View File

@ -559,6 +559,7 @@
<Compile Include="Providers\ReferenceDataProvider.cs"> <Compile Include="Providers\ReferenceDataProvider.cs">
<SubType>Code</SubType> <SubType>Code</SubType>
</Compile> </Compile>
<Compile Include="RootFolders\UnmappedFolder.cs" />
<Compile Include="RootFolders\RootFolderService.cs"> <Compile Include="RootFolders\RootFolderService.cs">
<SubType>Code</SubType> <SubType>Code</SubType>
</Compile> </Compile>

View File

@ -11,6 +11,6 @@ namespace NzbDrone.Core.RootFolders
[Ignore] [Ignore]
public ulong FreeSpace { get; set; } public ulong FreeSpace { get; set; }
public List<string> UnmappedFolders { get; set; } public List<UnmappedFolder> UnmappedFolders { get; set; }
} }
} }

View File

@ -14,7 +14,7 @@ namespace NzbDrone.Core.RootFolders
List<RootFolder> All(); List<RootFolder> All();
RootFolder Add(RootFolder rootDir); RootFolder Add(RootFolder rootDir);
void Remove(int rootDirId); void Remove(int rootDirId);
List<String> GetUnmappedFolders(string path); List<UnmappedFolder> GetUnmappedFolders(string path);
Dictionary<string, ulong> FreeSpaceOnDrives(); Dictionary<string, ulong> FreeSpaceOnDrives();
} }
@ -71,13 +71,13 @@ namespace NzbDrone.Core.RootFolders
_rootFolderRepository.Delete(rootDirId); _rootFolderRepository.Delete(rootDirId);
} }
public virtual List<String> GetUnmappedFolders(string path) public virtual List<UnmappedFolder> GetUnmappedFolders(string path)
{ {
Logger.Debug("Generating list of unmapped folders"); Logger.Debug("Generating list of unmapped folders");
if (String.IsNullOrEmpty(path)) if (String.IsNullOrEmpty(path))
throw new ArgumentException("Invalid path provided", "path"); throw new ArgumentException("Invalid path provided", "path");
var results = new List<String>(); var results = new List<UnmappedFolder>();
if (!_diskProvider.FolderExists(path)) if (!_diskProvider.FolderExists(path))
{ {
@ -89,7 +89,8 @@ namespace NzbDrone.Core.RootFolders
{ {
if (!_seriesProvider.SeriesPathExists(seriesFolder)) 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 });
} }
} }

View File

@ -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; }
}
}

View File

@ -18,7 +18,10 @@ define([
var seriesId = this.model.get('id'); var seriesId = this.model.get('id');
var title = this.model.get('seriesName'); var title = this.model.get('seriesName');
var quality = this.options.qualityProfile.val(); 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({ var model = new NzbDrone.Series.SeriesModel({
seriesId:seriesId, seriesId:seriesId,
@ -88,7 +91,8 @@ define([
itemViewOptions:function () { itemViewOptions:function () {
return { return {
qualityProfile:this.ui.profileList, qualityProfile:this.ui.profileList,
rootFolder:this.model.get('rootFolder') rootFolder: this.model.get('rootFolder'),
folder: this.model.get('folder')
}; };
} }

View File

@ -1,7 +1,7 @@
<div class="row unmapped-folder-view"> <div class="row unmapped-folder-view">
<div class="span11"> <div class="span11">
<div class="row folder-header"> <div class="row folder-header">
<input class="x-txt-search input-xlarge" type="text" value="{{folder}}" placeholder="{{folder}}"></input> <input class="x-txt-search input-xlarge" type="text" value="{{folder.name}}" placeholder="{{folder.name}}"></input>
<select class="span2 x-lst-quality-profile"> <select class="span2 x-lst-quality-profile">
{{#each quality.models}} {{#each quality.models}}
<option value="{{id}}">{{attributes.name}}</option> <option value="{{id}}">{{attributes.name}}</option>

View File

@ -14,8 +14,6 @@ define(['app','Quality/QualityProfileCollection'], function (app, qualityProfile
NzbDrone.AddSeries.Existing.UnmappedFolderCollection = Backbone.Collection.extend({ NzbDrone.AddSeries.Existing.UnmappedFolderCollection = Backbone.Collection.extend({
model: NzbDrone.AddSeries.Existing.UnmappedFolderModel, model: NzbDrone.AddSeries.Existing.UnmappedFolderModel,
importItems: function (rootFolderModel) { importItems: function (rootFolderModel) {
this.reset(); this.reset();

View File

@ -1,11 +1,9 @@
define(['app', 'AddSeries/RootFolders/RootFolderModel'], function () { define(['app', 'AddSeries/RootFolders/RootFolderModel'], function () {
var rootFolderCollection = Backbone.Collection.extend({ var rootFolderCollection = Backbone.Collection.extend({
url: NzbDrone.Constants.ApiRoot + '/rootdir', url: NzbDrone.Constants.ApiRoot + '/rootfolder',
model: NzbDrone.AddSeries.RootFolders.RootFolderModel model: NzbDrone.AddSeries.RootFolders.RootFolderModel
}); });
return new rootFolderCollection(); return new rootFolderCollection();
}); });

View File

@ -6,7 +6,7 @@ define(['app', 'Quality/QualityProfileCollection', 'Series/SeriesItemView'], fun
itemViewContainer: 'tbody', itemViewContainer: 'tbody',
template: 'Series/SeriesCollectionTemplate', template: 'Series/SeriesCollectionTemplate',
qualityProfileCollection: qualityProfileCollection, qualityProfileCollection: qualityProfileCollection,
emptyView: NzbDrone.Series.EmptySeriesCollectionView, //emptyView: NzbDrone.Series.EmptySeriesCollectionView,
initialize: function () { initialize: function () {
this.collection = new NzbDrone.Series.SeriesCollection(); this.collection = new NzbDrone.Series.SeriesCollection();