mirror of https://github.com/Sonarr/Sonarr
Add series uses all available information
This commit is contained in:
parent
bfb167c374
commit
23acb3a9ae
|
@ -29,7 +29,6 @@ namespace NzbDrone.Core.Datastore.Migration
|
||||||
.WithColumn("Images").AsString()
|
.WithColumn("Images").AsString()
|
||||||
.WithColumn("RootFolderId").AsInt32()
|
.WithColumn("RootFolderId").AsInt32()
|
||||||
.WithColumn("Folder").AsString().NotNullable()
|
.WithColumn("Folder").AsString().NotNullable()
|
||||||
.WithColumn("Path").AsString().Unique()
|
|
||||||
.WithColumn("Monitored").AsBoolean()
|
.WithColumn("Monitored").AsBoolean()
|
||||||
.WithColumn("QualityProfileId").AsInt32()
|
.WithColumn("QualityProfileId").AsInt32()
|
||||||
.WithColumn("SeasonFolder").AsBoolean()
|
.WithColumn("SeasonFolder").AsBoolean()
|
||||||
|
|
|
@ -42,6 +42,7 @@ namespace NzbDrone.Core.Datastore
|
||||||
.HasOne(h => h.Episode, h => h.EpisodeId);
|
.HasOne(h => h.Episode, h => h.EpisodeId);
|
||||||
|
|
||||||
Mapper.Entity<Series>().RegisterModel("Series")
|
Mapper.Entity<Series>().RegisterModel("Series")
|
||||||
|
.Ignore(s => s.Path)
|
||||||
.HasOne(s => s.RootFolder, s => s.RootFolderId);
|
.HasOne(s => s.RootFolder, s => s.RootFolderId);
|
||||||
|
|
||||||
Mapper.Entity<Season>().RegisterModel("Seasons");
|
Mapper.Entity<Season>().RegisterModel("Seasons");
|
||||||
|
|
|
@ -8,6 +8,7 @@ using NzbDrone.Common;
|
||||||
using NzbDrone.Common.EnsureThat;
|
using NzbDrone.Common.EnsureThat;
|
||||||
using NzbDrone.Common.Eventing;
|
using NzbDrone.Common.Eventing;
|
||||||
using NzbDrone.Core.Configuration;
|
using NzbDrone.Core.Configuration;
|
||||||
|
using NzbDrone.Core.Datastore;
|
||||||
using NzbDrone.Core.MetadataSource;
|
using NzbDrone.Core.MetadataSource;
|
||||||
using NzbDrone.Core.Model;
|
using NzbDrone.Core.Model;
|
||||||
using NzbDrone.Core.Organizer;
|
using NzbDrone.Core.Organizer;
|
||||||
|
@ -34,17 +35,19 @@ namespace NzbDrone.Core.Tv
|
||||||
private readonly IConfigService _configService;
|
private readonly IConfigService _configService;
|
||||||
private readonly IProvideSeriesInfo _seriesInfoProxy;
|
private readonly IProvideSeriesInfo _seriesInfoProxy;
|
||||||
private readonly IEventAggregator _eventAggregator;
|
private readonly IEventAggregator _eventAggregator;
|
||||||
|
private readonly IBasicRepository<RootFolder> _rootFolderRepository;
|
||||||
private readonly DiskProvider _diskProvider;
|
private readonly DiskProvider _diskProvider;
|
||||||
private readonly Logger _logger;
|
private readonly Logger _logger;
|
||||||
|
|
||||||
public SeriesService(ISeriesRepository seriesRepository, IConfigService configServiceService,
|
public SeriesService(ISeriesRepository seriesRepository, IConfigService configServiceService,
|
||||||
IProvideSeriesInfo seriesInfoProxy, IEventAggregator eventAggregator,
|
IProvideSeriesInfo seriesInfoProxy, IEventAggregator eventAggregator,
|
||||||
DiskProvider diskProvider, Logger logger)
|
IBasicRepository<RootFolder> rootFolderRepository, DiskProvider diskProvider, Logger logger)
|
||||||
{
|
{
|
||||||
_seriesRepository = seriesRepository;
|
_seriesRepository = seriesRepository;
|
||||||
_configService = configServiceService;
|
_configService = configServiceService;
|
||||||
_seriesInfoProxy = seriesInfoProxy;
|
_seriesInfoProxy = seriesInfoProxy;
|
||||||
_eventAggregator = eventAggregator;
|
_eventAggregator = eventAggregator;
|
||||||
|
_rootFolderRepository = rootFolderRepository;
|
||||||
_diskProvider = diskProvider;
|
_diskProvider = diskProvider;
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
}
|
}
|
||||||
|
@ -88,11 +91,10 @@ namespace NzbDrone.Core.Tv
|
||||||
{
|
{
|
||||||
Ensure.That(() => newSeries).IsNotNull();
|
Ensure.That(() => newSeries).IsNotNull();
|
||||||
|
|
||||||
//Todo: If Path is null we need to create the path
|
|
||||||
if(String.IsNullOrWhiteSpace(newSeries.Folder))
|
if(String.IsNullOrWhiteSpace(newSeries.Folder))
|
||||||
{
|
{
|
||||||
newSeries.Folder = FileNameBuilder.CleanFilename(newSeries.Title);
|
newSeries.Folder = FileNameBuilder.CleanFilename(newSeries.Title);
|
||||||
_diskProvider.CreateDirectory(Path.Combine(newSeries.RootFolder.Value.Path, newSeries.Folder));
|
_diskProvider.CreateDirectory(Path.Combine(_rootFolderRepository.Get(newSeries.RootFolderId).Path, newSeries.Folder));
|
||||||
}
|
}
|
||||||
|
|
||||||
_logger.Info("Adding Series [{0}] Path: [{1}]", newSeries.Title, newSeries.Path);
|
_logger.Info("Adding Series [{0}] Path: [{1}]", newSeries.Title, newSeries.Path);
|
||||||
|
|
|
@ -13,27 +13,23 @@ define([
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
var seriesId = this.model.get('tvDbId');
|
|
||||||
var title = this.model.get('title');
|
|
||||||
var quality = this.options.qualityProfile.val();
|
var quality = this.options.qualityProfile.val();
|
||||||
var path = this.options.folder.path;
|
var rootFolderId = this.options.rootFolder.id;
|
||||||
|
var folder = this.options.folder.name;
|
||||||
|
|
||||||
var model = new NzbDrone.Series.SeriesModel({
|
this.model.set('qualityProfileId', quality);
|
||||||
tvDbId : seriesId,
|
this.model.set('rootFolderId', rootFolderId);
|
||||||
title : title,
|
this.model.set('folder', folder);
|
||||||
qualityProfileId: quality,
|
|
||||||
path : path
|
|
||||||
});
|
|
||||||
|
|
||||||
var seriesCollection = new NzbDrone.Series.SeriesCollection();
|
var seriesCollection = new NzbDrone.Series.SeriesCollection();
|
||||||
seriesCollection.add(model);
|
seriesCollection.add(this.model);
|
||||||
|
|
||||||
model.save(undefined, {
|
this.model.save(undefined, {
|
||||||
success: function () {
|
success: function () {
|
||||||
var notificationModel = new NzbDrone.Shared.NotificationModel({
|
var notificationModel = new NzbDrone.Shared.NotificationModel({
|
||||||
tvDbId : seriesId,
|
tvDbId : self.model.get('tvDbId'),
|
||||||
title : 'Added',
|
title : 'Added',
|
||||||
message: title,
|
message: self.model.get('title'),
|
||||||
level : 'success'
|
level : 'success'
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -52,7 +48,7 @@ define([
|
||||||
|
|
||||||
events: {
|
events: {
|
||||||
'click .x-btn-search': 'search',
|
'click .x-btn-search': 'search',
|
||||||
'keydown .x-txt-search': 'keydown'
|
'keydown .x-txt-search': 'keyDown'
|
||||||
},
|
},
|
||||||
|
|
||||||
ui: {
|
ui: {
|
||||||
|
@ -88,7 +84,8 @@ define([
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
keydown: function (e) {
|
keyDown: function (e) {
|
||||||
|
//Check for enter being pressed
|
||||||
var code = (e.keyCode ? e.keyCode : e.which);
|
var code = (e.keyCode ? e.keyCode : e.which);
|
||||||
if(code === 13) {
|
if(code === 13) {
|
||||||
this.search();
|
this.search();
|
||||||
|
|
|
@ -16,7 +16,7 @@ define(['app', 'Quality/QualityProfileCollection'], function (app, qualityProfil
|
||||||
importItems: function (rootFolderModel) {
|
importItems: function (rootFolderModel) {
|
||||||
|
|
||||||
this.reset();
|
this.reset();
|
||||||
var rootFolder = rootFolderModel.get('path');
|
var rootFolder = rootFolderModel;//.get('path');
|
||||||
|
|
||||||
_.each(rootFolderModel.get('unmappedFolders'), function (folder) {
|
_.each(rootFolderModel.get('unmappedFolders'), function (folder) {
|
||||||
this.push(new NzbDrone.AddSeries.Existing.UnmappedFolderModel({ rootFolder: rootFolder, folder: folder}));
|
this.push(new NzbDrone.AddSeries.Existing.UnmappedFolderModel({ rootFolder: rootFolder, folder: folder}));
|
||||||
|
|
|
@ -11,11 +11,9 @@ define(['app', 'AddSeries/RootFolders/RootFolderCollection', 'AddSeries/New/Sear
|
||||||
regions: {
|
regions: {
|
||||||
searchResult: '#search-result'
|
searchResult: '#search-result'
|
||||||
},
|
},
|
||||||
|
|
||||||
collection: new NzbDrone.Series.SeriesCollection(),
|
collection: new NzbDrone.Series.SeriesCollection(),
|
||||||
|
|
||||||
onRender: function () {
|
onRender: function () {
|
||||||
console.log('binding auto complete');
|
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
this.ui.seriesSearch
|
this.ui.seriesSearch
|
||||||
|
|
Loading…
Reference in New Issue