mirror of
https://github.com/Radarr/Radarr.git
synced 2024-11-04 10:02:40 +01:00
Add series uses all available information
This commit is contained in:
parent
bfb167c374
commit
23acb3a9ae
@ -29,7 +29,6 @@ protected override void MainDbUpgrade()
|
||||
.WithColumn("Images").AsString()
|
||||
.WithColumn("RootFolderId").AsInt32()
|
||||
.WithColumn("Folder").AsString().NotNullable()
|
||||
.WithColumn("Path").AsString().Unique()
|
||||
.WithColumn("Monitored").AsBoolean()
|
||||
.WithColumn("QualityProfileId").AsInt32()
|
||||
.WithColumn("SeasonFolder").AsBoolean()
|
||||
|
@ -42,6 +42,7 @@ public static void Map()
|
||||
.HasOne(h => h.Episode, h => h.EpisodeId);
|
||||
|
||||
Mapper.Entity<Series>().RegisterModel("Series")
|
||||
.Ignore(s => s.Path)
|
||||
.HasOne(s => s.RootFolder, s => s.RootFolderId);
|
||||
|
||||
Mapper.Entity<Season>().RegisterModel("Seasons");
|
||||
|
@ -8,6 +8,7 @@
|
||||
using NzbDrone.Common.EnsureThat;
|
||||
using NzbDrone.Common.Eventing;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using NzbDrone.Core.Datastore;
|
||||
using NzbDrone.Core.MetadataSource;
|
||||
using NzbDrone.Core.Model;
|
||||
using NzbDrone.Core.Organizer;
|
||||
@ -34,17 +35,19 @@ public class SeriesService : ISeriesService, IHandleAsync<SeriesAddedEvent>
|
||||
private readonly IConfigService _configService;
|
||||
private readonly IProvideSeriesInfo _seriesInfoProxy;
|
||||
private readonly IEventAggregator _eventAggregator;
|
||||
private readonly IBasicRepository<RootFolder> _rootFolderRepository;
|
||||
private readonly DiskProvider _diskProvider;
|
||||
private readonly Logger _logger;
|
||||
|
||||
public SeriesService(ISeriesRepository seriesRepository, IConfigService configServiceService,
|
||||
IProvideSeriesInfo seriesInfoProxy, IEventAggregator eventAggregator,
|
||||
DiskProvider diskProvider, Logger logger)
|
||||
IBasicRepository<RootFolder> rootFolderRepository, DiskProvider diskProvider, Logger logger)
|
||||
{
|
||||
_seriesRepository = seriesRepository;
|
||||
_configService = configServiceService;
|
||||
_seriesInfoProxy = seriesInfoProxy;
|
||||
_eventAggregator = eventAggregator;
|
||||
_rootFolderRepository = rootFolderRepository;
|
||||
_diskProvider = diskProvider;
|
||||
_logger = logger;
|
||||
}
|
||||
@ -88,11 +91,10 @@ public void AddSeries(Series newSeries)
|
||||
{
|
||||
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));
|
||||
_diskProvider.CreateDirectory(Path.Combine(_rootFolderRepository.Get(newSeries.RootFolderId).Path, newSeries.Folder));
|
||||
}
|
||||
|
||||
_logger.Info("Adding Series [{0}] Path: [{1}]", newSeries.Title, newSeries.Path);
|
||||
|
@ -13,27 +13,23 @@ define([
|
||||
|
||||
var self = this;
|
||||
|
||||
var seriesId = this.model.get('tvDbId');
|
||||
var title = this.model.get('title');
|
||||
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({
|
||||
tvDbId : seriesId,
|
||||
title : title,
|
||||
qualityProfileId: quality,
|
||||
path : path
|
||||
});
|
||||
this.model.set('qualityProfileId', quality);
|
||||
this.model.set('rootFolderId', rootFolderId);
|
||||
this.model.set('folder', folder);
|
||||
|
||||
var seriesCollection = new NzbDrone.Series.SeriesCollection();
|
||||
seriesCollection.add(model);
|
||||
seriesCollection.add(this.model);
|
||||
|
||||
model.save(undefined, {
|
||||
this.model.save(undefined, {
|
||||
success: function () {
|
||||
var notificationModel = new NzbDrone.Shared.NotificationModel({
|
||||
tvDbId : seriesId,
|
||||
tvDbId : self.model.get('tvDbId'),
|
||||
title : 'Added',
|
||||
message: title,
|
||||
message: self.model.get('title'),
|
||||
level : 'success'
|
||||
});
|
||||
|
||||
@ -52,7 +48,7 @@ define([
|
||||
|
||||
events: {
|
||||
'click .x-btn-search': 'search',
|
||||
'keydown .x-txt-search': 'keydown'
|
||||
'keydown .x-txt-search': 'keyDown'
|
||||
},
|
||||
|
||||
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);
|
||||
if(code === 13) {
|
||||
this.search();
|
||||
|
@ -16,7 +16,7 @@ define(['app', 'Quality/QualityProfileCollection'], function (app, qualityProfil
|
||||
importItems: function (rootFolderModel) {
|
||||
|
||||
this.reset();
|
||||
var rootFolder = rootFolderModel.get('path');
|
||||
var rootFolder = rootFolderModel;//.get('path');
|
||||
|
||||
_.each(rootFolderModel.get('unmappedFolders'), function (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: {
|
||||
searchResult: '#search-result'
|
||||
},
|
||||
|
||||
collection: new NzbDrone.Series.SeriesCollection(),
|
||||
|
||||
onRender: function () {
|
||||
console.log('binding auto complete');
|
||||
var self = this;
|
||||
|
||||
this.ui.seriesSearch
|
||||
|
Loading…
Reference in New Issue
Block a user