Renamed Folder to FolderName. Series.Path is readonly

pull/2/head
Mark McDowall 12 years ago
parent 434e43f31a
commit e43cb87620

@ -75,9 +75,10 @@ namespace NzbDrone.Api.Series
series.SeasonFolder = request.SeasonFolder;
series.QualityProfileId = request.QualityProfileId;
var oldPath = series.Path;
//Todo: Do we want to force a scan when this path changes? Can we use events instead?
series.RootFolderId = request.RootFolderId;
series.FolderName = request.FolderName;
series.Path = request.Path;
series.BacklogSetting = (BacklogSettingType)request.BacklogSetting;
if (!String.IsNullOrWhiteSpace(request.CustomStartDate))
@ -88,11 +89,6 @@ namespace NzbDrone.Api.Series
_seriesRepository.Update(series);
if (oldPath != series.Path)
_jobProvider.Enqueue(typeof(DiskScanJob), new { SeriesId = series.Id });
_seriesRepository.Update(series);
return request.AsResponse();
}

@ -37,7 +37,8 @@ namespace NzbDrone.Api.Series
public List<Core.MediaCover.MediaCover> Images { get; set; }
//View & Edit
public String Path { get; set; }
public int RootFolderId { get; set; }
public string FolderName { get; set; }
public Int32 QualityProfileId { get; set; }
//Editing Only

