1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-04 10:02:40 +01:00

Renamed Folder to FolderName. Series.Path is readonly

This commit is contained in:
Mark McDowall 2013-04-11 08:28:08 -07:00
parent 434e43f31a
commit e43cb87620
9 changed files with 32 additions and 21 deletions

View File

@ -75,9 +75,10 @@ private Response UpdateSeries()
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 @@ private Response UpdateSeries()
_seriesRepository.Update(series);
if (oldPath != series.Path)
_jobProvider.Enqueue(typeof(DiskScanJob), new { SeriesId = series.Id });
_seriesRepository.Update(series);
return request.AsResponse();
}

View File

@ -37,7 +37,8 @@ public class SeriesResource
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

View File

@ -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 @@ public void CalculateFilePath_SeasonFolder_SingleNumber(string filename, int sea
{
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();

View File

@ -5,10 +5,12 @@
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 @@ public class ProcessDownloadFixture : CoreTest
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 @@ public void should_logError_and_return_if_size_exceeds_free_space()
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>()

View File

@ -5,10 +5,12 @@
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 @@ public class ProcessDropDirectoryFixture : CoreTest
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();
}

View File

@ -5,10 +5,12 @@
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 @@ public class ProcessVideoFileFixture : CoreTest
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 @@ public void should_logError_and_return_if_size_exceeds_free_space()
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>()

View File

@ -28,7 +28,7 @@ protected override void MainDbUpgrade()
.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()

View File

@ -47,13 +47,13 @@ public Series()
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

View File

@ -91,10 +91,10 @@ public void AddSeries(Series newSeries)
{
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 @@ public void UpdateFromSeriesEditor(IList<Series> editedSeries)
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);