Add series changes
This commit is contained in:
parent
19dfd49ad3
commit
684a72792a
|
@ -27,6 +27,8 @@ namespace NzbDrone.Core.Datastore.Migration
|
|||
.WithColumn("Overview").AsString().Nullable()
|
||||
.WithColumn("AirTime").AsString().Nullable()
|
||||
.WithColumn("Images").AsString()
|
||||
.WithColumn("RootFolderId").AsInt32()
|
||||
.WithColumn("Folder").AsString().NotNullable()
|
||||
.WithColumn("Path").AsString().Unique()
|
||||
.WithColumn("Monitored").AsBoolean()
|
||||
.WithColumn("QualityProfileId").AsInt32()
|
||||
|
|
|
@ -41,7 +41,8 @@ namespace NzbDrone.Core.Datastore
|
|||
Mapper.Entity<History.History>().RegisterModel("History")
|
||||
.HasOne(h => h.Episode, h => h.EpisodeId);
|
||||
|
||||
Mapper.Entity<Series>().RegisterModel("Series");
|
||||
Mapper.Entity<Series>().RegisterModel("Series")
|
||||
.HasOne(s => s.RootFolder, s => s.RootFolderId);
|
||||
|
||||
Mapper.Entity<Season>().RegisterModel("Seasons");
|
||||
Mapper.Entity<Episode>().RegisterModel("Episodes");
|
||||
|
|
|
@ -83,7 +83,6 @@ namespace NzbDrone.Core.MediaFiles
|
|||
parseResult.Quality = episodeFile.Quality;
|
||||
parseResult.Episodes = episodes;
|
||||
|
||||
|
||||
if (newDownload)
|
||||
{
|
||||
_eventAggregator.Publish(new EpisodeDownloadedEvent(parseResult));
|
||||
|
@ -91,7 +90,5 @@ namespace NzbDrone.Core.MediaFiles
|
|||
|
||||
return episodeFile;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -28,7 +28,6 @@ namespace NzbDrone.Core.MediaFiles
|
|||
private readonly Logger _logger;
|
||||
private readonly IMediaFileRepository _mediaFileRepository;
|
||||
|
||||
|
||||
public MediaFileService(IMediaFileRepository mediaFileRepository, IConfigService configService, IEpisodeService episodeService, IEventAggregator eventAggregator, Logger logger)
|
||||
{
|
||||
_mediaFileRepository = mediaFileRepository;
|
||||
|
@ -74,8 +73,6 @@ namespace NzbDrone.Core.MediaFiles
|
|||
return _mediaFileRepository.GetFilesBySeason(seriesId, seasonNumber);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void HandleAsync(SeriesDeletedEvent message)
|
||||
{
|
||||
var files = GetFilesBySeries(message.Series.Id);
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Marr.Data;
|
||||
using NzbDrone.Core.Datastore;
|
||||
using NzbDrone.Core.MetadataSource.Trakt;
|
||||
using NzbDrone.Core.Model;
|
||||
using NzbDrone.Core.Qualities;
|
||||
using NzbDrone.Core.RootFolders;
|
||||
|
||||
|
||||
namespace NzbDrone.Core.Tv
|
||||
|
@ -25,13 +27,11 @@ namespace NzbDrone.Core.Tv
|
|||
public int TvDbId { get; set; }
|
||||
public int TvRageId { get; set; }
|
||||
public string ImdbId { get; set; }
|
||||
|
||||
public string Title { get; set; }
|
||||
public string CleanTitle { get; set; }
|
||||
public SeriesStatusType Status { get; set; }
|
||||
public string Overview { get; set; }
|
||||
public String AirTime { get; set; }
|
||||
public string Path { get; set; }
|
||||
public bool Monitored { get; set; }
|
||||
public int QualityProfileId { get; set; }
|
||||
public bool SeasonFolder { get; set; }
|
||||
|
@ -44,9 +44,15 @@ namespace NzbDrone.Core.Tv
|
|||
public string Network { get; set; }
|
||||
public DateTime? CustomStartDate { get; set; }
|
||||
public bool UseSceneNumbering { get; set; }
|
||||
|
||||
public string TitleSlug { get; set; }
|
||||
|
||||
public int RootFolderId { get; set; }
|
||||
public string Folder { get; set; }
|
||||
public LazyLoaded<RootFolder> RootFolder { get; set; }
|
||||
|
||||
//Todo: Store the root folder + folderName
|
||||
public string Path { get; set; }
|
||||
|
||||
//Todo: This should be a double since there are timezones that aren't on a full hour offset
|
||||
public int UtcOffset { get; set; }
|
||||
|
||||
|
|
|
@ -1,12 +1,17 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Marr.Data;
|
||||
using NLog;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Common.EnsureThat;
|
||||
using NzbDrone.Common.Eventing;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using NzbDrone.Core.MetadataSource;
|
||||
using NzbDrone.Core.Model;
|
||||
using NzbDrone.Core.Organizer;
|
||||
using NzbDrone.Core.RootFolders;
|
||||
using NzbDrone.Core.Tv.Events;
|
||||
|
||||
namespace NzbDrone.Core.Tv
|
||||
|
@ -29,15 +34,18 @@ namespace NzbDrone.Core.Tv
|
|||
private readonly IConfigService _configService;
|
||||
private readonly IProvideSeriesInfo _seriesInfoProxy;
|
||||
private readonly IEventAggregator _eventAggregator;
|
||||
private readonly DiskProvider _diskProvider;
|
||||
private readonly Logger _logger;
|
||||
|
||||
public SeriesService(ISeriesRepository seriesRepository, IConfigService configServiceService, IProvideSeriesInfo seriesInfoProxy,
|
||||
IEventAggregator eventAggregator, Logger logger)
|
||||
public SeriesService(ISeriesRepository seriesRepository, IConfigService configServiceService,
|
||||
IProvideSeriesInfo seriesInfoProxy, IEventAggregator eventAggregator,
|
||||
DiskProvider diskProvider, Logger logger)
|
||||
{
|
||||
_seriesRepository = seriesRepository;
|
||||
_configService = configServiceService;
|
||||
_seriesInfoProxy = seriesInfoProxy;
|
||||
_eventAggregator = eventAggregator;
|
||||
_diskProvider = diskProvider;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
|
@ -80,6 +88,13 @@ namespace NzbDrone.Core.Tv
|
|||
{
|
||||
Ensure.That(() => newSeries).IsNotNull();
|
||||
|
||||
//Todo: If Path is null we need to create the path
|
||||
if(String.IsNullOrWhiteSpace(newSeries.Folder))
|
||||
{
|
||||
newSeries.Folder = FileNameBuilder.CleanFilename(newSeries.Title);
|
||||
_diskProvider.CreateDirectory(Path.Combine(newSeries.RootFolder.Value.Path, newSeries.Folder));
|
||||
}
|
||||
|
||||
_logger.Info("Adding Series [{0}] Path: [{1}]", newSeries.Title, newSeries.Path);
|
||||
|
||||
newSeries.Monitored = true;
|
||||
|
|
|
@ -22,13 +22,10 @@ define(['app', 'Shared/NotificationCollection', 'Series/SeriesCollection'], func
|
|||
addSeries: function () {
|
||||
|
||||
var quality = this.ui.qualityProfile.val();
|
||||
|
||||
//Todo: This will create an invalid path on linux...
|
||||
var rootPath = this.ui.rootFolder.find(":selected").text();
|
||||
var path = rootPath + "\\" + this.model.get('title');
|
||||
var rootFolderId = this.ui.rootFolder.val();
|
||||
|
||||
this.model.set('qualityProfileId', quality);
|
||||
this.model.set('path', path);
|
||||
this.model.set('rootFolderId', rootFolderId);
|
||||
|
||||
var self = this;
|
||||
|
||||
|
|
Loading…
Reference in New Issue