@ -1,10 +1,12 @@
using System.Linq;
using FizzWare.NBuilder;
using FluentAssertions;
using Marr.Data;
using NUnit.Framework;
using NzbDrone.Core.Configuration;
using NzbDrone.Core.MediaFiles;
using NzbDrone.Core.Organizer;
using NzbDrone.Core.RootFolders;
using NzbDrone.Core.Tv;
using NzbDrone.Core.Test.Framework;
@ -31,7 +33,8 @@ namespace NzbDrone.Core.Test.MediaFileTests
{
var fakeSeries = Builder<Series>.CreateNew()
.With(s => s.Title = "30 Rock")
.With(s => s.Path = @"C:\Test\30 Rock")
.With(s => s.RootFolder = new LazyLoaded<RootFolder>(new RootFolder { Path = @"C:\Test\TV" }))
.With(s => s.FolderName = "30 Rock")
.With(s => s.SeasonFolder = useSeasonFolder)
.Build();

@ -5,10 +5,12 @@ using System.IO;
using System.Linq;
using FizzWare.NBuilder;
using Marr.Data;
using Moq;
using NUnit.Framework;
using NzbDrone.Common;
using NzbDrone.Core.MediaFiles;
using NzbDrone.Core.RootFolders;
using NzbDrone.Core.Tv;
using NzbDrone.Core.Model;
using NzbDrone.Core.Providers;
@ -28,7 +30,8 @@ namespace NzbDrone.Core.Test.ProviderTests.PostDownloadProviderTests
public void Setup()
{
fakeSeries = Builder<Series>.CreateNew()
.With(s => s.Path = @"C:\Test\TV\30 Rock")
.With(s => s.RootFolder = new LazyLoaded<RootFolder>(new RootFolder { Path = @"C:\Test\TV" }))
.With(s => s.FolderName = "30 Rock")
.Build();
}
@ -342,7 +345,8 @@ namespace NzbDrone.Core.Test.ProviderTests.PostDownloadProviderTests
var series = Builder<Series>.CreateNew()
.With(s => s.Title = "30 Rock")
.With(s => s.Path = @"C:\Test\TV\30 Rock")
.With(s => s.RootFolder = new LazyLoaded<RootFolder>(new RootFolder { Path = @"C:\Test\TV" }))
.With(s => s.FolderName = "30 Rock")
.Build();
Mocker.GetMock<ISeriesRepository>()

@ -5,10 +5,12 @@ using System.IO;
using System.Linq;
using FizzWare.NBuilder;
using Marr.Data;
using Moq;
using NUnit.Framework;
using NzbDrone.Common;
using NzbDrone.Core.MediaFiles;
using NzbDrone.Core.RootFolders;
using NzbDrone.Core.Tv;
using NzbDrone.Core.Model;
using NzbDrone.Core.Providers;
@ -28,7 +30,8 @@ namespace NzbDrone.Core.Test.ProviderTests.PostDownloadProviderTests
public void Setup()
{
fakeSeries = Builder<Series>.CreateNew()
.With(s => s.Path = @"C:\Test\TV\30 Rock")
.With(s => s.RootFolder = new LazyLoaded<RootFolder>(new RootFolder { Path = @"C:\Test\TV" }))
.With(s => s.FolderName = "30 Rock")
.Build();
}

@ -5,10 +5,12 @@ using System.IO;
using System.Linq;
using FizzWare.NBuilder;
using Marr.Data;
using Moq;
using NUnit.Framework;
using NzbDrone.Common;
using NzbDrone.Core.MediaFiles;
using NzbDrone.Core.RootFolders;
using NzbDrone.Core.Tv;
using NzbDrone.Core.Model;
using NzbDrone.Core.Providers;
@ -28,7 +30,8 @@ namespace NzbDrone.Core.Test.ProviderTests.PostDownloadProviderTests
public void Setup()
{
fakeSeries = Builder<Series>.CreateNew()
.With(s => s.Path = @"C:\Test\TV\30 Rock")
.With(s => s.RootFolder = new LazyLoaded<RootFolder>(new RootFolder { Path = @"C:\Test\TV" }))
.With(s => s.FolderName = "30 Rock")
.Build();
}
@ -147,7 +150,8 @@ namespace NzbDrone.Core.Test.ProviderTests.PostDownloadProviderTests
var series = Builder<Series>.CreateNew()
.With(s => s.Title = "30 Rock")
.With(s => s.Path = @"C:\Test\TV\30 Rock")
.With(s => s.RootFolder = new LazyLoaded<RootFolder>(new RootFolder { Path = @"C:\Test\TV" }))
.With(s => s.FolderName = "30 Rock")
.Build();
Mocker.GetMock<ISeriesRepository>()

@ -28,7 +28,7 @@ namespace NzbDrone.Core.Datastore.Migration
.WithColumn("AirTime").AsString().Nullable()
.WithColumn("Images").AsString()
.WithColumn("RootFolderId").AsInt32()
.WithColumn("Folder").AsString().NotNullable()
.WithColumn("FolderName").AsString()
.WithColumn("Monitored").AsBoolean()
.WithColumn("QualityProfileId").AsInt32()
.WithColumn("SeasonFolder").AsBoolean()

@ -47,13 +47,13 @@ namespace NzbDrone.Core.Tv
public string TitleSlug { get; set; }
public int RootFolderId { get; set; }
public string Folder { get; set; }
public string FolderName { get; set; }
public LazyLoaded<RootFolder> RootFolder { get; set; }
//Todo: Use this to auto link RootFolder and Folder (using the proper path separator)
public string Path
{
get { return System.IO.Path.Combine(RootFolder.Value.Path, Folder); }
get { return System.IO.Path.Combine(RootFolder.Value.Path, FolderName); }
}
//Todo: This should be a double since there are timezones that aren't on a full hour offset

@ -91,10 +91,10 @@ namespace NzbDrone.Core.Tv
{
Ensure.That(() => newSeries).IsNotNull();
if(String.IsNullOrWhiteSpace(newSeries.Folder))
if(String.IsNullOrWhiteSpace(newSeries.FolderName))
{
newSeries.Folder = FileNameBuilder.CleanFilename(newSeries.Title);
_diskProvider.CreateDirectory(Path.Combine(_rootFolderRepository.Get(newSeries.RootFolderId).Path, newSeries.Folder));
newSeries.FolderName = FileNameBuilder.CleanFilename(newSeries.Title);
_diskProvider.CreateDirectory(Path.Combine(_rootFolderRepository.Get(newSeries.RootFolderId).Path, newSeries.FolderName));
}
_logger.Info("Adding Series [{0}] Path: [{1}]", newSeries.Title, newSeries.Path);
@ -123,7 +123,7 @@ namespace NzbDrone.Core.Tv
series.Monitored = edited.Monitored;
series.SeasonFolder = edited.SeasonFolder;
series.BacklogSetting = edited.BacklogSetting;
series.Path = edited.Path;
//series.Path = edited.Path;
series.CustomStartDate = edited.CustomStartDate;
_seriesRepository.Update(series);

Loading…
Cancel
Save