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
{
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;

View File

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

View File

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

View File

@ -11,6 +11,6 @@ namespace NzbDrone.Core.RootFolders
[Ignore]
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();
RootFolder Add(RootFolder rootDir);
void Remove(int rootDirId);
List<String> GetUnmappedFolders(string path);
List<UnmappedFolder> GetUnmappedFolders(string path);
Dictionary<string, ulong> FreeSpaceOnDrives();
}
@ -71,13 +71,13 @@ namespace NzbDrone.Core.RootFolders
_rootFolderRepository.Delete(rootDirId);
}
public virtual List<String> GetUnmappedFolders(string path)
public virtual List<UnmappedFolder> 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<String>();
var results = new List<UnmappedFolder>();
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 });
}
}

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 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')
};
}

View File

@ -1,7 +1,7 @@
<div class="row unmapped-folder-view">
<div class="span11">
<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">
{{#each quality.models}}
<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({
model: NzbDrone.AddSeries.Existing.UnmappedFolderModel,
importItems: function (rootFolderModel) {
this.reset();

View File

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

View File

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