diff --git a/Gruntfile.js b/Gruntfile.js index 7025f8c6b..bd0bb243e 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -1,9 +1,10 @@ module.exports = function (grunt) { 'use strict'; - var outputRoot = '_output/'; - var outputDir = outputRoot +'UI/'; - var srcContent = 'UI/Content/'; + var outputRoot = '_output/'; + var outputDir = outputRoot +'UI/'; + var srcRoot = 'src/UI/' + var srcContent = srcRoot + 'Content/'; var destContent = outputDir + 'Content/'; grunt.initConfig({ @@ -11,36 +12,39 @@ module.exports = function (grunt) { pkg: grunt.file.readJSON('package.json'), curl: { - 'UI/JsLibraries/backbone.js' : 'http://documentcloud.github.io/backbone/backbone.js', - 'UI/JsLibraries/backbone.marionette.js' : 'http://marionettejs.com/downloads/backbone.marionette.js', - 'UI/JsLibraries/backbone.modelbinder.js' : 'http://raw.github.com/theironcook/Backbone.ModelBinder/master/Backbone.ModelBinder.js', - 'UI/JsLibraries/backbone.shortcuts.js' : 'http://raw.github.com/bry4n/backbone-shortcuts/master/backbone.shortcuts.js', + 'src/UI/JsLibraries/backbone.js' : 'http://documentcloud.github.io/backbone/backbone.js', + 'src/UI/JsLibraries/backbone.marionette.js' : 'http://marionettejs.com/downloads/backbone.marionette.js', + 'src/UI/JsLibraries/backbone.modelbinder.js' : 'http://raw.github.com/theironcook/Backbone.ModelBinder/master/Backbone.ModelBinder.js', + 'src/UI/JsLibraries/backbone.shortcuts.js' : 'http://raw.github.com/bry4n/backbone-shortcuts/master/backbone.shortcuts.js', - 'UI/JsLibraries/backbone.pageable.js' : 'http://raw.github.com/wyuenho/backbone-pageable/master/lib/backbone-pageable.js', - 'UI/JsLibraries/backbone.backgrid.js' : 'http://raw.github.com/wyuenho/backgrid/master/lib/backgrid.js', - 'UI/JsLibraries/backbone.backgrid.paginator.js' : 'http://raw.github.com/wyuenho/backgrid/master/lib/extensions/paginator/backgrid-paginator.js', - 'UI/JsLibraries/backbone.backgrid.filter.js' : 'http://raw.github.com/wyuenho/backgrid/master/lib/extensions/filter/backgrid-filter.js', + 'src/UI/JsLibraries/backbone.pageable.js' : 'http://raw.github.com/wyuenho/backbone-pageable/master/lib/backbone-pageable.js', + 'src/UI/JsLibraries/backbone.backgrid.js' : 'http://raw.github.com/wyuenho/backgrid/master/lib/backgrid.js', + 'src/UI/JsLibraries/backbone.backgrid.paginator.js' : 'http://raw.github.com/wyuenho/backgrid/master/lib/extensions/paginator/backgrid-paginator.js', + 'src/UI/JsLibraries/backbone.backgrid.filter.js' : 'http://raw.github.com/wyuenho/backgrid/master/lib/extensions/filter/backgrid-filter.js', - 'UI/JsLibraries/backbone.validation.js' : 'https://raw.github.com/thedersen/backbone.validation/master/dist/backbone-validation.js', + 'src/UI/JsLibraries/backbone.backgrid.selectall.js' : 'http://raw.github.com/wyuenho/backgrid-select-all/master/backgrid-select-all.js', + 'src/UI/Content/Backgrid/selectall.css' : 'http://raw.github.com/wyuenho/backgrid-select-all/master/backgrid-select-all.css', - 'UI/JsLibraries/handlebars.runtime.js' : 'http://raw.github.com/wycats/handlebars.js/master/dist/handlebars.runtime.js', - 'UI/JsLibraries/handlebars.helpers.js' : 'http://raw.github.com/danharper/Handlebars-Helpers/master/helpers.js', + 'src/UI/JsLibraries/backbone.validation.js' : 'https://raw.github.com/thedersen/backbone.validation/master/dist/backbone-validation.js', - 'UI/JsLibraries/jquery.js' : 'http://code.jquery.com/jquery.js', - 'UI/JsLibraries/jquery.backstretch.js' : 'http://raw.github.com/srobbin/jquery-backstretch/master/jquery.backstretch.js', - 'UI/JsLibraries/jquery.signalR.js' : 'http://raw.github.com/SignalR/SignalR/master/samples/Microsoft.AspNet.SignalR.Hosting.AspNet.Samples/Scripts/jquery.signalR.js', - 'UI/JsLibraries/jquery.knob.js' : 'http://raw.github.com/aterrien/jQuery-Knob/master/js/jquery.knob.js', + 'src/UI/JsLibraries/handlebars.runtime.js' : 'http://raw.github.com/wycats/handlebars.js/master/dist/handlebars.runtime.js', + 'src/UI/JsLibraries/handlebars.helpers.js' : 'http://raw.github.com/danharper/Handlebars-Helpers/master/helpers.js', - 'UI/JsLibraries/require.js' : 'http://raw.github.com/jrburke/requirejs/master/require.js', - 'UI/JsLibraries/filesize.js' : 'http://cdn.filesizejs.com/filesize.js', - 'UI/JsLibraries/lodash.underscore.js' : 'http://raw.github.com/bestiejs/lodash/master/dist/lodash.underscore.js', + 'src/UI/JsLibraries/jquery.js' : 'http://code.jquery.com/jquery.js', + 'src/UI/JsLibraries/jquery.backstretch.js' : 'http://raw.github.com/srobbin/jquery-backstretch/master/jquery.backstretch.js', + 'src/UI/JsLibraries/jquery.signalR.js' : 'http://raw.github.com/SignalR/SignalR/master/samples/Microsoft.AspNet.SignalR.Hosting.AspNet.Samples/Scripts/jquery.signalR.js', + 'src/UI/JsLibraries/jquery.knob.js' : 'http://raw.github.com/aterrien/jQuery-Knob/master/js/jquery.knob.js', + + 'src/UI/JsLibraries/require.js' : 'http://raw.github.com/jrburke/requirejs/master/require.js', + 'src/UI/JsLibraries/filesize.js' : 'http://cdn.filesizejs.com/filesize.js', + 'src/UI/JsLibraries/lodash.underscore.js' : 'http://raw.github.com/bestiejs/lodash/master/dist/lodash.underscore.js', - 'UI/JsLibraries/messenger.js' : 'http://raw.github.com/HubSpot/messenger/master/build/js/messenger.js', - 'UI/Content/Messenger/messenger.css' : 'http://raw.github.com/HubSpot/messenger/master/build/css/messenger.css', - 'UI/Content/Messenger/messenger.future.css' : 'http://raw.github.com/HubSpot/messenger/master/build/css/messenger-theme-future.css', + 'src/UI/JsLibraries/messenger.js' : 'http://raw.github.com/HubSpot/messenger/master/build/js/messenger.js', + 'src/UI/Content/Messenger/messenger.css' : 'http://raw.github.com/HubSpot/messenger/master/build/css/messenger.css', + 'src/UI/Content/Messenger/messenger.future.css' : 'http://raw.github.com/HubSpot/messenger/master/build/css/messenger-theme-future.css', - 'UI/Content/bootstrap.toggle-switch.css' : 'http://raw.github.com/ghinda/css-toggle-switch/gh-pages/toggle-switch.css', - 'UI/Content/prefixer.less' : 'http://raw.github.com/JoelSutherland/LESS-Prefixer/master/prefixer.less' + 'src/UI/Content/bootstrap.toggle-switch.css' : 'http://raw.github.com/ghinda/css-toggle-switch/gh-pages/toggle-switch.css', + 'src/UI/Content/prefixer.less' : 'http://raw.github.com/JoelSutherland/LESS-Prefixer/master/prefixer.less' }, clean: { @@ -63,19 +67,20 @@ module.exports = function (grunt) { dest: destContent + 'bootstrap.css' }, general : { - expand :true, - src : [ - 'UI/Content/theme.less', - 'UI/Content/overrides.less', - 'UI/Series/series.less', - 'UI/AddSeries/addSeries.less', - 'UI/Calendar/calendar.less', - 'UI/Cells/cells.less', - 'UI/Logs/logs.less', - 'UI/Settings/settings.less', - 'UI/Update/update.less' + cwd : srcRoot, + expand : true, + src :[ + 'Content/theme.less', + 'Content/overrides.less', + 'Series/series.less', + 'AddSeries/addSeries.less', + 'Calendar/calendar.less', + 'Cells/cells.less', + 'Settings/settings.less', + 'System/Logs/logs.less', + 'System/Update/update.less' ], - dest : outputRoot, + dest : outputDir, ext: '.css' } }, @@ -88,49 +93,65 @@ module.exports = function (grunt) { amd : true, processName: function (fileName) { return fileName - .replace('UI/', '') + .replace(srcRoot, '') .replace('.html', '') .toLowerCase(); } }, files : { - src : ['UI/**/*Template.html','UI/**/*Partial.html'], + src : [ srcRoot + '**/*Template.html', srcRoot + '**/*Partial.html'], dest: outputDir + 'templates.js' } }, copy: { index : { - src : 'UI/*ndex.html', - dest: outputRoot + cwd : srcRoot, + expand: true, + src : '*ndex.html', + dest : outputDir }, scripts: { - src : 'UI/**/*.js', - dest: outputRoot + cwd : srcRoot, + expand: true, + src : '**/*.js', + dest : outputDir }, styles : { - src : 'UI/**/*.css', - dest: outputRoot + cwd : srcRoot, + expand: true, + src : '**/*.css', + dest : outputDir }, images : { - src : 'UI/**/*.png', - dest: outputRoot + cwd : srcRoot, + expand: true, + src : '**/*.png', + dest : outputDir }, jpg : { - src : 'UI/**/*.jpg', - dest: outputRoot + cwd : srcRoot, + expand: true, + src : '**/*.jpg', + dest : outputDir }, icon : { - src : 'UI/**/*.ico', - dest: outputRoot + cwd : srcRoot, + expand: true, + src : '**/*.ico', + dest : outputDir }, fontAwesome : { - src : 'UI/**/FontAwesome/*.*', - dest: outputRoot + cwd : srcRoot, + expand: true, + src : '**/FontAwesome/*.*', + dest : outputDir }, fonts : { - src : 'UI/**/fonts/*.*', - dest: outputRoot + cwd : srcRoot, + expand: true, + src : '**/fonts/*.*', + dest : outputDir } }, @@ -143,7 +164,7 @@ module.exports = function (grunt) { tasks: ['less:bootstrap','less:general'] }, generalLess: { - files: ['UI/**/*.less', '!**/Bootstrap/**', '!**/FontAwesome/**'], + files: [ srcRoot + '**/*.less', '!**/Bootstrap/**', '!**/FontAwesome/**'], tasks: ['less:general'] }, handlebars : { @@ -151,35 +172,35 @@ module.exports = function (grunt) { tasks: ['handlebars'] }, copyIndex : { - files: '<%= copy.index.src %>', + files: '<%= copy.index.cwd %><%= copy.index.src %>', tasks: ['copy:index'] }, copyScripts: { - files: '<%= copy.scripts.src %>', + files: '<%= copy.scripts.cwd %><%= copy.scripts.src %>', tasks: ['copy:scripts'] }, copyStyles : { - files: '<%= copy.styles.src %>', + files: '<%= copy.styles.cwd %><%= copy.styles.src %>', tasks: ['copy:styles'] }, copyImages : { - files: '<%= copy.images.src %>', + files: '<%= copy.images.cwd %><%= copy.images.src %>', tasks: ['copy:images'] }, copyJpg : { - files: '<%= copy.jpg.src %>', + files: '<%= copy.jpg.cwd %><%= copy.jpg.src %>', tasks: ['copy:jpg'] }, copyIcon : { - files: '<%= copy.icon.src %>', + files: '<%= copy.icon.cwd %><%= copy.icon.src %>', tasks: ['copy:icon'] }, copyFontAwesome : { - files: '<%= copy.fontAwesome.src %>', + files: '<%= copy.fontAwesome.cwd %><%= copy.fontAwesome.src %>', tasks: ['copy:fontAwesome'] }, copyFonts : { - files: '<%= copy.fonts.src %>', + files: '<%= copy.fonts.cwd %><%= copy.fonts.src %>', tasks: ['copy:fonts'] } } diff --git a/NzbDrone.Api/ClientSchema/SchemaDeserializer.cs b/NzbDrone.Api/ClientSchema/SchemaDeserializer.cs deleted file mode 100644 index 9985ffb49..000000000 --- a/NzbDrone.Api/ClientSchema/SchemaDeserializer.cs +++ /dev/null @@ -1,45 +0,0 @@ -using System; -using System.Collections.Generic; -using NzbDrone.Common; -using NzbDrone.Common.Reflection; -using NzbDrone.Core.Annotations; - -namespace NzbDrone.Api.ClientSchema -{ - public static class SchemaDeserializer - { - public static T DeserializeSchema(T model, List fields) - { - var properties = model.GetType().GetSimpleProperties(); - - foreach (var propertyInfo in properties) - { - var fieldAttribute = propertyInfo.GetAttribute(false); - - if (fieldAttribute != null) - { - var field = fields.Find(f => f.Name == propertyInfo.Name); - - if (propertyInfo.PropertyType == typeof (Int32)) - { - var intValue = Convert.ToInt32(field.Value); - propertyInfo.SetValue(model, intValue, null); - } - - else if (propertyInfo.PropertyType == typeof(Nullable)) - { - var intValue = field.Value.ToString().ParseInt32(); - propertyInfo.SetValue(model, intValue, null); - } - - else - { - propertyInfo.SetValue(model, field.Value, null); - } - } - } - - return model; - } - } -} \ No newline at end of file diff --git a/NzbDrone.Api/Episodes/EpisodeModule.cs b/NzbDrone.Api/Episodes/EpisodeModule.cs deleted file mode 100644 index 3d6684d19..000000000 --- a/NzbDrone.Api/Episodes/EpisodeModule.cs +++ /dev/null @@ -1,44 +0,0 @@ -using System.Collections.Generic; -using NzbDrone.Api.Mapping; -using NzbDrone.Api.REST; -using NzbDrone.Core.Tv; - -namespace NzbDrone.Api.Episodes -{ - public class EpisodeModule : NzbDroneRestModule - { - private readonly IEpisodeService _episodeService; - - public EpisodeModule(IEpisodeService episodeService) - : base("/episodes") - { - _episodeService = episodeService; - - GetResourceAll = GetEpisodes; - UpdateResource = SetMonitored; - GetResourceById = GetEpisode; - } - - private List GetEpisodes() - { - var seriesId = (int?)Request.Query.SeriesId; - - if (seriesId == null) - { - throw new BadRequestException("seriesId is missing"); - } - - return ToListResource(() => _episodeService.GetEpisodeBySeries(seriesId.Value)); - } - - private void SetMonitored(EpisodeResource episodeResource) - { - _episodeService.SetEpisodeMonitored(episodeResource.Id, episodeResource.Monitored); - } - - private EpisodeResource GetEpisode(int id) - { - return _episodeService.GetEpisode(id).InjectTo(); - } - } -} \ No newline at end of file diff --git a/NzbDrone.Api/Indexers/IndexerModule.cs b/NzbDrone.Api/Indexers/IndexerModule.cs deleted file mode 100644 index 02215d3ed..000000000 --- a/NzbDrone.Api/Indexers/IndexerModule.cs +++ /dev/null @@ -1,113 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using NzbDrone.Api.ClientSchema; -using NzbDrone.Api.REST; -using NzbDrone.Core.Indexers; -using Omu.ValueInjecter; -using FluentValidation; -using NzbDrone.Api.Mapping; - -namespace NzbDrone.Api.Indexers -{ - public class IndexerModule : NzbDroneRestModule - { - private readonly IIndexerService _indexerService; - - public IndexerModule(IIndexerService indexerService) - { - _indexerService = indexerService; - GetResourceAll = GetAll; - GetResourceById = GetIndexer; - CreateResource = CreateIndexer; - UpdateResource = UpdateIndexer; - DeleteResource = DeleteIndexer; - - - SharedValidator.RuleFor(c => c.Name).NotEmpty(); - SharedValidator.RuleFor(c => c.Implementation).NotEmpty(); - - PostValidator.RuleFor(c => c.Fields).NotEmpty(); - } - - private IndexerResource GetIndexer(int id) - { - return _indexerService.Get(id).InjectTo(); - } - - private List GetAll() - { - var indexers = _indexerService.All(); - - var result = new List(indexers.Count); - - foreach (var indexer in indexers) - { - var indexerResource = new IndexerResource(); - indexerResource.InjectFrom(indexer); - indexerResource.Fields = SchemaBuilder.GenerateSchema(indexer.Settings); - - result.Add(indexerResource); - } - - return result; - } - - private int CreateIndexer(IndexerResource indexerResource) - { - var indexer = GetIndexer(indexerResource); - indexer = _indexerService.Create(indexer); - return indexer.Id; - } - - private void UpdateIndexer(IndexerResource indexerResource) - { - var indexer = _indexerService.Get(indexerResource.Id); - indexer.InjectFrom(indexerResource); - indexer.Settings = SchemaDeserializer.DeserializeSchema(indexer.Settings, indexerResource.Fields); - - ValidateIndexer(indexer); - - _indexerService.Update(indexer); - } - - - private static void ValidateIndexer(Indexer indexer) - { - if (indexer.Enable) - { - var validationResult = indexer.Settings.Validate(); - - if (!validationResult.IsValid) - { - throw new ValidationException(validationResult.Errors); - } - } - } - - private Indexer GetIndexer(IndexerResource indexerResource) - { - var indexer = _indexerService.Schema() - .SingleOrDefault(i => - i.Implementation.Equals(indexerResource.Implementation, - StringComparison.InvariantCultureIgnoreCase)); - - if (indexer == null) - { - throw new BadRequestException("Invalid Indexer Implementation"); - } - - indexer.InjectFrom(indexerResource); - indexer.Settings = SchemaDeserializer.DeserializeSchema(indexer.Settings, indexerResource.Fields); - - ValidateIndexer(indexer); - - return indexer; - } - - private void DeleteIndexer(int id) - { - _indexerService.Delete(id); - } - } -} \ No newline at end of file diff --git a/NzbDrone.Api/NzbDrone.Api.ncrunchproject b/NzbDrone.Api/NzbDrone.Api.ncrunchproject deleted file mode 100644 index 1a2228e7f..000000000 --- a/NzbDrone.Api/NzbDrone.Api.ncrunchproject +++ /dev/null @@ -1,22 +0,0 @@ - - false - true - false - false - false - false - false - false - true - true - false - true - true - 5000 - Debug - x86 - - x86 - STA - x86 - \ No newline at end of file diff --git a/NzbDrone.Api/Update/UpdateModule.cs b/NzbDrone.Api/Update/UpdateModule.cs deleted file mode 100644 index e4a8cbf3a..000000000 --- a/NzbDrone.Api/Update/UpdateModule.cs +++ /dev/null @@ -1,54 +0,0 @@ -using System; -using System.Collections.Generic; -using Newtonsoft.Json; -using NzbDrone.Api.REST; -using NzbDrone.Core.Update; -using NzbDrone.Api.Mapping; - -namespace NzbDrone.Api.Update -{ - public class UpdateModule : NzbDroneRestModule - { - private readonly ICheckUpdateService _checkUpdateService; - private readonly IRecentUpdateProvider _recentUpdateProvider; - - public UpdateModule(ICheckUpdateService checkUpdateService, - IRecentUpdateProvider recentUpdateProvider) - { - _checkUpdateService = checkUpdateService; - _recentUpdateProvider = recentUpdateProvider; - GetResourceAll = GetRecentUpdates; - } - - private UpdateResource GetAvailableUpdate() - { - var update = _checkUpdateService.AvailableUpdate(); - var response = new UpdateResource(); - - if (update != null) - { - return update.InjectTo(); - } - - return response; - } - - private List GetRecentUpdates() - { - return ToListResource(_recentUpdateProvider.GetRecentUpdatePackages); - } - } - - public class UpdateResource : RestResource - { - [JsonConverter(typeof(Newtonsoft.Json.Converters.VersionConverter))] - public Version Version { get; set; } - - public String Branch { get; set; } - public DateTime ReleaseDate { get; set; } - public String FileName { get; set; } - public String Url { get; set; } - - public UpdateChanges Changes { get; set; } - } -} \ No newline at end of file diff --git a/NzbDrone.Common.Test/NzbDrone.Common.Test.ncrunchproject b/NzbDrone.Common.Test/NzbDrone.Common.Test.ncrunchproject deleted file mode 100644 index 21e25ddd5..000000000 --- a/NzbDrone.Common.Test/NzbDrone.Common.Test.ncrunchproject +++ /dev/null @@ -1,60 +0,0 @@ - - false - true - false - false - false - false - false - false - true - true - false - true - true - 5000 - Debug - x86 - - x86 - STA - x86 - - - NzbDrone.Common.Test.EnviromentProviderTest.ApplicationPath_should_find_root_in_current_folder - - - NzbDrone\.Common\.Test\.EventingTests\.ServiceNameFixture\..* - - - NzbDrone\.Common\.Test\.ServiceFactoryFixture\..* - - - NzbDrone.Common.Test.ProcessProviderTests.ToString_on_new_processInfo - - - NzbDrone.Common.Test.ProcessProviderTests.Should_be_able_to_start_process - - - NzbDrone.Common.Test.ProcessProviderTests.kill_all_should_kill_all_process_with_name - - - NzbDrone.Common.Test.ProcessProviderTests.GetProcessById_should_return_null_for_invalid_process(9999) - - - NzbDrone.Common.Test.ProcessProviderTests.GetProcessById_should_return_null_for_invalid_process(-1) - - - NzbDrone.Common.Test.ProcessProviderTests.GetProcessById_should_return_null_for_invalid_process(0) - - - NzbDrone\.Common\.Test\.ServiceProviderTests\..* - - - NzbDrone.Common.Test.DiskProviderTests.DiskProviderFixture.folder_should_return_correct_value_for_last_write - - - NzbDrone\.Common\.Test\.DiskProviderTests\.DiskProviderFixture\..* - - - \ No newline at end of file diff --git a/NzbDrone.Common/NzbDrone.Common.ncrunchproject b/NzbDrone.Common/NzbDrone.Common.ncrunchproject deleted file mode 100644 index 1a2228e7f..000000000 --- a/NzbDrone.Common/NzbDrone.Common.ncrunchproject +++ /dev/null @@ -1,22 +0,0 @@ - - false - true - false - false - false - false - false - false - true - true - false - true - true - 5000 - Debug - x86 - - x86 - STA - x86 - \ No newline at end of file diff --git a/NzbDrone.Core.Test/App_Data/Config.xml b/NzbDrone.Core.Test/App_Data/Config.xml deleted file mode 100644 index c4328bdeb..000000000 --- a/NzbDrone.Core.Test/App_Data/Config.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - 8989 - true - \ No newline at end of file diff --git a/NzbDrone.Core/Indexers/IndexerBase.cs b/NzbDrone.Core/Indexers/IndexerBase.cs deleted file mode 100644 index 6f544a2be..000000000 --- a/NzbDrone.Core/Indexers/IndexerBase.cs +++ /dev/null @@ -1,43 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace NzbDrone.Core.Indexers -{ - public abstract class IndexerBase : IIndexer - { - public abstract string Name { get; } - - public abstract IndexerKind Kind { get; } - - public virtual bool EnableByDefault { get { return true; } } - - public IndexerDefinition InstanceDefinition { get; set; } - - public virtual IEnumerable DefaultDefinitions - { - get - { - yield return new IndexerDefinition - { - Name = Name, - Enable = EnableByDefault, - Implementation = GetType().Name, - Settings = String.Empty - }; - } - } - - public virtual IParseFeed Parser { get; private set; } - - public abstract IEnumerable RecentFeed { get; } - public abstract IEnumerable GetEpisodeSearchUrls(string seriesTitle, int tvRageId, int seasonNumber, int episodeNumber); - public abstract IEnumerable GetDailyEpisodeSearchUrls(string seriesTitle, int tvRageId, DateTime date); - public abstract IEnumerable GetSeasonSearchUrls(string seriesTitle, int tvRageId, int seasonNumber, int offset); - } - - public enum IndexerKind - { - Usenet, - Torrent - } -} \ No newline at end of file diff --git a/NzbDrone.Core/Indexers/IndexerDefinition.cs b/NzbDrone.Core/Indexers/IndexerDefinition.cs deleted file mode 100644 index a061052e7..000000000 --- a/NzbDrone.Core/Indexers/IndexerDefinition.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; -using NzbDrone.Core.Datastore; - -namespace NzbDrone.Core.Indexers -{ - public class IndexerDefinition : ModelBase - { - public Boolean Enable { get; set; } - public String Name { get; set; } - public String Settings { get; set; } - public String Implementation { get; set; } - } -} \ No newline at end of file diff --git a/NzbDrone.Core/Indexers/IndexerRepository.cs b/NzbDrone.Core/Indexers/IndexerRepository.cs deleted file mode 100644 index b4c6446a1..000000000 --- a/NzbDrone.Core/Indexers/IndexerRepository.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System; -using System.Linq; -using NzbDrone.Core.Datastore; -using NzbDrone.Core.Messaging.Events; - - -namespace NzbDrone.Core.Indexers -{ - public interface IIndexerRepository : IBasicRepository - { - IndexerDefinition Get(string name); - IndexerDefinition Find(string name); - } - - public class IndexerRepository : BasicRepository, IIndexerRepository - { - public IndexerRepository(IDatabase database, IEventAggregator eventAggregator) - : base(database, eventAggregator) - { - } - - public IndexerDefinition Get(string name) - { - return Query.Single(i => i.Name.Equals(name, StringComparison.InvariantCultureIgnoreCase)); - } - - public IndexerDefinition Find(string name) - { - return Query.SingleOrDefault(i => i.Name.Equals(name, StringComparison.InvariantCultureIgnoreCase)); - } - - } -} diff --git a/NzbDrone.Core/Indexers/IndexerService.cs b/NzbDrone.Core/Indexers/IndexerService.cs deleted file mode 100644 index e1b49c2dd..000000000 --- a/NzbDrone.Core/Indexers/IndexerService.cs +++ /dev/null @@ -1,201 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using NLog; -using NzbDrone.Common.Serializer; -using NzbDrone.Core.Configuration; -using NzbDrone.Core.Indexers.Newznab; -using NzbDrone.Core.Lifecycle; -using NzbDrone.Core.Messaging.Events; -using Omu.ValueInjecter; - -namespace NzbDrone.Core.Indexers -{ - public class Indexer - { - public int Id { get; set; } - public string Name { get; set; } - public bool Enable { get; set; } - public IIndexerSetting Settings { get; set; } - public IIndexer Instance { get; set; } - public string Implementation { get; set; } - } - - public interface IIndexerService - { - List All(); - List GetAvailableIndexers(); - Indexer Get(int id); - Indexer Get(string name); - List Schema(); - Indexer Create(Indexer indexer); - Indexer Update(Indexer indexer); - void Delete(int id); - } - - public class IndexerService : IIndexerService, IHandle - { - private readonly IIndexerRepository _indexerRepository; - private readonly IConfigFileProvider _configFileProvider; - private readonly INewznabTestService _newznabTestService; - private readonly Logger _logger; - - private readonly List _indexers; - - public IndexerService(IIndexerRepository indexerRepository, - IEnumerable indexers, - IConfigFileProvider configFileProvider, - INewznabTestService newznabTestService, - Logger logger) - { - _indexerRepository = indexerRepository; - _configFileProvider = configFileProvider; - _newznabTestService = newznabTestService; - _logger = logger; - - - if (!configFileProvider.Torrent) - { - _indexers = indexers.Where(c => c.Kind != IndexerKind.Torrent).ToList(); - } - else - { - _indexers = indexers.ToList(); - } - } - - public List All() - { - return _indexerRepository.All().Select(ToIndexer).ToList(); - } - - public List GetAvailableIndexers() - { - return All().Where(c => c.Enable && c.Settings.Validate().IsValid).Select(c => c.Instance).ToList(); - } - - public Indexer Get(int id) - { - return ToIndexer(_indexerRepository.Get(id)); - } - - public Indexer Get(string name) - { - return ToIndexer(_indexerRepository.Get(name)); - } - - public List Schema() - { - var indexers = new List(); - - var newznab = new Indexer(); - newznab.Instance = new Newznab.Newznab(); - newznab.Id = 1; - newznab.Name = "Newznab"; - newznab.Settings = new NewznabSettings(); - newznab.Implementation = "Newznab"; - - indexers.Add(newznab); - - return indexers; - } - - public Indexer Create(Indexer indexer) - { - var definition = new IndexerDefinition - { - Name = indexer.Name, - Enable = indexer.Enable, - Implementation = indexer.Implementation, - Settings = indexer.Settings.ToJson() - }; - - var instance = ToIndexer(definition).Instance; - _newznabTestService.Test(instance); - - definition = _indexerRepository.Insert(definition); - indexer.Id = definition.Id; - - return indexer; - } - - public Indexer Update(Indexer indexer) - { - var definition = _indexerRepository.Get(indexer.Id); - definition.InjectFrom(indexer); - definition.Settings = indexer.Settings.ToJson(); - _indexerRepository.Update(definition); - - return indexer; - } - - public void Delete(int id) - { - _indexerRepository.Delete(id); - } - - private Indexer ToIndexer(IndexerDefinition definition) - { - var indexer = new Indexer(); - indexer.Id = definition.Id; - indexer.Enable = definition.Enable; - indexer.Instance = GetInstance(definition); - indexer.Name = definition.Name; - indexer.Implementation = definition.Implementation; - - if (indexer.Instance.GetType().GetMethod("ImportSettingsFromJson") != null) - { - indexer.Settings = ((dynamic)indexer.Instance).ImportSettingsFromJson(definition.Settings); - } - else - { - indexer.Settings = NullSetting.Instance; - } - - return indexer; - } - - private IIndexer GetInstance(IndexerDefinition indexerDefinition) - { - var type = GetImplementation(indexerDefinition); - var instance = (IIndexer)Activator.CreateInstance(type); - instance.InstanceDefinition = indexerDefinition; - return instance; - } - - private Type GetImplementation(IndexerDefinition indexerDefinition) - { - return _indexers.Select(c => c.GetType()).SingleOrDefault(c => c.Name.Equals(indexerDefinition.Implementation, StringComparison.InvariantCultureIgnoreCase)); - } - - public void Handle(ApplicationStartedEvent message) - { - _logger.Debug("Initializing indexers. Count {0}", _indexers.Count); - - RemoveMissingImplementations(); - - var definitions = _indexers.SelectMany(indexer => indexer.DefaultDefinitions); - - var currentIndexer = All(); - - var newIndexers = definitions.Where(def => currentIndexer.All(c => c.Implementation != def.Implementation)).ToList(); - - - if (newIndexers.Any()) - { - _indexerRepository.InsertMany(newIndexers); - } - } - - private void RemoveMissingImplementations() - { - var storedIndexers = _indexerRepository.All(); - - foreach (var indexerDefinition in storedIndexers.Where(i => GetImplementation(i) == null)) - { - _logger.Debug("Removing Indexer {0} ", indexerDefinition.Name); - _indexerRepository.Delete(indexerDefinition); - } - } - } -} \ No newline at end of file diff --git a/NzbDrone.Core/Indexers/IndexerSettingProvider.cs b/NzbDrone.Core/Indexers/IndexerSettingProvider.cs deleted file mode 100644 index ab7da9e58..000000000 --- a/NzbDrone.Core/Indexers/IndexerSettingProvider.cs +++ /dev/null @@ -1,31 +0,0 @@ -using NzbDrone.Common.Serializer; - -namespace NzbDrone.Core.Indexers -{ - public interface IProviderIndexerSetting - { - TSetting Get(IIndexer indexer) where TSetting : IIndexerSetting, new(); - } - - public class IndexerSettingProvider : IProviderIndexerSetting - { - private readonly IIndexerRepository _indexerRepository; - - public IndexerSettingProvider(IIndexerRepository indexerRepository) - { - _indexerRepository = indexerRepository; - } - - public TSetting Get(IIndexer indexer) where TSetting : IIndexerSetting, new() - { - var indexerDef = _indexerRepository.Find(indexer.Name); - - if (indexerDef == null || string.IsNullOrWhiteSpace(indexerDef.Settings)) - { - return new TSetting(); - } - - return Json.Deserialize(indexerDef.Settings); - } - } -} \ No newline at end of file diff --git a/NzbDrone.Core/Indexers/IndexerWithSetting.cs b/NzbDrone.Core/Indexers/IndexerWithSetting.cs deleted file mode 100644 index 78db54932..000000000 --- a/NzbDrone.Core/Indexers/IndexerWithSetting.cs +++ /dev/null @@ -1,21 +0,0 @@ -using NzbDrone.Common.Serializer; - -namespace NzbDrone.Core.Indexers -{ - public abstract class IndexerWithSetting : IndexerBase where TSetting : class, IIndexerSetting, new() - { - public TSetting Settings { get; set; } - - public override bool EnableByDefault - { - get { return false; } - } - - public TSetting ImportSettingsFromJson(string json) - { - Settings = Json.Deserialize(json) ?? new TSetting(); - - return Settings; - } - } -} \ No newline at end of file diff --git a/NzbDrone.Core/Notifications/INotifcationSettings.cs b/NzbDrone.Core/Notifications/INotifcationSettings.cs deleted file mode 100644 index 49e113de4..000000000 --- a/NzbDrone.Core/Notifications/INotifcationSettings.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace NzbDrone.Core.Notifications -{ - public interface INotifcationSettings - { - bool IsValid { get; } - } -} diff --git a/NzbDrone.Core/NzbDrone.Core.ncrunchproject b/NzbDrone.Core/NzbDrone.Core.ncrunchproject deleted file mode 100644 index b2eed192e..000000000 --- a/NzbDrone.Core/NzbDrone.Core.ncrunchproject +++ /dev/null @@ -1,23 +0,0 @@ - - false - true - false - false - false - false - false - false - true - true - false - true - true - 5000 - Debug - x86 - - x86 - STA - x86 - PostBuildEventDisabled - \ No newline at end of file diff --git a/NzbDrone.Test.Common/NzbDrone.Test.Common.ncrunchproject b/NzbDrone.Test.Common/NzbDrone.Test.Common.ncrunchproject deleted file mode 100644 index 1a2228e7f..000000000 --- a/NzbDrone.Test.Common/NzbDrone.Test.Common.ncrunchproject +++ /dev/null @@ -1,22 +0,0 @@ - - false - true - false - false - false - false - false - false - true - true - false - true - true - 5000 - Debug - x86 - - x86 - STA - x86 - \ No newline at end of file diff --git a/NzbDrone.Test.Dummy/NzbDrone.Test.Dummy.ncrunchproject b/NzbDrone.Test.Dummy/NzbDrone.Test.Dummy.ncrunchproject deleted file mode 100644 index 1a2228e7f..000000000 --- a/NzbDrone.Test.Dummy/NzbDrone.Test.Dummy.ncrunchproject +++ /dev/null @@ -1,22 +0,0 @@ - - false - true - false - false - false - false - false - false - true - true - false - true - true - 5000 - Debug - x86 - - x86 - STA - x86 - \ No newline at end of file diff --git a/NzbDrone.Update.Test/NzbDrone.Update.Test.ncrunchproject b/NzbDrone.Update.Test/NzbDrone.Update.Test.ncrunchproject deleted file mode 100644 index 1a2228e7f..000000000 --- a/NzbDrone.Update.Test/NzbDrone.Update.Test.ncrunchproject +++ /dev/null @@ -1,22 +0,0 @@ - - false - true - false - false - false - false - false - false - true - true - false - true - true - 5000 - Debug - x86 - - x86 - STA - x86 - \ No newline at end of file diff --git a/NzbDrone.Update/NzbDrone.Update.ncrunchproject b/NzbDrone.Update/NzbDrone.Update.ncrunchproject deleted file mode 100644 index 1a2228e7f..000000000 --- a/NzbDrone.Update/NzbDrone.Update.ncrunchproject +++ /dev/null @@ -1,22 +0,0 @@ - - false - true - false - false - false - false - false - false - true - true - false - true - true - 5000 - Debug - x86 - - x86 - STA - x86 - \ No newline at end of file diff --git a/NzbDrone.Wix/configuration.xml b/NzbDrone.Wix/configuration.xml deleted file mode 100644 index fdf4f44bf..000000000 --- a/NzbDrone.Wix/configuration.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/NzbDrone.Wix/dotNetInstaller.exe b/NzbDrone.Wix/dotNetInstaller.exe deleted file mode 100644 index a0dd60f8b..000000000 Binary files a/NzbDrone.Wix/dotNetInstaller.exe and /dev/null differ diff --git a/NzbDrone.Wix/nzbdrone.wix.build.bat b/NzbDrone.Wix/nzbdrone.wix.build.bat deleted file mode 100644 index f031916c2..000000000 --- a/NzbDrone.Wix/nzbdrone.wix.build.bat +++ /dev/null @@ -1,8 +0,0 @@ -rd _raw /s /q -rd _setup /s /q -xcopy ..\SyntikX.Client\bin\release\*.* _raw\ /S /V /I /F /R - -"C:\Program Files (x86)\WiX Toolset v3.6\bin\candle.exe" -nologo "syntik.wix.build.wxs" -out "_setup\SyntikX.Wix.wixobj" -ext WixNetFxExtension -ext WixUIExtension -"C:\Program Files (x86)\WiX Toolset v3.6\bin\light.exe" -nologo "_setup\SyntikX.Wix.wixobj" -out "_setup\SyntikX.msi" -ext WixNetFxExtension -ext WixUIExtension - -pause \ No newline at end of file diff --git a/NzbDrone.Wix/nzbdrone.wix.build.debug.bat b/NzbDrone.Wix/nzbdrone.wix.build.debug.bat deleted file mode 100644 index abf84ccaf..000000000 --- a/NzbDrone.Wix/nzbdrone.wix.build.debug.bat +++ /dev/null @@ -1,10 +0,0 @@ -rd _raw /s /q -rd _setup /s /q -xcopy ..\SyntikX.Client\bin\debug\*.* _raw\ /S /V /I /F /R - -SET BUILD_NUMBER=1.9.9.9 - -"C:\Program Files (x86)\WiX Toolset v3.6\bin\candle.exe" -nologo "syntik.wix.build.wxs" -out "_setup\SyntikX.Wix.wixobj" -ext WixNetFxExtension -ext WixUIExtension -"C:\Program Files (x86)\WiX Toolset v3.6\bin\light.exe" -nologo "_setup\SyntikX.Wix.wixobj" -out "_setup\SyntikX.Wix.msi" -ext WixNetFxExtension -ext WixUIExtension - -pause \ No newline at end of file diff --git a/NzbDrone.Wix/nzbdrone.wix.build.wxs b/NzbDrone.Wix/nzbdrone.wix.build.wxs deleted file mode 100644 index 36284be23..000000000 --- a/NzbDrone.Wix/nzbdrone.wix.build.wxs +++ /dev/null @@ -1,84 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - NETFRAMEWORK40FULL - - - - - - - - - \ No newline at end of file diff --git a/NzbDrone.ncrunchsolution b/NzbDrone.ncrunchsolution deleted file mode 100644 index 098d74afe..000000000 --- a/NzbDrone.ncrunchsolution +++ /dev/null @@ -1,13 +0,0 @@ - - 1 - True - true - true - UseDynamicAnalysis - Disabled - Disabled - Disabled - Run all tests automatically:BFRydWU=;Run all tests manually:BUZhbHNl;Run impacted tests automatically, others manually (experimental!):CklzSW1wYWN0ZWQ=;Run pinned tests automatically, others manually:CElzUGlubmVk;Fast:DlN0cnVjdHVyYWxOb2RlBAAAABNEb2VzTm90SGF2ZUNhdGVnb3J5D0ludGVncmF0aW9uVGVzdBNEb2VzTm90SGF2ZUNhdGVnb3J5BkRiVGVzdApJc0ltcGFjdGVkE0RvZXNOb3RIYXZlQ2F0ZWdvcnkORGlza0FjY2Vzc1Rlc3QAAAAAAAAAAAAAAAA= - - - \ No newline at end of file diff --git a/ServiceHelpers/ServiceInstall/ServiceInstall.ncrunchproject b/ServiceHelpers/ServiceInstall/ServiceInstall.ncrunchproject deleted file mode 100644 index b2eed192e..000000000 --- a/ServiceHelpers/ServiceInstall/ServiceInstall.ncrunchproject +++ /dev/null @@ -1,23 +0,0 @@ - - false - true - false - false - false - false - false - false - true - true - false - true - true - 5000 - Debug - x86 - - x86 - STA - x86 - PostBuildEventDisabled - \ No newline at end of file diff --git a/ServiceHelpers/ServiceUninstall/ServiceUninstall.ncrunchproject b/ServiceHelpers/ServiceUninstall/ServiceUninstall.ncrunchproject deleted file mode 100644 index b2eed192e..000000000 --- a/ServiceHelpers/ServiceUninstall/ServiceUninstall.ncrunchproject +++ /dev/null @@ -1,23 +0,0 @@ - - false - true - false - false - false - false - false - false - true - true - false - true - true - 5000 - Debug - x86 - - x86 - STA - x86 - PostBuildEventDisabled - \ No newline at end of file diff --git a/UI/Content/font.less b/UI/Content/font.less deleted file mode 100644 index a4657ee47..000000000 --- a/UI/Content/font.less +++ /dev/null @@ -1,35 +0,0 @@ -@font-face { - font-family: 'Open Sans'; - font-style: normal; - font-weight: 300; - src: url('/Content/fonts/OpenSans-Light.eot'); - src: local('Open Sans Light'), - local('OpenSans-Light'), - url('/Content/fonts/OpenSans-Light.eot?#iefix') format('embedded-opentype'), - url('/Content/fonts/OpenSans-Light.woff') format('woff'), - url('/Content/fonts/OpenSans-Light.ttf') format('truetype'); -} - -@font-face { - font-family: 'Open Sans'; - font-style: normal; - font-weight: 400; - src: url('/Content/fonts/OpenSans-Regular.eot'); - src: local('Open Sans'), - local('OpenSans'), - url('/Content/fonts/OpenSans-Regular.eot?#iefix') format('embedded-opentype'), - url('/Content/fonts/OpenSans-Regular.woff') format('woff'), - url('/Content/fonts/OpenSans-Regular.ttf') format('truetype') -} - -@font-face { - font-family: 'Open Sans'; - font-style: normal; - font-weight: 600; - src: url('/Content/fonts/OpenSans-SemiBold.eot'); - src: local('Open Sans SemiBold'), - local('OpenSans-SemiBold'), - url('/Content/fonts/OpenSans-SemiBold.eot?#iefix') format('embedded-opentype'), - url('/Content/fonts/OpenSans-SemiBold.woff') format('woff'), - url('/Content/fonts/OpenSans-SemiBold.ttf') format('truetype') -} diff --git a/UI/Content/fonts/OpenSans-Italic.eot b/UI/Content/fonts/OpenSans-Italic.eot deleted file mode 100644 index 3fa532787..000000000 Binary files a/UI/Content/fonts/OpenSans-Italic.eot and /dev/null differ diff --git a/UI/Content/fonts/OpenSans-Italic.ttf b/UI/Content/fonts/OpenSans-Italic.ttf deleted file mode 100644 index c90da48ff..000000000 Binary files a/UI/Content/fonts/OpenSans-Italic.ttf and /dev/null differ diff --git a/UI/Content/fonts/OpenSans-Italic.woff b/UI/Content/fonts/OpenSans-Italic.woff deleted file mode 100644 index cedefb8f6..000000000 Binary files a/UI/Content/fonts/OpenSans-Italic.woff and /dev/null differ diff --git a/UI/Content/fonts/OpenSans-LightItalic.eot b/UI/Content/fonts/OpenSans-LightItalic.eot deleted file mode 100644 index 6005799a2..000000000 Binary files a/UI/Content/fonts/OpenSans-LightItalic.eot and /dev/null differ diff --git a/UI/Content/fonts/OpenSans-LightItalic.ttf b/UI/Content/fonts/OpenSans-LightItalic.ttf deleted file mode 100644 index 68299c4bc..000000000 Binary files a/UI/Content/fonts/OpenSans-LightItalic.ttf and /dev/null differ diff --git a/UI/Content/fonts/OpenSans-LightItalic.woff b/UI/Content/fonts/OpenSans-LightItalic.woff deleted file mode 100644 index dd0a0ea26..000000000 Binary files a/UI/Content/fonts/OpenSans-LightItalic.woff and /dev/null differ diff --git a/UI/Content/fonts/OpenSans-SemiboldItalic.eot b/UI/Content/fonts/OpenSans-SemiboldItalic.eot deleted file mode 100644 index 31cd82048..000000000 Binary files a/UI/Content/fonts/OpenSans-SemiboldItalic.eot and /dev/null differ diff --git a/UI/Content/fonts/OpenSans-SemiboldItalic.ttf b/UI/Content/fonts/OpenSans-SemiboldItalic.ttf deleted file mode 100644 index 59b6d16b0..000000000 Binary files a/UI/Content/fonts/OpenSans-SemiboldItalic.ttf and /dev/null differ diff --git a/UI/Content/fonts/OpenSans-SemiboldItalic.woff b/UI/Content/fonts/OpenSans-SemiboldItalic.woff deleted file mode 100644 index 983bb3314..000000000 Binary files a/UI/Content/fonts/OpenSans-SemiboldItalic.woff and /dev/null differ diff --git a/UI/Handlebars/Helpers/Version.js b/UI/Handlebars/Helpers/Version.js deleted file mode 100644 index ca6dad750..000000000 --- a/UI/Handlebars/Helpers/Version.js +++ /dev/null @@ -1,18 +0,0 @@ -'use strict'; - -define( - [ - 'handlebars' - ], function (Handlebars) { - - Handlebars.registerHelper('currentVersion', function (version) { - var currentVersion = window.NzbDrone.ServerStatus.version; - - if (currentVersion === version) - { - return new Handlebars.SafeString(''); - } - - return ''; - }); - }); diff --git a/UI/History/IndexerTemplate.html b/UI/History/IndexerTemplate.html deleted file mode 100644 index 5f493178b..000000000 --- a/UI/History/IndexerTemplate.html +++ /dev/null @@ -1 +0,0 @@ -{{indexer}} \ No newline at end of file diff --git a/UI/Logs/Logs.less b/UI/Logs/Logs.less deleted file mode 100644 index 3c3a2a5a0..000000000 --- a/UI/Logs/Logs.less +++ /dev/null @@ -1,53 +0,0 @@ -@import "../Content/FontAwesome/font-awesome"; -@import "../Shared/Styles/clickable"; - -#logs-screen { - - .log-time-cell{ - width: 80px; - } - - .log-level-cell{ - width: 12px; - font-size: 14px; - } - - td{ - font-size: 13px; - } - - - .icon-info:before { - .icon(@info-sign); - color : dodgerblue; - } - - .icon-debug:before { - .icon(@info-sign); - color : gray; - } - - .icon-trace:before { - .icon(@info-sign); - color : lightgrey; - } - - .icon-warn:before { - .icon(@exclamation-sign); - color : orange; - } - - .icon-error:before { - .icon(@bug); - color : red; - } - - .icon-fatal:before { - .icon(@remove-sign); - color : purple; - } -} - -.log-file-row { - .clickable; -} \ No newline at end of file diff --git a/UI/Logs/Model.js b/UI/Logs/Model.js deleted file mode 100644 index 17c0fd6da..000000000 --- a/UI/Logs/Model.js +++ /dev/null @@ -1,8 +0,0 @@ -'use strict'; -define( - [ - 'backbone' - ], function (Backbone) { - return Backbone.Model.extend({ - }); - }); diff --git a/UI/Missing/MissingLayout.js b/UI/Missing/MissingLayout.js deleted file mode 100644 index 3b4ae5195..000000000 --- a/UI/Missing/MissingLayout.js +++ /dev/null @@ -1,101 +0,0 @@ -'use strict'; -define( - [ - 'marionette', - 'backgrid', - 'Missing/Collection', - 'Cells/SeriesTitleCell', - 'Cells/EpisodeNumberCell', - 'Cells/EpisodeTitleCell', - 'Cells/RelativeDateCell', - 'Shared/Grid/Pager', - 'Shared/Toolbar/ToolbarLayout', - 'Shared/LoadingView' - ], function (Marionette, Backgrid, MissingCollection, SeriesTitleCell, EpisodeNumberCell, EpisodeTitleCell, RelativeDateCell, GridPager, ToolbarLayout, LoadingView) { - return Marionette.Layout.extend({ - template: 'Missing/MissingLayoutTemplate', - - regions: { - missing: '#x-missing', - toolbar: '#x-toolbar', - pager : '#x-pager' - }, - - columns: - [ - { - name : 'series', - label : 'Series Title', - sortable: false, - cell : SeriesTitleCell - }, - { - name : 'this', - label : 'Episode', - sortable: false, - cell : EpisodeNumberCell - }, - { - name : 'this', - label : 'Episode Title', - sortable: false, - cell : EpisodeTitleCell - }, - { - name : 'airDateUtc', - label: 'Air Date', - cell : RelativeDateCell - } - ], - - leftSideButtons: { - type : 'default', - storeState: false, - items : - [ - { - title : 'Season Pass', - icon : 'icon-bookmark', - route : 'seasonpass' - } - ] - }, - - _showTable: function () { - this.missing.show(new Backgrid.Grid({ - columns : this.columns, - collection: this.missingCollection, - className : 'table table-hover' - })); - - this.pager.show(new GridPager({ - columns : this.columns, - collection: this.missingCollection - })); - }, - - - initialize: function () { - this.missingCollection = new MissingCollection(); - - this.listenTo(this.missingCollection, 'sync', this._showTable); - }, - - - onShow: function () { - this.missing.show(new LoadingView()); - this.missingCollection.fetch(); - this._showToolbar(); - }, - - _showToolbar: function () { - this.toolbar.show(new ToolbarLayout({ - left : - [ - this.leftSideButtons - ], - context: this - })); - } - }); - }); diff --git a/UI/Settings/Indexers/Model.js b/UI/Settings/Indexers/Model.js deleted file mode 100644 index a0abfd704..000000000 --- a/UI/Settings/Indexers/Model.js +++ /dev/null @@ -1,17 +0,0 @@ -'use strict'; -define([ - 'Settings/SettingsModelBase'], function (ModelBase) { - return ModelBase.extend({ - - baseInitialize: ModelBase.prototype.initialize, - - initialize: function () { - var name = this.get('name'); - - this.successMessage = 'Saved indexer: ' + name; - this.errorMessage = 'Couldn\'t save indexer: ' + name; - - this.baseInitialize.call(this); - } - }); -}); diff --git a/UI/System/Layout.js b/UI/System/Layout.js deleted file mode 100644 index 5f4778c59..000000000 --- a/UI/System/Layout.js +++ /dev/null @@ -1,63 +0,0 @@ -'use strict'; -define( - [ - 'app', - 'marionette', - 'System/StatusModel', - 'System/About/View', - 'Logs/Layout', - 'Shared/Toolbar/ToolbarLayout' - ], function (App, - Marionette, - StatusModel, - AboutView, - LogsLayout, - ToolbarLayout) { - return Marionette.Layout.extend({ - template: 'System/LayoutTemplate', - - regions: { - toolbar : '#toolbar', - about : '#about', - loading : '#loading' - }, - - leftSideButtons: { - type : 'default', - storeState: false, - items : - [ - { - title: 'Logs', - icon : 'icon-book', - route: 'logs' - }, - { - title : 'Updates', - icon : 'icon-upload-alt', - route : 'update' - } - ] - }, - - initialize: function () { - this.statusModel = StatusModel; - }, - - onRender: function () { - this._showToolbar(); - this.about.show(new AboutView({ model: this.statusModel })); - }, - - _showToolbar: function () { - this.toolbar.show(new ToolbarLayout({ - left : - [ - this.leftSideButtons - ], - context: this - })); - } - }); - }); - diff --git a/UI/System/LayoutTemplate.html b/UI/System/LayoutTemplate.html deleted file mode 100644 index 3760f7c46..000000000 --- a/UI/System/LayoutTemplate.html +++ /dev/null @@ -1,17 +0,0 @@ -
-
-
-
-
- -
-
-
-
-
- -
-
-
-
-
\ No newline at end of file diff --git a/UI/Update/UpdateItemView.js b/UI/Update/UpdateItemView.js deleted file mode 100644 index 8d478f038..000000000 --- a/UI/Update/UpdateItemView.js +++ /dev/null @@ -1,11 +0,0 @@ -'use strict'; - -define( - [ - 'app', - 'marionette' - ], function (App, Marionette) { - return Marionette.ItemView.extend({ - template: 'Update/UpdateItemViewTemplate' - }); - }); diff --git a/UI/Update/UpdateLayout.js b/UI/Update/UpdateLayout.js deleted file mode 100644 index 4794f761c..000000000 --- a/UI/Update/UpdateLayout.js +++ /dev/null @@ -1,58 +0,0 @@ -'use strict'; -define( - [ - 'marionette', - 'backgrid', - 'Update/UpdateCollection', - 'Update/UpdateCollectionView', - 'Shared/Toolbar/ToolbarLayout', - 'Shared/LoadingView' - ], function (Marionette, Backgrid, UpdateCollection, UpdateCollectionView, ToolbarLayout, LoadingView) { - return Marionette.Layout.extend({ - template: 'Update/UpdateLayoutTemplate', - - regions: { - updates: '#x-updates', - toolbar: '#x-toolbar' - }, - - leftSideButtons: { - type : 'default', - storeState: false, - items : - [ - { - title : 'Check for Update', - icon : 'icon-nd-update', - command: 'applicationUpdate' - } - ] - }, - - initialize: function () { - this.updateCollection = new UpdateCollection(); - }, - - onRender: function () { - this.updates.show(new LoadingView()); - this._showToolbar(); - - var self = this; - var promise = this.updateCollection.fetch(); - - promise.done(function (){ - self.updates.show(new UpdateCollectionView({ collection: self.updateCollection })); - }); - }, - - _showToolbar: function () { - this.toolbar.show(new ToolbarLayout({ - left : - [ - this.leftSideButtons - ], - context: this - })); - } - }); - }); diff --git a/build.ps1 b/build.ps1 index f8bc5ad62..21934eff3 100644 --- a/build.ps1 +++ b/build.ps1 @@ -6,11 +6,9 @@ $testSearchPattern = '*.Test\bin\x86\Release' Function Build() { - $clean = $msbuild + " nzbdrone.sln /t:Clean /m" - $build = $msbuild + " nzbdrone.sln /p:Configuration=Release /p:Platform=x86 /t:Build /m" + $clean = $msbuild + " src\nzbdrone.sln /t:Clean /m" + $build = $msbuild + " src\nzbdrone.sln /p:Configuration=Release /p:Platform=x86 /t:Build /m" - - if(Test-Path $outputFolder) { Remove-Item -Recurse -Force $outputFolder -ErrorAction Continue @@ -72,7 +70,7 @@ Function PackageMono() get-childitem $outputFolderMono -File -Filter ServiceUninstall.* -Recurse | foreach ($_) {remove-item $_.fullname} get-childitem $outputFolderMono -File -Filter ServiceInstall.* -Recurse | foreach ($_) {remove-item $_.fullname} - Write-Host Removing native windows binaries Sqlite, MedianInfo + Write-Host Removing native windows binaries Sqlite, MediaInfo get-childitem $outputFolderMono -File -Filter sqlite3.* -Recurse | foreach ($_) {remove-item $_.fullname} get-childitem $outputFolderMono -File -Filter MediaInfo.* -Recurse | foreach ($_) {remove-item $_.fullname} @@ -85,8 +83,8 @@ Function PackageMono() Function AddJsonNet() { get-childitem $outputFolder -File -Filter Newtonsoft.Json.* -Recurse | foreach ($_) {remove-item $_.fullname} - Copy-Item .\packages\Newtonsoft.Json.5.*\lib\net35\*.dll -Destination $outputFolder - Copy-Item .\packages\Newtonsoft.Json.5.*\lib\net35\*.dll -Destination $outputFolder\NzbDrone.Update + Copy-Item .\src\packages\Newtonsoft.Json.5.*\lib\net35\*.dll -Destination $outputFolder + Copy-Item .\src\packages\Newtonsoft.Json.5.*\lib\net35\*.dll -Destination $outputFolder\NzbDrone.Update } Function PackageTests() @@ -103,9 +101,7 @@ Function PackageTests() Copy-Item -Recurse ($_.FullName + "\*") $testPackageFolder -ErrorAction Ignore } - .\.nuget\NuGet.exe install NUnit.Runners -Version 2.6.1 -Output $testPackageFolder - - + .\src\.nuget\NuGet.exe install NUnit.Runners -Version 2.6.1 -Output $testPackageFolder Copy-Item $outputFolder\*.dll -Destination $testPackageFolder -Force Copy-Item $outputFolder\*.pdb -Destination $testPackageFolder -Force @@ -141,4 +137,3 @@ Build RunGrunt PackageMono PackageTests - diff --git a/.nuget/NuGet.Config b/src/.nuget/NuGet.Config similarity index 100% rename from .nuget/NuGet.Config rename to src/.nuget/NuGet.Config diff --git a/.nuget/NuGet.exe b/src/.nuget/NuGet.exe similarity index 100% rename from .nuget/NuGet.exe rename to src/.nuget/NuGet.exe diff --git a/.nuget/NuGet.targets b/src/.nuget/NuGet.targets similarity index 100% rename from .nuget/NuGet.targets rename to src/.nuget/NuGet.targets diff --git a/Exceptron.Client/Configuration/ExceptronConfiguration.cs b/src/Exceptron.Client/Configuration/ExceptronConfiguration.cs similarity index 100% rename from Exceptron.Client/Configuration/ExceptronConfiguration.cs rename to src/Exceptron.Client/Configuration/ExceptronConfiguration.cs diff --git a/Exceptron.Client/ExceptionData.cs b/src/Exceptron.Client/ExceptionData.cs similarity index 100% rename from Exceptron.Client/ExceptionData.cs rename to src/Exceptron.Client/ExceptionData.cs diff --git a/Exceptron.Client/ExceptionSeverity.cs b/src/Exceptron.Client/ExceptionSeverity.cs similarity index 100% rename from Exceptron.Client/ExceptionSeverity.cs rename to src/Exceptron.Client/ExceptionSeverity.cs diff --git a/Exceptron.Client/Exceptron.Client.csproj b/src/Exceptron.Client/Exceptron.Client.csproj similarity index 97% rename from Exceptron.Client/Exceptron.Client.csproj rename to src/Exceptron.Client/Exceptron.Client.csproj index b74cdfd4f..a22db88f7 100644 --- a/Exceptron.Client/Exceptron.Client.csproj +++ b/src/Exceptron.Client/Exceptron.Client.csproj @@ -21,7 +21,7 @@ true - ..\_output\ + ..\..\_output\ DEBUG;TRACE full x86 @@ -29,7 +29,7 @@ MinimumRecommendedRules.ruleset - ..\_output\ + ..\..\_output\ TRACE diff --git a/Exceptron.Client/Exceptron.Client.nuspec b/src/Exceptron.Client/Exceptron.Client.nuspec similarity index 100% rename from Exceptron.Client/Exceptron.Client.nuspec rename to src/Exceptron.Client/Exceptron.Client.nuspec diff --git a/Exceptron.Client/ExceptronApiException.cs b/src/Exceptron.Client/ExceptronApiException.cs similarity index 100% rename from Exceptron.Client/ExceptronApiException.cs rename to src/Exceptron.Client/ExceptronApiException.cs diff --git a/Exceptron.Client/ExceptronClient.cs b/src/Exceptron.Client/ExceptronClient.cs similarity index 100% rename from Exceptron.Client/ExceptronClient.cs rename to src/Exceptron.Client/ExceptronClient.cs diff --git a/Exceptron.Client/IExceptronClient.cs b/src/Exceptron.Client/IExceptronClient.cs similarity index 100% rename from Exceptron.Client/IExceptronClient.cs rename to src/Exceptron.Client/IExceptronClient.cs diff --git a/Exceptron.Client/IRestClient.cs b/src/Exceptron.Client/IRestClient.cs similarity index 100% rename from Exceptron.Client/IRestClient.cs rename to src/Exceptron.Client/IRestClient.cs diff --git a/Exceptron.Client/Message/ExceptionReport.cs b/src/Exceptron.Client/Message/ExceptionReport.cs similarity index 100% rename from Exceptron.Client/Message/ExceptionReport.cs rename to src/Exceptron.Client/Message/ExceptionReport.cs diff --git a/Exceptron.Client/Message/ExceptionResponse.cs b/src/Exceptron.Client/Message/ExceptionResponse.cs similarity index 100% rename from Exceptron.Client/Message/ExceptionResponse.cs rename to src/Exceptron.Client/Message/ExceptionResponse.cs diff --git a/Exceptron.Client/Message/Frame.cs b/src/Exceptron.Client/Message/Frame.cs similarity index 100% rename from Exceptron.Client/Message/Frame.cs rename to src/Exceptron.Client/Message/Frame.cs diff --git a/Exceptron.Client/NuGet/web.config.transform b/src/Exceptron.Client/NuGet/web.config.transform similarity index 100% rename from Exceptron.Client/NuGet/web.config.transform rename to src/Exceptron.Client/NuGet/web.config.transform diff --git a/Exceptron.Client/Properties/AssemblyInfo.cs b/src/Exceptron.Client/Properties/AssemblyInfo.cs similarity index 100% rename from Exceptron.Client/Properties/AssemblyInfo.cs rename to src/Exceptron.Client/Properties/AssemblyInfo.cs diff --git a/Exceptron.Client/RestClient.cs b/src/Exceptron.Client/RestClient.cs similarity index 100% rename from Exceptron.Client/RestClient.cs rename to src/Exceptron.Client/RestClient.cs diff --git a/Exceptron.Client/fastJSON/Getters.cs b/src/Exceptron.Client/fastJSON/Getters.cs similarity index 100% rename from Exceptron.Client/fastJSON/Getters.cs rename to src/Exceptron.Client/fastJSON/Getters.cs diff --git a/Exceptron.Client/fastJSON/JSON.cs b/src/Exceptron.Client/fastJSON/JSON.cs similarity index 100% rename from Exceptron.Client/fastJSON/JSON.cs rename to src/Exceptron.Client/fastJSON/JSON.cs diff --git a/Exceptron.Client/fastJSON/JsonParser.cs b/src/Exceptron.Client/fastJSON/JsonParser.cs similarity index 100% rename from Exceptron.Client/fastJSON/JsonParser.cs rename to src/Exceptron.Client/fastJSON/JsonParser.cs diff --git a/Exceptron.Client/fastJSON/JsonSerializer.cs b/src/Exceptron.Client/fastJSON/JsonSerializer.cs similarity index 100% rename from Exceptron.Client/fastJSON/JsonSerializer.cs rename to src/Exceptron.Client/fastJSON/JsonSerializer.cs diff --git a/Exceptron.Client/fastJSON/SafeDictionary.cs b/src/Exceptron.Client/fastJSON/SafeDictionary.cs similarity index 100% rename from Exceptron.Client/fastJSON/SafeDictionary.cs rename to src/Exceptron.Client/fastJSON/SafeDictionary.cs diff --git a/Exceptron.Client/fastJSON/license.txt b/src/Exceptron.Client/fastJSON/license.txt similarity index 100% rename from Exceptron.Client/fastJSON/license.txt rename to src/Exceptron.Client/fastJSON/license.txt diff --git a/Libraries/Interop.NetFwTypeLib.dll b/src/Libraries/Interop.NetFwTypeLib.dll similarity index 100% rename from Libraries/Interop.NetFwTypeLib.dll rename to src/Libraries/Interop.NetFwTypeLib.dll diff --git a/Libraries/Manifest Tool/mt.exe b/src/Libraries/Manifest Tool/mt.exe similarity index 100% rename from Libraries/Manifest Tool/mt.exe rename to src/Libraries/Manifest Tool/mt.exe diff --git a/Libraries/Manifest Tool/mt.exe.config b/src/Libraries/Manifest Tool/mt.exe.config similarity index 100% rename from Libraries/Manifest Tool/mt.exe.config rename to src/Libraries/Manifest Tool/mt.exe.config diff --git a/Libraries/Sqlite/System.Data.SQLite.dll b/src/Libraries/Sqlite/System.Data.SQLite.dll similarity index 100% rename from Libraries/Sqlite/System.Data.SQLite.dll rename to src/Libraries/Sqlite/System.Data.SQLite.dll diff --git a/Libraries/Sqlite/System.Data.SQLite.xml b/src/Libraries/Sqlite/System.Data.SQLite.xml similarity index 100% rename from Libraries/Sqlite/System.Data.SQLite.xml rename to src/Libraries/Sqlite/System.Data.SQLite.xml diff --git a/Libraries/Sqlite/sqlite3.dll b/src/Libraries/Sqlite/sqlite3.dll similarity index 100% rename from Libraries/Sqlite/sqlite3.dll rename to src/Libraries/Sqlite/sqlite3.dll diff --git a/Marr.Data/Converters/BooleanIntConverter.cs b/src/Marr.Data/Converters/BooleanIntConverter.cs similarity index 85% rename from Marr.Data/Converters/BooleanIntConverter.cs rename to src/Marr.Data/Converters/BooleanIntConverter.cs index 9dc9b41d3..18c964d15 100644 --- a/Marr.Data/Converters/BooleanIntConverter.cs +++ b/src/Marr.Data/Converters/BooleanIntConverter.cs @@ -20,14 +20,14 @@ namespace Marr.Data.Converters { public class BooleanIntConverter : IConverter { - public object FromDB(ColumnMap map, object dbValue) + public object FromDB(ConverterContext context) { - if (dbValue == DBNull.Value) + if (context.DbValue == DBNull.Value) { return DBNull.Value; } - int val = (int)dbValue; + int val = (int)context.DbValue; if (val == 1) { @@ -40,7 +40,12 @@ namespace Marr.Data.Converters throw new ConversionException( string.Format( "The BooleanCharConverter could not convert the value '{0}' to a boolean.", - dbValue)); + context.DbValue)); + } + + public object FromDB(ColumnMap map, object dbValue) + { + return FromDB(new ConverterContext { ColumnMap = map, DbValue = dbValue }); } public object ToDB(object clrValue) diff --git a/Marr.Data/Converters/BooleanYNConverter.cs b/src/Marr.Data/Converters/BooleanYNConverter.cs similarity index 85% rename from Marr.Data/Converters/BooleanYNConverter.cs rename to src/Marr.Data/Converters/BooleanYNConverter.cs index b116bdeaf..38003939c 100644 --- a/Marr.Data/Converters/BooleanYNConverter.cs +++ b/src/Marr.Data/Converters/BooleanYNConverter.cs @@ -20,14 +20,14 @@ namespace Marr.Data.Converters { public class BooleanYNConverter : IConverter { - public object FromDB(ColumnMap map, object dbValue) + public object FromDB(ConverterContext context) { - if (dbValue == DBNull.Value) + if (context.DbValue == DBNull.Value) { return DBNull.Value; } - string val = dbValue.ToString(); + string val = context.DbValue.ToString(); if (val == "Y") { @@ -40,7 +40,12 @@ namespace Marr.Data.Converters throw new ConversionException( string.Format( "The BooleanYNConverter could not convert the value '{0}' to a boolean.", - dbValue)); + context.DbValue)); + } + + public object FromDB(ColumnMap map, object dbValue) + { + return FromDB(new ConverterContext {ColumnMap = map, DbValue = dbValue}); } public object ToDB(object clrValue) diff --git a/Marr.Data/Converters/CastConverter.cs b/src/Marr.Data/Converters/CastConverter.cs similarity index 87% rename from Marr.Data/Converters/CastConverter.cs rename to src/Marr.Data/Converters/CastConverter.cs index 4253357ed..2fa3b8eca 100644 --- a/Marr.Data/Converters/CastConverter.cs +++ b/src/Marr.Data/Converters/CastConverter.cs @@ -30,10 +30,15 @@ namespace Marr.Data.Converters get { return typeof(TDb); } } + public object FromDB(ConverterContext context) + { + TDb val = (TDb)context.DbValue; + return val.ToType(typeof(TClr), CultureInfo.InvariantCulture); + } + public object FromDB(ColumnMap map, object dbValue) { - TDb val = (TDb)dbValue; - return val.ToType(typeof(TClr), CultureInfo.InvariantCulture); + return FromDB(new ConverterContext { ColumnMap = map, DbValue = dbValue }); } public object ToDB(object clrValue) diff --git a/Marr.Data/Converters/ConversionException.cs b/src/Marr.Data/Converters/ConversionException.cs similarity index 100% rename from Marr.Data/Converters/ConversionException.cs rename to src/Marr.Data/Converters/ConversionException.cs diff --git a/src/Marr.Data/Converters/ConverterContext.cs b/src/Marr.Data/Converters/ConverterContext.cs new file mode 100644 index 000000000..341925077 --- /dev/null +++ b/src/Marr.Data/Converters/ConverterContext.cs @@ -0,0 +1,13 @@ +using System.Data; +using Marr.Data.Mapping; + +namespace Marr.Data.Converters +{ + public class ConverterContext + { + public ColumnMap ColumnMap { get; set; } + public object DbValue { get; set; } + public ColumnMapCollection MapCollection { get; set; } + public IDataRecord DataRecord { get; set; } + } +} \ No newline at end of file diff --git a/Marr.Data/Converters/EnumIntConverter.cs b/src/Marr.Data/Converters/EnumIntConverter.cs similarity index 78% rename from Marr.Data/Converters/EnumIntConverter.cs rename to src/Marr.Data/Converters/EnumIntConverter.cs index a7d528d16..5fe88a411 100644 --- a/Marr.Data/Converters/EnumIntConverter.cs +++ b/src/Marr.Data/Converters/EnumIntConverter.cs @@ -20,11 +20,16 @@ namespace Marr.Data.Converters { public class EnumIntConverter : IConverter { + public object FromDB(ConverterContext context) + { + if (context.DbValue == null || context.DbValue == DBNull.Value) + return null; + return Enum.ToObject(context.ColumnMap.FieldType, (int)context.DbValue); + } + public object FromDB(ColumnMap map, object dbValue) { - if (dbValue == null || dbValue == DBNull.Value) - return null; - return Enum.ToObject(map.FieldType, (int)dbValue); + return FromDB(new ConverterContext { ColumnMap = map, DbValue = dbValue }); } public object ToDB(object clrValue) diff --git a/Marr.Data/Converters/EnumStringConverter.cs b/src/Marr.Data/Converters/EnumStringConverter.cs similarity index 79% rename from Marr.Data/Converters/EnumStringConverter.cs rename to src/Marr.Data/Converters/EnumStringConverter.cs index 4e304fc10..eb4f8b01a 100644 --- a/Marr.Data/Converters/EnumStringConverter.cs +++ b/src/Marr.Data/Converters/EnumStringConverter.cs @@ -20,11 +20,16 @@ namespace Marr.Data.Converters { public class EnumStringConverter : IConverter { + public object FromDB(ConverterContext context) + { + if (context.DbValue == null || context.DbValue == DBNull.Value) + return null; + return Enum.Parse(context.ColumnMap.FieldType, (string)context.DbValue); + } + public object FromDB(ColumnMap map, object dbValue) { - if (dbValue == null || dbValue == DBNull.Value) - return null; - return Enum.Parse(map.FieldType, (string)dbValue); + return FromDB(new ConverterContext { ColumnMap = map, DbValue = dbValue }); } public object ToDB(object clrValue) diff --git a/Marr.Data/Converters/IConverter.cs b/src/Marr.Data/Converters/IConverter.cs similarity index 88% rename from Marr.Data/Converters/IConverter.cs rename to src/Marr.Data/Converters/IConverter.cs index 318f26957..f2e9685a9 100644 --- a/Marr.Data/Converters/IConverter.cs +++ b/src/Marr.Data/Converters/IConverter.cs @@ -20,6 +20,9 @@ namespace Marr.Data.Converters { public interface IConverter { + object FromDB(ConverterContext context); + + [Obsolete("use FromDB(ConverterContext context) instead")] object FromDB(ColumnMap map, object dbValue); object ToDB(object clrValue); Type DbType { get; } diff --git a/Marr.Data/DataHelper.cs b/src/Marr.Data/DataHelper.cs similarity index 100% rename from Marr.Data/DataHelper.cs rename to src/Marr.Data/DataHelper.cs diff --git a/Marr.Data/DataMapper.cs b/src/Marr.Data/DataMapper.cs similarity index 100% rename from Marr.Data/DataMapper.cs rename to src/Marr.Data/DataMapper.cs diff --git a/Marr.Data/DataMappingException.cs b/src/Marr.Data/DataMappingException.cs similarity index 100% rename from Marr.Data/DataMappingException.cs rename to src/Marr.Data/DataMappingException.cs diff --git a/Marr.Data/EntityGraph.cs b/src/Marr.Data/EntityGraph.cs similarity index 100% rename from Marr.Data/EntityGraph.cs rename to src/Marr.Data/EntityGraph.cs diff --git a/Marr.Data/EntityMerger.cs b/src/Marr.Data/EntityMerger.cs similarity index 100% rename from Marr.Data/EntityMerger.cs rename to src/Marr.Data/EntityMerger.cs diff --git a/Marr.Data/EntityReference.cs b/src/Marr.Data/EntityReference.cs similarity index 100% rename from Marr.Data/EntityReference.cs rename to src/Marr.Data/EntityReference.cs diff --git a/Marr.Data/ExtensionMethods.cs b/src/Marr.Data/ExtensionMethods.cs similarity index 100% rename from Marr.Data/ExtensionMethods.cs rename to src/Marr.Data/ExtensionMethods.cs diff --git a/Marr.Data/GroupingKeyCollection.cs b/src/Marr.Data/GroupingKeyCollection.cs similarity index 100% rename from Marr.Data/GroupingKeyCollection.cs rename to src/Marr.Data/GroupingKeyCollection.cs diff --git a/Marr.Data/IDataMapper.cs b/src/Marr.Data/IDataMapper.cs similarity index 100% rename from Marr.Data/IDataMapper.cs rename to src/Marr.Data/IDataMapper.cs diff --git a/Marr.Data/LazyLoaded.cs b/src/Marr.Data/LazyLoaded.cs similarity index 100% rename from Marr.Data/LazyLoaded.cs rename to src/Marr.Data/LazyLoaded.cs diff --git a/Marr.Data/MapRepository.cs b/src/Marr.Data/MapRepository.cs similarity index 100% rename from Marr.Data/MapRepository.cs rename to src/Marr.Data/MapRepository.cs diff --git a/Marr.Data/Mapping/ColumnAttribute.cs b/src/Marr.Data/Mapping/ColumnAttribute.cs similarity index 100% rename from Marr.Data/Mapping/ColumnAttribute.cs rename to src/Marr.Data/Mapping/ColumnAttribute.cs diff --git a/Marr.Data/Mapping/ColumnInfo.cs b/src/Marr.Data/Mapping/ColumnInfo.cs similarity index 100% rename from Marr.Data/Mapping/ColumnInfo.cs rename to src/Marr.Data/Mapping/ColumnInfo.cs diff --git a/Marr.Data/Mapping/ColumnMap.cs b/src/Marr.Data/Mapping/ColumnMap.cs similarity index 100% rename from Marr.Data/Mapping/ColumnMap.cs rename to src/Marr.Data/Mapping/ColumnMap.cs diff --git a/Marr.Data/Mapping/ColumnMapBuilder.cs b/src/Marr.Data/Mapping/ColumnMapBuilder.cs similarity index 100% rename from Marr.Data/Mapping/ColumnMapBuilder.cs rename to src/Marr.Data/Mapping/ColumnMapBuilder.cs diff --git a/Marr.Data/Mapping/ColumnMapCollection.cs b/src/Marr.Data/Mapping/ColumnMapCollection.cs similarity index 100% rename from Marr.Data/Mapping/ColumnMapCollection.cs rename to src/Marr.Data/Mapping/ColumnMapCollection.cs diff --git a/Marr.Data/Mapping/EnumConversionType.cs b/src/Marr.Data/Mapping/EnumConversionType.cs similarity index 100% rename from Marr.Data/Mapping/EnumConversionType.cs rename to src/Marr.Data/Mapping/EnumConversionType.cs diff --git a/Marr.Data/Mapping/FluentMappings.cs b/src/Marr.Data/Mapping/FluentMappings.cs similarity index 100% rename from Marr.Data/Mapping/FluentMappings.cs rename to src/Marr.Data/Mapping/FluentMappings.cs diff --git a/Marr.Data/Mapping/IColumnInfo.cs b/src/Marr.Data/Mapping/IColumnInfo.cs similarity index 100% rename from Marr.Data/Mapping/IColumnInfo.cs rename to src/Marr.Data/Mapping/IColumnInfo.cs diff --git a/Marr.Data/Mapping/IRelationshipInfo.cs b/src/Marr.Data/Mapping/IRelationshipInfo.cs similarity index 100% rename from Marr.Data/Mapping/IRelationshipInfo.cs rename to src/Marr.Data/Mapping/IRelationshipInfo.cs diff --git a/Marr.Data/Mapping/MapBuilder.cs b/src/Marr.Data/Mapping/MapBuilder.cs similarity index 100% rename from Marr.Data/Mapping/MapBuilder.cs rename to src/Marr.Data/Mapping/MapBuilder.cs diff --git a/Marr.Data/Mapping/MappingHelper.cs b/src/Marr.Data/Mapping/MappingHelper.cs similarity index 94% rename from Marr.Data/Mapping/MappingHelper.cs rename to src/Marr.Data/Mapping/MappingHelper.cs index f025528be..0b4c73681 100644 --- a/Marr.Data/Mapping/MappingHelper.cs +++ b/src/Marr.Data/Mapping/MappingHelper.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Linq; using System.Data.Common; +using Marr.Data.Converters; namespace Marr.Data.Mapping { @@ -53,7 +54,15 @@ namespace Marr.Data.Mapping // Handle conversions if (dataMap.Converter != null) { - dbValue = dataMap.Converter.FromDB(dataMap, dbValue); + var convertContext = new ConverterContext + { + DbValue = dbValue, + ColumnMap = dataMap, + MapCollection = mappings, + DataRecord = reader + }; + + dbValue = dataMap.Converter.FromDB(convertContext); } if (dbValue != DBNull.Value && dbValue != null) diff --git a/Marr.Data/Mapping/Relationship.cs b/src/Marr.Data/Mapping/Relationship.cs similarity index 100% rename from Marr.Data/Mapping/Relationship.cs rename to src/Marr.Data/Mapping/Relationship.cs diff --git a/Marr.Data/Mapping/RelationshipAttribute.cs b/src/Marr.Data/Mapping/RelationshipAttribute.cs similarity index 100% rename from Marr.Data/Mapping/RelationshipAttribute.cs rename to src/Marr.Data/Mapping/RelationshipAttribute.cs diff --git a/Marr.Data/Mapping/RelationshipBuilder.cs b/src/Marr.Data/Mapping/RelationshipBuilder.cs similarity index 100% rename from Marr.Data/Mapping/RelationshipBuilder.cs rename to src/Marr.Data/Mapping/RelationshipBuilder.cs diff --git a/Marr.Data/Mapping/RelationshipCollection.cs b/src/Marr.Data/Mapping/RelationshipCollection.cs similarity index 100% rename from Marr.Data/Mapping/RelationshipCollection.cs rename to src/Marr.Data/Mapping/RelationshipCollection.cs diff --git a/Marr.Data/Mapping/RelationshipInfo.cs b/src/Marr.Data/Mapping/RelationshipInfo.cs similarity index 100% rename from Marr.Data/Mapping/RelationshipInfo.cs rename to src/Marr.Data/Mapping/RelationshipInfo.cs diff --git a/Marr.Data/Mapping/Strategies/AttributeMapStrategy.cs b/src/Marr.Data/Mapping/Strategies/AttributeMapStrategy.cs similarity index 100% rename from Marr.Data/Mapping/Strategies/AttributeMapStrategy.cs rename to src/Marr.Data/Mapping/Strategies/AttributeMapStrategy.cs diff --git a/Marr.Data/Mapping/Strategies/ConventionMapStrategy.cs b/src/Marr.Data/Mapping/Strategies/ConventionMapStrategy.cs similarity index 100% rename from Marr.Data/Mapping/Strategies/ConventionMapStrategy.cs rename to src/Marr.Data/Mapping/Strategies/ConventionMapStrategy.cs diff --git a/Marr.Data/Mapping/Strategies/IMapStrategy.cs b/src/Marr.Data/Mapping/Strategies/IMapStrategy.cs similarity index 100% rename from Marr.Data/Mapping/Strategies/IMapStrategy.cs rename to src/Marr.Data/Mapping/Strategies/IMapStrategy.cs diff --git a/Marr.Data/Mapping/Strategies/PropertyMapStrategy.cs b/src/Marr.Data/Mapping/Strategies/PropertyMapStrategy.cs similarity index 100% rename from Marr.Data/Mapping/Strategies/PropertyMapStrategy.cs rename to src/Marr.Data/Mapping/Strategies/PropertyMapStrategy.cs diff --git a/Marr.Data/Mapping/Strategies/ReflectionMapStrategyBase.cs b/src/Marr.Data/Mapping/Strategies/ReflectionMapStrategyBase.cs similarity index 100% rename from Marr.Data/Mapping/Strategies/ReflectionMapStrategyBase.cs rename to src/Marr.Data/Mapping/Strategies/ReflectionMapStrategyBase.cs diff --git a/Marr.Data/Mapping/TableAttribute.cs b/src/Marr.Data/Mapping/TableAttribute.cs similarity index 100% rename from Marr.Data/Mapping/TableAttribute.cs rename to src/Marr.Data/Mapping/TableAttribute.cs diff --git a/Marr.Data/Mapping/TableBuilder.cs b/src/Marr.Data/Mapping/TableBuilder.cs similarity index 100% rename from Marr.Data/Mapping/TableBuilder.cs rename to src/Marr.Data/Mapping/TableBuilder.cs diff --git a/Marr.Data/Marr.Data.csproj b/src/Marr.Data/Marr.Data.csproj similarity index 97% rename from Marr.Data/Marr.Data.csproj rename to src/Marr.Data/Marr.Data.csproj index f7e58cb01..b369b7085 100644 --- a/Marr.Data/Marr.Data.csproj +++ b/src/Marr.Data/Marr.Data.csproj @@ -23,7 +23,7 @@ true - ..\_output\ + ..\..\_output\ DEBUG;TRACE full x86 @@ -31,7 +31,7 @@ MinimumRecommendedRules.ruleset - ..\_output\ + ..\..\_output\ TRACE true pdbonly @@ -52,6 +52,7 @@ + diff --git a/Marr.Data/Parameters/DbTypeBuilder.cs b/src/Marr.Data/Parameters/DbTypeBuilder.cs similarity index 100% rename from Marr.Data/Parameters/DbTypeBuilder.cs rename to src/Marr.Data/Parameters/DbTypeBuilder.cs diff --git a/Marr.Data/Parameters/IDbTypeBuilder.cs b/src/Marr.Data/Parameters/IDbTypeBuilder.cs similarity index 100% rename from Marr.Data/Parameters/IDbTypeBuilder.cs rename to src/Marr.Data/Parameters/IDbTypeBuilder.cs diff --git a/Marr.Data/Parameters/OleDbTypeBuilder.cs b/src/Marr.Data/Parameters/OleDbTypeBuilder.cs similarity index 100% rename from Marr.Data/Parameters/OleDbTypeBuilder.cs rename to src/Marr.Data/Parameters/OleDbTypeBuilder.cs diff --git a/Marr.Data/Parameters/ParameterChainMethods.cs b/src/Marr.Data/Parameters/ParameterChainMethods.cs similarity index 100% rename from Marr.Data/Parameters/ParameterChainMethods.cs rename to src/Marr.Data/Parameters/ParameterChainMethods.cs diff --git a/Marr.Data/Parameters/SqlDbTypeBuilder.cs b/src/Marr.Data/Parameters/SqlDbTypeBuilder.cs similarity index 100% rename from Marr.Data/Parameters/SqlDbTypeBuilder.cs rename to src/Marr.Data/Parameters/SqlDbTypeBuilder.cs diff --git a/Marr.Data/Properties/AssemblyInfo.cs b/src/Marr.Data/Properties/AssemblyInfo.cs similarity index 100% rename from Marr.Data/Properties/AssemblyInfo.cs rename to src/Marr.Data/Properties/AssemblyInfo.cs diff --git a/Marr.Data/QGen/DeleteQuery.cs b/src/Marr.Data/QGen/DeleteQuery.cs similarity index 100% rename from Marr.Data/QGen/DeleteQuery.cs rename to src/Marr.Data/QGen/DeleteQuery.cs diff --git a/Marr.Data/QGen/Dialects/Dialect.cs b/src/Marr.Data/QGen/Dialects/Dialect.cs similarity index 100% rename from Marr.Data/QGen/Dialects/Dialect.cs rename to src/Marr.Data/QGen/Dialects/Dialect.cs diff --git a/Marr.Data/QGen/Dialects/FirebirdDialect.cs b/src/Marr.Data/QGen/Dialects/FirebirdDialect.cs similarity index 100% rename from Marr.Data/QGen/Dialects/FirebirdDialect.cs rename to src/Marr.Data/QGen/Dialects/FirebirdDialect.cs diff --git a/Marr.Data/QGen/Dialects/OracleDialect.cs b/src/Marr.Data/QGen/Dialects/OracleDialect.cs similarity index 100% rename from Marr.Data/QGen/Dialects/OracleDialect.cs rename to src/Marr.Data/QGen/Dialects/OracleDialect.cs diff --git a/Marr.Data/QGen/Dialects/SqlServerCeDialect.cs b/src/Marr.Data/QGen/Dialects/SqlServerCeDialect.cs similarity index 100% rename from Marr.Data/QGen/Dialects/SqlServerCeDialect.cs rename to src/Marr.Data/QGen/Dialects/SqlServerCeDialect.cs diff --git a/Marr.Data/QGen/Dialects/SqlServerDialect.cs b/src/Marr.Data/QGen/Dialects/SqlServerDialect.cs similarity index 100% rename from Marr.Data/QGen/Dialects/SqlServerDialect.cs rename to src/Marr.Data/QGen/Dialects/SqlServerDialect.cs diff --git a/Marr.Data/QGen/Dialects/SqliteDialect.cs b/src/Marr.Data/QGen/Dialects/SqliteDialect.cs similarity index 100% rename from Marr.Data/QGen/Dialects/SqliteDialect.cs rename to src/Marr.Data/QGen/Dialects/SqliteDialect.cs diff --git a/Marr.Data/QGen/ExpressionVisitor.cs b/src/Marr.Data/QGen/ExpressionVisitor.cs similarity index 100% rename from Marr.Data/QGen/ExpressionVisitor.cs rename to src/Marr.Data/QGen/ExpressionVisitor.cs diff --git a/Marr.Data/QGen/IQuery.cs b/src/Marr.Data/QGen/IQuery.cs similarity index 100% rename from Marr.Data/QGen/IQuery.cs rename to src/Marr.Data/QGen/IQuery.cs diff --git a/Marr.Data/QGen/IQueryBuilder.cs b/src/Marr.Data/QGen/IQueryBuilder.cs similarity index 100% rename from Marr.Data/QGen/IQueryBuilder.cs rename to src/Marr.Data/QGen/IQueryBuilder.cs diff --git a/Marr.Data/QGen/InsertQuery.cs b/src/Marr.Data/QGen/InsertQuery.cs similarity index 100% rename from Marr.Data/QGen/InsertQuery.cs rename to src/Marr.Data/QGen/InsertQuery.cs diff --git a/Marr.Data/QGen/InsertQueryBuilder.cs b/src/Marr.Data/QGen/InsertQueryBuilder.cs similarity index 100% rename from Marr.Data/QGen/InsertQueryBuilder.cs rename to src/Marr.Data/QGen/InsertQueryBuilder.cs diff --git a/Marr.Data/QGen/JoinBuilder.cs b/src/Marr.Data/QGen/JoinBuilder.cs similarity index 100% rename from Marr.Data/QGen/JoinBuilder.cs rename to src/Marr.Data/QGen/JoinBuilder.cs diff --git a/Marr.Data/QGen/PagingQueryDecorator.cs b/src/Marr.Data/QGen/PagingQueryDecorator.cs similarity index 100% rename from Marr.Data/QGen/PagingQueryDecorator.cs rename to src/Marr.Data/QGen/PagingQueryDecorator.cs diff --git a/Marr.Data/QGen/QueryBuilder.cs b/src/Marr.Data/QGen/QueryBuilder.cs similarity index 100% rename from Marr.Data/QGen/QueryBuilder.cs rename to src/Marr.Data/QGen/QueryBuilder.cs diff --git a/Marr.Data/QGen/QueryFactory.cs b/src/Marr.Data/QGen/QueryFactory.cs similarity index 100% rename from Marr.Data/QGen/QueryFactory.cs rename to src/Marr.Data/QGen/QueryFactory.cs diff --git a/Marr.Data/QGen/QueryQueueItem.cs b/src/Marr.Data/QGen/QueryQueueItem.cs similarity index 100% rename from Marr.Data/QGen/QueryQueueItem.cs rename to src/Marr.Data/QGen/QueryQueueItem.cs diff --git a/Marr.Data/QGen/RowCountQueryDecorator.cs b/src/Marr.Data/QGen/RowCountQueryDecorator.cs similarity index 100% rename from Marr.Data/QGen/RowCountQueryDecorator.cs rename to src/Marr.Data/QGen/RowCountQueryDecorator.cs diff --git a/Marr.Data/QGen/SelectQuery.cs b/src/Marr.Data/QGen/SelectQuery.cs similarity index 100% rename from Marr.Data/QGen/SelectQuery.cs rename to src/Marr.Data/QGen/SelectQuery.cs diff --git a/Marr.Data/QGen/SortBuilder.cs b/src/Marr.Data/QGen/SortBuilder.cs similarity index 100% rename from Marr.Data/QGen/SortBuilder.cs rename to src/Marr.Data/QGen/SortBuilder.cs diff --git a/Marr.Data/QGen/SortColumn.cs b/src/Marr.Data/QGen/SortColumn.cs similarity index 100% rename from Marr.Data/QGen/SortColumn.cs rename to src/Marr.Data/QGen/SortColumn.cs diff --git a/Marr.Data/QGen/SqlitePagingQueryDecorator.cs b/src/Marr.Data/QGen/SqlitePagingQueryDecorator.cs similarity index 100% rename from Marr.Data/QGen/SqlitePagingQueryDecorator.cs rename to src/Marr.Data/QGen/SqlitePagingQueryDecorator.cs diff --git a/Marr.Data/QGen/SqliteRowCountQueryDecorator.cs b/src/Marr.Data/QGen/SqliteRowCountQueryDecorator.cs similarity index 100% rename from Marr.Data/QGen/SqliteRowCountQueryDecorator.cs rename to src/Marr.Data/QGen/SqliteRowCountQueryDecorator.cs diff --git a/Marr.Data/QGen/Table.cs b/src/Marr.Data/QGen/Table.cs similarity index 100% rename from Marr.Data/QGen/Table.cs rename to src/Marr.Data/QGen/Table.cs diff --git a/Marr.Data/QGen/TableCollection.cs b/src/Marr.Data/QGen/TableCollection.cs similarity index 100% rename from Marr.Data/QGen/TableCollection.cs rename to src/Marr.Data/QGen/TableCollection.cs diff --git a/Marr.Data/QGen/UpdateQuery.cs b/src/Marr.Data/QGen/UpdateQuery.cs similarity index 100% rename from Marr.Data/QGen/UpdateQuery.cs rename to src/Marr.Data/QGen/UpdateQuery.cs diff --git a/Marr.Data/QGen/UpdateQueryBuilder.cs b/src/Marr.Data/QGen/UpdateQueryBuilder.cs similarity index 100% rename from Marr.Data/QGen/UpdateQueryBuilder.cs rename to src/Marr.Data/QGen/UpdateQueryBuilder.cs diff --git a/Marr.Data/QGen/View.cs b/src/Marr.Data/QGen/View.cs similarity index 100% rename from Marr.Data/QGen/View.cs rename to src/Marr.Data/QGen/View.cs diff --git a/Marr.Data/QGen/WhereBuilder.cs b/src/Marr.Data/QGen/WhereBuilder.cs similarity index 100% rename from Marr.Data/QGen/WhereBuilder.cs rename to src/Marr.Data/QGen/WhereBuilder.cs diff --git a/Marr.Data/Reflection/IReflectionStrategy.cs b/src/Marr.Data/Reflection/IReflectionStrategy.cs similarity index 100% rename from Marr.Data/Reflection/IReflectionStrategy.cs rename to src/Marr.Data/Reflection/IReflectionStrategy.cs diff --git a/Marr.Data/Reflection/ReflectionHelper.cs b/src/Marr.Data/Reflection/ReflectionHelper.cs similarity index 100% rename from Marr.Data/Reflection/ReflectionHelper.cs rename to src/Marr.Data/Reflection/ReflectionHelper.cs diff --git a/Marr.Data/Reflection/SimpleReflectionStrategy.cs b/src/Marr.Data/Reflection/SimpleReflectionStrategy.cs similarity index 100% rename from Marr.Data/Reflection/SimpleReflectionStrategy.cs rename to src/Marr.Data/Reflection/SimpleReflectionStrategy.cs diff --git a/Marr.Data/SqlModesEnum.cs b/src/Marr.Data/SqlModesEnum.cs similarity index 100% rename from Marr.Data/SqlModesEnum.cs rename to src/Marr.Data/SqlModesEnum.cs diff --git a/Marr.Data/UnitOfWork.cs b/src/Marr.Data/UnitOfWork.cs similarity index 100% rename from Marr.Data/UnitOfWork.cs rename to src/Marr.Data/UnitOfWork.cs diff --git a/Marr.Data/UnitOfWorkSharedContext.cs b/src/Marr.Data/UnitOfWorkSharedContext.cs similarity index 100% rename from Marr.Data/UnitOfWorkSharedContext.cs rename to src/Marr.Data/UnitOfWorkSharedContext.cs diff --git a/NzbDrone.Api.Test/ClientSchemaTests/SchemaBuilderFixture.cs b/src/NzbDrone.Api.Test/ClientSchemaTests/SchemaBuilderFixture.cs similarity index 90% rename from NzbDrone.Api.Test/ClientSchemaTests/SchemaBuilderFixture.cs rename to src/NzbDrone.Api.Test/ClientSchemaTests/SchemaBuilderFixture.cs index bf3d72d11..385a9b989 100644 --- a/NzbDrone.Api.Test/ClientSchemaTests/SchemaBuilderFixture.cs +++ b/src/NzbDrone.Api.Test/ClientSchemaTests/SchemaBuilderFixture.cs @@ -12,7 +12,7 @@ namespace NzbDrone.Api.Test.ClientSchemaTests [Test] public void should_return_field_for_every_property() { - var schema = SchemaBuilder.GenerateSchema(new TestModel()); + var schema = SchemaBuilder.ToSchema(new TestModel()); schema.Should().HaveCount(2); } @@ -26,7 +26,7 @@ namespace NzbDrone.Api.Test.ClientSchemaTests LastName = "Poop" }; - var schema = SchemaBuilder.GenerateSchema(model); + var schema = SchemaBuilder.ToSchema(model); schema.Should().Contain(c => c.Order == 1 && c.Name == "LastName" && c.Label == "Last Name" && c.HelpText == "Your Last Name" && (string) c.Value == "Poop"); schema.Should().Contain(c => c.Order == 0 && c.Name == "FirstName" && c.Label == "First Name" && c.HelpText == "Your First Name" && (string) c.Value == "Bob"); diff --git a/NzbDrone.Api.Test/DirectoryLookupServiceFixture.cs b/src/NzbDrone.Api.Test/DirectoryLookupServiceFixture.cs similarity index 100% rename from NzbDrone.Api.Test/DirectoryLookupServiceFixture.cs rename to src/NzbDrone.Api.Test/DirectoryLookupServiceFixture.cs diff --git a/NzbDrone.Api.Test/MappingTests/ResourceMappingFixture.cs b/src/NzbDrone.Api.Test/MappingTests/ResourceMappingFixture.cs similarity index 98% rename from NzbDrone.Api.Test/MappingTests/ResourceMappingFixture.cs rename to src/NzbDrone.Api.Test/MappingTests/ResourceMappingFixture.cs index 82fb9425a..e03e02c35 100644 --- a/NzbDrone.Api.Test/MappingTests/ResourceMappingFixture.cs +++ b/src/NzbDrone.Api.Test/MappingTests/ResourceMappingFixture.cs @@ -36,7 +36,7 @@ namespace NzbDrone.Api.Test.MappingTests [TestCase(typeof(Episode), typeof(EpisodeResource))] [TestCase(typeof(RootFolder), typeof(RootFolderResource))] [TestCase(typeof(NamingConfig), typeof(NamingConfigResource))] - [TestCase(typeof(Indexer), typeof(IndexerResource))] + [TestCase(typeof(IndexerDefinition), typeof(IndexerResource))] [TestCase(typeof(ReleaseInfo), typeof(ReleaseResource))] [TestCase(typeof(ParsedEpisodeInfo), typeof(ReleaseResource))] [TestCase(typeof(DownloadDecision), typeof(ReleaseResource))] diff --git a/NzbDrone.Api.Test/NzbDrone.Api.Test.csproj b/src/NzbDrone.Api.Test/NzbDrone.Api.Test.csproj similarity index 100% rename from NzbDrone.Api.Test/NzbDrone.Api.Test.csproj rename to src/NzbDrone.Api.Test/NzbDrone.Api.Test.csproj diff --git a/NzbDrone.Api.Test/Properties/AssemblyInfo.cs b/src/NzbDrone.Api.Test/Properties/AssemblyInfo.cs similarity index 100% rename from NzbDrone.Api.Test/Properties/AssemblyInfo.cs rename to src/NzbDrone.Api.Test/Properties/AssemblyInfo.cs diff --git a/NzbDrone.Api.Test/packages.config b/src/NzbDrone.Api.Test/packages.config similarity index 100% rename from NzbDrone.Api.Test/packages.config rename to src/NzbDrone.Api.Test/packages.config diff --git a/NzbDrone.Api/Authentication/AuthenticationService.cs b/src/NzbDrone.Api/Authentication/AuthenticationService.cs similarity index 100% rename from NzbDrone.Api/Authentication/AuthenticationService.cs rename to src/NzbDrone.Api/Authentication/AuthenticationService.cs diff --git a/NzbDrone.Api/Authentication/EnableBasicAuthInNancy.cs b/src/NzbDrone.Api/Authentication/EnableBasicAuthInNancy.cs similarity index 100% rename from NzbDrone.Api/Authentication/EnableBasicAuthInNancy.cs rename to src/NzbDrone.Api/Authentication/EnableBasicAuthInNancy.cs diff --git a/NzbDrone.Api/Authentication/EnableStatelessAuthInNancy.cs b/src/NzbDrone.Api/Authentication/EnableStatelessAuthInNancy.cs similarity index 100% rename from NzbDrone.Api/Authentication/EnableStatelessAuthInNancy.cs rename to src/NzbDrone.Api/Authentication/EnableStatelessAuthInNancy.cs diff --git a/NzbDrone.Api/Authentication/NzbDroneUser.cs b/src/NzbDrone.Api/Authentication/NzbDroneUser.cs similarity index 100% rename from NzbDrone.Api/Authentication/NzbDroneUser.cs rename to src/NzbDrone.Api/Authentication/NzbDroneUser.cs diff --git a/NzbDrone.Api/Calendar/CalendarModule.cs b/src/NzbDrone.Api/Calendar/CalendarModule.cs similarity index 92% rename from NzbDrone.Api/Calendar/CalendarModule.cs rename to src/NzbDrone.Api/Calendar/CalendarModule.cs index 755c898aa..cd6f8d13f 100644 --- a/NzbDrone.Api/Calendar/CalendarModule.cs +++ b/src/NzbDrone.Api/Calendar/CalendarModule.cs @@ -23,8 +23,8 @@ namespace NzbDrone.Api.Calendar private List GetPaged() { - var start = DateTime.Today.AddDays(-1); - var end = DateTime.Today.AddDays(7); + var start = DateTime.Today; + var end = DateTime.Today.AddDays(2); var queryStart = Request.Query.Start; var queryEnd = Request.Query.End; diff --git a/NzbDrone.Api/ClientSchema/Field.cs b/src/NzbDrone.Api/ClientSchema/Field.cs similarity index 100% rename from NzbDrone.Api/ClientSchema/Field.cs rename to src/NzbDrone.Api/ClientSchema/Field.cs diff --git a/NzbDrone.Api/ClientSchema/FieldDefinitionAttribute.cs b/src/NzbDrone.Api/ClientSchema/FieldDefinitionAttribute.cs similarity index 100% rename from NzbDrone.Api/ClientSchema/FieldDefinitionAttribute.cs rename to src/NzbDrone.Api/ClientSchema/FieldDefinitionAttribute.cs diff --git a/NzbDrone.Api/ClientSchema/SchemaBuilder.cs b/src/NzbDrone.Api/ClientSchema/SchemaBuilder.cs similarity index 51% rename from NzbDrone.Api/ClientSchema/SchemaBuilder.cs rename to src/NzbDrone.Api/ClientSchema/SchemaBuilder.cs index 99b2c6d15..c5c96c302 100644 --- a/NzbDrone.Api/ClientSchema/SchemaBuilder.cs +++ b/src/NzbDrone.Api/ClientSchema/SchemaBuilder.cs @@ -1,6 +1,8 @@ using System; using System.Collections.Generic; using System.Linq; +using NzbDrone.Common; +using NzbDrone.Common.EnsureThat; using NzbDrone.Common.Reflection; using NzbDrone.Core.Annotations; @@ -8,8 +10,10 @@ namespace NzbDrone.Api.ClientSchema { public static class SchemaBuilder { - public static List GenerateSchema(object model) + public static List ToSchema(object model) { + Ensure.That(() => model).IsNotNull(); + var properties = model.GetType().GetSimpleProperties(); var result = new List(properties.Count); @@ -50,10 +54,55 @@ namespace NzbDrone.Api.ClientSchema } + + public static object ReadFormSchema(List fields, Type targetType) + { + Ensure.That(() => targetType).IsNotNull(); + + var properties = targetType.GetSimpleProperties(); + + var target = Activator.CreateInstance(targetType); + + foreach (var propertyInfo in properties) + { + var fieldAttribute = propertyInfo.GetAttribute(false); + + if (fieldAttribute != null) + { + var field = fields.Find(f => f.Name == propertyInfo.Name); + + if (propertyInfo.PropertyType == typeof(Int32)) + { + var intValue = Convert.ToInt32(field.Value); + propertyInfo.SetValue(target, intValue, null); + } + + else if (propertyInfo.PropertyType == typeof(Nullable)) + { + var intValue = field.Value.ToString().ParseInt32(); + propertyInfo.SetValue(target, intValue, null); + } + + else + { + propertyInfo.SetValue(target, field.Value, null); + } + } + } + + return target; + + } + + public static T ReadFormSchema(List fields) + { + return (T)ReadFormSchema(fields, typeof (T)); + } + private static List GetSelectOptions(Type selectOptions) { var options = from Enum e in Enum.GetValues(selectOptions) - select new SelectOption { Value = Convert.ToInt32(e), Name = e.ToString() }; + select new SelectOption { Value = Convert.ToInt32(e), Name = e.ToString() }; return options.OrderBy(o => o.Value).ToList(); } diff --git a/src/NzbDrone.Api/ClientSchema/SchemaDeserializer.cs b/src/NzbDrone.Api/ClientSchema/SchemaDeserializer.cs new file mode 100644 index 000000000..36d2a68e8 --- /dev/null +++ b/src/NzbDrone.Api/ClientSchema/SchemaDeserializer.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using NzbDrone.Common; +using NzbDrone.Common.Reflection; +using NzbDrone.Core.Annotations; + +namespace NzbDrone.Api.ClientSchema +{ + public static class SchemaDeserializer + { + + } +} \ No newline at end of file diff --git a/NzbDrone.Api/ClientSchema/SelectOption.cs b/src/NzbDrone.Api/ClientSchema/SelectOption.cs similarity index 100% rename from NzbDrone.Api/ClientSchema/SelectOption.cs rename to src/NzbDrone.Api/ClientSchema/SelectOption.cs diff --git a/NzbDrone.Api/Commands/CommandModule.cs b/src/NzbDrone.Api/Commands/CommandModule.cs similarity index 100% rename from NzbDrone.Api/Commands/CommandModule.cs rename to src/NzbDrone.Api/Commands/CommandModule.cs diff --git a/NzbDrone.Api/Commands/CommandResource.cs b/src/NzbDrone.Api/Commands/CommandResource.cs similarity index 100% rename from NzbDrone.Api/Commands/CommandResource.cs rename to src/NzbDrone.Api/Commands/CommandResource.cs diff --git a/NzbDrone.Api/Config/NamingConfigResource.cs b/src/NzbDrone.Api/Config/NamingConfigResource.cs similarity index 100% rename from NzbDrone.Api/Config/NamingConfigResource.cs rename to src/NzbDrone.Api/Config/NamingConfigResource.cs diff --git a/NzbDrone.Api/Config/NamingModule.cs b/src/NzbDrone.Api/Config/NamingModule.cs similarity index 100% rename from NzbDrone.Api/Config/NamingModule.cs rename to src/NzbDrone.Api/Config/NamingModule.cs diff --git a/NzbDrone.Api/Config/NamingSampleResource.cs b/src/NzbDrone.Api/Config/NamingSampleResource.cs similarity index 100% rename from NzbDrone.Api/Config/NamingSampleResource.cs rename to src/NzbDrone.Api/Config/NamingSampleResource.cs diff --git a/NzbDrone.Api/Config/SettingsModule.cs b/src/NzbDrone.Api/Config/SettingsModule.cs similarity index 100% rename from NzbDrone.Api/Config/SettingsModule.cs rename to src/NzbDrone.Api/Config/SettingsModule.cs diff --git a/NzbDrone.Api/Directories/DirectoryLookupService.cs b/src/NzbDrone.Api/Directories/DirectoryLookupService.cs similarity index 100% rename from NzbDrone.Api/Directories/DirectoryLookupService.cs rename to src/NzbDrone.Api/Directories/DirectoryLookupService.cs diff --git a/NzbDrone.Api/Directories/DirectoryModule.cs b/src/NzbDrone.Api/Directories/DirectoryModule.cs similarity index 100% rename from NzbDrone.Api/Directories/DirectoryModule.cs rename to src/NzbDrone.Api/Directories/DirectoryModule.cs diff --git a/NzbDrone.Api/EpisodeFiles/EpisodeFileModule.cs b/src/NzbDrone.Api/EpisodeFiles/EpisodeFileModule.cs similarity index 64% rename from NzbDrone.Api/EpisodeFiles/EpisodeFileModule.cs rename to src/NzbDrone.Api/EpisodeFiles/EpisodeFileModule.cs index 15b4e65ed..f9df68dee 100644 --- a/NzbDrone.Api/EpisodeFiles/EpisodeFileModule.cs +++ b/src/NzbDrone.Api/EpisodeFiles/EpisodeFileModule.cs @@ -1,16 +1,22 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using NzbDrone.Api.REST; +using NzbDrone.Core.Datastore.Events; using NzbDrone.Core.MediaFiles; using NzbDrone.Api.Mapping; +using NzbDrone.Core.MediaFiles.Events; +using NzbDrone.Core.Messaging.Commands; +using NzbDrone.Core.Messaging.Events; namespace NzbDrone.Api.EpisodeFiles { - public class EpisodeModule : NzbDroneRestModule + public class EpisodeModule : NzbDroneRestModuleWithSignalR, + IHandle { private readonly IMediaFileService _mediaFileService; - public EpisodeModule(IMediaFileService mediaFileService) - : base("/episodefile") + public EpisodeModule(ICommandExecutor commandExecutor, IMediaFileService mediaFileService) + : base(commandExecutor) { _mediaFileService = mediaFileService; GetResourceById = GetEpisodeFile; @@ -41,5 +47,10 @@ namespace NzbDrone.Api.EpisodeFiles episodeFile.Quality = episodeFileResource.Quality; _mediaFileService.Update(episodeFile); } + + public void Handle(EpisodeFileAddedEvent message) + { + BroadcastResourceChange(ModelAction.Updated, message.EpisodeFile.Id); + } } } \ No newline at end of file diff --git a/NzbDrone.Api/EpisodeFiles/EpisodeFileResource.cs b/src/NzbDrone.Api/EpisodeFiles/EpisodeFileResource.cs similarity index 100% rename from NzbDrone.Api/EpisodeFiles/EpisodeFileResource.cs rename to src/NzbDrone.Api/EpisodeFiles/EpisodeFileResource.cs diff --git a/src/NzbDrone.Api/Episodes/EpisodeModule.cs b/src/NzbDrone.Api/Episodes/EpisodeModule.cs new file mode 100644 index 000000000..aaab212a8 --- /dev/null +++ b/src/NzbDrone.Api/Episodes/EpisodeModule.cs @@ -0,0 +1,72 @@ +using System; +using System.Collections.Generic; +using NzbDrone.Api.Mapping; +using NzbDrone.Api.REST; +using NzbDrone.Core.Datastore.Events; +using NzbDrone.Core.Download; +using NzbDrone.Core.MediaFiles.Events; +using NzbDrone.Core.Messaging.Commands; +using NzbDrone.Core.Messaging.Events; +using NzbDrone.Core.Tv; + +namespace NzbDrone.Api.Episodes +{ + public class EpisodeModule : NzbDroneRestModuleWithSignalR, + IHandle, + IHandle + + { + private readonly IEpisodeService _episodeService; + + public EpisodeModule(ICommandExecutor commandExecutor, IEpisodeService episodeService) + : base(commandExecutor, "episodes") + { + _episodeService = episodeService; + + GetResourceAll = GetEpisodes; + UpdateResource = SetMonitored; + GetResourceById = GetEpisode; + } + + private List GetEpisodes() + { + var seriesId = (int?)Request.Query.SeriesId; + + if (seriesId == null) + { + throw new BadRequestException("seriesId is missing"); + } + + return ToListResource(() => _episodeService.GetEpisodeBySeries(seriesId.Value)); + } + + private void SetMonitored(EpisodeResource episodeResource) + { + _episodeService.SetEpisodeMonitored(episodeResource.Id, episodeResource.Monitored); + } + + private EpisodeResource GetEpisode(int id) + { + return _episodeService.GetEpisode(id).InjectTo(); + } + + public void Handle(EpisodeGrabbedEvent message) + { + foreach (var episode in message.Episode.Episodes) + { + var resource = episode.InjectTo(); + resource.Downloading = true; + + BroadcastResourceChange(ModelAction.Updated, resource); + } + } + + public void Handle(EpisodeDownloadedEvent message) + { + foreach (var episode in message.Episode.Episodes) + { + BroadcastResourceChange(ModelAction.Updated, episode.Id); + } + } + } +} \ No newline at end of file diff --git a/NzbDrone.Api/Episodes/EpisodeResource.cs b/src/NzbDrone.Api/Episodes/EpisodeResource.cs similarity index 95% rename from NzbDrone.Api/Episodes/EpisodeResource.cs rename to src/NzbDrone.Api/Episodes/EpisodeResource.cs index 03ae675c5..a767ef9e6 100644 --- a/NzbDrone.Api/Episodes/EpisodeResource.cs +++ b/src/NzbDrone.Api/Episodes/EpisodeResource.cs @@ -26,5 +26,7 @@ namespace NzbDrone.Api.Episodes public DateTime? GrabDate { get; set; } public Core.Tv.Series Series { get; set; } public String SeriesTitle { get; set; } + + public Boolean Downloading { get; set; } } } diff --git a/NzbDrone.Api/ErrorManagement/ApiException.cs b/src/NzbDrone.Api/ErrorManagement/ApiException.cs similarity index 100% rename from NzbDrone.Api/ErrorManagement/ApiException.cs rename to src/NzbDrone.Api/ErrorManagement/ApiException.cs diff --git a/NzbDrone.Api/ErrorManagement/ErrorHandler.cs b/src/NzbDrone.Api/ErrorManagement/ErrorHandler.cs similarity index 100% rename from NzbDrone.Api/ErrorManagement/ErrorHandler.cs rename to src/NzbDrone.Api/ErrorManagement/ErrorHandler.cs diff --git a/NzbDrone.Api/ErrorManagement/ErrorModel.cs b/src/NzbDrone.Api/ErrorManagement/ErrorModel.cs similarity index 100% rename from NzbDrone.Api/ErrorManagement/ErrorModel.cs rename to src/NzbDrone.Api/ErrorManagement/ErrorModel.cs diff --git a/NzbDrone.Api/ErrorManagement/NzbDroneErrorPipeline.cs b/src/NzbDrone.Api/ErrorManagement/NzbDroneErrorPipeline.cs similarity index 100% rename from NzbDrone.Api/ErrorManagement/NzbDroneErrorPipeline.cs rename to src/NzbDrone.Api/ErrorManagement/NzbDroneErrorPipeline.cs diff --git a/NzbDrone.Api/Exceptions/InvalidApiKeyException.cs b/src/NzbDrone.Api/Exceptions/InvalidApiKeyException.cs similarity index 100% rename from NzbDrone.Api/Exceptions/InvalidApiKeyException.cs rename to src/NzbDrone.Api/Exceptions/InvalidApiKeyException.cs diff --git a/NzbDrone.Api/Extensions/LazyExtensions.cs b/src/NzbDrone.Api/Extensions/LazyExtensions.cs similarity index 100% rename from NzbDrone.Api/Extensions/LazyExtensions.cs rename to src/NzbDrone.Api/Extensions/LazyExtensions.cs diff --git a/NzbDrone.Api/Extensions/NancyJsonSerializer.cs b/src/NzbDrone.Api/Extensions/NancyJsonSerializer.cs similarity index 100% rename from NzbDrone.Api/Extensions/NancyJsonSerializer.cs rename to src/NzbDrone.Api/Extensions/NancyJsonSerializer.cs diff --git a/NzbDrone.Api/Extensions/Pipelines/CacheHeaderPipeline.cs b/src/NzbDrone.Api/Extensions/Pipelines/CacheHeaderPipeline.cs similarity index 100% rename from NzbDrone.Api/Extensions/Pipelines/CacheHeaderPipeline.cs rename to src/NzbDrone.Api/Extensions/Pipelines/CacheHeaderPipeline.cs diff --git a/NzbDrone.Api/Extensions/Pipelines/GZipPipeline.cs b/src/NzbDrone.Api/Extensions/Pipelines/GZipPipeline.cs similarity index 100% rename from NzbDrone.Api/Extensions/Pipelines/GZipPipeline.cs rename to src/NzbDrone.Api/Extensions/Pipelines/GZipPipeline.cs diff --git a/NzbDrone.Api/Extensions/Pipelines/IRegisterNancyPipeline.cs b/src/NzbDrone.Api/Extensions/Pipelines/IRegisterNancyPipeline.cs similarity index 100% rename from NzbDrone.Api/Extensions/Pipelines/IRegisterNancyPipeline.cs rename to src/NzbDrone.Api/Extensions/Pipelines/IRegisterNancyPipeline.cs diff --git a/NzbDrone.Api/Extensions/Pipelines/IfModifiedPipeline.cs b/src/NzbDrone.Api/Extensions/Pipelines/IfModifiedPipeline.cs similarity index 100% rename from NzbDrone.Api/Extensions/Pipelines/IfModifiedPipeline.cs rename to src/NzbDrone.Api/Extensions/Pipelines/IfModifiedPipeline.cs diff --git a/NzbDrone.Api/Extensions/ReqResExtensions.cs b/src/NzbDrone.Api/Extensions/ReqResExtensions.cs similarity index 100% rename from NzbDrone.Api/Extensions/ReqResExtensions.cs rename to src/NzbDrone.Api/Extensions/ReqResExtensions.cs diff --git a/NzbDrone.Api/Extensions/RequestExtensions.cs b/src/NzbDrone.Api/Extensions/RequestExtensions.cs similarity index 100% rename from NzbDrone.Api/Extensions/RequestExtensions.cs rename to src/NzbDrone.Api/Extensions/RequestExtensions.cs diff --git a/NzbDrone.Api/Frontend/IsCacheableSpecification.cs b/src/NzbDrone.Api/Frontend/IsCacheableSpecification.cs similarity index 79% rename from NzbDrone.Api/Frontend/IsCacheableSpecification.cs rename to src/NzbDrone.Api/Frontend/IsCacheableSpecification.cs index a86768495..aa8dc8e65 100644 --- a/NzbDrone.Api/Frontend/IsCacheableSpecification.cs +++ b/src/NzbDrone.Api/Frontend/IsCacheableSpecification.cs @@ -24,6 +24,12 @@ namespace NzbDrone.Api.Frontend if (context.Request.Path.StartsWith("/signalr", StringComparison.CurrentCultureIgnoreCase)) return false; if (context.Request.Path.EndsWith("app.js")) return false; + if (context.Request.Path.StartsWith("/log", StringComparison.CurrentCultureIgnoreCase) && + context.Request.Path.EndsWith(".txt", StringComparison.CurrentCultureIgnoreCase)) + { + return false; + } + if (context.Response != null) { if (context.Response.ContentType.Contains("text/html")) return false; diff --git a/NzbDrone.Api/Frontend/Mappers/IMapHttpRequestsToDisk.cs b/src/NzbDrone.Api/Frontend/Mappers/IMapHttpRequestsToDisk.cs similarity index 100% rename from NzbDrone.Api/Frontend/Mappers/IMapHttpRequestsToDisk.cs rename to src/NzbDrone.Api/Frontend/Mappers/IMapHttpRequestsToDisk.cs diff --git a/NzbDrone.Api/Frontend/Mappers/IndexHtmlMapper.cs b/src/NzbDrone.Api/Frontend/Mappers/IndexHtmlMapper.cs similarity index 100% rename from NzbDrone.Api/Frontend/Mappers/IndexHtmlMapper.cs rename to src/NzbDrone.Api/Frontend/Mappers/IndexHtmlMapper.cs diff --git a/NzbDrone.Api/Frontend/Mappers/LogFileMapper.cs b/src/NzbDrone.Api/Frontend/Mappers/LogFileMapper.cs similarity index 100% rename from NzbDrone.Api/Frontend/Mappers/LogFileMapper.cs rename to src/NzbDrone.Api/Frontend/Mappers/LogFileMapper.cs diff --git a/NzbDrone.Api/Frontend/Mappers/MediaCoverMapper.cs b/src/NzbDrone.Api/Frontend/Mappers/MediaCoverMapper.cs similarity index 100% rename from NzbDrone.Api/Frontend/Mappers/MediaCoverMapper.cs rename to src/NzbDrone.Api/Frontend/Mappers/MediaCoverMapper.cs diff --git a/NzbDrone.Api/Frontend/Mappers/StaticResourceMapper.cs b/src/NzbDrone.Api/Frontend/Mappers/StaticResourceMapper.cs similarity index 100% rename from NzbDrone.Api/Frontend/Mappers/StaticResourceMapper.cs rename to src/NzbDrone.Api/Frontend/Mappers/StaticResourceMapper.cs diff --git a/NzbDrone.Api/Frontend/Mappers/StaticResourceMapperBase.cs b/src/NzbDrone.Api/Frontend/Mappers/StaticResourceMapperBase.cs similarity index 100% rename from NzbDrone.Api/Frontend/Mappers/StaticResourceMapperBase.cs rename to src/NzbDrone.Api/Frontend/Mappers/StaticResourceMapperBase.cs diff --git a/NzbDrone.Api/Frontend/StaticResourceModule.cs b/src/NzbDrone.Api/Frontend/StaticResourceModule.cs similarity index 100% rename from NzbDrone.Api/Frontend/StaticResourceModule.cs rename to src/NzbDrone.Api/Frontend/StaticResourceModule.cs diff --git a/NzbDrone.Api/History/HistoryModule.cs b/src/NzbDrone.Api/History/HistoryModule.cs similarity index 74% rename from NzbDrone.Api/History/HistoryModule.cs rename to src/NzbDrone.Api/History/HistoryModule.cs index 9069f2930..85b3f6135 100644 --- a/NzbDrone.Api/History/HistoryModule.cs +++ b/src/NzbDrone.Api/History/HistoryModule.cs @@ -1,4 +1,7 @@ -using NzbDrone.Core.Datastore; +using System; +using System.Collections.Generic; +using NzbDrone.Api.Mapping; +using NzbDrone.Core.Datastore; using NzbDrone.Core.History; namespace NzbDrone.Api.History @@ -15,6 +18,8 @@ namespace NzbDrone.Api.History private PagingResource GetHistory(PagingResource pagingResource) { + var episodeId = Request.Query.EpisodeId; + var pagingSpec = new PagingSpec { Page = pagingResource.Page, @@ -23,6 +28,12 @@ namespace NzbDrone.Api.History SortDirection = pagingResource.SortDirection }; + if (episodeId.HasValue) + { + int i = (int)episodeId; + pagingSpec.FilterExpression = h => h.EpisodeId == i; + } + return ApplyToPage(_historyService.Paged, pagingSpec); } } diff --git a/NzbDrone.Api/History/HistoryResource.cs b/src/NzbDrone.Api/History/HistoryResource.cs similarity index 100% rename from NzbDrone.Api/History/HistoryResource.cs rename to src/NzbDrone.Api/History/HistoryResource.cs diff --git a/src/NzbDrone.Api/IndexerResource.cs b/src/NzbDrone.Api/IndexerResource.cs new file mode 100644 index 000000000..65c5bad64 --- /dev/null +++ b/src/NzbDrone.Api/IndexerResource.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using NzbDrone.Api.ClientSchema; +using NzbDrone.Api.REST; + +namespace NzbDrone.Api +{ + public class ProviderResource : RestResource + { + public Boolean Enable { get; set; } + public String Name { get; set; } + public List Fields { get; set; } + public String Implementation { get; set; } + public String ConfigContract { get; set; } + } +} \ No newline at end of file diff --git a/src/NzbDrone.Api/Indexers/IndexerModule.cs b/src/NzbDrone.Api/Indexers/IndexerModule.cs new file mode 100644 index 000000000..33c56a108 --- /dev/null +++ b/src/NzbDrone.Api/Indexers/IndexerModule.cs @@ -0,0 +1,12 @@ +using NzbDrone.Core.Indexers; + +namespace NzbDrone.Api.Indexers +{ + public class IndexerModule : ProviderModuleBase + { + public IndexerModule(IndexerFactory indexerFactory) + : base(indexerFactory, "indexer") + { + } + } +} \ No newline at end of file diff --git a/NzbDrone.Api/Indexers/IndexerResource.cs b/src/NzbDrone.Api/Indexers/IndexerResource.cs similarity index 88% rename from NzbDrone.Api/Indexers/IndexerResource.cs rename to src/NzbDrone.Api/Indexers/IndexerResource.cs index 34a31551a..a613526fe 100644 --- a/NzbDrone.Api/Indexers/IndexerResource.cs +++ b/src/NzbDrone.Api/Indexers/IndexerResource.cs @@ -11,5 +11,6 @@ namespace NzbDrone.Api.Indexers public String Name { get; set; } public List Fields { get; set; } public String Implementation { get; set; } + public String ConfigContract { get; set; } } } \ No newline at end of file diff --git a/NzbDrone.Api/Indexers/IndexerSchemaModule.cs b/src/NzbDrone.Api/Indexers/IndexerSchemaModule.cs similarity index 66% rename from NzbDrone.Api/Indexers/IndexerSchemaModule.cs rename to src/NzbDrone.Api/Indexers/IndexerSchemaModule.cs index ad2ca7846..a0312bdc4 100644 --- a/NzbDrone.Api/Indexers/IndexerSchemaModule.cs +++ b/src/NzbDrone.Api/Indexers/IndexerSchemaModule.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using System.Linq; using NzbDrone.Api.ClientSchema; using NzbDrone.Core.Indexers; using Omu.ValueInjecter; @@ -7,26 +8,28 @@ namespace NzbDrone.Api.Indexers { public class IndexerSchemaModule : NzbDroneRestModule { - private readonly IIndexerService _indexerService; + private readonly IIndexerFactory _indexerFactory; - public IndexerSchemaModule(IIndexerService indexerService) + public IndexerSchemaModule(IIndexerFactory indexerFactory) : base("indexer/schema") { - _indexerService = indexerService; + _indexerFactory = indexerFactory; GetResourceAll = GetSchema; } private List GetSchema() { - var indexers = _indexerService.Schema(); - var result = new List(indexers.Count); + var indexers = _indexerFactory.Templates().Where(c => c.Implementation =="Newznab"); + + + var result = new List(indexers.Count()); foreach (var indexer in indexers) { var indexerResource = new IndexerResource(); indexerResource.InjectFrom(indexer); - indexerResource.Fields = SchemaBuilder.GenerateSchema(indexer.Settings); + indexerResource.Fields = SchemaBuilder.ToSchema(indexer.Settings); result.Add(indexerResource); } diff --git a/NzbDrone.Api/Indexers/ReleaseModule.cs b/src/NzbDrone.Api/Indexers/ReleaseModule.cs similarity index 100% rename from NzbDrone.Api/Indexers/ReleaseModule.cs rename to src/NzbDrone.Api/Indexers/ReleaseModule.cs diff --git a/NzbDrone.Api/Indexers/ReleaseResource.cs b/src/NzbDrone.Api/Indexers/ReleaseResource.cs similarity index 100% rename from NzbDrone.Api/Indexers/ReleaseResource.cs rename to src/NzbDrone.Api/Indexers/ReleaseResource.cs diff --git a/NzbDrone.Api/Logs/LogFileModule.cs b/src/NzbDrone.Api/Logs/LogFileModule.cs similarity index 100% rename from NzbDrone.Api/Logs/LogFileModule.cs rename to src/NzbDrone.Api/Logs/LogFileModule.cs diff --git a/NzbDrone.Api/Logs/LogFileResource.cs b/src/NzbDrone.Api/Logs/LogFileResource.cs similarity index 100% rename from NzbDrone.Api/Logs/LogFileResource.cs rename to src/NzbDrone.Api/Logs/LogFileResource.cs diff --git a/NzbDrone.Api/Logs/LogModule.cs b/src/NzbDrone.Api/Logs/LogModule.cs similarity index 100% rename from NzbDrone.Api/Logs/LogModule.cs rename to src/NzbDrone.Api/Logs/LogModule.cs diff --git a/NzbDrone.Api/Logs/LogResource.cs b/src/NzbDrone.Api/Logs/LogResource.cs similarity index 100% rename from NzbDrone.Api/Logs/LogResource.cs rename to src/NzbDrone.Api/Logs/LogResource.cs diff --git a/NzbDrone.Api/Mapping/CloneInjection.cs b/src/NzbDrone.Api/Mapping/CloneInjection.cs similarity index 100% rename from NzbDrone.Api/Mapping/CloneInjection.cs rename to src/NzbDrone.Api/Mapping/CloneInjection.cs diff --git a/NzbDrone.Api/Mapping/MappingValidation.cs b/src/NzbDrone.Api/Mapping/MappingValidation.cs similarity index 100% rename from NzbDrone.Api/Mapping/MappingValidation.cs rename to src/NzbDrone.Api/Mapping/MappingValidation.cs diff --git a/NzbDrone.Api/Mapping/ResourceMappingException.cs b/src/NzbDrone.Api/Mapping/ResourceMappingException.cs similarity index 100% rename from NzbDrone.Api/Mapping/ResourceMappingException.cs rename to src/NzbDrone.Api/Mapping/ResourceMappingException.cs diff --git a/NzbDrone.Api/Mapping/ValueInjectorExtensions.cs b/src/NzbDrone.Api/Mapping/ValueInjectorExtensions.cs similarity index 97% rename from NzbDrone.Api/Mapping/ValueInjectorExtensions.cs rename to src/NzbDrone.Api/Mapping/ValueInjectorExtensions.cs index ce21efaef..d8ac662f5 100644 --- a/NzbDrone.Api/Mapping/ValueInjectorExtensions.cs +++ b/src/NzbDrone.Api/Mapping/ValueInjectorExtensions.cs @@ -1,41 +1,41 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Linq; -using Omu.ValueInjecter; - -namespace NzbDrone.Api.Mapping -{ - public static class ValueInjectorExtensions - { - public static TTarget InjectTo(this object source) where TTarget : new() - { - var targetType = typeof(TTarget); - - if (targetType.IsGenericType && - targetType.GetGenericTypeDefinition() != null && - targetType.GetGenericTypeDefinition().GetInterfaces().Contains(typeof(IEnumerable)) && - source.GetType().IsGenericType && - source.GetType().GetGenericTypeDefinition() != null && - source.GetType().GetGenericTypeDefinition().GetInterfaces().Contains(typeof(IEnumerable))) - { - - var result = new TTarget(); - - var listSubType = targetType.GetGenericArguments()[0]; - var listType = typeof(List<>).MakeGenericType(listSubType); - var addMethod = listType.GetMethod("Add"); - - foreach (var sourceItem in (IEnumerable)source) - { - var e = Activator.CreateInstance(listSubType).InjectFrom(sourceItem); - addMethod.Invoke(result, new[] { e }); - } - - return result; - } - - return (TTarget)new TTarget().InjectFrom(source); - } - } +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using Omu.ValueInjecter; + +namespace NzbDrone.Api.Mapping +{ + public static class ValueInjectorExtensions + { + public static TTarget InjectTo(this object source) where TTarget : new() + { + var targetType = typeof(TTarget); + + if (targetType.IsGenericType && + targetType.GetGenericTypeDefinition() != null && + targetType.GetGenericTypeDefinition().GetInterfaces().Contains(typeof(IEnumerable)) && + source.GetType().IsGenericType && + source.GetType().GetGenericTypeDefinition() != null && + source.GetType().GetGenericTypeDefinition().GetInterfaces().Contains(typeof(IEnumerable))) + { + + var result = new TTarget(); + + var listSubType = targetType.GetGenericArguments()[0]; + var listType = typeof(List<>).MakeGenericType(listSubType); + var addMethod = listType.GetMethod("Add"); + + foreach (var sourceItem in (IEnumerable)source) + { + var e = Activator.CreateInstance(listSubType).InjectFrom(sourceItem); + addMethod.Invoke(result, new[] { e }); + } + + return result; + } + + return (TTarget)new TTarget().InjectFrom(source); + } + } } \ No newline at end of file diff --git a/NzbDrone.Api/Missing/MissingModule.cs b/src/NzbDrone.Api/Missing/MissingModule.cs similarity index 100% rename from NzbDrone.Api/Missing/MissingModule.cs rename to src/NzbDrone.Api/Missing/MissingModule.cs diff --git a/NzbDrone.Api/NancyBootstrapper.cs b/src/NzbDrone.Api/NancyBootstrapper.cs similarity index 100% rename from NzbDrone.Api/NancyBootstrapper.cs rename to src/NzbDrone.Api/NancyBootstrapper.cs diff --git a/NzbDrone.Api/Notifications/NotificationModule.cs b/src/NzbDrone.Api/Notifications/NotificationModule.cs similarity index 89% rename from NzbDrone.Api/Notifications/NotificationModule.cs rename to src/NzbDrone.Api/Notifications/NotificationModule.cs index bc7ca8aac..c8be13f67 100644 --- a/NzbDrone.Api/Notifications/NotificationModule.cs +++ b/src/NzbDrone.Api/Notifications/NotificationModule.cs @@ -4,6 +4,7 @@ using System.Linq; using NzbDrone.Api.ClientSchema; using NzbDrone.Api.Mapping; using NzbDrone.Api.REST; +using NzbDrone.Common.Reflection; using NzbDrone.Core.Notifications; using Omu.ValueInjecter; @@ -39,7 +40,7 @@ namespace NzbDrone.Api.Notifications { var notificationResource = new NotificationResource(); notificationResource.InjectFrom(notification); - notificationResource.Fields = SchemaBuilder.GenerateSchema(notification.Settings); + notificationResource.Fields = SchemaBuilder.ToSchema(notification.Settings); notificationResource.TestCommand = String.Format("test{0}", notification.Implementation.ToLowerInvariant()); result.Add(notificationResource); @@ -79,7 +80,10 @@ namespace NzbDrone.Api.Notifications } notification.InjectFrom(notificationResource); - notification.Settings = SchemaDeserializer.DeserializeSchema(notification.Settings, notificationResource.Fields); + + //var configType = ReflectionExtensions.CoreAssembly.FindTypeByName(notification) + + //notification.Settings = SchemaBuilder.ReadFormSchema(notification.Settings, notificationResource.Fields); return notification; } diff --git a/NzbDrone.Api/Notifications/NotificationResource.cs b/src/NzbDrone.Api/Notifications/NotificationResource.cs similarity index 100% rename from NzbDrone.Api/Notifications/NotificationResource.cs rename to src/NzbDrone.Api/Notifications/NotificationResource.cs diff --git a/NzbDrone.Api/Notifications/NotificationSchemaModule.cs b/src/NzbDrone.Api/Notifications/NotificationSchemaModule.cs similarity index 92% rename from NzbDrone.Api/Notifications/NotificationSchemaModule.cs rename to src/NzbDrone.Api/Notifications/NotificationSchemaModule.cs index d347e343c..68a5bd594 100644 --- a/NzbDrone.Api/Notifications/NotificationSchemaModule.cs +++ b/src/NzbDrone.Api/Notifications/NotificationSchemaModule.cs @@ -28,7 +28,7 @@ namespace NzbDrone.Api.Notifications { var notificationResource = new NotificationResource(); notificationResource.InjectFrom(notification); - notificationResource.Fields = SchemaBuilder.GenerateSchema(notification.Settings); + notificationResource.Fields = SchemaBuilder.ToSchema(notification.Settings); notificationResource.TestCommand = String.Format("test{0}", notification.Implementation.ToLowerInvariant()); result.Add(notificationResource); diff --git a/NzbDrone.Api/NzbDrone.Api.csproj b/src/NzbDrone.Api/NzbDrone.Api.csproj similarity index 97% rename from NzbDrone.Api/NzbDrone.Api.csproj rename to src/NzbDrone.Api/NzbDrone.Api.csproj index b88c2277d..7b885fe48 100644 --- a/NzbDrone.Api/NzbDrone.Api.csproj +++ b/src/NzbDrone.Api/NzbDrone.Api.csproj @@ -18,7 +18,7 @@ true - ..\_output\ + ..\..\_output\ DEBUG;TRACE full x86 @@ -26,7 +26,7 @@ MinimumRecommendedRules.ruleset - ..\_output\ + ..\..\_output\ TRACE true pdbonly @@ -109,6 +109,8 @@ + + @@ -126,6 +128,8 @@ + + diff --git a/NzbDrone.Api/NzbDroneApiModule.cs b/src/NzbDrone.Api/NzbDroneApiModule.cs similarity index 100% rename from NzbDrone.Api/NzbDroneApiModule.cs rename to src/NzbDrone.Api/NzbDroneApiModule.cs diff --git a/NzbDrone.Api/NzbDroneRestModule.cs b/src/NzbDrone.Api/NzbDroneRestModule.cs similarity index 100% rename from NzbDrone.Api/NzbDroneRestModule.cs rename to src/NzbDrone.Api/NzbDroneRestModule.cs diff --git a/NzbDrone.Api/NzbDroneRestModuleWithSignalR.cs b/src/NzbDrone.Api/NzbDroneRestModuleWithSignalR.cs similarity index 75% rename from NzbDrone.Api/NzbDroneRestModuleWithSignalR.cs rename to src/NzbDrone.Api/NzbDroneRestModuleWithSignalR.cs index 7cdfb3f53..bb35273df 100644 --- a/NzbDrone.Api/NzbDroneRestModuleWithSignalR.cs +++ b/src/NzbDrone.Api/NzbDroneRestModuleWithSignalR.cs @@ -18,6 +18,12 @@ namespace NzbDrone.Api _commandExecutor = commandExecutor; } + protected NzbDroneRestModuleWithSignalR(ICommandExecutor commandExecutor, string resource) + : base(resource) + { + _commandExecutor = commandExecutor; + } + public void Handle(ModelEvent message) { if (message.Action == ModelAction.Deleted || message.Action == ModelAction.Sync) @@ -28,6 +34,17 @@ namespace NzbDrone.Api BroadcastResourceChange(message.Action, message.Model.Id); } + protected void BroadcastResourceChange(ModelAction action, TResource resource) + { + var signalRMessage = new SignalRMessage + { + Name = Resource, + Body = new ResourceChangeMessage(resource, action) + }; + + _commandExecutor.PublishCommand(new BroadcastSignalRMessage(signalRMessage)); + } + protected void BroadcastResourceChange(ModelAction action, int id) { var resource = GetResourceById(id); diff --git a/NzbDrone.Api/PagingResource.cs b/src/NzbDrone.Api/PagingResource.cs similarity index 100% rename from NzbDrone.Api/PagingResource.cs rename to src/NzbDrone.Api/PagingResource.cs diff --git a/NzbDrone.Api/Properties/AssemblyInfo.cs b/src/NzbDrone.Api/Properties/AssemblyInfo.cs similarity index 100% rename from NzbDrone.Api/Properties/AssemblyInfo.cs rename to src/NzbDrone.Api/Properties/AssemblyInfo.cs diff --git a/src/NzbDrone.Api/ProviderModuleBase.cs b/src/NzbDrone.Api/ProviderModuleBase.cs new file mode 100644 index 000000000..f379f598a --- /dev/null +++ b/src/NzbDrone.Api/ProviderModuleBase.cs @@ -0,0 +1,134 @@ +using System.Collections.Generic; +using System.Linq; +using FluentValidation; +using Nancy; +using NzbDrone.Api.ClientSchema; +using NzbDrone.Api.Extensions; +using NzbDrone.Api.Indexers; +using NzbDrone.Api.Mapping; +using NzbDrone.Common.Reflection; +using NzbDrone.Core.ThingiProvider; +using Omu.ValueInjecter; + +namespace NzbDrone.Api +{ + public abstract class ProviderModuleBase : NzbDroneRestModule + where TProviderDefinition : ProviderDefinition, new() + where TProvider : IProvider + where TProviderResource : ProviderResource, new() + { + private readonly IProviderFactory _providerFactory; + + protected ProviderModuleBase(IProviderFactory providerFactory, string resource) + : base(resource) + { + _providerFactory = providerFactory; + Get["templates"] = x => GetTemplates(); + GetResourceAll = GetAll; + GetResourceById = GetProviderById; + CreateResource = CreateProvider; + UpdateResource = UpdateProvider; + DeleteResource = DeleteProvider; + + + + SharedValidator.RuleFor(c => c.Name).NotEmpty(); + SharedValidator.RuleFor(c => c.Implementation).NotEmpty(); + SharedValidator.RuleFor(c => c.ConfigContract).NotEmpty(); + + PostValidator.RuleFor(c => c.Fields).NotEmpty(); + } + + private TProviderResource GetProviderById(int id) + { + return _providerFactory.Get(id).InjectTo(); + } + + private List GetAll() + { + var indexerDefinitions = _providerFactory.All(); + + var result = new List(indexerDefinitions.Count); + + foreach (var definition in indexerDefinitions) + { + var indexerResource = new TProviderResource(); + indexerResource.InjectFrom(definition); + indexerResource.Fields = SchemaBuilder.ToSchema(definition.Settings); + + result.Add(indexerResource); + } + + return result; + } + + private int CreateProvider(TProviderResource indexerResource) + { + var indexer = GetDefinition(indexerResource); + indexer = _providerFactory.Create(indexer); + return indexer.Id; + } + + private void UpdateProvider(TProviderResource indexerResource) + { + var indexer = GetDefinition(indexerResource); + + ValidateIndexer(indexer); + + _providerFactory.Update(indexer); + } + + + private static void ValidateIndexer(ProviderDefinition definition) + { + if (!definition.Enable) return; + + var validationResult = definition.Settings.Validate(); + + if (!validationResult.IsValid) + { + throw new ValidationException(validationResult.Errors); + } + } + + private TProviderDefinition GetDefinition(TProviderResource indexerResource) + { + + var definition = new TProviderDefinition(); + + definition.InjectFrom(indexerResource); + + var configContract = ReflectionExtensions.CoreAssembly.FindTypeByName(definition.ConfigContract); + definition.Settings = (IProviderConfig)SchemaBuilder.ReadFormSchema(indexerResource.Fields, configContract); + + ValidateIndexer(definition); + + return definition; + } + + private void DeleteProvider(int id) + { + _providerFactory.Delete(id); + } + + private Response GetTemplates() + { + + var indexers = _providerFactory.Templates(); + + + var result = new List(indexers.Count()); + + foreach (var indexer in indexers) + { + var indexerResource = new IndexerResource(); + indexerResource.InjectFrom(indexer); + indexerResource.Fields = SchemaBuilder.ToSchema(indexer.Settings); + + result.Add(indexerResource); + } + + return result.AsResponse(); + } + } +} \ No newline at end of file diff --git a/NzbDrone.Api/Qualities/QualityProfileModule.cs b/src/NzbDrone.Api/Qualities/QualityProfileModule.cs similarity index 100% rename from NzbDrone.Api/Qualities/QualityProfileModule.cs rename to src/NzbDrone.Api/Qualities/QualityProfileModule.cs diff --git a/NzbDrone.Api/Qualities/QualityProfileResource.cs b/src/NzbDrone.Api/Qualities/QualityProfileResource.cs similarity index 100% rename from NzbDrone.Api/Qualities/QualityProfileResource.cs rename to src/NzbDrone.Api/Qualities/QualityProfileResource.cs diff --git a/NzbDrone.Api/Qualities/QualityProfileSchemaModule.cs b/src/NzbDrone.Api/Qualities/QualityProfileSchemaModule.cs similarity index 100% rename from NzbDrone.Api/Qualities/QualityProfileSchemaModule.cs rename to src/NzbDrone.Api/Qualities/QualityProfileSchemaModule.cs diff --git a/NzbDrone.Api/Qualities/QualitySizeModule.cs b/src/NzbDrone.Api/Qualities/QualitySizeModule.cs similarity index 100% rename from NzbDrone.Api/Qualities/QualitySizeModule.cs rename to src/NzbDrone.Api/Qualities/QualitySizeModule.cs diff --git a/NzbDrone.Api/Qualities/QualitySizeResource.cs b/src/NzbDrone.Api/Qualities/QualitySizeResource.cs similarity index 100% rename from NzbDrone.Api/Qualities/QualitySizeResource.cs rename to src/NzbDrone.Api/Qualities/QualitySizeResource.cs diff --git a/src/NzbDrone.Api/Queue/QueueModule.cs b/src/NzbDrone.Api/Queue/QueueModule.cs new file mode 100644 index 000000000..efc5ac7ff --- /dev/null +++ b/src/NzbDrone.Api/Queue/QueueModule.cs @@ -0,0 +1,32 @@ +using System.Collections.Generic; +using NzbDrone.Core.Datastore.Events; +using NzbDrone.Core.Download; +using NzbDrone.Core.Messaging.Commands; +using NzbDrone.Core.Messaging.Events; +using NzbDrone.Core.Queue; + +namespace NzbDrone.Api.Queue +{ + public class QueueModule : NzbDroneRestModuleWithSignalR, + IHandle + { + private readonly IQueueService _queueService; + + public QueueModule(ICommandExecutor commandExecutor, IQueueService queueService) + : base(commandExecutor) + { + _queueService = queueService; + GetResourceAll = GetQueue; + } + + private List GetQueue() + { + return ToListResource(_queueService.GetQueue); + } + + public void Handle(UpdateQueueEvent message) + { + BroadcastResourceChange(ModelAction.Sync); + } + } +} \ No newline at end of file diff --git a/src/NzbDrone.Api/Queue/QueueResource.cs b/src/NzbDrone.Api/Queue/QueueResource.cs new file mode 100644 index 000000000..429a25c44 --- /dev/null +++ b/src/NzbDrone.Api/Queue/QueueResource.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using NzbDrone.Api.REST; +using NzbDrone.Core.Tv; + +namespace NzbDrone.Api.Queue +{ + public class QueueResource : RestResource + { + public Core.Tv.Series Series { get; set; } + public Episode Episode { get; set; } + public QualityModel Quality { get; set; } + public Decimal Size { get; set; } + public String Title { get; set; } + public Decimal Sizeleft { get; set; } + public TimeSpan Timeleft { get; set; } + public String Status { get; set; } + } +} diff --git a/NzbDrone.Api/REST/BadRequestException.cs b/src/NzbDrone.Api/REST/BadRequestException.cs similarity index 100% rename from NzbDrone.Api/REST/BadRequestException.cs rename to src/NzbDrone.Api/REST/BadRequestException.cs diff --git a/NzbDrone.Api/REST/ResourceValidator.cs b/src/NzbDrone.Api/REST/ResourceValidator.cs similarity index 100% rename from NzbDrone.Api/REST/ResourceValidator.cs rename to src/NzbDrone.Api/REST/ResourceValidator.cs diff --git a/NzbDrone.Api/REST/RestModule.cs b/src/NzbDrone.Api/REST/RestModule.cs similarity index 100% rename from NzbDrone.Api/REST/RestModule.cs rename to src/NzbDrone.Api/REST/RestModule.cs diff --git a/NzbDrone.Api/REST/RestResource.cs b/src/NzbDrone.Api/REST/RestResource.cs similarity index 100% rename from NzbDrone.Api/REST/RestResource.cs rename to src/NzbDrone.Api/REST/RestResource.cs diff --git a/NzbDrone.Api/ResourceChangeMessage.cs b/src/NzbDrone.Api/ResourceChangeMessage.cs similarity index 92% rename from NzbDrone.Api/ResourceChangeMessage.cs rename to src/NzbDrone.Api/ResourceChangeMessage.cs index 6b7efb50a..6319dcc39 100644 --- a/NzbDrone.Api/ResourceChangeMessage.cs +++ b/src/NzbDrone.Api/ResourceChangeMessage.cs @@ -11,7 +11,7 @@ namespace NzbDrone.Api public ResourceChangeMessage(ModelAction action) { - if (action != ModelAction.Deleted || action != ModelAction.Sync) + if (action != ModelAction.Deleted && action != ModelAction.Sync) { throw new InvalidOperationException("Resource message without a resource needs to have Delete or Sync as action"); } diff --git a/NzbDrone.Api/RootFolders/RootFolderModule.cs b/src/NzbDrone.Api/RootFolders/RootFolderModule.cs similarity index 100% rename from NzbDrone.Api/RootFolders/RootFolderModule.cs rename to src/NzbDrone.Api/RootFolders/RootFolderModule.cs diff --git a/NzbDrone.Api/RootFolders/RootFolderResource.cs b/src/NzbDrone.Api/RootFolders/RootFolderResource.cs similarity index 100% rename from NzbDrone.Api/RootFolders/RootFolderResource.cs rename to src/NzbDrone.Api/RootFolders/RootFolderResource.cs diff --git a/NzbDrone.Api/Series/SeriesLookupModule.cs b/src/NzbDrone.Api/Series/SeriesLookupModule.cs similarity index 100% rename from NzbDrone.Api/Series/SeriesLookupModule.cs rename to src/NzbDrone.Api/Series/SeriesLookupModule.cs diff --git a/NzbDrone.Api/Series/SeriesModule.cs b/src/NzbDrone.Api/Series/SeriesModule.cs similarity index 100% rename from NzbDrone.Api/Series/SeriesModule.cs rename to src/NzbDrone.Api/Series/SeriesModule.cs diff --git a/NzbDrone.Api/Series/SeriesResource.cs b/src/NzbDrone.Api/Series/SeriesResource.cs similarity index 100% rename from NzbDrone.Api/Series/SeriesResource.cs rename to src/NzbDrone.Api/Series/SeriesResource.cs diff --git a/NzbDrone.Api/System/SystemModule.cs b/src/NzbDrone.Api/System/SystemModule.cs similarity index 96% rename from NzbDrone.Api/System/SystemModule.cs rename to src/NzbDrone.Api/System/SystemModule.cs index a013b15af..f409612fd 100644 --- a/NzbDrone.Api/System/SystemModule.cs +++ b/src/NzbDrone.Api/System/SystemModule.cs @@ -42,7 +42,8 @@ namespace NzbDrone.Api.System IsLinux = OsInfo.IsLinux, IsWindows = OsInfo.IsWindows, Branch = _configFileProvider.Branch, - Authentication = _configFileProvider.AuthenticationEnabled + Authentication = _configFileProvider.AuthenticationEnabled, + StartOfWeek = (int)OsInfo.FirstDayOfWeek }.AsResponse(); } diff --git a/NzbDrone.Api/TinyIoCNancyBootstrapper.cs b/src/NzbDrone.Api/TinyIoCNancyBootstrapper.cs similarity index 100% rename from NzbDrone.Api/TinyIoCNancyBootstrapper.cs rename to src/NzbDrone.Api/TinyIoCNancyBootstrapper.cs diff --git a/src/NzbDrone.Api/Update/UpdateModule.cs b/src/NzbDrone.Api/Update/UpdateModule.cs new file mode 100644 index 000000000..2ade0b76d --- /dev/null +++ b/src/NzbDrone.Api/Update/UpdateModule.cs @@ -0,0 +1,74 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Nancy; +using Newtonsoft.Json; +using NzbDrone.Api.Extensions; +using NzbDrone.Api.REST; +using NzbDrone.Common.EnvironmentInfo; +using NzbDrone.Core.Update; +using NzbDrone.Api.Mapping; + +namespace NzbDrone.Api.Update +{ + public class UpdateModule : NzbDroneRestModule + { + private readonly IRecentUpdateProvider _recentUpdateProvider; + private readonly IInstallUpdates _installUpdateService; + + public UpdateModule(IRecentUpdateProvider recentUpdateProvider, + IInstallUpdates installUpdateService) + { + _recentUpdateProvider = recentUpdateProvider; + _installUpdateService = installUpdateService; + GetResourceAll = GetRecentUpdates; + Post["/"] = x=> InstallUpdate(); + } + + private List GetRecentUpdates() + { + var resources = _recentUpdateProvider.GetRecentUpdatePackages() + .OrderByDescending(u => u.Version) + .InjectTo>(); + + foreach (var updateResource in resources) + { + if (updateResource.Version > BuildInfo.Version) + { + updateResource.IsUpgrade = true; + } + + else if (updateResource.Version == BuildInfo.Version) + { + updateResource.Installed = true; + } + } + + return resources; + } + + private Response InstallUpdate() + { + var updateResource = Request.Body.FromJson(); + + var updatePackage = updateResource.InjectTo(); + _installUpdateService.InstallUpdate(updatePackage); + + return updateResource.AsResponse(); + } + } + + public class UpdateResource : RestResource + { + [JsonConverter(typeof(Newtonsoft.Json.Converters.VersionConverter))] + public Version Version { get; set; } + + public String Branch { get; set; } + public DateTime ReleaseDate { get; set; } + public String FileName { get; set; } + public String Url { get; set; } + public Boolean IsUpgrade { get; set; } + public Boolean Installed { get; set; } + public UpdateChanges Changes { get; set; } + } +} \ No newline at end of file diff --git a/NzbDrone.Api/Validation/PathValidator.cs b/src/NzbDrone.Api/Validation/PathValidator.cs similarity index 100% rename from NzbDrone.Api/Validation/PathValidator.cs rename to src/NzbDrone.Api/Validation/PathValidator.cs diff --git a/NzbDrone.Api/Validation/RuleBuilderExtensions.cs b/src/NzbDrone.Api/Validation/RuleBuilderExtensions.cs similarity index 100% rename from NzbDrone.Api/Validation/RuleBuilderExtensions.cs rename to src/NzbDrone.Api/Validation/RuleBuilderExtensions.cs diff --git a/NzbDrone.Api/packages.config b/src/NzbDrone.Api/packages.config similarity index 100% rename from NzbDrone.Api/packages.config rename to src/NzbDrone.Api/packages.config diff --git a/NzbDrone.App.Test/ContainerFixture.cs b/src/NzbDrone.App.Test/ContainerFixture.cs similarity index 97% rename from NzbDrone.App.Test/ContainerFixture.cs rename to src/NzbDrone.App.Test/ContainerFixture.cs index 14a35688d..a165f9348 100644 --- a/NzbDrone.App.Test/ContainerFixture.cs +++ b/src/NzbDrone.App.Test/ContainerFixture.cs @@ -37,7 +37,7 @@ namespace NzbDrone.App.Test { var factory = MainAppContainerBuilder.BuildContainer(args).Resolve(); - factory.Build().Should().NotBeNull(); + factory.Build().Should().NotBeNull(); } [Test] diff --git a/NzbDrone.App.Test/License.txt b/src/NzbDrone.App.Test/License.txt similarity index 100% rename from NzbDrone.App.Test/License.txt rename to src/NzbDrone.App.Test/License.txt diff --git a/NzbDrone.App.Test/MonitoringProviderTest.cs b/src/NzbDrone.App.Test/MonitoringProviderTest.cs similarity index 100% rename from NzbDrone.App.Test/MonitoringProviderTest.cs rename to src/NzbDrone.App.Test/MonitoringProviderTest.cs diff --git a/NzbDrone.App.Test/NzbDrone.Host.Test.csproj b/src/NzbDrone.App.Test/NzbDrone.Host.Test.csproj similarity index 100% rename from NzbDrone.App.Test/NzbDrone.Host.Test.csproj rename to src/NzbDrone.App.Test/NzbDrone.Host.Test.csproj diff --git a/NzbDrone.App.Test/Properties/AssemblyInfo.cs b/src/NzbDrone.App.Test/Properties/AssemblyInfo.cs similarity index 100% rename from NzbDrone.App.Test/Properties/AssemblyInfo.cs rename to src/NzbDrone.App.Test/Properties/AssemblyInfo.cs diff --git a/NzbDrone.App.Test/RouterTest.cs b/src/NzbDrone.App.Test/RouterTest.cs similarity index 100% rename from NzbDrone.App.Test/RouterTest.cs rename to src/NzbDrone.App.Test/RouterTest.cs diff --git a/NzbDrone.App.Test/packages.config b/src/NzbDrone.App.Test/packages.config similarity index 100% rename from NzbDrone.App.Test/packages.config rename to src/NzbDrone.App.Test/packages.config diff --git a/NzbDrone.Common.Test/CacheTests/CachedFixture.cs b/src/NzbDrone.Common.Test/CacheTests/CachedFixture.cs similarity index 100% rename from NzbDrone.Common.Test/CacheTests/CachedFixture.cs rename to src/NzbDrone.Common.Test/CacheTests/CachedFixture.cs diff --git a/NzbDrone.Common.Test/CacheTests/CachedManagerFixture.cs b/src/NzbDrone.Common.Test/CacheTests/CachedManagerFixture.cs similarity index 100% rename from NzbDrone.Common.Test/CacheTests/CachedManagerFixture.cs rename to src/NzbDrone.Common.Test/CacheTests/CachedManagerFixture.cs diff --git a/NzbDrone.Common.Test/ConfigFileProviderTest.cs b/src/NzbDrone.Common.Test/ConfigFileProviderTest.cs similarity index 100% rename from NzbDrone.Common.Test/ConfigFileProviderTest.cs rename to src/NzbDrone.Common.Test/ConfigFileProviderTest.cs diff --git a/NzbDrone.Common.Test/DiskProviderTests/DiskProviderFixture.cs b/src/NzbDrone.Common.Test/DiskProviderTests/DiskProviderFixture.cs similarity index 100% rename from NzbDrone.Common.Test/DiskProviderTests/DiskProviderFixture.cs rename to src/NzbDrone.Common.Test/DiskProviderTests/DiskProviderFixture.cs diff --git a/NzbDrone.Common.Test/DiskProviderTests/FreeSpaceFixture.cs b/src/NzbDrone.Common.Test/DiskProviderTests/FreeSpaceFixture.cs similarity index 100% rename from NzbDrone.Common.Test/DiskProviderTests/FreeSpaceFixture.cs rename to src/NzbDrone.Common.Test/DiskProviderTests/FreeSpaceFixture.cs diff --git a/NzbDrone.Common.Test/DiskProviderTests/IsParentFixture.cs b/src/NzbDrone.Common.Test/DiskProviderTests/IsParentFixture.cs similarity index 100% rename from NzbDrone.Common.Test/DiskProviderTests/IsParentFixture.cs rename to src/NzbDrone.Common.Test/DiskProviderTests/IsParentFixture.cs diff --git a/NzbDrone.Common.Test/EnsureTest/PathExtensionFixture.cs b/src/NzbDrone.Common.Test/EnsureTest/PathExtensionFixture.cs similarity index 100% rename from NzbDrone.Common.Test/EnsureTest/PathExtensionFixture.cs rename to src/NzbDrone.Common.Test/EnsureTest/PathExtensionFixture.cs diff --git a/NzbDrone.Common.Test/EnvironmentProviderTest.cs b/src/NzbDrone.Common.Test/EnvironmentProviderTest.cs similarity index 100% rename from NzbDrone.Common.Test/EnvironmentProviderTest.cs rename to src/NzbDrone.Common.Test/EnvironmentProviderTest.cs diff --git a/NzbDrone.Common.Test/EnvironmentTests/EnvironmentProviderTest.cs b/src/NzbDrone.Common.Test/EnvironmentTests/EnvironmentProviderTest.cs similarity index 100% rename from NzbDrone.Common.Test/EnvironmentTests/EnvironmentProviderTest.cs rename to src/NzbDrone.Common.Test/EnvironmentTests/EnvironmentProviderTest.cs diff --git a/NzbDrone.Common.Test/EnvironmentTests/StartupArgumentsFixture.cs b/src/NzbDrone.Common.Test/EnvironmentTests/StartupArgumentsFixture.cs similarity index 100% rename from NzbDrone.Common.Test/EnvironmentTests/StartupArgumentsFixture.cs rename to src/NzbDrone.Common.Test/EnvironmentTests/StartupArgumentsFixture.cs diff --git a/NzbDrone.Common.Test/License.txt b/src/NzbDrone.Common.Test/License.txt similarity index 100% rename from NzbDrone.Common.Test/License.txt rename to src/NzbDrone.Common.Test/License.txt diff --git a/NzbDrone.Common.Test/NzbDrone.Common.Test.csproj b/src/NzbDrone.Common.Test/NzbDrone.Common.Test.csproj similarity index 100% rename from NzbDrone.Common.Test/NzbDrone.Common.Test.csproj rename to src/NzbDrone.Common.Test/NzbDrone.Common.Test.csproj diff --git a/NzbDrone.Common.Test/PathExtensionFixture.cs b/src/NzbDrone.Common.Test/PathExtensionFixture.cs similarity index 100% rename from NzbDrone.Common.Test/PathExtensionFixture.cs rename to src/NzbDrone.Common.Test/PathExtensionFixture.cs diff --git a/NzbDrone.Common.Test/ProcessProviderTests.cs b/src/NzbDrone.Common.Test/ProcessProviderTests.cs similarity index 100% rename from NzbDrone.Common.Test/ProcessProviderTests.cs rename to src/NzbDrone.Common.Test/ProcessProviderTests.cs diff --git a/NzbDrone.Common.Test/ReflectionExtensions.cs b/src/NzbDrone.Common.Test/ReflectionExtensions.cs similarity index 100% rename from NzbDrone.Common.Test/ReflectionExtensions.cs rename to src/NzbDrone.Common.Test/ReflectionExtensions.cs diff --git a/NzbDrone.Common.Test/ReflectionTests/ReflectionExtensionFixture.cs b/src/NzbDrone.Common.Test/ReflectionTests/ReflectionExtensionFixture.cs similarity index 96% rename from NzbDrone.Common.Test/ReflectionTests/ReflectionExtensionFixture.cs rename to src/NzbDrone.Common.Test/ReflectionTests/ReflectionExtensionFixture.cs index 4576b24ac..3e6c3fab9 100644 --- a/NzbDrone.Common.Test/ReflectionTests/ReflectionExtensionFixture.cs +++ b/src/NzbDrone.Common.Test/ReflectionTests/ReflectionExtensionFixture.cs @@ -1,31 +1,31 @@ -using System.Reflection; -using FluentAssertions; -using NUnit.Framework; -using NzbDrone.Common.Reflection; -using NzbDrone.Core.Datastore; -using NzbDrone.Test.Common; - -namespace NzbDrone.Common.Test.ReflectionTests -{ - public class ReflectionExtensionFixture : TestBase - { - [Test] - public void should_get_properties_from_models() - { - var models = Assembly.Load("NzbDrone.Core").ImplementationsOf(); - - foreach (var model in models) - { - model.GetSimpleProperties().Should().NotBeEmpty(); - } - } - - [Test] - public void should_be_able_to_get_implementations() - { - var models = Assembly.Load("NzbDrone.Core").ImplementationsOf(); - - models.Should().NotBeEmpty(); - } - } +using System.Reflection; +using FluentAssertions; +using NUnit.Framework; +using NzbDrone.Common.Reflection; +using NzbDrone.Core.Datastore; +using NzbDrone.Test.Common; + +namespace NzbDrone.Common.Test.ReflectionTests +{ + public class ReflectionExtensionFixture : TestBase + { + [Test] + public void should_get_properties_from_models() + { + var models = Assembly.Load("NzbDrone.Core").ImplementationsOf(); + + foreach (var model in models) + { + model.GetSimpleProperties().Should().NotBeEmpty(); + } + } + + [Test] + public void should_be_able_to_get_implementations() + { + var models = Assembly.Load("NzbDrone.Core").ImplementationsOf(); + + models.Should().NotBeEmpty(); + } + } } \ No newline at end of file diff --git a/NzbDrone.Common.Test/ServiceFactoryFixture.cs b/src/NzbDrone.Common.Test/ServiceFactoryFixture.cs similarity index 100% rename from NzbDrone.Common.Test/ServiceFactoryFixture.cs rename to src/NzbDrone.Common.Test/ServiceFactoryFixture.cs diff --git a/NzbDrone.Common.Test/ServiceProviderTests.cs b/src/NzbDrone.Common.Test/ServiceProviderTests.cs similarity index 100% rename from NzbDrone.Common.Test/ServiceProviderTests.cs rename to src/NzbDrone.Common.Test/ServiceProviderTests.cs diff --git a/NzbDrone.Common.Test/WebClientTests.cs b/src/NzbDrone.Common.Test/WebClientTests.cs similarity index 100% rename from NzbDrone.Common.Test/WebClientTests.cs rename to src/NzbDrone.Common.Test/WebClientTests.cs diff --git a/NzbDrone.Common.Test/packages.config b/src/NzbDrone.Common.Test/packages.config similarity index 100% rename from NzbDrone.Common.Test/packages.config rename to src/NzbDrone.Common.Test/packages.config diff --git a/NzbDrone.Common/ArchiveProvider.cs b/src/NzbDrone.Common/ArchiveProvider.cs similarity index 100% rename from NzbDrone.Common/ArchiveProvider.cs rename to src/NzbDrone.Common/ArchiveProvider.cs diff --git a/NzbDrone.Common/Cache/CacheManger.cs b/src/NzbDrone.Common/Cache/CacheManger.cs similarity index 100% rename from NzbDrone.Common/Cache/CacheManger.cs rename to src/NzbDrone.Common/Cache/CacheManger.cs diff --git a/NzbDrone.Common/Cache/Cached.cs b/src/NzbDrone.Common/Cache/Cached.cs similarity index 100% rename from NzbDrone.Common/Cache/Cached.cs rename to src/NzbDrone.Common/Cache/Cached.cs diff --git a/NzbDrone.Common/Cache/ICached.cs b/src/NzbDrone.Common/Cache/ICached.cs similarity index 100% rename from NzbDrone.Common/Cache/ICached.cs rename to src/NzbDrone.Common/Cache/ICached.cs diff --git a/NzbDrone.Common/Composition/Container.cs b/src/NzbDrone.Common/Composition/Container.cs similarity index 100% rename from NzbDrone.Common/Composition/Container.cs rename to src/NzbDrone.Common/Composition/Container.cs diff --git a/NzbDrone.Common/Composition/ContainerBuilderBase.cs b/src/NzbDrone.Common/Composition/ContainerBuilderBase.cs similarity index 100% rename from NzbDrone.Common/Composition/ContainerBuilderBase.cs rename to src/NzbDrone.Common/Composition/ContainerBuilderBase.cs diff --git a/NzbDrone.Common/Composition/IContainer.cs b/src/NzbDrone.Common/Composition/IContainer.cs similarity index 100% rename from NzbDrone.Common/Composition/IContainer.cs rename to src/NzbDrone.Common/Composition/IContainer.cs diff --git a/NzbDrone.Common/ConsoleService.cs b/src/NzbDrone.Common/ConsoleService.cs similarity index 100% rename from NzbDrone.Common/ConsoleService.cs rename to src/NzbDrone.Common/ConsoleService.cs diff --git a/src/NzbDrone.Common/DateTimeExtensions.cs b/src/NzbDrone.Common/DateTimeExtensions.cs new file mode 100644 index 000000000..8b2ba6491 --- /dev/null +++ b/src/NzbDrone.Common/DateTimeExtensions.cs @@ -0,0 +1,24 @@ +using System; +using System.Globalization; + +namespace NzbDrone.Common +{ + public static class DateTimeExtensions + { + public static DateTime GetFirstDayOfWeek(this DateTime dayInWeek) + { + var defaultCultureInfo = CultureInfo.CurrentCulture; + return GetFirstDayOfWeek(dayInWeek, defaultCultureInfo); + } + + public static DateTime GetFirstDayOfWeek(this DateTime dayInWeek, CultureInfo cultureInfo) + { + DayOfWeek firstDay = cultureInfo.DateTimeFormat.FirstDayOfWeek; + DateTime firstDayInWeek = dayInWeek.Date; + while (firstDayInWeek.DayOfWeek != firstDay) + firstDayInWeek = firstDayInWeek.AddDays(-1); + + return firstDayInWeek; + } + } +} diff --git a/NzbDrone.Common/DiskProvider.cs b/src/NzbDrone.Common/DiskProvider.cs similarity index 100% rename from NzbDrone.Common/DiskProvider.cs rename to src/NzbDrone.Common/DiskProvider.cs diff --git a/NzbDrone.Common/EnsureThat/Ensure.cs b/src/NzbDrone.Common/EnsureThat/Ensure.cs similarity index 100% rename from NzbDrone.Common/EnsureThat/Ensure.cs rename to src/NzbDrone.Common/EnsureThat/Ensure.cs diff --git a/NzbDrone.Common/EnsureThat/EnsureBoolExtensions.cs b/src/NzbDrone.Common/EnsureThat/EnsureBoolExtensions.cs similarity index 100% rename from NzbDrone.Common/EnsureThat/EnsureBoolExtensions.cs rename to src/NzbDrone.Common/EnsureThat/EnsureBoolExtensions.cs diff --git a/NzbDrone.Common/EnsureThat/EnsureCollectionExtensions.cs b/src/NzbDrone.Common/EnsureThat/EnsureCollectionExtensions.cs similarity index 100% rename from NzbDrone.Common/EnsureThat/EnsureCollectionExtensions.cs rename to src/NzbDrone.Common/EnsureThat/EnsureCollectionExtensions.cs diff --git a/NzbDrone.Common/EnsureThat/EnsureDateTimeExtensions.cs b/src/NzbDrone.Common/EnsureThat/EnsureDateTimeExtensions.cs similarity index 100% rename from NzbDrone.Common/EnsureThat/EnsureDateTimeExtensions.cs rename to src/NzbDrone.Common/EnsureThat/EnsureDateTimeExtensions.cs diff --git a/NzbDrone.Common/EnsureThat/EnsureDecimalExtensions.cs b/src/NzbDrone.Common/EnsureThat/EnsureDecimalExtensions.cs similarity index 100% rename from NzbDrone.Common/EnsureThat/EnsureDecimalExtensions.cs rename to src/NzbDrone.Common/EnsureThat/EnsureDecimalExtensions.cs diff --git a/NzbDrone.Common/EnsureThat/EnsureDoubleExtensions.cs b/src/NzbDrone.Common/EnsureThat/EnsureDoubleExtensions.cs similarity index 100% rename from NzbDrone.Common/EnsureThat/EnsureDoubleExtensions.cs rename to src/NzbDrone.Common/EnsureThat/EnsureDoubleExtensions.cs diff --git a/NzbDrone.Common/EnsureThat/EnsureGuidExtensions.cs b/src/NzbDrone.Common/EnsureThat/EnsureGuidExtensions.cs similarity index 100% rename from NzbDrone.Common/EnsureThat/EnsureGuidExtensions.cs rename to src/NzbDrone.Common/EnsureThat/EnsureGuidExtensions.cs diff --git a/NzbDrone.Common/EnsureThat/EnsureIntExtensions.cs b/src/NzbDrone.Common/EnsureThat/EnsureIntExtensions.cs similarity index 100% rename from NzbDrone.Common/EnsureThat/EnsureIntExtensions.cs rename to src/NzbDrone.Common/EnsureThat/EnsureIntExtensions.cs diff --git a/NzbDrone.Common/EnsureThat/EnsureLongExtensions.cs b/src/NzbDrone.Common/EnsureThat/EnsureLongExtensions.cs similarity index 100% rename from NzbDrone.Common/EnsureThat/EnsureLongExtensions.cs rename to src/NzbDrone.Common/EnsureThat/EnsureLongExtensions.cs diff --git a/NzbDrone.Common/EnsureThat/EnsureNullableValueTypeExtensions.cs b/src/NzbDrone.Common/EnsureThat/EnsureNullableValueTypeExtensions.cs similarity index 100% rename from NzbDrone.Common/EnsureThat/EnsureNullableValueTypeExtensions.cs rename to src/NzbDrone.Common/EnsureThat/EnsureNullableValueTypeExtensions.cs diff --git a/NzbDrone.Common/EnsureThat/EnsureObjectExtensions.cs b/src/NzbDrone.Common/EnsureThat/EnsureObjectExtensions.cs similarity index 100% rename from NzbDrone.Common/EnsureThat/EnsureObjectExtensions.cs rename to src/NzbDrone.Common/EnsureThat/EnsureObjectExtensions.cs diff --git a/NzbDrone.Common/EnsureThat/EnsureShortExtensions.cs b/src/NzbDrone.Common/EnsureThat/EnsureShortExtensions.cs similarity index 100% rename from NzbDrone.Common/EnsureThat/EnsureShortExtensions.cs rename to src/NzbDrone.Common/EnsureThat/EnsureShortExtensions.cs diff --git a/NzbDrone.Common/EnsureThat/EnsureStringExtensions.cs b/src/NzbDrone.Common/EnsureThat/EnsureStringExtensions.cs similarity index 100% rename from NzbDrone.Common/EnsureThat/EnsureStringExtensions.cs rename to src/NzbDrone.Common/EnsureThat/EnsureStringExtensions.cs diff --git a/NzbDrone.Common/EnsureThat/EnsureTypeExtensions.cs b/src/NzbDrone.Common/EnsureThat/EnsureTypeExtensions.cs similarity index 100% rename from NzbDrone.Common/EnsureThat/EnsureTypeExtensions.cs rename to src/NzbDrone.Common/EnsureThat/EnsureTypeExtensions.cs diff --git a/NzbDrone.Common/EnsureThat/ExceptionFactory.cs b/src/NzbDrone.Common/EnsureThat/ExceptionFactory.cs similarity index 100% rename from NzbDrone.Common/EnsureThat/ExceptionFactory.cs rename to src/NzbDrone.Common/EnsureThat/ExceptionFactory.cs diff --git a/NzbDrone.Common/EnsureThat/ExpressionExtensions.cs b/src/NzbDrone.Common/EnsureThat/ExpressionExtensions.cs similarity index 100% rename from NzbDrone.Common/EnsureThat/ExpressionExtensions.cs rename to src/NzbDrone.Common/EnsureThat/ExpressionExtensions.cs diff --git a/NzbDrone.Common/EnsureThat/Param.cs b/src/NzbDrone.Common/EnsureThat/Param.cs similarity index 100% rename from NzbDrone.Common/EnsureThat/Param.cs rename to src/NzbDrone.Common/EnsureThat/Param.cs diff --git a/NzbDrone.Common/EnsureThat/Resources/ExceptionMessages.Designer.cs b/src/NzbDrone.Common/EnsureThat/Resources/ExceptionMessages.Designer.cs similarity index 100% rename from NzbDrone.Common/EnsureThat/Resources/ExceptionMessages.Designer.cs rename to src/NzbDrone.Common/EnsureThat/Resources/ExceptionMessages.Designer.cs diff --git a/NzbDrone.Common/EnsureThat/Resources/ExceptionMessages.resx b/src/NzbDrone.Common/EnsureThat/Resources/ExceptionMessages.resx similarity index 100% rename from NzbDrone.Common/EnsureThat/Resources/ExceptionMessages.resx rename to src/NzbDrone.Common/EnsureThat/Resources/ExceptionMessages.resx diff --git a/NzbDrone.Common/EnsureThat/TypeParam.cs b/src/NzbDrone.Common/EnsureThat/TypeParam.cs similarity index 100% rename from NzbDrone.Common/EnsureThat/TypeParam.cs rename to src/NzbDrone.Common/EnsureThat/TypeParam.cs diff --git a/NzbDrone.Common/EnvironmentInfo/AppFolderInfo.cs b/src/NzbDrone.Common/EnvironmentInfo/AppFolderInfo.cs similarity index 100% rename from NzbDrone.Common/EnvironmentInfo/AppFolderInfo.cs rename to src/NzbDrone.Common/EnvironmentInfo/AppFolderInfo.cs diff --git a/NzbDrone.Common/EnvironmentInfo/BuildInfo.cs b/src/NzbDrone.Common/EnvironmentInfo/BuildInfo.cs similarity index 100% rename from NzbDrone.Common/EnvironmentInfo/BuildInfo.cs rename to src/NzbDrone.Common/EnvironmentInfo/BuildInfo.cs diff --git a/NzbDrone.Common/EnvironmentInfo/OsInfo.cs b/src/NzbDrone.Common/EnvironmentInfo/OsInfo.cs similarity index 80% rename from NzbDrone.Common/EnvironmentInfo/OsInfo.cs rename to src/NzbDrone.Common/EnvironmentInfo/OsInfo.cs index b30c2c2ee..3b769bfea 100644 --- a/NzbDrone.Common/EnvironmentInfo/OsInfo.cs +++ b/src/NzbDrone.Common/EnvironmentInfo/OsInfo.cs @@ -28,5 +28,13 @@ namespace NzbDrone.Common.EnvironmentInfo return !IsLinux; } } + + public static DayOfWeek FirstDayOfWeek + { + get + { + return DateTime.Today.GetFirstDayOfWeek().DayOfWeek; + } + } } } \ No newline at end of file diff --git a/NzbDrone.Common/EnvironmentInfo/RuntimeInfo.cs b/src/NzbDrone.Common/EnvironmentInfo/RuntimeInfo.cs similarity index 100% rename from NzbDrone.Common/EnvironmentInfo/RuntimeInfo.cs rename to src/NzbDrone.Common/EnvironmentInfo/RuntimeInfo.cs diff --git a/NzbDrone.Common/EnvironmentInfo/StartupArguments.cs b/src/NzbDrone.Common/EnvironmentInfo/StartupArguments.cs similarity index 100% rename from NzbDrone.Common/EnvironmentInfo/StartupArguments.cs rename to src/NzbDrone.Common/EnvironmentInfo/StartupArguments.cs diff --git a/NzbDrone.Common/Exceptions/NzbDroneException.cs b/src/NzbDrone.Common/Exceptions/NzbDroneException.cs similarity index 100% rename from NzbDrone.Common/Exceptions/NzbDroneException.cs rename to src/NzbDrone.Common/Exceptions/NzbDroneException.cs diff --git a/NzbDrone.Common/Expansive/CircularReferenceException.cs b/src/NzbDrone.Common/Expansive/CircularReferenceException.cs similarity index 100% rename from NzbDrone.Common/Expansive/CircularReferenceException.cs rename to src/NzbDrone.Common/Expansive/CircularReferenceException.cs diff --git a/NzbDrone.Common/Expansive/Expansive.cs b/src/NzbDrone.Common/Expansive/Expansive.cs similarity index 100% rename from NzbDrone.Common/Expansive/Expansive.cs rename to src/NzbDrone.Common/Expansive/Expansive.cs diff --git a/NzbDrone.Common/Expansive/PatternStyle.cs b/src/NzbDrone.Common/Expansive/PatternStyle.cs similarity index 100% rename from NzbDrone.Common/Expansive/PatternStyle.cs rename to src/NzbDrone.Common/Expansive/PatternStyle.cs diff --git a/NzbDrone.Common/Expansive/Tree.cs b/src/NzbDrone.Common/Expansive/Tree.cs similarity index 100% rename from NzbDrone.Common/Expansive/Tree.cs rename to src/NzbDrone.Common/Expansive/Tree.cs diff --git a/NzbDrone.Common/Expansive/TreeNode.cs b/src/NzbDrone.Common/Expansive/TreeNode.cs similarity index 100% rename from NzbDrone.Common/Expansive/TreeNode.cs rename to src/NzbDrone.Common/Expansive/TreeNode.cs diff --git a/NzbDrone.Common/Expansive/TreeNodeList.cs b/src/NzbDrone.Common/Expansive/TreeNodeList.cs similarity index 100% rename from NzbDrone.Common/Expansive/TreeNodeList.cs rename to src/NzbDrone.Common/Expansive/TreeNodeList.cs diff --git a/NzbDrone.Common/Expansive/license.txt b/src/NzbDrone.Common/Expansive/license.txt similarity index 100% rename from NzbDrone.Common/Expansive/license.txt rename to src/NzbDrone.Common/Expansive/license.txt diff --git a/NzbDrone.Common/HashUtil.cs b/src/NzbDrone.Common/HashUtil.cs similarity index 100% rename from NzbDrone.Common/HashUtil.cs rename to src/NzbDrone.Common/HashUtil.cs diff --git a/NzbDrone.Common/HttpProvider.cs b/src/NzbDrone.Common/HttpProvider.cs similarity index 100% rename from NzbDrone.Common/HttpProvider.cs rename to src/NzbDrone.Common/HttpProvider.cs diff --git a/NzbDrone.Common/IEnumerableExtensions.cs b/src/NzbDrone.Common/IEnumerableExtensions.cs similarity index 100% rename from NzbDrone.Common/IEnumerableExtensions.cs rename to src/NzbDrone.Common/IEnumerableExtensions.cs diff --git a/NzbDrone.Common/Instrumentation/ExceptronTarget.cs b/src/NzbDrone.Common/Instrumentation/ExceptronTarget.cs similarity index 100% rename from NzbDrone.Common/Instrumentation/ExceptronTarget.cs rename to src/NzbDrone.Common/Instrumentation/ExceptronTarget.cs diff --git a/NzbDrone.Common/Instrumentation/GlobalExceptionHandlers.cs b/src/NzbDrone.Common/Instrumentation/GlobalExceptionHandlers.cs similarity index 100% rename from NzbDrone.Common/Instrumentation/GlobalExceptionHandlers.cs rename to src/NzbDrone.Common/Instrumentation/GlobalExceptionHandlers.cs diff --git a/NzbDrone.Common/Instrumentation/LogEventExtensions.cs b/src/NzbDrone.Common/Instrumentation/LogEventExtensions.cs similarity index 96% rename from NzbDrone.Common/Instrumentation/LogEventExtensions.cs rename to src/NzbDrone.Common/Instrumentation/LogEventExtensions.cs index 373aa9201..6b1ab2e84 100644 --- a/NzbDrone.Common/Instrumentation/LogEventExtensions.cs +++ b/src/NzbDrone.Common/Instrumentation/LogEventExtensions.cs @@ -1,39 +1,39 @@ -using System; -using NLog; -using NzbDrone.Common.Serializer; - -namespace NzbDrone.Common.Instrumentation -{ - public static class LogEventExtensions - { - public static string GetHash(this LogEventInfo logEvent) - { - var stackString = logEvent.StackTrace.ToJson(); - var hashSeed = String.Concat(logEvent.LoggerName, logEvent.Exception.GetType().ToString(), stackString, logEvent.Level); - return HashUtil.CalculateCrc(hashSeed); - } - - public static string GetFormattedMessage(this LogEventInfo logEvent) - { - var message = logEvent.FormattedMessage; - - if (logEvent.Exception != null) - { - if (logEvent.Exception != null) - { - if (String.IsNullOrWhiteSpace(message)) - { - message = logEvent.Exception.Message; - } - else - { - message += ": " + logEvent.Exception.Message; - } - } - - } - - return message; - } - } +using System; +using NLog; +using NzbDrone.Common.Serializer; + +namespace NzbDrone.Common.Instrumentation +{ + public static class LogEventExtensions + { + public static string GetHash(this LogEventInfo logEvent) + { + var stackString = logEvent.StackTrace.ToJson(); + var hashSeed = String.Concat(logEvent.LoggerName, logEvent.Exception.GetType().ToString(), stackString, logEvent.Level); + return HashUtil.CalculateCrc(hashSeed); + } + + public static string GetFormattedMessage(this LogEventInfo logEvent) + { + var message = logEvent.FormattedMessage; + + if (logEvent.Exception != null) + { + if (logEvent.Exception != null) + { + if (String.IsNullOrWhiteSpace(message)) + { + message = logEvent.Exception.Message; + } + else + { + message += ": " + logEvent.Exception.Message; + } + } + + } + + return message; + } + } } \ No newline at end of file diff --git a/NzbDrone.Common/Instrumentation/LogTargets.cs b/src/NzbDrone.Common/Instrumentation/LogTargets.cs similarity index 100% rename from NzbDrone.Common/Instrumentation/LogTargets.cs rename to src/NzbDrone.Common/Instrumentation/LogTargets.cs diff --git a/NzbDrone.Common/Instrumentation/LogglyTarget.cs b/src/NzbDrone.Common/Instrumentation/LogglyTarget.cs similarity index 96% rename from NzbDrone.Common/Instrumentation/LogglyTarget.cs rename to src/NzbDrone.Common/Instrumentation/LogglyTarget.cs index 8f2817581..ae246eb41 100644 --- a/NzbDrone.Common/Instrumentation/LogglyTarget.cs +++ b/src/NzbDrone.Common/Instrumentation/LogglyTarget.cs @@ -1,63 +1,63 @@ -using System.Collections.Generic; -using NLog; -using NLog.Layouts; -using NLog.Targets; -using NzbDrone.Common.EnvironmentInfo; -using NzbDrone.Common.Serializer; -using Logger = Loggly.Logger; - -namespace NzbDrone.Common.Instrumentation -{ - public class LogglyTarget : TargetWithLayout - { - private Logger _logger; - - public LogglyTarget() - { - Layout = new SimpleLayout("${callsite:className=false:fileName=false:includeSourcePath=false:methodName=true}"); - - } - - protected override void InitializeTarget() - { - string apiKey = string.Empty; - - if (RuntimeInfo.IsProduction) - { - apiKey = "4c4ecb69-d1b9-4e2a-b54b-b0c4cc143a95"; - } - else - { - apiKey = "d344a321-b107-45c4-a548-77138f446510"; - } - - _logger = new Logger(apiKey); - } - - - protected override void Write(LogEventInfo logEvent) - { - var dictionary = new Dictionary(); - - if (logEvent.Exception != null) - { - dictionary.Add("ex", logEvent.Exception.ToString()); - dictionary.Add("extyp", logEvent.Exception.GetType().Name); - dictionary.Add("hash", logEvent.GetHash()); - - foreach (var key in logEvent.Exception.Data.Keys) - { - dictionary.Add(key.ToString(), logEvent.Exception.Data[key]); - } - } - - dictionary.Add("logger", logEvent.LoggerName); - dictionary.Add("method", Layout.Render(logEvent)); - dictionary.Add("level", logEvent.Level.Name); - dictionary.Add("message", logEvent.GetFormattedMessage()); - dictionary.Add("ver", BuildInfo.Version.ToString()); - - _logger.Log(dictionary.ToJson()); - } - } +using System.Collections.Generic; +using NLog; +using NLog.Layouts; +using NLog.Targets; +using NzbDrone.Common.EnvironmentInfo; +using NzbDrone.Common.Serializer; +using Logger = Loggly.Logger; + +namespace NzbDrone.Common.Instrumentation +{ + public class LogglyTarget : TargetWithLayout + { + private Logger _logger; + + public LogglyTarget() + { + Layout = new SimpleLayout("${callsite:className=false:fileName=false:includeSourcePath=false:methodName=true}"); + + } + + protected override void InitializeTarget() + { + string apiKey = string.Empty; + + if (RuntimeInfo.IsProduction) + { + apiKey = "4c4ecb69-d1b9-4e2a-b54b-b0c4cc143a95"; + } + else + { + apiKey = "d344a321-b107-45c4-a548-77138f446510"; + } + + _logger = new Logger(apiKey); + } + + + protected override void Write(LogEventInfo logEvent) + { + var dictionary = new Dictionary(); + + if (logEvent.Exception != null) + { + dictionary.Add("ex", logEvent.Exception.ToString()); + dictionary.Add("extyp", logEvent.Exception.GetType().Name); + dictionary.Add("hash", logEvent.GetHash()); + + foreach (var key in logEvent.Exception.Data.Keys) + { + dictionary.Add(key.ToString(), logEvent.Exception.Data[key]); + } + } + + dictionary.Add("logger", logEvent.LoggerName); + dictionary.Add("method", Layout.Render(logEvent)); + dictionary.Add("level", logEvent.Level.Name); + dictionary.Add("message", logEvent.GetFormattedMessage()); + dictionary.Add("ver", BuildInfo.Version.ToString()); + + _logger.Log(dictionary.ToJson()); + } + } } \ No newline at end of file diff --git a/NzbDrone.Common/Instrumentation/NzbDroneLogger.cs b/src/NzbDrone.Common/Instrumentation/NzbDroneLogger.cs similarity index 100% rename from NzbDrone.Common/Instrumentation/NzbDroneLogger.cs rename to src/NzbDrone.Common/Instrumentation/NzbDroneLogger.cs diff --git a/NzbDrone.Common/Instrumentation/VersionLayoutRenderer.cs b/src/NzbDrone.Common/Instrumentation/VersionLayoutRenderer.cs similarity index 100% rename from NzbDrone.Common/Instrumentation/VersionLayoutRenderer.cs rename to src/NzbDrone.Common/Instrumentation/VersionLayoutRenderer.cs diff --git a/NzbDrone.Common/Messaging/IEvent.cs b/src/NzbDrone.Common/Messaging/IEvent.cs similarity index 100% rename from NzbDrone.Common/Messaging/IEvent.cs rename to src/NzbDrone.Common/Messaging/IEvent.cs diff --git a/NzbDrone.Common/Messaging/IMessage.cs b/src/NzbDrone.Common/Messaging/IMessage.cs similarity index 100% rename from NzbDrone.Common/Messaging/IMessage.cs rename to src/NzbDrone.Common/Messaging/IMessage.cs diff --git a/NzbDrone.Common/Model/ProcessInfo.cs b/src/NzbDrone.Common/Model/ProcessInfo.cs similarity index 100% rename from NzbDrone.Common/Model/ProcessInfo.cs rename to src/NzbDrone.Common/Model/ProcessInfo.cs diff --git a/NzbDrone.Common/NzbDrone.Common.csproj b/src/NzbDrone.Common/NzbDrone.Common.csproj similarity index 98% rename from NzbDrone.Common/NzbDrone.Common.csproj rename to src/NzbDrone.Common/NzbDrone.Common.csproj index 0d76e91a2..869176ecb 100644 --- a/NzbDrone.Common/NzbDrone.Common.csproj +++ b/src/NzbDrone.Common/NzbDrone.Common.csproj @@ -19,7 +19,7 @@ true - ..\_output\ + ..\..\_output\ DEBUG;TRACE full x86 @@ -27,7 +27,7 @@ MinimumRecommendedRules.ruleset - ..\_output\ + ..\..\_output\ TRACE true pdbonly @@ -66,6 +66,7 @@ + diff --git a/NzbDrone.Common/PathEqualityComparer.cs b/src/NzbDrone.Common/PathEqualityComparer.cs similarity index 100% rename from NzbDrone.Common/PathEqualityComparer.cs rename to src/NzbDrone.Common/PathEqualityComparer.cs diff --git a/NzbDrone.Common/PathExtensions.cs b/src/NzbDrone.Common/PathExtensions.cs similarity index 100% rename from NzbDrone.Common/PathExtensions.cs rename to src/NzbDrone.Common/PathExtensions.cs diff --git a/NzbDrone.Common/Processes/ProcessOutput.cs b/src/NzbDrone.Common/Processes/ProcessOutput.cs similarity index 100% rename from NzbDrone.Common/Processes/ProcessOutput.cs rename to src/NzbDrone.Common/Processes/ProcessOutput.cs diff --git a/NzbDrone.Common/Processes/ProcessProvider.cs b/src/NzbDrone.Common/Processes/ProcessProvider.cs similarity index 100% rename from NzbDrone.Common/Processes/ProcessProvider.cs rename to src/NzbDrone.Common/Processes/ProcessProvider.cs diff --git a/NzbDrone.Common/Properties/AssemblyInfo.cs b/src/NzbDrone.Common/Properties/AssemblyInfo.cs similarity index 100% rename from NzbDrone.Common/Properties/AssemblyInfo.cs rename to src/NzbDrone.Common/Properties/AssemblyInfo.cs diff --git a/NzbDrone.Common/Properties/SharedAssemblyInfo.cs b/src/NzbDrone.Common/Properties/SharedAssemblyInfo.cs similarity index 100% rename from NzbDrone.Common/Properties/SharedAssemblyInfo.cs rename to src/NzbDrone.Common/Properties/SharedAssemblyInfo.cs diff --git a/NzbDrone.Common/Reflection/ReflectionExtensions.cs b/src/NzbDrone.Common/Reflection/ReflectionExtensions.cs similarity index 87% rename from NzbDrone.Common/Reflection/ReflectionExtensions.cs rename to src/NzbDrone.Common/Reflection/ReflectionExtensions.cs index 98ff9ff12..898d45119 100644 --- a/NzbDrone.Common/Reflection/ReflectionExtensions.cs +++ b/src/NzbDrone.Common/Reflection/ReflectionExtensions.cs @@ -7,6 +7,8 @@ namespace NzbDrone.Common.Reflection { public static class ReflectionExtensions { + public static readonly Assembly CoreAssembly = Assembly.Load("NzbDrone.Core"); + public static List GetSimpleProperties(this Type type) { var properties = type.GetProperties(); @@ -58,6 +60,11 @@ namespace NzbDrone.Common.Reflection return (T)attribute; } + public static Type FindTypeByName(this Assembly assembly, string name) + { + return assembly.GetTypes().SingleOrDefault(c => c.Name.Equals(name, StringComparison.InvariantCultureIgnoreCase)); + } + public static bool HasAttribute(this Type type) { return type.GetCustomAttributes(typeof(TAttribute), true).Any(); diff --git a/NzbDrone.Common/Security/IgnoreCertErrorPolicy.cs b/src/NzbDrone.Common/Security/IgnoreCertErrorPolicy.cs similarity index 100% rename from NzbDrone.Common/Security/IgnoreCertErrorPolicy.cs rename to src/NzbDrone.Common/Security/IgnoreCertErrorPolicy.cs diff --git a/NzbDrone.Common/Serializer/IntConverter.cs b/src/NzbDrone.Common/Serializer/IntConverter.cs similarity index 100% rename from NzbDrone.Common/Serializer/IntConverter.cs rename to src/NzbDrone.Common/Serializer/IntConverter.cs diff --git a/NzbDrone.Common/Serializer/Json.cs b/src/NzbDrone.Common/Serializer/Json.cs similarity index 100% rename from NzbDrone.Common/Serializer/Json.cs rename to src/NzbDrone.Common/Serializer/Json.cs diff --git a/NzbDrone.Common/ServiceFactory.cs b/src/NzbDrone.Common/ServiceFactory.cs similarity index 100% rename from NzbDrone.Common/ServiceFactory.cs rename to src/NzbDrone.Common/ServiceFactory.cs diff --git a/NzbDrone.Common/ServiceProvider.cs b/src/NzbDrone.Common/ServiceProvider.cs similarity index 100% rename from NzbDrone.Common/ServiceProvider.cs rename to src/NzbDrone.Common/ServiceProvider.cs diff --git a/NzbDrone.Common/Services.cs b/src/NzbDrone.Common/Services.cs similarity index 100% rename from NzbDrone.Common/Services.cs rename to src/NzbDrone.Common/Services.cs diff --git a/NzbDrone.Common/StringExtensions.cs b/src/NzbDrone.Common/StringExtensions.cs similarity index 100% rename from NzbDrone.Common/StringExtensions.cs rename to src/NzbDrone.Common/StringExtensions.cs diff --git a/NzbDrone.Common/TPL/LimitedConcurrencyLevelTaskScheduler.cs b/src/NzbDrone.Common/TPL/LimitedConcurrencyLevelTaskScheduler.cs similarity index 100% rename from NzbDrone.Common/TPL/LimitedConcurrencyLevelTaskScheduler.cs rename to src/NzbDrone.Common/TPL/LimitedConcurrencyLevelTaskScheduler.cs diff --git a/NzbDrone.Common/TPL/TaskExtensions.cs b/src/NzbDrone.Common/TPL/TaskExtensions.cs similarity index 100% rename from NzbDrone.Common/TPL/TaskExtensions.cs rename to src/NzbDrone.Common/TPL/TaskExtensions.cs diff --git a/NzbDrone.Common/TinyIoC.cs b/src/NzbDrone.Common/TinyIoC.cs similarity index 100% rename from NzbDrone.Common/TinyIoC.cs rename to src/NzbDrone.Common/TinyIoC.cs diff --git a/NzbDrone.Common/TryParseExtension.cs b/src/NzbDrone.Common/TryParseExtension.cs similarity index 100% rename from NzbDrone.Common/TryParseExtension.cs rename to src/NzbDrone.Common/TryParseExtension.cs diff --git a/NzbDrone.Common/packages.config b/src/NzbDrone.Common/packages.config similarity index 100% rename from NzbDrone.Common/packages.config rename to src/NzbDrone.Common/packages.config diff --git a/NzbDrone.Console/ConsoleAlerts.cs b/src/NzbDrone.Console/ConsoleAlerts.cs similarity index 100% rename from NzbDrone.Console/ConsoleAlerts.cs rename to src/NzbDrone.Console/ConsoleAlerts.cs diff --git a/NzbDrone.Console/ConsoleApp.cs b/src/NzbDrone.Console/ConsoleApp.cs similarity index 100% rename from NzbDrone.Console/ConsoleApp.cs rename to src/NzbDrone.Console/ConsoleApp.cs diff --git a/NzbDrone.Console/NzbDrone.Console.csproj b/src/NzbDrone.Console/NzbDrone.Console.csproj similarity index 98% rename from NzbDrone.Console/NzbDrone.Console.csproj rename to src/NzbDrone.Console/NzbDrone.Console.csproj index cec173fe1..f4351791a 100644 --- a/NzbDrone.Console/NzbDrone.Console.csproj +++ b/src/NzbDrone.Console/NzbDrone.Console.csproj @@ -37,7 +37,7 @@ true full false - ..\_output\ + ..\..\_output\ DEBUG;TRACE prompt 4 @@ -48,7 +48,7 @@ x86 pdbonly true - ..\_output\ + ..\..\_output\ TRACE prompt 4 diff --git a/NzbDrone.Console/Properties/AssemblyInfo.cs b/src/NzbDrone.Console/Properties/AssemblyInfo.cs similarity index 100% rename from NzbDrone.Console/Properties/AssemblyInfo.cs rename to src/NzbDrone.Console/Properties/AssemblyInfo.cs diff --git a/NzbDrone.Console/packages.config b/src/NzbDrone.Console/packages.config similarity index 100% rename from NzbDrone.Console/packages.config rename to src/NzbDrone.Console/packages.config diff --git a/NzbDrone.Core.Test/Configuration/ConfigCachingFixture.cs b/src/NzbDrone.Core.Test/Configuration/ConfigCachingFixture.cs similarity index 100% rename from NzbDrone.Core.Test/Configuration/ConfigCachingFixture.cs rename to src/NzbDrone.Core.Test/Configuration/ConfigCachingFixture.cs diff --git a/NzbDrone.Core.Test/Configuration/ConfigServiceFixture.cs b/src/NzbDrone.Core.Test/Configuration/ConfigServiceFixture.cs similarity index 100% rename from NzbDrone.Core.Test/Configuration/ConfigServiceFixture.cs rename to src/NzbDrone.Core.Test/Configuration/ConfigServiceFixture.cs diff --git a/NzbDrone.Core.Test/DataAugmentationFixture/Scene/SceneMappingProxyFixture.cs b/src/NzbDrone.Core.Test/DataAugmentationFixture/Scene/SceneMappingProxyFixture.cs similarity index 100% rename from NzbDrone.Core.Test/DataAugmentationFixture/Scene/SceneMappingProxyFixture.cs rename to src/NzbDrone.Core.Test/DataAugmentationFixture/Scene/SceneMappingProxyFixture.cs diff --git a/NzbDrone.Core.Test/DataAugmentationFixture/Scene/SceneMappingServiceFixture.cs b/src/NzbDrone.Core.Test/DataAugmentationFixture/Scene/SceneMappingServiceFixture.cs similarity index 100% rename from NzbDrone.Core.Test/DataAugmentationFixture/Scene/SceneMappingServiceFixture.cs rename to src/NzbDrone.Core.Test/DataAugmentationFixture/Scene/SceneMappingServiceFixture.cs diff --git a/NzbDrone.Core.Test/Datastore/BasicRepositoryFixture.cs b/src/NzbDrone.Core.Test/Datastore/BasicRepositoryFixture.cs similarity index 100% rename from NzbDrone.Core.Test/Datastore/BasicRepositoryFixture.cs rename to src/NzbDrone.Core.Test/Datastore/BasicRepositoryFixture.cs diff --git a/src/NzbDrone.Core.Test/Datastore/Converters/ProviderSettingConverterFixture.cs b/src/NzbDrone.Core.Test/Datastore/Converters/ProviderSettingConverterFixture.cs new file mode 100644 index 000000000..9aafbee73 --- /dev/null +++ b/src/NzbDrone.Core.Test/Datastore/Converters/ProviderSettingConverterFixture.cs @@ -0,0 +1,39 @@ +using System; +using FluentAssertions; +using Marr.Data.Converters; +using NUnit.Framework; +using NzbDrone.Core.Datastore.Converters; +using NzbDrone.Core.Test.Framework; +using NzbDrone.Core.ThingiProvider; + +namespace NzbDrone.Core.Test.Datastore.Converters +{ + [TestFixture] + public class ProviderSettingConverterFixture : CoreTest + { + [Test] + public void should_return_null_config_if_config_is_null() + { + var result = Subject.FromDB(new ConverterContext() + { + DbValue = DBNull.Value + }); + + + result.Should().Be(NullConfig.Instance); + } + + [TestCase(null)] + [TestCase("")] + public void should_return_null_config_if_config_is_empty(object dbValue) + { + var result = Subject.FromDB(new ConverterContext() + { + DbValue = dbValue + }); + + + result.Should().Be(NullConfig.Instance); + } + } +} \ No newline at end of file diff --git a/NzbDrone.Core.Test/Datastore/DatabaseRelationshipFixture.cs b/src/NzbDrone.Core.Test/Datastore/DatabaseRelationshipFixture.cs similarity index 100% rename from NzbDrone.Core.Test/Datastore/DatabaseRelationshipFixture.cs rename to src/NzbDrone.Core.Test/Datastore/DatabaseRelationshipFixture.cs diff --git a/NzbDrone.Core.Test/Datastore/MappingExtentionFixture.cs b/src/NzbDrone.Core.Test/Datastore/MappingExtentionFixture.cs similarity index 100% rename from NzbDrone.Core.Test/Datastore/MappingExtentionFixture.cs rename to src/NzbDrone.Core.Test/Datastore/MappingExtentionFixture.cs diff --git a/NzbDrone.Core.Test/Datastore/ObjectDatabaseFixture.cs b/src/NzbDrone.Core.Test/Datastore/ObjectDatabaseFixture.cs similarity index 100% rename from NzbDrone.Core.Test/Datastore/ObjectDatabaseFixture.cs rename to src/NzbDrone.Core.Test/Datastore/ObjectDatabaseFixture.cs diff --git a/NzbDrone.Core.Test/Datastore/PagingSpecExtenstionsTests/PagingOffsetFixture.cs b/src/NzbDrone.Core.Test/Datastore/PagingSpecExtenstionsTests/PagingOffsetFixture.cs similarity index 100% rename from NzbDrone.Core.Test/Datastore/PagingSpecExtenstionsTests/PagingOffsetFixture.cs rename to src/NzbDrone.Core.Test/Datastore/PagingSpecExtenstionsTests/PagingOffsetFixture.cs diff --git a/NzbDrone.Core.Test/Datastore/PagingSpecExtenstionsTests/ToSortDirectionFixture.cs b/src/NzbDrone.Core.Test/Datastore/PagingSpecExtenstionsTests/ToSortDirectionFixture.cs similarity index 100% rename from NzbDrone.Core.Test/Datastore/PagingSpecExtenstionsTests/ToSortDirectionFixture.cs rename to src/NzbDrone.Core.Test/Datastore/PagingSpecExtenstionsTests/ToSortDirectionFixture.cs diff --git a/NzbDrone.Core.Test/Datastore/ReflectionStrategyFixture/Benchmarks.cs b/src/NzbDrone.Core.Test/Datastore/ReflectionStrategyFixture/Benchmarks.cs similarity index 100% rename from NzbDrone.Core.Test/Datastore/ReflectionStrategyFixture/Benchmarks.cs rename to src/NzbDrone.Core.Test/Datastore/ReflectionStrategyFixture/Benchmarks.cs diff --git a/NzbDrone.Core.Test/Datastore/SQLiteMigrationHelperTests/AlterFixture.cs b/src/NzbDrone.Core.Test/Datastore/SQLiteMigrationHelperTests/AlterFixture.cs similarity index 100% rename from NzbDrone.Core.Test/Datastore/SQLiteMigrationHelperTests/AlterFixture.cs rename to src/NzbDrone.Core.Test/Datastore/SQLiteMigrationHelperTests/AlterFixture.cs diff --git a/NzbDrone.Core.Test/Datastore/SQLiteMigrationHelperTests/DuplicateFixture.cs b/src/NzbDrone.Core.Test/Datastore/SQLiteMigrationHelperTests/DuplicateFixture.cs similarity index 100% rename from NzbDrone.Core.Test/Datastore/SQLiteMigrationHelperTests/DuplicateFixture.cs rename to src/NzbDrone.Core.Test/Datastore/SQLiteMigrationHelperTests/DuplicateFixture.cs diff --git a/NzbDrone.Core.Test/DecisionEngineTests/AcceptableSizeSpecificationFixture.cs b/src/NzbDrone.Core.Test/DecisionEngineTests/AcceptableSizeSpecificationFixture.cs similarity index 100% rename from NzbDrone.Core.Test/DecisionEngineTests/AcceptableSizeSpecificationFixture.cs rename to src/NzbDrone.Core.Test/DecisionEngineTests/AcceptableSizeSpecificationFixture.cs diff --git a/NzbDrone.Core.Test/DecisionEngineTests/CutoffSpecificationFixture.cs b/src/NzbDrone.Core.Test/DecisionEngineTests/CutoffSpecificationFixture.cs similarity index 100% rename from NzbDrone.Core.Test/DecisionEngineTests/CutoffSpecificationFixture.cs rename to src/NzbDrone.Core.Test/DecisionEngineTests/CutoffSpecificationFixture.cs diff --git a/NzbDrone.Core.Test/DecisionEngineTests/DownloadDecisionMakerFixture.cs b/src/NzbDrone.Core.Test/DecisionEngineTests/DownloadDecisionMakerFixture.cs similarity index 100% rename from NzbDrone.Core.Test/DecisionEngineTests/DownloadDecisionMakerFixture.cs rename to src/NzbDrone.Core.Test/DecisionEngineTests/DownloadDecisionMakerFixture.cs diff --git a/NzbDrone.Core.Test/DecisionEngineTests/LanguageSpecificationFixture.cs b/src/NzbDrone.Core.Test/DecisionEngineTests/LanguageSpecificationFixture.cs similarity index 100% rename from NzbDrone.Core.Test/DecisionEngineTests/LanguageSpecificationFixture.cs rename to src/NzbDrone.Core.Test/DecisionEngineTests/LanguageSpecificationFixture.cs diff --git a/NzbDrone.Core.Test/DecisionEngineTests/MonitoredEpisodeSpecificationFixture.cs b/src/NzbDrone.Core.Test/DecisionEngineTests/MonitoredEpisodeSpecificationFixture.cs similarity index 100% rename from NzbDrone.Core.Test/DecisionEngineTests/MonitoredEpisodeSpecificationFixture.cs rename to src/NzbDrone.Core.Test/DecisionEngineTests/MonitoredEpisodeSpecificationFixture.cs diff --git a/NzbDrone.Core.Test/DecisionEngineTests/NotRestrictedReleaseSpecificationFixture.cs b/src/NzbDrone.Core.Test/DecisionEngineTests/NotRestrictedReleaseSpecificationFixture.cs similarity index 100% rename from NzbDrone.Core.Test/DecisionEngineTests/NotRestrictedReleaseSpecificationFixture.cs rename to src/NzbDrone.Core.Test/DecisionEngineTests/NotRestrictedReleaseSpecificationFixture.cs diff --git a/NzbDrone.Core.Test/DecisionEngineTests/QualityAllowedByProfileSpecificationFixture.cs b/src/NzbDrone.Core.Test/DecisionEngineTests/QualityAllowedByProfileSpecificationFixture.cs similarity index 100% rename from NzbDrone.Core.Test/DecisionEngineTests/QualityAllowedByProfileSpecificationFixture.cs rename to src/NzbDrone.Core.Test/DecisionEngineTests/QualityAllowedByProfileSpecificationFixture.cs diff --git a/NzbDrone.Core.Test/DecisionEngineTests/QualityUpgradeSpecificationFixture.cs b/src/NzbDrone.Core.Test/DecisionEngineTests/QualityUpgradeSpecificationFixture.cs similarity index 100% rename from NzbDrone.Core.Test/DecisionEngineTests/QualityUpgradeSpecificationFixture.cs rename to src/NzbDrone.Core.Test/DecisionEngineTests/QualityUpgradeSpecificationFixture.cs diff --git a/NzbDrone.Core.Test/DecisionEngineTests/RetentionSpecificationFixture.cs b/src/NzbDrone.Core.Test/DecisionEngineTests/RetentionSpecificationFixture.cs similarity index 100% rename from NzbDrone.Core.Test/DecisionEngineTests/RetentionSpecificationFixture.cs rename to src/NzbDrone.Core.Test/DecisionEngineTests/RetentionSpecificationFixture.cs diff --git a/NzbDrone.Core.Test/DecisionEngineTests/RssSync/ProperSpecificationFixture.cs b/src/NzbDrone.Core.Test/DecisionEngineTests/RssSync/ProperSpecificationFixture.cs similarity index 100% rename from NzbDrone.Core.Test/DecisionEngineTests/RssSync/ProperSpecificationFixture.cs rename to src/NzbDrone.Core.Test/DecisionEngineTests/RssSync/ProperSpecificationFixture.cs diff --git a/NzbDrone.Core.Test/DecisionEngineTests/UpgradeDiskSpecificationFixture.cs b/src/NzbDrone.Core.Test/DecisionEngineTests/UpgradeDiskSpecificationFixture.cs similarity index 100% rename from NzbDrone.Core.Test/DecisionEngineTests/UpgradeDiskSpecificationFixture.cs rename to src/NzbDrone.Core.Test/DecisionEngineTests/UpgradeDiskSpecificationFixture.cs diff --git a/NzbDrone.Core.Test/DecisionEngineTests/UpgradeHistorySpecificationFixture.cs b/src/NzbDrone.Core.Test/DecisionEngineTests/UpgradeHistorySpecificationFixture.cs similarity index 100% rename from NzbDrone.Core.Test/DecisionEngineTests/UpgradeHistorySpecificationFixture.cs rename to src/NzbDrone.Core.Test/DecisionEngineTests/UpgradeHistorySpecificationFixture.cs diff --git a/NzbDrone.Core.Test/Download/DownloadApprovedReportsTests/DownloadApprovedFixture.cs b/src/NzbDrone.Core.Test/Download/DownloadApprovedReportsTests/DownloadApprovedFixture.cs similarity index 100% rename from NzbDrone.Core.Test/Download/DownloadApprovedReportsTests/DownloadApprovedFixture.cs rename to src/NzbDrone.Core.Test/Download/DownloadApprovedReportsTests/DownloadApprovedFixture.cs diff --git a/NzbDrone.Core.Test/Download/DownloadApprovedReportsTests/GetQualifiedReportsFixture.cs b/src/NzbDrone.Core.Test/Download/DownloadApprovedReportsTests/GetQualifiedReportsFixture.cs similarity index 100% rename from NzbDrone.Core.Test/Download/DownloadApprovedReportsTests/GetQualifiedReportsFixture.cs rename to src/NzbDrone.Core.Test/Download/DownloadApprovedReportsTests/GetQualifiedReportsFixture.cs diff --git a/NzbDrone.Core.Test/Download/DownloadClientTests/BlackholeProviderFixture.cs b/src/NzbDrone.Core.Test/Download/DownloadClientTests/BlackholeProviderFixture.cs similarity index 100% rename from NzbDrone.Core.Test/Download/DownloadClientTests/BlackholeProviderFixture.cs rename to src/NzbDrone.Core.Test/Download/DownloadClientTests/BlackholeProviderFixture.cs diff --git a/NzbDrone.Core.Test/Download/DownloadClientTests/NzbgetProviderTests/DownloadNzbFixture.cs b/src/NzbDrone.Core.Test/Download/DownloadClientTests/NzbgetProviderTests/DownloadNzbFixture.cs similarity index 100% rename from NzbDrone.Core.Test/Download/DownloadClientTests/NzbgetProviderTests/DownloadNzbFixture.cs rename to src/NzbDrone.Core.Test/Download/DownloadClientTests/NzbgetProviderTests/DownloadNzbFixture.cs diff --git a/NzbDrone.Core.Test/Download/DownloadClientTests/NzbgetProviderTests/QueueFixture.cs b/src/NzbDrone.Core.Test/Download/DownloadClientTests/NzbgetProviderTests/QueueFixture.cs similarity index 100% rename from NzbDrone.Core.Test/Download/DownloadClientTests/NzbgetProviderTests/QueueFixture.cs rename to src/NzbDrone.Core.Test/Download/DownloadClientTests/NzbgetProviderTests/QueueFixture.cs diff --git a/NzbDrone.Core.Test/Download/DownloadClientTests/PneumaticProviderFixture.cs b/src/NzbDrone.Core.Test/Download/DownloadClientTests/PneumaticProviderFixture.cs similarity index 100% rename from NzbDrone.Core.Test/Download/DownloadClientTests/PneumaticProviderFixture.cs rename to src/NzbDrone.Core.Test/Download/DownloadClientTests/PneumaticProviderFixture.cs diff --git a/NzbDrone.Core.Test/Download/DownloadClientTests/SabProviderTests/QueueFixture.cs b/src/NzbDrone.Core.Test/Download/DownloadClientTests/SabProviderTests/QueueFixture.cs similarity index 100% rename from NzbDrone.Core.Test/Download/DownloadClientTests/SabProviderTests/QueueFixture.cs rename to src/NzbDrone.Core.Test/Download/DownloadClientTests/SabProviderTests/QueueFixture.cs diff --git a/NzbDrone.Core.Test/Download/DownloadClientTests/SabProviderTests/SabProviderFixture.cs b/src/NzbDrone.Core.Test/Download/DownloadClientTests/SabProviderTests/SabProviderFixture.cs similarity index 100% rename from NzbDrone.Core.Test/Download/DownloadClientTests/SabProviderTests/SabProviderFixture.cs rename to src/NzbDrone.Core.Test/Download/DownloadClientTests/SabProviderTests/SabProviderFixture.cs diff --git a/NzbDrone.Core.Test/Download/DownloadServiceFixture.cs b/src/NzbDrone.Core.Test/Download/DownloadServiceFixture.cs similarity index 100% rename from NzbDrone.Core.Test/Download/DownloadServiceFixture.cs rename to src/NzbDrone.Core.Test/Download/DownloadServiceFixture.cs diff --git a/NzbDrone.Core.Test/EpisodeParseResultTest.cs b/src/NzbDrone.Core.Test/EpisodeParseResultTest.cs similarity index 100% rename from NzbDrone.Core.Test/EpisodeParseResultTest.cs rename to src/NzbDrone.Core.Test/EpisodeParseResultTest.cs diff --git a/NzbDrone.Core.Test/Files/Categories_json.txt b/src/NzbDrone.Core.Test/Files/Categories_json.txt similarity index 100% rename from NzbDrone.Core.Test/Files/Categories_json.txt rename to src/NzbDrone.Core.Test/Files/Categories_json.txt diff --git a/NzbDrone.Core.Test/Files/History.txt b/src/NzbDrone.Core.Test/Files/History.txt similarity index 100% rename from NzbDrone.Core.Test/Files/History.txt rename to src/NzbDrone.Core.Test/Files/History.txt diff --git a/NzbDrone.Core.Test/Files/HistoryEmpty.txt b/src/NzbDrone.Core.Test/Files/HistoryEmpty.txt similarity index 100% rename from NzbDrone.Core.Test/Files/HistoryEmpty.txt rename to src/NzbDrone.Core.Test/Files/HistoryEmpty.txt diff --git a/NzbDrone.Core.Test/Files/Indexers/Newznab/unauthorized.xml b/src/NzbDrone.Core.Test/Files/Indexers/Newznab/unauthorized.xml similarity index 100% rename from NzbDrone.Core.Test/Files/Indexers/Newznab/unauthorized.xml rename to src/NzbDrone.Core.Test/Files/Indexers/Newznab/unauthorized.xml diff --git a/NzbDrone.Core.Test/Files/JsonError.txt b/src/NzbDrone.Core.Test/Files/JsonError.txt similarity index 100% rename from NzbDrone.Core.Test/Files/JsonError.txt rename to src/NzbDrone.Core.Test/Files/JsonError.txt diff --git a/NzbDrone.Core.Test/Files/LongOverview.txt b/src/NzbDrone.Core.Test/Files/LongOverview.txt similarity index 100% rename from NzbDrone.Core.Test/Files/LongOverview.txt rename to src/NzbDrone.Core.Test/Files/LongOverview.txt diff --git a/NzbDrone.Core.Test/Files/Media/H264_sample.mp4 b/src/NzbDrone.Core.Test/Files/Media/H264_sample.mp4 similarity index 100% rename from NzbDrone.Core.Test/Files/Media/H264_sample.mp4 rename to src/NzbDrone.Core.Test/Files/Media/H264_sample.mp4 diff --git a/NzbDrone.Core.Test/Files/Nzbget/JsonError.txt b/src/NzbDrone.Core.Test/Files/Nzbget/JsonError.txt similarity index 100% rename from NzbDrone.Core.Test/Files/Nzbget/JsonError.txt rename to src/NzbDrone.Core.Test/Files/Nzbget/JsonError.txt diff --git a/NzbDrone.Core.Test/Files/Nzbget/Queue.txt b/src/NzbDrone.Core.Test/Files/Nzbget/Queue.txt similarity index 100% rename from NzbDrone.Core.Test/Files/Nzbget/Queue.txt rename to src/NzbDrone.Core.Test/Files/Nzbget/Queue.txt diff --git a/NzbDrone.Core.Test/Files/Nzbget/Queue_empty.txt b/src/NzbDrone.Core.Test/Files/Nzbget/Queue_empty.txt similarity index 100% rename from NzbDrone.Core.Test/Files/Nzbget/Queue_empty.txt rename to src/NzbDrone.Core.Test/Files/Nzbget/Queue_empty.txt diff --git a/NzbDrone.Core.Test/Files/Queue.txt b/src/NzbDrone.Core.Test/Files/Queue.txt similarity index 100% rename from NzbDrone.Core.Test/Files/Queue.txt rename to src/NzbDrone.Core.Test/Files/Queue.txt diff --git a/NzbDrone.Core.Test/Files/QueueEmpty.txt b/src/NzbDrone.Core.Test/Files/QueueEmpty.txt similarity index 100% rename from NzbDrone.Core.Test/Files/QueueEmpty.txt rename to src/NzbDrone.Core.Test/Files/QueueEmpty.txt diff --git a/NzbDrone.Core.Test/Files/QueueUnknownPriority.txt b/src/NzbDrone.Core.Test/Files/QueueUnknownPriority.txt similarity index 100% rename from NzbDrone.Core.Test/Files/QueueUnknownPriority.txt rename to src/NzbDrone.Core.Test/Files/QueueUnknownPriority.txt diff --git a/NzbDrone.Core.Test/Files/RSS/SizeParsing/newznab.xml b/src/NzbDrone.Core.Test/Files/RSS/SizeParsing/newznab.xml similarity index 100% rename from NzbDrone.Core.Test/Files/RSS/SizeParsing/newznab.xml rename to src/NzbDrone.Core.Test/Files/RSS/SizeParsing/newznab.xml diff --git a/NzbDrone.Core.Test/Files/RSS/SizeParsing/nzbclub.xml b/src/NzbDrone.Core.Test/Files/RSS/SizeParsing/nzbclub.xml similarity index 100% rename from NzbDrone.Core.Test/Files/RSS/SizeParsing/nzbclub.xml rename to src/NzbDrone.Core.Test/Files/RSS/SizeParsing/nzbclub.xml diff --git a/NzbDrone.Core.Test/Files/RSS/SizeParsing/nzbindex.xml b/src/NzbDrone.Core.Test/Files/RSS/SizeParsing/nzbindex.xml similarity index 100% rename from NzbDrone.Core.Test/Files/RSS/SizeParsing/nzbindex.xml rename to src/NzbDrone.Core.Test/Files/RSS/SizeParsing/nzbindex.xml diff --git a/NzbDrone.Core.Test/Files/RSS/SizeParsing/nzbsrus.xml b/src/NzbDrone.Core.Test/Files/RSS/SizeParsing/nzbsrus.xml similarity index 100% rename from NzbDrone.Core.Test/Files/RSS/SizeParsing/nzbsrus.xml rename to src/NzbDrone.Core.Test/Files/RSS/SizeParsing/nzbsrus.xml diff --git a/NzbDrone.Core.Test/Files/RSS/SizeParsing/omgwtfnzbs.xml b/src/NzbDrone.Core.Test/Files/RSS/SizeParsing/omgwtfnzbs.xml similarity index 100% rename from NzbDrone.Core.Test/Files/RSS/SizeParsing/omgwtfnzbs.xml rename to src/NzbDrone.Core.Test/Files/RSS/SizeParsing/omgwtfnzbs.xml diff --git a/NzbDrone.Core.Test/Files/RSS/filesharingtalk.xml b/src/NzbDrone.Core.Test/Files/RSS/filesharingtalk.xml similarity index 100% rename from NzbDrone.Core.Test/Files/RSS/filesharingtalk.xml rename to src/NzbDrone.Core.Test/Files/RSS/filesharingtalk.xml diff --git a/NzbDrone.Core.Test/Files/RSS/newznab.xml b/src/NzbDrone.Core.Test/Files/RSS/newznab.xml similarity index 100% rename from NzbDrone.Core.Test/Files/RSS/newznab.xml rename to src/NzbDrone.Core.Test/Files/RSS/newznab.xml diff --git a/NzbDrone.Core.Test/Files/RSS/nzbclub.xml b/src/NzbDrone.Core.Test/Files/RSS/nzbclub.xml similarity index 100% rename from NzbDrone.Core.Test/Files/RSS/nzbclub.xml rename to src/NzbDrone.Core.Test/Files/RSS/nzbclub.xml diff --git a/NzbDrone.Core.Test/Files/RSS/nzbindex.xml b/src/NzbDrone.Core.Test/Files/RSS/nzbindex.xml similarity index 100% rename from NzbDrone.Core.Test/Files/RSS/nzbindex.xml rename to src/NzbDrone.Core.Test/Files/RSS/nzbindex.xml diff --git a/NzbDrone.Core.Test/Files/RSS/nzbsrus.xml b/src/NzbDrone.Core.Test/Files/RSS/nzbsrus.xml similarity index 100% rename from NzbDrone.Core.Test/Files/RSS/nzbsrus.xml rename to src/NzbDrone.Core.Test/Files/RSS/nzbsrus.xml diff --git a/NzbDrone.Core.Test/Files/RSS/omgwtfnzbs.xml b/src/NzbDrone.Core.Test/Files/RSS/omgwtfnzbs.xml similarity index 100% rename from NzbDrone.Core.Test/Files/RSS/omgwtfnzbs.xml rename to src/NzbDrone.Core.Test/Files/RSS/omgwtfnzbs.xml diff --git a/NzbDrone.Core.Test/Files/RSS/wombles.xml b/src/NzbDrone.Core.Test/Files/RSS/wombles.xml similarity index 100% rename from NzbDrone.Core.Test/Files/RSS/wombles.xml rename to src/NzbDrone.Core.Test/Files/RSS/wombles.xml diff --git a/NzbDrone.Core.Test/Files/SceneMappings.json b/src/NzbDrone.Core.Test/Files/SceneMappings.json similarity index 100% rename from NzbDrone.Core.Test/Files/SceneMappings.json rename to src/NzbDrone.Core.Test/Files/SceneMappings.json diff --git a/NzbDrone.Core.Test/Files/TestArchive.zip b/src/NzbDrone.Core.Test/Files/TestArchive.zip similarity index 100% rename from NzbDrone.Core.Test/Files/TestArchive.zip rename to src/NzbDrone.Core.Test/Files/TestArchive.zip diff --git a/NzbDrone.Core.Test/Files/Xem/Failure.txt b/src/NzbDrone.Core.Test/Files/Xem/Failure.txt similarity index 100% rename from NzbDrone.Core.Test/Files/Xem/Failure.txt rename to src/NzbDrone.Core.Test/Files/Xem/Failure.txt diff --git a/NzbDrone.Core.Test/Files/Xem/Ids.txt b/src/NzbDrone.Core.Test/Files/Xem/Ids.txt similarity index 100% rename from NzbDrone.Core.Test/Files/Xem/Ids.txt rename to src/NzbDrone.Core.Test/Files/Xem/Ids.txt diff --git a/NzbDrone.Core.Test/Files/Xem/Mappings.txt b/src/NzbDrone.Core.Test/Files/Xem/Mappings.txt similarity index 100% rename from NzbDrone.Core.Test/Files/Xem/Mappings.txt rename to src/NzbDrone.Core.Test/Files/Xem/Mappings.txt diff --git a/NzbDrone.Core.Test/Files/Xem/Names.txt b/src/NzbDrone.Core.Test/Files/Xem/Names.txt similarity index 100% rename from NzbDrone.Core.Test/Files/Xem/Names.txt rename to src/NzbDrone.Core.Test/Files/Xem/Names.txt diff --git a/NzbDrone.Core.Test/FluentTest.cs b/src/NzbDrone.Core.Test/FluentTest.cs similarity index 100% rename from NzbDrone.Core.Test/FluentTest.cs rename to src/NzbDrone.Core.Test/FluentTest.cs diff --git a/NzbDrone.Core.Test/Framework/CoreTest.cs b/src/NzbDrone.Core.Test/Framework/CoreTest.cs similarity index 100% rename from NzbDrone.Core.Test/Framework/CoreTest.cs rename to src/NzbDrone.Core.Test/Framework/CoreTest.cs diff --git a/NzbDrone.Core.Test/Framework/DbTest.cs b/src/NzbDrone.Core.Test/Framework/DbTest.cs similarity index 100% rename from NzbDrone.Core.Test/Framework/DbTest.cs rename to src/NzbDrone.Core.Test/Framework/DbTest.cs diff --git a/NzbDrone.Core.Test/Framework/NBuilderExtensions.cs b/src/NzbDrone.Core.Test/Framework/NBuilderExtensions.cs similarity index 100% rename from NzbDrone.Core.Test/Framework/NBuilderExtensions.cs rename to src/NzbDrone.Core.Test/Framework/NBuilderExtensions.cs diff --git a/NzbDrone.Core.Test/Framework/TestBaseTests.cs b/src/NzbDrone.Core.Test/Framework/TestBaseTests.cs similarity index 100% rename from NzbDrone.Core.Test/Framework/TestBaseTests.cs rename to src/NzbDrone.Core.Test/Framework/TestBaseTests.cs diff --git a/NzbDrone.Core.Test/Framework/TestDbHelper.cs b/src/NzbDrone.Core.Test/Framework/TestDbHelper.cs similarity index 100% rename from NzbDrone.Core.Test/Framework/TestDbHelper.cs rename to src/NzbDrone.Core.Test/Framework/TestDbHelper.cs diff --git a/NzbDrone.Core.Test/HistoryTests/HistoryRepositoryFixture.cs b/src/NzbDrone.Core.Test/HistoryTests/HistoryRepositoryFixture.cs similarity index 100% rename from NzbDrone.Core.Test/HistoryTests/HistoryRepositoryFixture.cs rename to src/NzbDrone.Core.Test/HistoryTests/HistoryRepositoryFixture.cs diff --git a/NzbDrone.Core.Test/Housekeeping/Housekeepers/CleanupOrphanedEpisodesFixture.cs b/src/NzbDrone.Core.Test/Housekeeping/Housekeepers/CleanupOrphanedEpisodesFixture.cs similarity index 100% rename from NzbDrone.Core.Test/Housekeeping/Housekeepers/CleanupOrphanedEpisodesFixture.cs rename to src/NzbDrone.Core.Test/Housekeeping/Housekeepers/CleanupOrphanedEpisodesFixture.cs diff --git a/NzbDrone.Core.Test/Housekeeping/Housekeepers/CleanupOrphanedHistoryItemsFixture.cs b/src/NzbDrone.Core.Test/Housekeeping/Housekeepers/CleanupOrphanedHistoryItemsFixture.cs similarity index 100% rename from NzbDrone.Core.Test/Housekeeping/Housekeepers/CleanupOrphanedHistoryItemsFixture.cs rename to src/NzbDrone.Core.Test/Housekeeping/Housekeepers/CleanupOrphanedHistoryItemsFixture.cs diff --git a/NzbDrone.Core.Test/IndexerSearchTests/FetchAndParseRssServiceFixture.cs b/src/NzbDrone.Core.Test/IndexerSearchTests/FetchAndParseRssServiceFixture.cs similarity index 100% rename from NzbDrone.Core.Test/IndexerSearchTests/FetchAndParseRssServiceFixture.cs rename to src/NzbDrone.Core.Test/IndexerSearchTests/FetchAndParseRssServiceFixture.cs diff --git a/NzbDrone.Core.Test/IndexerSearchTests/SearchDefinitionFixture.cs b/src/NzbDrone.Core.Test/IndexerSearchTests/SearchDefinitionFixture.cs similarity index 100% rename from NzbDrone.Core.Test/IndexerSearchTests/SearchDefinitionFixture.cs rename to src/NzbDrone.Core.Test/IndexerSearchTests/SearchDefinitionFixture.cs diff --git a/NzbDrone.Core.Test/IndexerTests/BasicRssParserFixture.cs b/src/NzbDrone.Core.Test/IndexerTests/BasicRssParserFixture.cs similarity index 100% rename from NzbDrone.Core.Test/IndexerTests/BasicRssParserFixture.cs rename to src/NzbDrone.Core.Test/IndexerTests/BasicRssParserFixture.cs diff --git a/NzbDrone.Core.Test/IndexerTests/FetchAndParseRssServiceFixture.cs b/src/NzbDrone.Core.Test/IndexerTests/FetchAndParseRssServiceFixture.cs similarity index 100% rename from NzbDrone.Core.Test/IndexerTests/FetchAndParseRssServiceFixture.cs rename to src/NzbDrone.Core.Test/IndexerTests/FetchAndParseRssServiceFixture.cs diff --git a/NzbDrone.Core.Test/IndexerTests/IndexerServiceFixture.cs b/src/NzbDrone.Core.Test/IndexerTests/IndexerServiceFixture.cs similarity index 92% rename from NzbDrone.Core.Test/IndexerTests/IndexerServiceFixture.cs rename to src/NzbDrone.Core.Test/IndexerTests/IndexerServiceFixture.cs index 2de52fb5f..bbfb8404a 100644 --- a/NzbDrone.Core.Test/IndexerTests/IndexerServiceFixture.cs +++ b/src/NzbDrone.Core.Test/IndexerTests/IndexerServiceFixture.cs @@ -13,7 +13,7 @@ using NzbDrone.Core.Test.Framework; namespace NzbDrone.Core.Test.IndexerTests { - public class IndexerServiceFixture : DbTest + public class IndexerServiceFixture : DbTest { private List _indexers; @@ -57,10 +57,8 @@ namespace NzbDrone.Core.Test.IndexerTests var indexers = Subject.All().ToList(); indexers.Should().NotBeEmpty(); indexers.Should().NotContain(c => c.Settings == null); - indexers.Should().NotContain(c => c.Instance == null); indexers.Should().NotContain(c => c.Name == null); indexers.Select(c => c.Name).Should().OnlyHaveUniqueItems(); - indexers.Select(c => c.Instance).Should().OnlyHaveUniqueItems(); } @@ -73,6 +71,7 @@ namespace NzbDrone.Core.Test.IndexerTests var existingIndexers = Builder.CreateNew().BuildNew(); + existingIndexers.ConfigContract = typeof (NewznabSettings).Name; repo.Insert(existingIndexers); diff --git a/NzbDrone.Core.Test/IndexerTests/IntegrationTests/IndexerIntegrationTests.cs b/src/NzbDrone.Core.Test/IndexerTests/IntegrationTests/IndexerIntegrationTests.cs similarity index 79% rename from NzbDrone.Core.Test/IndexerTests/IntegrationTests/IndexerIntegrationTests.cs rename to src/NzbDrone.Core.Test/IndexerTests/IntegrationTests/IndexerIntegrationTests.cs index 1be142824..28dc053e4 100644 --- a/NzbDrone.Core.Test/IndexerTests/IntegrationTests/IndexerIntegrationTests.cs +++ b/src/NzbDrone.Core.Test/IndexerTests/IntegrationTests/IndexerIntegrationTests.cs @@ -7,6 +7,7 @@ using NzbDrone.Core.Indexers.Wombles; using NzbDrone.Core.Parser.Model; using NzbDrone.Core.Test.Framework; using NUnit.Framework; +using NzbDrone.Core.ThingiProvider; using NzbDrone.Test.Common.Categories; using System.Linq; @@ -27,6 +28,12 @@ namespace NzbDrone.Core.Test.IndexerTests.IntegrationTests { var indexer = new Wombles(); + indexer.Definition = new IndexerDefinition + { + Name = "Wombles", + Settings = NullConfig.Instance + }; + var result = Subject.FetchRss(indexer); ValidateResult(result, skipSize: true, skipInfo: true); @@ -37,6 +44,11 @@ namespace NzbDrone.Core.Test.IndexerTests.IntegrationTests public void extv_rss() { var indexer = new Eztv(); + indexer.Definition = new IndexerDefinition + { + Name = "Eztv", + Settings = NullConfig.Instance + }; var result = Subject.FetchRss(indexer); @@ -48,14 +60,14 @@ namespace NzbDrone.Core.Test.IndexerTests.IntegrationTests public void nzbsorg_rss() { var indexer = new Newznab(); - indexer.Settings = new NewznabSettings - { - ApiKey = "64d61d3cfd4b75e51d01cbc7c6a78275", - Url = "http://nzbs.org" - }; - indexer.InstanceDefinition = new IndexerDefinition(); - indexer.InstanceDefinition.Name = "nzbs.org"; + indexer.Definition = new IndexerDefinition(); + indexer.Definition.Name = "nzbs.org"; + indexer.Definition.Settings = new NewznabSettings + { + ApiKey = "64d61d3cfd4b75e51d01cbc7c6a78275", + Url = "http://nzbs.org" + }; var result = Subject.FetchRss(indexer); diff --git a/NzbDrone.Core.Test/IndexerTests/XElementExtensionsFixture.cs b/src/NzbDrone.Core.Test/IndexerTests/XElementExtensionsFixture.cs similarity index 100% rename from NzbDrone.Core.Test/IndexerTests/XElementExtensionsFixture.cs rename to src/NzbDrone.Core.Test/IndexerTests/XElementExtensionsFixture.cs diff --git a/NzbDrone.Core.Test/InstrumentationTests/DatabaseTargetFixture.cs b/src/NzbDrone.Core.Test/InstrumentationTests/DatabaseTargetFixture.cs similarity index 100% rename from NzbDrone.Core.Test/InstrumentationTests/DatabaseTargetFixture.cs rename to src/NzbDrone.Core.Test/InstrumentationTests/DatabaseTargetFixture.cs diff --git a/NzbDrone.Core.Test/JobTests/JobRepositoryFixture.cs b/src/NzbDrone.Core.Test/JobTests/JobRepositoryFixture.cs similarity index 100% rename from NzbDrone.Core.Test/JobTests/JobRepositoryFixture.cs rename to src/NzbDrone.Core.Test/JobTests/JobRepositoryFixture.cs diff --git a/NzbDrone.Core.Test/JobTests/TestJobs.cs b/src/NzbDrone.Core.Test/JobTests/TestJobs.cs similarity index 100% rename from NzbDrone.Core.Test/JobTests/TestJobs.cs rename to src/NzbDrone.Core.Test/JobTests/TestJobs.cs diff --git a/NzbDrone.Core.Test/MediaCoverTests/CoverExistsSpecificationFixture.cs b/src/NzbDrone.Core.Test/MediaCoverTests/CoverExistsSpecificationFixture.cs similarity index 96% rename from NzbDrone.Core.Test/MediaCoverTests/CoverExistsSpecificationFixture.cs rename to src/NzbDrone.Core.Test/MediaCoverTests/CoverExistsSpecificationFixture.cs index 0667832f4..b720e5516 100644 --- a/NzbDrone.Core.Test/MediaCoverTests/CoverExistsSpecificationFixture.cs +++ b/src/NzbDrone.Core.Test/MediaCoverTests/CoverExistsSpecificationFixture.cs @@ -1,75 +1,75 @@ -using System.Collections.Generic; -using FluentAssertions; -using Moq; -using NUnit.Framework; -using NzbDrone.Common; -using NzbDrone.Core.MediaCover; -using NzbDrone.Core.Test.Framework; -using NzbDrone.Test.Common; - -namespace NzbDrone.Core.Test.MediaCoverTests -{ - [TestFixture] - public class CoverAlreadyExistsSpecificationFixture : CoreTest - { - private Dictionary _headers; - - [SetUp] - public void Setup() - { - _headers = new Dictionary(); - Mocker.GetMock().Setup(c => c.GetFileSize(It.IsAny())).Returns(100); - Mocker.GetMock().Setup(c => c.GetHeader(It.IsAny())).Returns(_headers); - - } - - - private void GivenFileExistsOnDisk() - { - Mocker.GetMock().Setup(c => c.FileExists(It.IsAny())).Returns(true); - } - - - private void GivenExistingFileSize(long bytes) - { - GivenFileExistsOnDisk(); - Mocker.GetMock().Setup(c => c.GetFileSize(It.IsAny())).Returns(bytes); - - } - - - [Test] - public void should_return_false_if_file_not_exists() - { - Subject.AlreadyExists("http://url", "c:\\file.exe").Should().BeFalse(); - } - - [Test] - public void should_return_false_if_file_exists_but_diffrent_size() - { - GivenExistingFileSize(100); - _headers.Add(HttpProvider.CONTENT_LENGTH_HEADER, "200"); - - Subject.AlreadyExists("http://url", "c:\\file.exe").Should().BeFalse(); - } - - - [Test] - public void should_return_ture_if_file_exists_and_same_size() - { - GivenExistingFileSize(100); - _headers.Add(HttpProvider.CONTENT_LENGTH_HEADER, "100"); - - Subject.AlreadyExists("http://url", "c:\\file.exe").Should().BeTrue(); - } - - [Test] - public void should_return_true_if_there_is_no_size_header_and_file_exist() - { - GivenExistingFileSize(100); - Subject.AlreadyExists("http://url", "c:\\file.exe").Should().BeFalse(); - - ExceptionVerification.ExpectedWarns(1); - } - } +using System.Collections.Generic; +using FluentAssertions; +using Moq; +using NUnit.Framework; +using NzbDrone.Common; +using NzbDrone.Core.MediaCover; +using NzbDrone.Core.Test.Framework; +using NzbDrone.Test.Common; + +namespace NzbDrone.Core.Test.MediaCoverTests +{ + [TestFixture] + public class CoverAlreadyExistsSpecificationFixture : CoreTest + { + private Dictionary _headers; + + [SetUp] + public void Setup() + { + _headers = new Dictionary(); + Mocker.GetMock().Setup(c => c.GetFileSize(It.IsAny())).Returns(100); + Mocker.GetMock().Setup(c => c.GetHeader(It.IsAny())).Returns(_headers); + + } + + + private void GivenFileExistsOnDisk() + { + Mocker.GetMock().Setup(c => c.FileExists(It.IsAny())).Returns(true); + } + + + private void GivenExistingFileSize(long bytes) + { + GivenFileExistsOnDisk(); + Mocker.GetMock().Setup(c => c.GetFileSize(It.IsAny())).Returns(bytes); + + } + + + [Test] + public void should_return_false_if_file_not_exists() + { + Subject.AlreadyExists("http://url", "c:\\file.exe").Should().BeFalse(); + } + + [Test] + public void should_return_false_if_file_exists_but_diffrent_size() + { + GivenExistingFileSize(100); + _headers.Add(HttpProvider.CONTENT_LENGTH_HEADER, "200"); + + Subject.AlreadyExists("http://url", "c:\\file.exe").Should().BeFalse(); + } + + + [Test] + public void should_return_ture_if_file_exists_and_same_size() + { + GivenExistingFileSize(100); + _headers.Add(HttpProvider.CONTENT_LENGTH_HEADER, "100"); + + Subject.AlreadyExists("http://url", "c:\\file.exe").Should().BeTrue(); + } + + [Test] + public void should_return_true_if_there_is_no_size_header_and_file_exist() + { + GivenExistingFileSize(100); + Subject.AlreadyExists("http://url", "c:\\file.exe").Should().BeFalse(); + + ExceptionVerification.ExpectedWarns(1); + } + } } \ No newline at end of file diff --git a/NzbDrone.Core.Test/MediaCoverTests/MediaCoverServiceFixture.cs b/src/NzbDrone.Core.Test/MediaCoverTests/MediaCoverServiceFixture.cs similarity index 100% rename from NzbDrone.Core.Test/MediaCoverTests/MediaCoverServiceFixture.cs rename to src/NzbDrone.Core.Test/MediaCoverTests/MediaCoverServiceFixture.cs diff --git a/NzbDrone.Core.Test/MediaFiles/DownloadedEpisodesImportServiceFixture.cs b/src/NzbDrone.Core.Test/MediaFiles/DownloadedEpisodesImportServiceFixture.cs similarity index 100% rename from NzbDrone.Core.Test/MediaFiles/DownloadedEpisodesImportServiceFixture.cs rename to src/NzbDrone.Core.Test/MediaFiles/DownloadedEpisodesImportServiceFixture.cs diff --git a/NzbDrone.Core.Test/MediaFiles/EpisodeImport/ImportDecisionMakerFixture.cs b/src/NzbDrone.Core.Test/MediaFiles/EpisodeImport/ImportDecisionMakerFixture.cs similarity index 100% rename from NzbDrone.Core.Test/MediaFiles/EpisodeImport/ImportDecisionMakerFixture.cs rename to src/NzbDrone.Core.Test/MediaFiles/EpisodeImport/ImportDecisionMakerFixture.cs diff --git a/NzbDrone.Core.Test/MediaFiles/EpisodeImport/Specifications/FreeSpaceSpecificationFixture.cs b/src/NzbDrone.Core.Test/MediaFiles/EpisodeImport/Specifications/FreeSpaceSpecificationFixture.cs similarity index 100% rename from NzbDrone.Core.Test/MediaFiles/EpisodeImport/Specifications/FreeSpaceSpecificationFixture.cs rename to src/NzbDrone.Core.Test/MediaFiles/EpisodeImport/Specifications/FreeSpaceSpecificationFixture.cs diff --git a/NzbDrone.Core.Test/MediaFiles/EpisodeImport/Specifications/NotInUseSpecificationFixture.cs b/src/NzbDrone.Core.Test/MediaFiles/EpisodeImport/Specifications/NotInUseSpecificationFixture.cs similarity index 100% rename from NzbDrone.Core.Test/MediaFiles/EpisodeImport/Specifications/NotInUseSpecificationFixture.cs rename to src/NzbDrone.Core.Test/MediaFiles/EpisodeImport/Specifications/NotInUseSpecificationFixture.cs diff --git a/NzbDrone.Core.Test/MediaFiles/EpisodeImport/Specifications/NotSampleSpecificationFixture.cs b/src/NzbDrone.Core.Test/MediaFiles/EpisodeImport/Specifications/NotSampleSpecificationFixture.cs similarity index 100% rename from NzbDrone.Core.Test/MediaFiles/EpisodeImport/Specifications/NotSampleSpecificationFixture.cs rename to src/NzbDrone.Core.Test/MediaFiles/EpisodeImport/Specifications/NotSampleSpecificationFixture.cs diff --git a/NzbDrone.Core.Test/MediaFiles/EpisodeImport/Specifications/NotUnpackingSpecificationFixture.cs b/src/NzbDrone.Core.Test/MediaFiles/EpisodeImport/Specifications/NotUnpackingSpecificationFixture.cs similarity index 100% rename from NzbDrone.Core.Test/MediaFiles/EpisodeImport/Specifications/NotUnpackingSpecificationFixture.cs rename to src/NzbDrone.Core.Test/MediaFiles/EpisodeImport/Specifications/NotUnpackingSpecificationFixture.cs diff --git a/NzbDrone.Core.Test/MediaFiles/EpisodeImport/Specifications/UpgradeSpecificationFixture.cs b/src/NzbDrone.Core.Test/MediaFiles/EpisodeImport/Specifications/UpgradeSpecificationFixture.cs similarity index 100% rename from NzbDrone.Core.Test/MediaFiles/EpisodeImport/Specifications/UpgradeSpecificationFixture.cs rename to src/NzbDrone.Core.Test/MediaFiles/EpisodeImport/Specifications/UpgradeSpecificationFixture.cs diff --git a/NzbDrone.Core.Test/MediaFiles/ImportApprovedEpisodesFixture.cs b/src/NzbDrone.Core.Test/MediaFiles/ImportApprovedEpisodesFixture.cs similarity index 100% rename from NzbDrone.Core.Test/MediaFiles/ImportApprovedEpisodesFixture.cs rename to src/NzbDrone.Core.Test/MediaFiles/ImportApprovedEpisodesFixture.cs diff --git a/NzbDrone.Core.Test/MediaFiles/MediaFileRepositoryFixture.cs b/src/NzbDrone.Core.Test/MediaFiles/MediaFileRepositoryFixture.cs similarity index 100% rename from NzbDrone.Core.Test/MediaFiles/MediaFileRepositoryFixture.cs rename to src/NzbDrone.Core.Test/MediaFiles/MediaFileRepositoryFixture.cs diff --git a/NzbDrone.Core.Test/MediaFiles/MediaFileServiceTest.cs b/src/NzbDrone.Core.Test/MediaFiles/MediaFileServiceTest.cs similarity index 100% rename from NzbDrone.Core.Test/MediaFiles/MediaFileServiceTest.cs rename to src/NzbDrone.Core.Test/MediaFiles/MediaFileServiceTest.cs diff --git a/NzbDrone.Core.Test/MediaFiles/MediaFileTableCleanupServiceFixture.cs b/src/NzbDrone.Core.Test/MediaFiles/MediaFileTableCleanupServiceFixture.cs similarity index 100% rename from NzbDrone.Core.Test/MediaFiles/MediaFileTableCleanupServiceFixture.cs rename to src/NzbDrone.Core.Test/MediaFiles/MediaFileTableCleanupServiceFixture.cs diff --git a/NzbDrone.Core.Test/MediaFiles/MediaInfo/VideoFileInfoReaderFixture.cs b/src/NzbDrone.Core.Test/MediaFiles/MediaInfo/VideoFileInfoReaderFixture.cs similarity index 100% rename from NzbDrone.Core.Test/MediaFiles/MediaInfo/VideoFileInfoReaderFixture.cs rename to src/NzbDrone.Core.Test/MediaFiles/MediaInfo/VideoFileInfoReaderFixture.cs diff --git a/NzbDrone.Core.Test/MediaFiles/RenameEpisodeFileServiceFixture.cs b/src/NzbDrone.Core.Test/MediaFiles/RenameEpisodeFileServiceFixture.cs similarity index 100% rename from NzbDrone.Core.Test/MediaFiles/RenameEpisodeFileServiceFixture.cs rename to src/NzbDrone.Core.Test/MediaFiles/RenameEpisodeFileServiceFixture.cs diff --git a/NzbDrone.Core.Test/MediaFiles/UpgradeMediaFileServiceFixture.cs b/src/NzbDrone.Core.Test/MediaFiles/UpgradeMediaFileServiceFixture.cs similarity index 100% rename from NzbDrone.Core.Test/MediaFiles/UpgradeMediaFileServiceFixture.cs rename to src/NzbDrone.Core.Test/MediaFiles/UpgradeMediaFileServiceFixture.cs diff --git a/NzbDrone.Core.Test/Messaging/Commands/CommandEqualityComparerFixture.cs b/src/NzbDrone.Core.Test/Messaging/Commands/CommandEqualityComparerFixture.cs similarity index 72% rename from NzbDrone.Core.Test/Messaging/Commands/CommandEqualityComparerFixture.cs rename to src/NzbDrone.Core.Test/Messaging/Commands/CommandEqualityComparerFixture.cs index 34d4b1d30..56bfd1b2a 100644 --- a/NzbDrone.Core.Test/Messaging/Commands/CommandEqualityComparerFixture.cs +++ b/src/NzbDrone.Core.Test/Messaging/Commands/CommandEqualityComparerFixture.cs @@ -1,4 +1,5 @@ -using FluentAssertions; +using System.Collections.Generic; +using FluentAssertions; using NUnit.Framework; using NzbDrone.Core.Indexers; using NzbDrone.Core.IndexerSearch; @@ -24,8 +25,8 @@ namespace NzbDrone.Core.Test.Messaging.Commands [Test] public void should_return_true_when_single_property_matches() { - var command1 = new EpisodeSearchCommand { EpisodeId = 1 }; - var command2 = new EpisodeSearchCommand { EpisodeId = 1 }; + var command1 = new EpisodeSearchCommand { EpisodeIds = new List{ 1 } }; + var command2 = new EpisodeSearchCommand { EpisodeIds = new List { 1 } }; CommandEqualityComparer.Instance.Equals(command1, command2).Should().BeTrue(); } @@ -42,8 +43,8 @@ namespace NzbDrone.Core.Test.Messaging.Commands [Test] public void should_return_false_when_single_property_doesnt_match() { - var command1 = new EpisodeSearchCommand { EpisodeId = 1 }; - var command2 = new EpisodeSearchCommand { EpisodeId = 2 }; + var command1 = new EpisodeSearchCommand { EpisodeIds = new List { 1 } }; + var command2 = new EpisodeSearchCommand { EpisodeIds = new List { 2 } }; CommandEqualityComparer.Instance.Equals(command1, command2).Should().BeFalse(); } @@ -75,7 +76,6 @@ namespace NzbDrone.Core.Test.Messaging.Commands CommandEqualityComparer.Instance.Equals(command1, command2).Should().BeFalse(); } - [Test] public void should_return_false_when_only_one_has_null_property() { @@ -85,13 +85,28 @@ namespace NzbDrone.Core.Test.Messaging.Commands CommandEqualityComparer.Instance.Equals(command1, command2).Should().BeFalse(); } - [Test] public void should_return_false_when_commands_are_diffrent_types() { CommandEqualityComparer.Instance.Equals(new RssSyncCommand(), new ApplicationUpdateCommand()).Should().BeFalse(); } - + [Test] + public void should_return_false_when_commands_list_are_different_lengths() + { + var command1 = new EpisodeSearchCommand { EpisodeIds = new List { 1 } }; + var command2 = new EpisodeSearchCommand { EpisodeIds = new List { 1, 2 } }; + + CommandEqualityComparer.Instance.Equals(command1, command2).Should().BeFalse(); + } + + [Test] + public void should_return_false_when_commands_list_dont_match() + { + var command1 = new EpisodeSearchCommand { EpisodeIds = new List { 1 } }; + var command2 = new EpisodeSearchCommand { EpisodeIds = new List { 2 } }; + + CommandEqualityComparer.Instance.Equals(command1, command2).Should().BeFalse(); + } } } diff --git a/NzbDrone.Core.Test/Messaging/Commands/CommandExecutorFixture.cs b/src/NzbDrone.Core.Test/Messaging/Commands/CommandExecutorFixture.cs similarity index 100% rename from NzbDrone.Core.Test/Messaging/Commands/CommandExecutorFixture.cs rename to src/NzbDrone.Core.Test/Messaging/Commands/CommandExecutorFixture.cs diff --git a/NzbDrone.Core.Test/Messaging/Commands/CommandFixture.cs b/src/NzbDrone.Core.Test/Messaging/Commands/CommandFixture.cs similarity index 100% rename from NzbDrone.Core.Test/Messaging/Commands/CommandFixture.cs rename to src/NzbDrone.Core.Test/Messaging/Commands/CommandFixture.cs diff --git a/NzbDrone.Core.Test/Messaging/Events/EventAggregatorFixture.cs b/src/NzbDrone.Core.Test/Messaging/Events/EventAggregatorFixture.cs similarity index 100% rename from NzbDrone.Core.Test/Messaging/Events/EventAggregatorFixture.cs rename to src/NzbDrone.Core.Test/Messaging/Events/EventAggregatorFixture.cs diff --git a/NzbDrone.Core.Test/MetadataSourceTests/TraktProxyFixture.cs b/src/NzbDrone.Core.Test/MetadataSourceTests/TraktProxyFixture.cs similarity index 100% rename from NzbDrone.Core.Test/MetadataSourceTests/TraktProxyFixture.cs rename to src/NzbDrone.Core.Test/MetadataSourceTests/TraktProxyFixture.cs diff --git a/NzbDrone.Core.Test/NotificationTests/GrowlProviderTest.cs b/src/NzbDrone.Core.Test/NotificationTests/GrowlProviderTest.cs similarity index 100% rename from NzbDrone.Core.Test/NotificationTests/GrowlProviderTest.cs rename to src/NzbDrone.Core.Test/NotificationTests/GrowlProviderTest.cs diff --git a/NzbDrone.Core.Test/NotificationTests/NotificationServiceFixture.cs b/src/NzbDrone.Core.Test/NotificationTests/NotificationServiceFixture.cs similarity index 100% rename from NzbDrone.Core.Test/NotificationTests/NotificationServiceFixture.cs rename to src/NzbDrone.Core.Test/NotificationTests/NotificationServiceFixture.cs diff --git a/NzbDrone.Core.Test/NotificationTests/PlexProviderTest.cs b/src/NzbDrone.Core.Test/NotificationTests/PlexProviderTest.cs similarity index 100% rename from NzbDrone.Core.Test/NotificationTests/PlexProviderTest.cs rename to src/NzbDrone.Core.Test/NotificationTests/PlexProviderTest.cs diff --git a/NzbDrone.Core.Test/NotificationTests/ProwlProviderTest.cs b/src/NzbDrone.Core.Test/NotificationTests/ProwlProviderTest.cs similarity index 100% rename from NzbDrone.Core.Test/NotificationTests/ProwlProviderTest.cs rename to src/NzbDrone.Core.Test/NotificationTests/ProwlProviderTest.cs diff --git a/NzbDrone.Core.Test/NotificationTests/Xbmc/GetJsonVersionFixture.cs b/src/NzbDrone.Core.Test/NotificationTests/Xbmc/GetJsonVersionFixture.cs similarity index 100% rename from NzbDrone.Core.Test/NotificationTests/Xbmc/GetJsonVersionFixture.cs rename to src/NzbDrone.Core.Test/NotificationTests/Xbmc/GetJsonVersionFixture.cs diff --git a/NzbDrone.Core.Test/NotificationTests/Xbmc/Http/ActivePlayersFixture.cs b/src/NzbDrone.Core.Test/NotificationTests/Xbmc/Http/ActivePlayersFixture.cs similarity index 100% rename from NzbDrone.Core.Test/NotificationTests/Xbmc/Http/ActivePlayersFixture.cs rename to src/NzbDrone.Core.Test/NotificationTests/Xbmc/Http/ActivePlayersFixture.cs diff --git a/NzbDrone.Core.Test/NotificationTests/Xbmc/Http/CheckForErrorFixture.cs b/src/NzbDrone.Core.Test/NotificationTests/Xbmc/Http/CheckForErrorFixture.cs similarity index 100% rename from NzbDrone.Core.Test/NotificationTests/Xbmc/Http/CheckForErrorFixture.cs rename to src/NzbDrone.Core.Test/NotificationTests/Xbmc/Http/CheckForErrorFixture.cs diff --git a/NzbDrone.Core.Test/NotificationTests/Xbmc/Http/GetSeriesPathFixture.cs b/src/NzbDrone.Core.Test/NotificationTests/Xbmc/Http/GetSeriesPathFixture.cs similarity index 100% rename from NzbDrone.Core.Test/NotificationTests/Xbmc/Http/GetSeriesPathFixture.cs rename to src/NzbDrone.Core.Test/NotificationTests/Xbmc/Http/GetSeriesPathFixture.cs diff --git a/NzbDrone.Core.Test/NotificationTests/Xbmc/Http/UpdateFixture.cs b/src/NzbDrone.Core.Test/NotificationTests/Xbmc/Http/UpdateFixture.cs similarity index 100% rename from NzbDrone.Core.Test/NotificationTests/Xbmc/Http/UpdateFixture.cs rename to src/NzbDrone.Core.Test/NotificationTests/Xbmc/Http/UpdateFixture.cs diff --git a/NzbDrone.Core.Test/NotificationTests/Xbmc/Json/ActivePlayersFixture.cs b/src/NzbDrone.Core.Test/NotificationTests/Xbmc/Json/ActivePlayersFixture.cs similarity index 100% rename from NzbDrone.Core.Test/NotificationTests/Xbmc/Json/ActivePlayersFixture.cs rename to src/NzbDrone.Core.Test/NotificationTests/Xbmc/Json/ActivePlayersFixture.cs diff --git a/NzbDrone.Core.Test/NotificationTests/Xbmc/Json/CheckForErrorFixture.cs b/src/NzbDrone.Core.Test/NotificationTests/Xbmc/Json/CheckForErrorFixture.cs similarity index 100% rename from NzbDrone.Core.Test/NotificationTests/Xbmc/Json/CheckForErrorFixture.cs rename to src/NzbDrone.Core.Test/NotificationTests/Xbmc/Json/CheckForErrorFixture.cs diff --git a/NzbDrone.Core.Test/NotificationTests/Xbmc/Json/GetSeriesPathFixture.cs b/src/NzbDrone.Core.Test/NotificationTests/Xbmc/Json/GetSeriesPathFixture.cs similarity index 100% rename from NzbDrone.Core.Test/NotificationTests/Xbmc/Json/GetSeriesPathFixture.cs rename to src/NzbDrone.Core.Test/NotificationTests/Xbmc/Json/GetSeriesPathFixture.cs diff --git a/NzbDrone.Core.Test/NotificationTests/Xbmc/Json/UpdateFixture.cs b/src/NzbDrone.Core.Test/NotificationTests/Xbmc/Json/UpdateFixture.cs similarity index 100% rename from NzbDrone.Core.Test/NotificationTests/Xbmc/Json/UpdateFixture.cs rename to src/NzbDrone.Core.Test/NotificationTests/Xbmc/Json/UpdateFixture.cs diff --git a/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj b/src/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj similarity index 98% rename from NzbDrone.Core.Test/NzbDrone.Core.Test.csproj rename to src/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj index 58b09e81e..cbe2b0f67 100644 --- a/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj +++ b/src/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj @@ -102,6 +102,7 @@ + @@ -181,6 +182,8 @@ + + @@ -249,9 +252,6 @@ sqlite3.dll Always - - Always - Always diff --git a/NzbDrone.Core.Test/OrganizerTests/BuildFilePathFixture.cs b/src/NzbDrone.Core.Test/OrganizerTests/BuildFilePathFixture.cs similarity index 88% rename from NzbDrone.Core.Test/OrganizerTests/BuildFilePathFixture.cs rename to src/NzbDrone.Core.Test/OrganizerTests/BuildFilePathFixture.cs index 40c7e43c2..628bca46f 100644 --- a/NzbDrone.Core.Test/OrganizerTests/BuildFilePathFixture.cs +++ b/src/NzbDrone.Core.Test/OrganizerTests/BuildFilePathFixture.cs @@ -31,6 +31,7 @@ namespace NzbDrone.Core.Test.OrganizerTests [TestCase("30 Rock - S01E05 - Episode Title", 1, false, "Season %0s", @"C:\Test\30 Rock\30 Rock - S01E05 - Episode Title.mkv")] [TestCase("30 Rock - S01E05 - Episode Title", 1, false, "Season %s", @"C:\Test\30 Rock\30 Rock - S01E05 - Episode Title.mkv")] [TestCase("30 Rock - S01E05 - Episode Title", 1, true, "ReallyUglySeasonFolder %s", @"C:\Test\30 Rock\ReallyUglySeasonFolder 1\30 Rock - S01E05 - Episode Title.mkv")] + [TestCase("30 Rock - S00E05 - Episode Title", 0, true, "Season %s", @"C:\Test\30 Rock\Specials\30 Rock - S00E05 - Episode Title.mkv")] public void CalculateFilePath_SeasonFolder_SingleNumber(string filename, int seasonNumber, bool useSeasonFolder, string seasonFolderFormat, string expectedPath) { var fakeSeries = Builder.CreateNew() @@ -41,7 +42,7 @@ namespace NzbDrone.Core.Test.OrganizerTests Mocker.GetMock().Setup(e => e.SeasonFolderFormat).Returns(seasonFolderFormat); - Subject.BuildFilePath(fakeSeries, 1, filename, ".mkv").Should().Be(expectedPath.AsOsAgnostic()); + Subject.BuildFilePath(fakeSeries, seasonNumber, filename, ".mkv").Should().Be(expectedPath.AsOsAgnostic()); } } } \ No newline at end of file diff --git a/NzbDrone.Core.Test/OrganizerTests/GetNewFilenameFixture.cs b/src/NzbDrone.Core.Test/OrganizerTests/GetNewFilenameFixture.cs similarity index 100% rename from NzbDrone.Core.Test/OrganizerTests/GetNewFilenameFixture.cs rename to src/NzbDrone.Core.Test/OrganizerTests/GetNewFilenameFixture.cs diff --git a/NzbDrone.Core.Test/ParserTests/ParserFixture.cs b/src/NzbDrone.Core.Test/ParserTests/ParserFixture.cs similarity index 100% rename from NzbDrone.Core.Test/ParserTests/ParserFixture.cs rename to src/NzbDrone.Core.Test/ParserTests/ParserFixture.cs diff --git a/NzbDrone.Core.Test/ParserTests/ParsingServiceTests/GetEpisodesFixture.cs b/src/NzbDrone.Core.Test/ParserTests/ParsingServiceTests/GetEpisodesFixture.cs similarity index 100% rename from NzbDrone.Core.Test/ParserTests/ParsingServiceTests/GetEpisodesFixture.cs rename to src/NzbDrone.Core.Test/ParserTests/ParsingServiceTests/GetEpisodesFixture.cs diff --git a/NzbDrone.Core.Test/ParserTests/ParsingServiceTests/MapFixture.cs b/src/NzbDrone.Core.Test/ParserTests/ParsingServiceTests/MapFixture.cs similarity index 100% rename from NzbDrone.Core.Test/ParserTests/ParsingServiceTests/MapFixture.cs rename to src/NzbDrone.Core.Test/ParserTests/ParsingServiceTests/MapFixture.cs diff --git a/NzbDrone.Core.Test/ParserTests/QualityParserFixture.cs b/src/NzbDrone.Core.Test/ParserTests/QualityParserFixture.cs similarity index 100% rename from NzbDrone.Core.Test/ParserTests/QualityParserFixture.cs rename to src/NzbDrone.Core.Test/ParserTests/QualityParserFixture.cs diff --git a/NzbDrone.Core.Test/Properties/AssemblyInfo.cs b/src/NzbDrone.Core.Test/Properties/AssemblyInfo.cs similarity index 100% rename from NzbDrone.Core.Test/Properties/AssemblyInfo.cs rename to src/NzbDrone.Core.Test/Properties/AssemblyInfo.cs diff --git a/NzbDrone.Core.Test/ProviderTests/DiskProviderTests/ArchiveProviderFixture.cs b/src/NzbDrone.Core.Test/ProviderTests/DiskProviderTests/ArchiveProviderFixture.cs similarity index 100% rename from NzbDrone.Core.Test/ProviderTests/DiskProviderTests/ArchiveProviderFixture.cs rename to src/NzbDrone.Core.Test/ProviderTests/DiskProviderTests/ArchiveProviderFixture.cs diff --git a/NzbDrone.Core.Test/ProviderTests/DiskProviderTests/FreeDiskSpaceFixture.cs b/src/NzbDrone.Core.Test/ProviderTests/DiskProviderTests/FreeDiskSpaceFixture.cs similarity index 100% rename from NzbDrone.Core.Test/ProviderTests/DiskProviderTests/FreeDiskSpaceFixture.cs rename to src/NzbDrone.Core.Test/ProviderTests/DiskProviderTests/FreeDiskSpaceFixture.cs diff --git a/NzbDrone.Core.Test/ProviderTests/DiskScanProviderTests/GetVideoFilesFixture.cs b/src/NzbDrone.Core.Test/ProviderTests/DiskScanProviderTests/GetVideoFilesFixture.cs similarity index 100% rename from NzbDrone.Core.Test/ProviderTests/DiskScanProviderTests/GetVideoFilesFixture.cs rename to src/NzbDrone.Core.Test/ProviderTests/DiskScanProviderTests/GetVideoFilesFixture.cs diff --git a/NzbDrone.Core.Test/ProviderTests/RecycleBinProviderTests/CleanupFixture.cs b/src/NzbDrone.Core.Test/ProviderTests/RecycleBinProviderTests/CleanupFixture.cs similarity index 100% rename from NzbDrone.Core.Test/ProviderTests/RecycleBinProviderTests/CleanupFixture.cs rename to src/NzbDrone.Core.Test/ProviderTests/RecycleBinProviderTests/CleanupFixture.cs diff --git a/NzbDrone.Core.Test/ProviderTests/RecycleBinProviderTests/DeleteDirectoryFixture.cs b/src/NzbDrone.Core.Test/ProviderTests/RecycleBinProviderTests/DeleteDirectoryFixture.cs similarity index 100% rename from NzbDrone.Core.Test/ProviderTests/RecycleBinProviderTests/DeleteDirectoryFixture.cs rename to src/NzbDrone.Core.Test/ProviderTests/RecycleBinProviderTests/DeleteDirectoryFixture.cs diff --git a/NzbDrone.Core.Test/ProviderTests/RecycleBinProviderTests/DeleteFileFixture.cs b/src/NzbDrone.Core.Test/ProviderTests/RecycleBinProviderTests/DeleteFileFixture.cs similarity index 100% rename from NzbDrone.Core.Test/ProviderTests/RecycleBinProviderTests/DeleteFileFixture.cs rename to src/NzbDrone.Core.Test/ProviderTests/RecycleBinProviderTests/DeleteFileFixture.cs diff --git a/NzbDrone.Core.Test/ProviderTests/RecycleBinProviderTests/EmptyFixture.cs b/src/NzbDrone.Core.Test/ProviderTests/RecycleBinProviderTests/EmptyFixture.cs similarity index 100% rename from NzbDrone.Core.Test/ProviderTests/RecycleBinProviderTests/EmptyFixture.cs rename to src/NzbDrone.Core.Test/ProviderTests/RecycleBinProviderTests/EmptyFixture.cs diff --git a/NzbDrone.Core.Test/Providers/XemProxyFixture.cs b/src/NzbDrone.Core.Test/Providers/XemProxyFixture.cs similarity index 100% rename from NzbDrone.Core.Test/Providers/XemProxyFixture.cs rename to src/NzbDrone.Core.Test/Providers/XemProxyFixture.cs diff --git a/NzbDrone.Core.Test/Qualities/QualityFixture.cs b/src/NzbDrone.Core.Test/Qualities/QualityFixture.cs similarity index 100% rename from NzbDrone.Core.Test/Qualities/QualityFixture.cs rename to src/NzbDrone.Core.Test/Qualities/QualityFixture.cs diff --git a/NzbDrone.Core.Test/Qualities/QualityProfileRepositoryFixture.cs b/src/NzbDrone.Core.Test/Qualities/QualityProfileRepositoryFixture.cs similarity index 100% rename from NzbDrone.Core.Test/Qualities/QualityProfileRepositoryFixture.cs rename to src/NzbDrone.Core.Test/Qualities/QualityProfileRepositoryFixture.cs diff --git a/NzbDrone.Core.Test/Qualities/QualityProfileServiceFixture.cs b/src/NzbDrone.Core.Test/Qualities/QualityProfileServiceFixture.cs similarity index 100% rename from NzbDrone.Core.Test/Qualities/QualityProfileServiceFixture.cs rename to src/NzbDrone.Core.Test/Qualities/QualityProfileServiceFixture.cs diff --git a/NzbDrone.Core.Test/Qualities/QualitySizeRepositoryFixture.cs b/src/NzbDrone.Core.Test/Qualities/QualitySizeRepositoryFixture.cs similarity index 100% rename from NzbDrone.Core.Test/Qualities/QualitySizeRepositoryFixture.cs rename to src/NzbDrone.Core.Test/Qualities/QualitySizeRepositoryFixture.cs diff --git a/NzbDrone.Core.Test/Qualities/QualitySizeServiceFixture.cs b/src/NzbDrone.Core.Test/Qualities/QualitySizeServiceFixture.cs similarity index 100% rename from NzbDrone.Core.Test/Qualities/QualitySizeServiceFixture.cs rename to src/NzbDrone.Core.Test/Qualities/QualitySizeServiceFixture.cs diff --git a/NzbDrone.Core.Test/RootFolderTests/FreeSpaceOnDrivesFixture.cs b/src/NzbDrone.Core.Test/RootFolderTests/FreeSpaceOnDrivesFixture.cs similarity index 100% rename from NzbDrone.Core.Test/RootFolderTests/FreeSpaceOnDrivesFixture.cs rename to src/NzbDrone.Core.Test/RootFolderTests/FreeSpaceOnDrivesFixture.cs diff --git a/NzbDrone.Core.Test/RootFolderTests/RootFolderServiceFixture.cs b/src/NzbDrone.Core.Test/RootFolderTests/RootFolderServiceFixture.cs similarity index 100% rename from NzbDrone.Core.Test/RootFolderTests/RootFolderServiceFixture.cs rename to src/NzbDrone.Core.Test/RootFolderTests/RootFolderServiceFixture.cs diff --git a/NzbDrone.Core.Test/SeriesStatsTests/SeriesStatisticsFixture.cs b/src/NzbDrone.Core.Test/SeriesStatsTests/SeriesStatisticsFixture.cs similarity index 100% rename from NzbDrone.Core.Test/SeriesStatsTests/SeriesStatisticsFixture.cs rename to src/NzbDrone.Core.Test/SeriesStatsTests/SeriesStatisticsFixture.cs diff --git a/src/NzbDrone.Core.Test/ThingiProvider/ProviderBaseFixture.cs b/src/NzbDrone.Core.Test/ThingiProvider/ProviderBaseFixture.cs new file mode 100644 index 000000000..641e62dca --- /dev/null +++ b/src/NzbDrone.Core.Test/ThingiProvider/ProviderBaseFixture.cs @@ -0,0 +1,31 @@ +using FizzWare.NBuilder; +using FluentAssertions; +using NUnit.Framework; +using NzbDrone.Core.Indexers; +using NzbDrone.Core.Indexers.Newznab; +using NzbDrone.Core.Test.Framework; +using NzbDrone.Core.ThingiProvider; + +namespace NzbDrone.Core.Test.ThingiProvider +{ + + public class ProviderRepositoryFixture : DbTest + { + [Test] + public void should_read_write_download_provider() + { + var model = Builder.CreateNew().BuildNew(); + var newznabSettings = Builder.CreateNew().Build(); + model.Settings = newznabSettings; + Subject.Insert(model); + + var storedProvider = Subject.Single(); + + storedProvider.Settings.Should().BeOfType(); + + var storedSetting = (NewznabSettings)storedProvider.Settings; + + storedSetting.ShouldHave().AllProperties().EqualTo(newznabSettings); + } + } +} \ No newline at end of file diff --git a/src/NzbDrone.Core.Test/ThingiProviderTests/NullConfigFixture.cs b/src/NzbDrone.Core.Test/ThingiProviderTests/NullConfigFixture.cs new file mode 100644 index 000000000..0f47d9a91 --- /dev/null +++ b/src/NzbDrone.Core.Test/ThingiProviderTests/NullConfigFixture.cs @@ -0,0 +1,17 @@ +using FluentAssertions; +using NUnit.Framework; +using NzbDrone.Core.Test.Framework; +using NzbDrone.Core.ThingiProvider; + +namespace NzbDrone.Core.Test.ThingiProviderTests +{ + [TestFixture] + public class NullConfigFixture : CoreTest + { + [Test] + public void should_be_valid() + { + Subject.Validate().IsValid.Should().BeTrue(); + } + } +} \ No newline at end of file diff --git a/NzbDrone.Core.Test/TvTests/EpisodeProviderTests/EpisodeProviderTest.cs b/src/NzbDrone.Core.Test/TvTests/EpisodeProviderTests/EpisodeProviderTest.cs similarity index 100% rename from NzbDrone.Core.Test/TvTests/EpisodeProviderTests/EpisodeProviderTest.cs rename to src/NzbDrone.Core.Test/TvTests/EpisodeProviderTests/EpisodeProviderTest.cs diff --git a/NzbDrone.Core.Test/TvTests/EpisodeProviderTests/EpisodeProviderTest_GetEpisodesByParseResult.cs b/src/NzbDrone.Core.Test/TvTests/EpisodeProviderTests/EpisodeProviderTest_GetEpisodesByParseResult.cs similarity index 100% rename from NzbDrone.Core.Test/TvTests/EpisodeProviderTests/EpisodeProviderTest_GetEpisodesByParseResult.cs rename to src/NzbDrone.Core.Test/TvTests/EpisodeProviderTests/EpisodeProviderTest_GetEpisodesByParseResult.cs diff --git a/NzbDrone.Core.Test/TvTests/EpisodeProviderTests/HandleEpisodeFileDeletedFixture.cs b/src/NzbDrone.Core.Test/TvTests/EpisodeProviderTests/HandleEpisodeFileDeletedFixture.cs similarity index 100% rename from NzbDrone.Core.Test/TvTests/EpisodeProviderTests/HandleEpisodeFileDeletedFixture.cs rename to src/NzbDrone.Core.Test/TvTests/EpisodeProviderTests/HandleEpisodeFileDeletedFixture.cs diff --git a/NzbDrone.Core.Test/TvTests/EpisodeRepositoryTests/EpisodesBetweenDatesFixture.cs b/src/NzbDrone.Core.Test/TvTests/EpisodeRepositoryTests/EpisodesBetweenDatesFixture.cs similarity index 100% rename from NzbDrone.Core.Test/TvTests/EpisodeRepositoryTests/EpisodesBetweenDatesFixture.cs rename to src/NzbDrone.Core.Test/TvTests/EpisodeRepositoryTests/EpisodesBetweenDatesFixture.cs diff --git a/NzbDrone.Core.Test/TvTests/EpisodeRepositoryTests/EpisodesRepositoryReadFixture.cs b/src/NzbDrone.Core.Test/TvTests/EpisodeRepositoryTests/EpisodesRepositoryReadFixture.cs similarity index 100% rename from NzbDrone.Core.Test/TvTests/EpisodeRepositoryTests/EpisodesRepositoryReadFixture.cs rename to src/NzbDrone.Core.Test/TvTests/EpisodeRepositoryTests/EpisodesRepositoryReadFixture.cs diff --git a/NzbDrone.Core.Test/TvTests/EpisodeRepositoryTests/EpisodesWithoutFilesFixture.cs b/src/NzbDrone.Core.Test/TvTests/EpisodeRepositoryTests/EpisodesWithoutFilesFixture.cs similarity index 100% rename from NzbDrone.Core.Test/TvTests/EpisodeRepositoryTests/EpisodesWithoutFilesFixture.cs rename to src/NzbDrone.Core.Test/TvTests/EpisodeRepositoryTests/EpisodesWithoutFilesFixture.cs diff --git a/NzbDrone.Core.Test/TvTests/EpisodeRepositoryTests/FindEpisodeFixture.cs b/src/NzbDrone.Core.Test/TvTests/EpisodeRepositoryTests/FindEpisodeFixture.cs similarity index 100% rename from NzbDrone.Core.Test/TvTests/EpisodeRepositoryTests/FindEpisodeFixture.cs rename to src/NzbDrone.Core.Test/TvTests/EpisodeRepositoryTests/FindEpisodeFixture.cs diff --git a/NzbDrone.Core.Test/TvTests/QualityModelFixture.cs b/src/NzbDrone.Core.Test/TvTests/QualityModelFixture.cs similarity index 100% rename from NzbDrone.Core.Test/TvTests/QualityModelFixture.cs rename to src/NzbDrone.Core.Test/TvTests/QualityModelFixture.cs diff --git a/NzbDrone.Core.Test/TvTests/RefreshEpisodeServiceFixture.cs b/src/NzbDrone.Core.Test/TvTests/RefreshEpisodeServiceFixture.cs similarity index 100% rename from NzbDrone.Core.Test/TvTests/RefreshEpisodeServiceFixture.cs rename to src/NzbDrone.Core.Test/TvTests/RefreshEpisodeServiceFixture.cs diff --git a/NzbDrone.Core.Test/TvTests/SeriesRepositoryTests/QualityProfileRepositoryFixture.cs b/src/NzbDrone.Core.Test/TvTests/SeriesRepositoryTests/QualityProfileRepositoryFixture.cs similarity index 100% rename from NzbDrone.Core.Test/TvTests/SeriesRepositoryTests/QualityProfileRepositoryFixture.cs rename to src/NzbDrone.Core.Test/TvTests/SeriesRepositoryTests/QualityProfileRepositoryFixture.cs diff --git a/NzbDrone.Core.Test/TvTests/SeriesServiceTests/AddSeriesFixture.cs b/src/NzbDrone.Core.Test/TvTests/SeriesServiceTests/AddSeriesFixture.cs similarity index 100% rename from NzbDrone.Core.Test/TvTests/SeriesServiceTests/AddSeriesFixture.cs rename to src/NzbDrone.Core.Test/TvTests/SeriesServiceTests/AddSeriesFixture.cs diff --git a/NzbDrone.Core.Test/TvTests/SeriesServiceTests/UpdateSeriesFixture.cs b/src/NzbDrone.Core.Test/TvTests/SeriesServiceTests/UpdateSeriesFixture.cs similarity index 100% rename from NzbDrone.Core.Test/TvTests/SeriesServiceTests/UpdateSeriesFixture.cs rename to src/NzbDrone.Core.Test/TvTests/SeriesServiceTests/UpdateSeriesFixture.cs diff --git a/NzbDrone.Core.Test/UpdateTests/UpdatePackageProviderFixture.cs b/src/NzbDrone.Core.Test/UpdateTests/UpdatePackageProviderFixture.cs similarity index 100% rename from NzbDrone.Core.Test/UpdateTests/UpdatePackageProviderFixture.cs rename to src/NzbDrone.Core.Test/UpdateTests/UpdatePackageProviderFixture.cs diff --git a/NzbDrone.Core.Test/UpdateTests/UpdateServiceFixture.cs b/src/NzbDrone.Core.Test/UpdateTests/UpdateServiceFixture.cs similarity index 100% rename from NzbDrone.Core.Test/UpdateTests/UpdateServiceFixture.cs rename to src/NzbDrone.Core.Test/UpdateTests/UpdateServiceFixture.cs diff --git a/NzbDrone.Core.Test/XbmcVersionTests.cs b/src/NzbDrone.Core.Test/XbmcVersionTests.cs similarity index 100% rename from NzbDrone.Core.Test/XbmcVersionTests.cs rename to src/NzbDrone.Core.Test/XbmcVersionTests.cs diff --git a/NzbDrone.Core.Test/packages.config b/src/NzbDrone.Core.Test/packages.config similarity index 100% rename from NzbDrone.Core.Test/packages.config rename to src/NzbDrone.Core.Test/packages.config diff --git a/NzbDrone.Core/Annotations/FieldDefinitionAttribute.cs b/src/NzbDrone.Core/Annotations/FieldDefinitionAttribute.cs similarity index 100% rename from NzbDrone.Core/Annotations/FieldDefinitionAttribute.cs rename to src/NzbDrone.Core/Annotations/FieldDefinitionAttribute.cs diff --git a/NzbDrone.Core/App.config b/src/NzbDrone.Core/App.config similarity index 100% rename from NzbDrone.Core/App.config rename to src/NzbDrone.Core/App.config diff --git a/NzbDrone.Core/Configuration/Config.cs b/src/NzbDrone.Core/Configuration/Config.cs similarity index 100% rename from NzbDrone.Core/Configuration/Config.cs rename to src/NzbDrone.Core/Configuration/Config.cs diff --git a/NzbDrone.Core/Configuration/ConfigFileProvider.cs b/src/NzbDrone.Core/Configuration/ConfigFileProvider.cs similarity index 100% rename from NzbDrone.Core/Configuration/ConfigFileProvider.cs rename to src/NzbDrone.Core/Configuration/ConfigFileProvider.cs diff --git a/NzbDrone.Core/Configuration/ConfigRepository.cs b/src/NzbDrone.Core/Configuration/ConfigRepository.cs similarity index 100% rename from NzbDrone.Core/Configuration/ConfigRepository.cs rename to src/NzbDrone.Core/Configuration/ConfigRepository.cs diff --git a/NzbDrone.Core/Configuration/ConfigService.cs b/src/NzbDrone.Core/Configuration/ConfigService.cs similarity index 98% rename from NzbDrone.Core/Configuration/ConfigService.cs rename to src/NzbDrone.Core/Configuration/ConfigService.cs index 8a9b7a5d5..a7bebdb6d 100644 --- a/NzbDrone.Core/Configuration/ConfigService.cs +++ b/src/NzbDrone.Core/Configuration/ConfigService.cs @@ -128,6 +128,13 @@ namespace NzbDrone.Core.Configuration set { SetValue("SabOlderTvPriority", value); } } + public bool SabUseSsl + { + get { return GetValueBoolean("SabUseSsl", false); } + + set { SetValue("SabUseSsl", value); } + } + public String DownloadedEpisodesFolder { get { return GetValue(ConfigKey.DownloadedEpisodesFolder.ToString()); } @@ -162,7 +169,7 @@ namespace NzbDrone.Core.Configuration public DownloadClientType DownloadClient { - get { return GetValueEnum("DownloadClient", DownloadClientType.Sabnzbd); } + get { return GetValueEnum("DownloadClient", DownloadClientType.Blackhole); } set { SetValue("DownloadClient", value); } } diff --git a/NzbDrone.Core/Configuration/Events/ConfigFileSavedEvent.cs b/src/NzbDrone.Core/Configuration/Events/ConfigFileSavedEvent.cs similarity index 100% rename from NzbDrone.Core/Configuration/Events/ConfigFileSavedEvent.cs rename to src/NzbDrone.Core/Configuration/Events/ConfigFileSavedEvent.cs diff --git a/NzbDrone.Core/Configuration/Events/ConfigSavedEvent.cs b/src/NzbDrone.Core/Configuration/Events/ConfigSavedEvent.cs similarity index 100% rename from NzbDrone.Core/Configuration/Events/ConfigSavedEvent.cs rename to src/NzbDrone.Core/Configuration/Events/ConfigSavedEvent.cs diff --git a/NzbDrone.Core/Configuration/IConfigService.cs b/src/NzbDrone.Core/Configuration/IConfigService.cs similarity index 97% rename from NzbDrone.Core/Configuration/IConfigService.cs rename to src/NzbDrone.Core/Configuration/IConfigService.cs index d84ed272b..e226740b0 100644 --- a/NzbDrone.Core/Configuration/IConfigService.cs +++ b/src/NzbDrone.Core/Configuration/IConfigService.cs @@ -18,6 +18,7 @@ namespace NzbDrone.Core.Configuration String SabTvCategory { get; set; } SabPriorityType SabRecentTvPriority { get; set; } SabPriorityType SabOlderTvPriority { get; set; } + Boolean SabUseSsl { get; set; } String DownloadedEpisodesFolder { get; set; } bool UseSeasonFolder { get; set; } string SeasonFolderFormat { get; set; } diff --git a/NzbDrone.Core/Configuration/InvalidConfigFileException.cs b/src/NzbDrone.Core/Configuration/InvalidConfigFileException.cs similarity index 100% rename from NzbDrone.Core/Configuration/InvalidConfigFileException.cs rename to src/NzbDrone.Core/Configuration/InvalidConfigFileException.cs diff --git a/NzbDrone.Core/DataAugmentation/DailySeries/DailySeriesDataProxy.cs b/src/NzbDrone.Core/DataAugmentation/DailySeries/DailySeriesDataProxy.cs similarity index 100% rename from NzbDrone.Core/DataAugmentation/DailySeries/DailySeriesDataProxy.cs rename to src/NzbDrone.Core/DataAugmentation/DailySeries/DailySeriesDataProxy.cs diff --git a/NzbDrone.Core/DataAugmentation/DailySeries/DailySeriesService.cs b/src/NzbDrone.Core/DataAugmentation/DailySeries/DailySeriesService.cs similarity index 100% rename from NzbDrone.Core/DataAugmentation/DailySeries/DailySeriesService.cs rename to src/NzbDrone.Core/DataAugmentation/DailySeries/DailySeriesService.cs diff --git a/NzbDrone.Core/DataAugmentation/Scene/SceneMapping.cs b/src/NzbDrone.Core/DataAugmentation/Scene/SceneMapping.cs similarity index 100% rename from NzbDrone.Core/DataAugmentation/Scene/SceneMapping.cs rename to src/NzbDrone.Core/DataAugmentation/Scene/SceneMapping.cs diff --git a/NzbDrone.Core/DataAugmentation/Scene/SceneMappingProxy.cs b/src/NzbDrone.Core/DataAugmentation/Scene/SceneMappingProxy.cs similarity index 100% rename from NzbDrone.Core/DataAugmentation/Scene/SceneMappingProxy.cs rename to src/NzbDrone.Core/DataAugmentation/Scene/SceneMappingProxy.cs diff --git a/NzbDrone.Core/DataAugmentation/Scene/SceneMappingRepository.cs b/src/NzbDrone.Core/DataAugmentation/Scene/SceneMappingRepository.cs similarity index 100% rename from NzbDrone.Core/DataAugmentation/Scene/SceneMappingRepository.cs rename to src/NzbDrone.Core/DataAugmentation/Scene/SceneMappingRepository.cs diff --git a/NzbDrone.Core/DataAugmentation/Scene/SceneMappingService.cs b/src/NzbDrone.Core/DataAugmentation/Scene/SceneMappingService.cs similarity index 100% rename from NzbDrone.Core/DataAugmentation/Scene/SceneMappingService.cs rename to src/NzbDrone.Core/DataAugmentation/Scene/SceneMappingService.cs diff --git a/NzbDrone.Core/DataAugmentation/Scene/UpdateSceneMappingCommand.cs b/src/NzbDrone.Core/DataAugmentation/Scene/UpdateSceneMappingCommand.cs similarity index 100% rename from NzbDrone.Core/DataAugmentation/Scene/UpdateSceneMappingCommand.cs rename to src/NzbDrone.Core/DataAugmentation/Scene/UpdateSceneMappingCommand.cs diff --git a/NzbDrone.Core/DataAugmentation/Xem/Model/XemResult.cs b/src/NzbDrone.Core/DataAugmentation/Xem/Model/XemResult.cs similarity index 100% rename from NzbDrone.Core/DataAugmentation/Xem/Model/XemResult.cs rename to src/NzbDrone.Core/DataAugmentation/Xem/Model/XemResult.cs diff --git a/NzbDrone.Core/DataAugmentation/Xem/Model/XemSceneTvdbMapping.cs b/src/NzbDrone.Core/DataAugmentation/Xem/Model/XemSceneTvdbMapping.cs similarity index 100% rename from NzbDrone.Core/DataAugmentation/Xem/Model/XemSceneTvdbMapping.cs rename to src/NzbDrone.Core/DataAugmentation/Xem/Model/XemSceneTvdbMapping.cs diff --git a/NzbDrone.Core/DataAugmentation/Xem/Model/XemValues.cs b/src/NzbDrone.Core/DataAugmentation/Xem/Model/XemValues.cs similarity index 100% rename from NzbDrone.Core/DataAugmentation/Xem/Model/XemValues.cs rename to src/NzbDrone.Core/DataAugmentation/Xem/Model/XemValues.cs diff --git a/NzbDrone.Core/DataAugmentation/Xem/UpdateXemMappingsCommand.cs b/src/NzbDrone.Core/DataAugmentation/Xem/UpdateXemMappingsCommand.cs similarity index 100% rename from NzbDrone.Core/DataAugmentation/Xem/UpdateXemMappingsCommand.cs rename to src/NzbDrone.Core/DataAugmentation/Xem/UpdateXemMappingsCommand.cs diff --git a/NzbDrone.Core/DataAugmentation/Xem/XemProxy.cs b/src/NzbDrone.Core/DataAugmentation/Xem/XemProxy.cs similarity index 100% rename from NzbDrone.Core/DataAugmentation/Xem/XemProxy.cs rename to src/NzbDrone.Core/DataAugmentation/Xem/XemProxy.cs diff --git a/NzbDrone.Core/DataAugmentation/Xem/XemService.cs b/src/NzbDrone.Core/DataAugmentation/Xem/XemService.cs similarity index 100% rename from NzbDrone.Core/DataAugmentation/Xem/XemService.cs rename to src/NzbDrone.Core/DataAugmentation/Xem/XemService.cs diff --git a/NzbDrone.Core/Datastore/BasicRepository.cs b/src/NzbDrone.Core/Datastore/BasicRepository.cs similarity index 99% rename from NzbDrone.Core/Datastore/BasicRepository.cs rename to src/NzbDrone.Core/Datastore/BasicRepository.cs index 96c03e51e..f3e35930f 100644 --- a/NzbDrone.Core/Datastore/BasicRepository.cs +++ b/src/NzbDrone.Core/Datastore/BasicRepository.cs @@ -201,7 +201,6 @@ namespace NzbDrone.Core.Datastore .Execute(); } - public virtual PagingSpec GetPaged(PagingSpec pagingSpec) { var pagingQuery = Query.OrderBy(pagingSpec.OrderByClause(), pagingSpec.ToSortDirection()) diff --git a/NzbDrone.Core/Datastore/ConnectionStringFactory.cs b/src/NzbDrone.Core/Datastore/ConnectionStringFactory.cs similarity index 100% rename from NzbDrone.Core/Datastore/ConnectionStringFactory.cs rename to src/NzbDrone.Core/Datastore/ConnectionStringFactory.cs diff --git a/NzbDrone.Core/Datastore/Converters/BooleanIntConverter.cs b/src/NzbDrone.Core/Datastore/Converters/BooleanIntConverter.cs similarity index 79% rename from NzbDrone.Core/Datastore/Converters/BooleanIntConverter.cs rename to src/NzbDrone.Core/Datastore/Converters/BooleanIntConverter.cs index 88d06c669..7ec60e201 100644 --- a/NzbDrone.Core/Datastore/Converters/BooleanIntConverter.cs +++ b/src/NzbDrone.Core/Datastore/Converters/BooleanIntConverter.cs @@ -6,14 +6,14 @@ namespace NzbDrone.Core.Datastore.Converters { public class BooleanIntConverter : IConverter { - public object FromDB(ColumnMap map, object dbValue) + public object FromDB(ConverterContext context) { - if (dbValue == DBNull.Value) + if (context.DbValue == DBNull.Value) { return DBNull.Value; } - var val = (Int64)dbValue; + var val = (Int64)context.DbValue; switch (val) { @@ -22,10 +22,15 @@ namespace NzbDrone.Core.Datastore.Converters case 0: return false; default: - throw new ConversionException(string.Format("The BooleanCharConverter could not convert the value '{0}' to a Boolean.", dbValue)); + throw new ConversionException(string.Format("The BooleanCharConverter could not convert the value '{0}' to a Boolean.", context.DbValue)); } } + public object FromDB(ColumnMap map, object dbValue) + { + return FromDB(new ConverterContext { ColumnMap = map, DbValue = dbValue }); + } + public object ToDB(object clrValue) { var val = (Nullable)clrValue; diff --git a/NzbDrone.Core/Datastore/Converters/EmbeddedDocumentConverter.cs b/src/NzbDrone.Core/Datastore/Converters/EmbeddedDocumentConverter.cs similarity index 68% rename from NzbDrone.Core/Datastore/Converters/EmbeddedDocumentConverter.cs rename to src/NzbDrone.Core/Datastore/Converters/EmbeddedDocumentConverter.cs index b222eb320..e144d4cf4 100644 --- a/NzbDrone.Core/Datastore/Converters/EmbeddedDocumentConverter.cs +++ b/src/NzbDrone.Core/Datastore/Converters/EmbeddedDocumentConverter.cs @@ -7,22 +7,26 @@ namespace NzbDrone.Core.Datastore.Converters { public class EmbeddedDocumentConverter : IConverter { - - public object FromDB(ColumnMap map, object dbValue) + public virtual object FromDB(ConverterContext context) { - if (dbValue == DBNull.Value) + if (context.DbValue == DBNull.Value) { return DBNull.Value; } - var stringValue = (string)dbValue; + var stringValue = (string)context.DbValue; if (string.IsNullOrWhiteSpace(stringValue)) { return null; } - return Json.Deserialize(stringValue, map.FieldType); + return Json.Deserialize(stringValue, context.ColumnMap.FieldType); + } + + public object FromDB(ColumnMap map, object dbValue) + { + return FromDB(new ConverterContext { ColumnMap = map, DbValue = dbValue }); } public object ToDB(object clrValue) diff --git a/NzbDrone.Core/Datastore/Converters/EnumIntConverter.cs b/src/NzbDrone.Core/Datastore/Converters/EnumIntConverter.cs similarity index 65% rename from NzbDrone.Core/Datastore/Converters/EnumIntConverter.cs rename to src/NzbDrone.Core/Datastore/Converters/EnumIntConverter.cs index f79c736c2..40c2727bc 100644 --- a/NzbDrone.Core/Datastore/Converters/EnumIntConverter.cs +++ b/src/NzbDrone.Core/Datastore/Converters/EnumIntConverter.cs @@ -14,16 +14,21 @@ namespace NzbDrone.Core.Datastore.Converters } } - public object FromDB(ColumnMap map, object dbValue) + public object FromDB(ConverterContext context) { - if (dbValue != null && dbValue != DBNull.Value) + if (context.DbValue != null && context.DbValue != DBNull.Value) { - return Enum.ToObject(map.FieldType, (Int64)dbValue); + return Enum.ToObject(context.ColumnMap.FieldType, (Int64)context.DbValue); } return null; } + public object FromDB(ColumnMap map, object dbValue) + { + return FromDB(new ConverterContext { ColumnMap = map, DbValue = dbValue }); + } + public object ToDB(object clrValue) { if (clrValue != null) diff --git a/NzbDrone.Core/Datastore/Converters/Int32Converter.cs b/src/NzbDrone.Core/Datastore/Converters/Int32Converter.cs similarity index 64% rename from NzbDrone.Core/Datastore/Converters/Int32Converter.cs rename to src/NzbDrone.Core/Datastore/Converters/Int32Converter.cs index fcf66a045..c69bfb9a5 100644 --- a/NzbDrone.Core/Datastore/Converters/Int32Converter.cs +++ b/src/NzbDrone.Core/Datastore/Converters/Int32Converter.cs @@ -6,6 +6,21 @@ namespace NzbDrone.Core.Datastore.Converters { public class Int32Converter : IConverter { + public object FromDB(ConverterContext context) + { + if (context.DbValue == DBNull.Value) + { + return DBNull.Value; + } + + if (context.DbValue is Int32) + { + return context.DbValue; + } + + return Convert.ToInt32(context.DbValue); + } + public object FromDB(ColumnMap map, object dbValue) { if (dbValue == DBNull.Value) diff --git a/src/NzbDrone.Core/Datastore/Converters/ProviderSettingConverter.cs b/src/NzbDrone.Core/Datastore/Converters/ProviderSettingConverter.cs new file mode 100644 index 000000000..ace64d6af --- /dev/null +++ b/src/NzbDrone.Core/Datastore/Converters/ProviderSettingConverter.cs @@ -0,0 +1,40 @@ +using System; +using Marr.Data.Converters; +using NzbDrone.Common.Reflection; +using NzbDrone.Common.Serializer; +using NzbDrone.Core.ThingiProvider; + +namespace NzbDrone.Core.Datastore.Converters +{ + public class ProviderSettingConverter : EmbeddedDocumentConverter + { + public override object FromDB(ConverterContext context) + { + if (context.DbValue == DBNull.Value) + { + return NullConfig.Instance; + } + + var stringValue = (string)context.DbValue; + + if (string.IsNullOrWhiteSpace(stringValue)) + { + return NullConfig.Instance; + } + + var ordinal = context.DataRecord.GetOrdinal("ConfigContract"); + var contract = context.DataRecord.GetString(ordinal); + + + var impType = typeof (IProviderConfig).Assembly.FindTypeByName(contract); + + if (impType == null) + { + throw new ConfigContractNotFoundException(contract); + } + + return Json.Deserialize(stringValue, impType); + } + + } +} \ No newline at end of file diff --git a/NzbDrone.Core/Datastore/Converters/QualityIntConverter.cs b/src/NzbDrone.Core/Datastore/Converters/QualityIntConverter.cs similarity index 76% rename from NzbDrone.Core/Datastore/Converters/QualityIntConverter.cs rename to src/NzbDrone.Core/Datastore/Converters/QualityIntConverter.cs index 839ef85be..6dc9d6c24 100644 --- a/NzbDrone.Core/Datastore/Converters/QualityIntConverter.cs +++ b/src/NzbDrone.Core/Datastore/Converters/QualityIntConverter.cs @@ -7,18 +7,23 @@ namespace NzbDrone.Core.Datastore.Converters { public class QualityIntConverter : IConverter { - public object FromDB(ColumnMap map, object dbValue) + public object FromDB(ConverterContext context) { - if (dbValue == DBNull.Value) + if (context.DbValue == DBNull.Value) { return Quality.Unknown; } - var val = Convert.ToInt32(dbValue); + var val = Convert.ToInt32(context.DbValue); return (Quality)val; } + public object FromDB(ColumnMap map, object dbValue) + { + return FromDB(new ConverterContext { ColumnMap = map, DbValue = dbValue }); + } + public object ToDB(object clrValue) { if(clrValue == null) return 0; diff --git a/NzbDrone.Core/Datastore/Converters/UtcConverter.cs b/src/NzbDrone.Core/Datastore/Converters/UtcConverter.cs similarity index 76% rename from NzbDrone.Core/Datastore/Converters/UtcConverter.cs rename to src/NzbDrone.Core/Datastore/Converters/UtcConverter.cs index 0bdc802dc..25d313a6c 100644 --- a/NzbDrone.Core/Datastore/Converters/UtcConverter.cs +++ b/src/NzbDrone.Core/Datastore/Converters/UtcConverter.cs @@ -6,9 +6,14 @@ namespace NzbDrone.Core.Datastore.Converters { public class UtcConverter : IConverter { + public object FromDB(ConverterContext context) + { + return context.DbValue; + } + public object FromDB(ColumnMap map, object dbValue) { - return dbValue; + return FromDB(new ConverterContext { ColumnMap = map, DbValue = dbValue }); } public object ToDB(object clrValue) diff --git a/NzbDrone.Core/Datastore/Database.cs b/src/NzbDrone.Core/Datastore/Database.cs similarity index 100% rename from NzbDrone.Core/Datastore/Database.cs rename to src/NzbDrone.Core/Datastore/Database.cs diff --git a/NzbDrone.Core/Datastore/DbFactory.cs b/src/NzbDrone.Core/Datastore/DbFactory.cs similarity index 100% rename from NzbDrone.Core/Datastore/DbFactory.cs rename to src/NzbDrone.Core/Datastore/DbFactory.cs diff --git a/NzbDrone.Core/Datastore/Events/ModelEvent.cs b/src/NzbDrone.Core/Datastore/Events/ModelEvent.cs similarity index 95% rename from NzbDrone.Core/Datastore/Events/ModelEvent.cs rename to src/NzbDrone.Core/Datastore/Events/ModelEvent.cs index 3cabd3a69..72ff55296 100644 --- a/NzbDrone.Core/Datastore/Events/ModelEvent.cs +++ b/src/NzbDrone.Core/Datastore/Events/ModelEvent.cs @@ -16,12 +16,10 @@ namespace NzbDrone.Core.Datastore.Events public enum ModelAction { - Unknow = 0, + Unknown = 0, Created = 1, Updated = 2, Deleted = 3, Sync = 4 } - - } \ No newline at end of file diff --git a/NzbDrone.Core/Datastore/IEmbeddedDocument.cs b/src/NzbDrone.Core/Datastore/IEmbeddedDocument.cs similarity index 100% rename from NzbDrone.Core/Datastore/IEmbeddedDocument.cs rename to src/NzbDrone.Core/Datastore/IEmbeddedDocument.cs diff --git a/NzbDrone.Core/Datastore/LazyList.cs b/src/NzbDrone.Core/Datastore/LazyList.cs similarity index 100% rename from NzbDrone.Core/Datastore/LazyList.cs rename to src/NzbDrone.Core/Datastore/LazyList.cs diff --git a/NzbDrone.Core/Datastore/MappingExtensions.cs b/src/NzbDrone.Core/Datastore/MappingExtensions.cs similarity index 97% rename from NzbDrone.Core/Datastore/MappingExtensions.cs rename to src/NzbDrone.Core/Datastore/MappingExtensions.cs index bbaf838f2..509d81bca 100644 --- a/NzbDrone.Core/Datastore/MappingExtensions.cs +++ b/src/NzbDrone.Core/Datastore/MappingExtensions.cs @@ -1,61 +1,61 @@ -using System; -using System.Reflection; -using Marr.Data; -using Marr.Data.Mapping; -using NzbDrone.Common.Reflection; - -namespace NzbDrone.Core.Datastore -{ - public static class MappingExtensions - { - - public static ColumnMapBuilder MapResultSet(this FluentMappings.MappingsFluentEntity mapBuilder) where T : ResultSet, new() - { - return mapBuilder - .Columns - .AutoMapPropertiesWhere(IsMappableProperty); - } - - - public static ColumnMapBuilder RegisterModel(this FluentMappings.MappingsFluentEntity mapBuilder, string tableName = null) where T : ModelBase, new() - { - return mapBuilder.Table.MapTable(tableName) - .Columns - .AutoMapPropertiesWhere(IsMappableProperty) - .PrefixAltNames(String.Format("{0}_", typeof(T).Name)) - .For(c => c.Id) - .SetPrimaryKey() - .SetReturnValue() - .SetAutoIncrement(); - } - - public static RelationshipBuilder AutoMapChildModels(this ColumnMapBuilder mapBuilder) - { - return mapBuilder.Relationships.AutoMapPropertiesWhere(m => - m.MemberType == MemberTypes.Property && - typeof(ModelBase).IsAssignableFrom(((PropertyInfo) m).PropertyType)); - } - - public static bool IsMappableProperty(MemberInfo memberInfo) - { - var propertyInfo = memberInfo as PropertyInfo; - - if (propertyInfo == null) return false; - - - if (!propertyInfo.IsReadable() || !propertyInfo.IsWritable()) - { - return false; - } - - if (propertyInfo.PropertyType.IsSimpleType() || MapRepository.Instance.TypeConverters.ContainsKey(propertyInfo.PropertyType)) - { - return true; - } - - return false; - } - - - } +using System; +using System.Reflection; +using Marr.Data; +using Marr.Data.Mapping; +using NzbDrone.Common.Reflection; + +namespace NzbDrone.Core.Datastore +{ + public static class MappingExtensions + { + + public static ColumnMapBuilder MapResultSet(this FluentMappings.MappingsFluentEntity mapBuilder) where T : ResultSet, new() + { + return mapBuilder + .Columns + .AutoMapPropertiesWhere(IsMappableProperty); + } + + + public static ColumnMapBuilder RegisterModel(this FluentMappings.MappingsFluentEntity mapBuilder, string tableName = null) where T : ModelBase, new() + { + return mapBuilder.Table.MapTable(tableName) + .Columns + .AutoMapPropertiesWhere(IsMappableProperty) + .PrefixAltNames(String.Format("{0}_", typeof(T).Name)) + .For(c => c.Id) + .SetPrimaryKey() + .SetReturnValue() + .SetAutoIncrement(); + } + + public static RelationshipBuilder AutoMapChildModels(this ColumnMapBuilder mapBuilder) + { + return mapBuilder.Relationships.AutoMapPropertiesWhere(m => + m.MemberType == MemberTypes.Property && + typeof(ModelBase).IsAssignableFrom(((PropertyInfo) m).PropertyType)); + } + + public static bool IsMappableProperty(MemberInfo memberInfo) + { + var propertyInfo = memberInfo as PropertyInfo; + + if (propertyInfo == null) return false; + + + if (!propertyInfo.IsReadable() || !propertyInfo.IsWritable()) + { + return false; + } + + if (propertyInfo.PropertyType.IsSimpleType() || MapRepository.Instance.TypeConverters.ContainsKey(propertyInfo.PropertyType)) + { + return true; + } + + return false; + } + + + } } \ No newline at end of file diff --git a/NzbDrone.Core/Datastore/Migration/001_InitialSetup.cs b/src/NzbDrone.Core/Datastore/Migration/001_InitialSetup.cs similarity index 100% rename from NzbDrone.Core/Datastore/Migration/001_InitialSetup.cs rename to src/NzbDrone.Core/Datastore/Migration/001_InitialSetup.cs diff --git a/NzbDrone.Core/Datastore/Migration/002_Remove_tvrage_imdb_unique_constraint.cs b/src/NzbDrone.Core/Datastore/Migration/002_Remove_tvrage_imdb_unique_constraint.cs similarity index 100% rename from NzbDrone.Core/Datastore/Migration/002_Remove_tvrage_imdb_unique_constraint.cs rename to src/NzbDrone.Core/Datastore/Migration/002_Remove_tvrage_imdb_unique_constraint.cs diff --git a/NzbDrone.Core/Datastore/Migration/003_remove_clean_title_from_scene_mapping.cs b/src/NzbDrone.Core/Datastore/Migration/003_remove_clean_title_from_scene_mapping.cs similarity index 100% rename from NzbDrone.Core/Datastore/Migration/003_remove_clean_title_from_scene_mapping.cs rename to src/NzbDrone.Core/Datastore/Migration/003_remove_clean_title_from_scene_mapping.cs diff --git a/NzbDrone.Core/Datastore/Migration/004_updated_history.cs b/src/NzbDrone.Core/Datastore/Migration/004_updated_history.cs similarity index 100% rename from NzbDrone.Core/Datastore/Migration/004_updated_history.cs rename to src/NzbDrone.Core/Datastore/Migration/004_updated_history.cs diff --git a/NzbDrone.Core/Datastore/Migration/005_added_eventtype_to_history.cs b/src/NzbDrone.Core/Datastore/Migration/005_added_eventtype_to_history.cs similarity index 100% rename from NzbDrone.Core/Datastore/Migration/005_added_eventtype_to_history.cs rename to src/NzbDrone.Core/Datastore/Migration/005_added_eventtype_to_history.cs diff --git a/NzbDrone.Core/Datastore/Migration/006_add_index_to_log_time.cs b/src/NzbDrone.Core/Datastore/Migration/006_add_index_to_log_time.cs similarity index 100% rename from NzbDrone.Core/Datastore/Migration/006_add_index_to_log_time.cs rename to src/NzbDrone.Core/Datastore/Migration/006_add_index_to_log_time.cs diff --git a/NzbDrone.Core/Datastore/Migration/007_add_renameEpisodes_to_naming.cs b/src/NzbDrone.Core/Datastore/Migration/007_add_renameEpisodes_to_naming.cs similarity index 100% rename from NzbDrone.Core/Datastore/Migration/007_add_renameEpisodes_to_naming.cs rename to src/NzbDrone.Core/Datastore/Migration/007_add_renameEpisodes_to_naming.cs diff --git a/NzbDrone.Core/Datastore/Migration/008_remove_backlog.cs b/src/NzbDrone.Core/Datastore/Migration/008_remove_backlog.cs similarity index 100% rename from NzbDrone.Core/Datastore/Migration/008_remove_backlog.cs rename to src/NzbDrone.Core/Datastore/Migration/008_remove_backlog.cs diff --git a/NzbDrone.Core/Datastore/Migration/009_fix_renameEpisodes.cs b/src/NzbDrone.Core/Datastore/Migration/009_fix_renameEpisodes.cs similarity index 100% rename from NzbDrone.Core/Datastore/Migration/009_fix_renameEpisodes.cs rename to src/NzbDrone.Core/Datastore/Migration/009_fix_renameEpisodes.cs diff --git a/NzbDrone.Core/Datastore/Migration/010_add_monitored.cs b/src/NzbDrone.Core/Datastore/Migration/010_add_monitored.cs similarity index 100% rename from NzbDrone.Core/Datastore/Migration/010_add_monitored.cs rename to src/NzbDrone.Core/Datastore/Migration/010_add_monitored.cs diff --git a/NzbDrone.Core/Datastore/Migration/011_remove_ignored.cs b/src/NzbDrone.Core/Datastore/Migration/011_remove_ignored.cs similarity index 100% rename from NzbDrone.Core/Datastore/Migration/011_remove_ignored.cs rename to src/NzbDrone.Core/Datastore/Migration/011_remove_ignored.cs diff --git a/NzbDrone.Core/Datastore/Migration/012_remove_custom_start_date.cs b/src/NzbDrone.Core/Datastore/Migration/012_remove_custom_start_date.cs similarity index 100% rename from NzbDrone.Core/Datastore/Migration/012_remove_custom_start_date.cs rename to src/NzbDrone.Core/Datastore/Migration/012_remove_custom_start_date.cs diff --git a/NzbDrone.Core/Datastore/Migration/013_add_air_date_utc.cs b/src/NzbDrone.Core/Datastore/Migration/013_add_air_date_utc.cs similarity index 100% rename from NzbDrone.Core/Datastore/Migration/013_add_air_date_utc.cs rename to src/NzbDrone.Core/Datastore/Migration/013_add_air_date_utc.cs diff --git a/NzbDrone.Core/Datastore/Migration/014_drop_air_date.cs b/src/NzbDrone.Core/Datastore/Migration/014_drop_air_date.cs similarity index 100% rename from NzbDrone.Core/Datastore/Migration/014_drop_air_date.cs rename to src/NzbDrone.Core/Datastore/Migration/014_drop_air_date.cs diff --git a/NzbDrone.Core/Datastore/Migration/015_add_air_date_as_string.cs b/src/NzbDrone.Core/Datastore/Migration/015_add_air_date_as_string.cs similarity index 100% rename from NzbDrone.Core/Datastore/Migration/015_add_air_date_as_string.cs rename to src/NzbDrone.Core/Datastore/Migration/015_add_air_date_as_string.cs diff --git a/NzbDrone.Core/Datastore/Migration/016_updated_imported_history_item.cs b/src/NzbDrone.Core/Datastore/Migration/016_updated_imported_history_item.cs similarity index 100% rename from NzbDrone.Core/Datastore/Migration/016_updated_imported_history_item.cs rename to src/NzbDrone.Core/Datastore/Migration/016_updated_imported_history_item.cs diff --git a/NzbDrone.Core/Datastore/Migration/017_reset_scene_names.cs b/src/NzbDrone.Core/Datastore/Migration/017_reset_scene_names.cs similarity index 100% rename from NzbDrone.Core/Datastore/Migration/017_reset_scene_names.cs rename to src/NzbDrone.Core/Datastore/Migration/017_reset_scene_names.cs diff --git a/NzbDrone.Core/Datastore/Migration/018_remove_duplicates.cs b/src/NzbDrone.Core/Datastore/Migration/018_remove_duplicates.cs similarity index 100% rename from NzbDrone.Core/Datastore/Migration/018_remove_duplicates.cs rename to src/NzbDrone.Core/Datastore/Migration/018_remove_duplicates.cs diff --git a/NzbDrone.Core/Datastore/Migration/019_restore_unique_constraints.cs b/src/NzbDrone.Core/Datastore/Migration/019_restore_unique_constraints.cs similarity index 100% rename from NzbDrone.Core/Datastore/Migration/019_restore_unique_constraints.cs rename to src/NzbDrone.Core/Datastore/Migration/019_restore_unique_constraints.cs diff --git a/NzbDrone.Core/Datastore/Migration/020_add_year_and_seasons_to_series.cs b/src/NzbDrone.Core/Datastore/Migration/020_add_year_and_seasons_to_series.cs similarity index 100% rename from NzbDrone.Core/Datastore/Migration/020_add_year_and_seasons_to_series.cs rename to src/NzbDrone.Core/Datastore/Migration/020_add_year_and_seasons_to_series.cs diff --git a/NzbDrone.Core/Datastore/Migration/021_drop_seasons_table.cs b/src/NzbDrone.Core/Datastore/Migration/021_drop_seasons_table.cs similarity index 100% rename from NzbDrone.Core/Datastore/Migration/021_drop_seasons_table.cs rename to src/NzbDrone.Core/Datastore/Migration/021_drop_seasons_table.cs diff --git a/src/NzbDrone.Core/Datastore/Migration/022_move_notification_to_generic_provider.cs b/src/NzbDrone.Core/Datastore/Migration/022_move_notification_to_generic_provider.cs new file mode 100644 index 000000000..2b5182419 --- /dev/null +++ b/src/NzbDrone.Core/Datastore/Migration/022_move_notification_to_generic_provider.cs @@ -0,0 +1,68 @@ +using System; +using System.Collections.Generic; +using System.Data; +using FluentMigrator; +using NzbDrone.Common.Serializer; +using NzbDrone.Core.Datastore.Migration.Framework; + +namespace NzbDrone.Core.Datastore.Migration +{ + [Migration(22)] + public class move_indexer_to_generic_provider : NzbDroneMigrationBase + { + protected override void MainDbUpgrade() + { + Alter.Table("Indexers").AddColumn("ConfigContract").AsString().Nullable(); + + //Execute.WithConnection(ConvertSeasons); + } + + private void ConvertSeasons(IDbConnection conn, IDbTransaction tran) + { + using (IDbCommand allSeriesCmd = conn.CreateCommand()) + { + allSeriesCmd.Transaction = tran; + allSeriesCmd.CommandText = @"SELECT Id FROM Series"; + using (IDataReader allSeriesReader = allSeriesCmd.ExecuteReader()) + { + while (allSeriesReader.Read()) + { + int seriesId = allSeriesReader.GetInt32(0); + var seasons = new List(); + + using (IDbCommand seasonsCmd = conn.CreateCommand()) + { + seasonsCmd.Transaction = tran; + seasonsCmd.CommandText = String.Format(@"SELECT SeasonNumber, Monitored FROM Seasons WHERE SeriesId = {0}", seriesId); + + using (IDataReader seasonReader = seasonsCmd.ExecuteReader()) + { + while (seasonReader.Read()) + { + int seasonNumber = seasonReader.GetInt32(0); + bool monitored = seasonReader.GetBoolean(1); + + if (seasonNumber == 0) + { + monitored = false; + } + + seasons.Add(new { seasonNumber, monitored }); + } + } + } + + using (IDbCommand updateCmd = conn.CreateCommand()) + { + var text = String.Format("UPDATE Series SET Seasons = '{0}' WHERE Id = {1}", seasons.ToJson(), seriesId); + + updateCmd.Transaction = tran; + updateCmd.CommandText = text; + updateCmd.ExecuteNonQuery(); + } + } + } + } + } + } +} diff --git a/src/NzbDrone.Core/Datastore/Migration/023_add_config_contract_to_indexers.cs b/src/NzbDrone.Core/Datastore/Migration/023_add_config_contract_to_indexers.cs new file mode 100644 index 000000000..cf2153605 --- /dev/null +++ b/src/NzbDrone.Core/Datastore/Migration/023_add_config_contract_to_indexers.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Data; +using FluentMigrator; +using NzbDrone.Common.Serializer; +using NzbDrone.Core.Datastore.Migration.Framework; + +namespace NzbDrone.Core.Datastore.Migration +{ + [Migration(23)] + public class add_config_contract_to_indexers : NzbDroneMigrationBase + { + protected override void MainDbUpgrade() + { + Update.Table("Indexers").Set(new { ConfigContract = "NewznabSettings" }).Where(new { Implementation = "Newznab" }); + Update.Table("Indexers").Set(new { ConfigContract = "OmgwtfnzbsSettings" }).Where(new { Implementation = "Omgwtfnzbs" }); + Update.Table("Indexers").Set(new { ConfigContract = "NullConfig" }).Where(new { Implementation = "Wombles" }); + Update.Table("Indexers").Set(new { ConfigContract = "NullConfig" }).Where(new { Implementation = "Eztv" }); + + Delete.FromTable("Indexers").IsNull("ConfigContract"); + } + } +} diff --git a/NzbDrone.Core/Datastore/Migration/Framework/MigrationContext.cs b/src/NzbDrone.Core/Datastore/Migration/Framework/MigrationContext.cs similarity index 100% rename from NzbDrone.Core/Datastore/Migration/Framework/MigrationContext.cs rename to src/NzbDrone.Core/Datastore/Migration/Framework/MigrationContext.cs diff --git a/NzbDrone.Core/Datastore/Migration/Framework/MigrationController.cs b/src/NzbDrone.Core/Datastore/Migration/Framework/MigrationController.cs similarity index 100% rename from NzbDrone.Core/Datastore/Migration/Framework/MigrationController.cs rename to src/NzbDrone.Core/Datastore/Migration/Framework/MigrationController.cs diff --git a/NzbDrone.Core/Datastore/Migration/Framework/MigrationExtension.cs b/src/NzbDrone.Core/Datastore/Migration/Framework/MigrationExtension.cs similarity index 100% rename from NzbDrone.Core/Datastore/Migration/Framework/MigrationExtension.cs rename to src/NzbDrone.Core/Datastore/Migration/Framework/MigrationExtension.cs diff --git a/NzbDrone.Core/Datastore/Migration/Framework/MigrationLogger.cs b/src/NzbDrone.Core/Datastore/Migration/Framework/MigrationLogger.cs similarity index 100% rename from NzbDrone.Core/Datastore/Migration/Framework/MigrationLogger.cs rename to src/NzbDrone.Core/Datastore/Migration/Framework/MigrationLogger.cs diff --git a/NzbDrone.Core/Datastore/Migration/Framework/MigrationOptions.cs b/src/NzbDrone.Core/Datastore/Migration/Framework/MigrationOptions.cs similarity index 100% rename from NzbDrone.Core/Datastore/Migration/Framework/MigrationOptions.cs rename to src/NzbDrone.Core/Datastore/Migration/Framework/MigrationOptions.cs diff --git a/NzbDrone.Core/Datastore/Migration/Framework/NzbDroneMigrationBase.cs b/src/NzbDrone.Core/Datastore/Migration/Framework/NzbDroneMigrationBase.cs similarity index 100% rename from NzbDrone.Core/Datastore/Migration/Framework/NzbDroneMigrationBase.cs rename to src/NzbDrone.Core/Datastore/Migration/Framework/NzbDroneMigrationBase.cs diff --git a/NzbDrone.Core/Datastore/Migration/Framework/SQLiteColumn.cs b/src/NzbDrone.Core/Datastore/Migration/Framework/SQLiteColumn.cs similarity index 100% rename from NzbDrone.Core/Datastore/Migration/Framework/SQLiteColumn.cs rename to src/NzbDrone.Core/Datastore/Migration/Framework/SQLiteColumn.cs diff --git a/NzbDrone.Core/Datastore/Migration/Framework/SQLiteIndex.cs b/src/NzbDrone.Core/Datastore/Migration/Framework/SQLiteIndex.cs similarity index 100% rename from NzbDrone.Core/Datastore/Migration/Framework/SQLiteIndex.cs rename to src/NzbDrone.Core/Datastore/Migration/Framework/SQLiteIndex.cs diff --git a/NzbDrone.Core/Datastore/Migration/Framework/SQLiteMigrationHelper (vaio's conflicted copy 2013-09-04).cs b/src/NzbDrone.Core/Datastore/Migration/Framework/SQLiteMigrationHelper (vaio's conflicted copy 2013-09-04).cs similarity index 100% rename from NzbDrone.Core/Datastore/Migration/Framework/SQLiteMigrationHelper (vaio's conflicted copy 2013-09-04).cs rename to src/NzbDrone.Core/Datastore/Migration/Framework/SQLiteMigrationHelper (vaio's conflicted copy 2013-09-04).cs diff --git a/NzbDrone.Core/Datastore/Migration/Framework/SQLiteMigrationHelper.cs b/src/NzbDrone.Core/Datastore/Migration/Framework/SQLiteMigrationHelper.cs similarity index 100% rename from NzbDrone.Core/Datastore/Migration/Framework/SQLiteMigrationHelper.cs rename to src/NzbDrone.Core/Datastore/Migration/Framework/SQLiteMigrationHelper.cs diff --git a/NzbDrone.Core/Datastore/Migration/Framework/SqliteAlter.cs b/src/NzbDrone.Core/Datastore/Migration/Framework/SqliteAlter.cs similarity index 100% rename from NzbDrone.Core/Datastore/Migration/Framework/SqliteAlter.cs rename to src/NzbDrone.Core/Datastore/Migration/Framework/SqliteAlter.cs diff --git a/NzbDrone.Core/Datastore/MigrationType.cs b/src/NzbDrone.Core/Datastore/MigrationType.cs similarity index 100% rename from NzbDrone.Core/Datastore/MigrationType.cs rename to src/NzbDrone.Core/Datastore/MigrationType.cs diff --git a/NzbDrone.Core/Datastore/ModelBase.cs b/src/NzbDrone.Core/Datastore/ModelBase.cs similarity index 100% rename from NzbDrone.Core/Datastore/ModelBase.cs rename to src/NzbDrone.Core/Datastore/ModelBase.cs diff --git a/NzbDrone.Core/Datastore/ModelNotFoundException.cs b/src/NzbDrone.Core/Datastore/ModelNotFoundException.cs similarity index 100% rename from NzbDrone.Core/Datastore/ModelNotFoundException.cs rename to src/NzbDrone.Core/Datastore/ModelNotFoundException.cs diff --git a/NzbDrone.Core/Datastore/PagingSpec.cs b/src/NzbDrone.Core/Datastore/PagingSpec.cs similarity index 73% rename from NzbDrone.Core/Datastore/PagingSpec.cs rename to src/NzbDrone.Core/Datastore/PagingSpec.cs index c1b7eb8a7..37bd9776c 100644 --- a/NzbDrone.Core/Datastore/PagingSpec.cs +++ b/src/NzbDrone.Core/Datastore/PagingSpec.cs @@ -1,4 +1,6 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; namespace NzbDrone.Core.Datastore { @@ -10,6 +12,7 @@ namespace NzbDrone.Core.Datastore public string SortKey { get; set; } public SortDirection SortDirection { get; set; } public List Records { get; set; } + public Expression> FilterExpression { get; set; } } public enum SortDirection diff --git a/NzbDrone.Core/Datastore/PagingSpecExtensions.cs b/src/NzbDrone.Core/Datastore/PagingSpecExtensions.cs similarity index 100% rename from NzbDrone.Core/Datastore/PagingSpecExtensions.cs rename to src/NzbDrone.Core/Datastore/PagingSpecExtensions.cs diff --git a/NzbDrone.Core/Datastore/RelationshipExtensions.cs b/src/NzbDrone.Core/Datastore/RelationshipExtensions.cs similarity index 100% rename from NzbDrone.Core/Datastore/RelationshipExtensions.cs rename to src/NzbDrone.Core/Datastore/RelationshipExtensions.cs diff --git a/NzbDrone.Core/Datastore/ResultSet.cs b/src/NzbDrone.Core/Datastore/ResultSet.cs similarity index 100% rename from NzbDrone.Core/Datastore/ResultSet.cs rename to src/NzbDrone.Core/Datastore/ResultSet.cs diff --git a/NzbDrone.Core/Datastore/TableMapping.cs b/src/NzbDrone.Core/Datastore/TableMapping.cs similarity index 86% rename from NzbDrone.Core/Datastore/TableMapping.cs rename to src/NzbDrone.Core/Datastore/TableMapping.cs index 533b3ab70..bade3c2d6 100644 --- a/NzbDrone.Core/Datastore/TableMapping.cs +++ b/src/NzbDrone.Core/Datastore/TableMapping.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using Marr.Data; using Marr.Data.Mapping; +using NzbDrone.Common.Reflection; using NzbDrone.Core.Configuration; using NzbDrone.Core.DataAugmentation.Scene; using NzbDrone.Core.Datastore.Converters; @@ -15,6 +16,7 @@ using NzbDrone.Core.Organizer; using NzbDrone.Core.Qualities; using NzbDrone.Core.RootFolders; using NzbDrone.Core.SeriesStats; +using NzbDrone.Core.ThingiProvider; using NzbDrone.Core.Tv; namespace NzbDrone.Core.Datastore @@ -69,6 +71,7 @@ namespace NzbDrone.Core.Datastore private static void RegisterMappers() { RegisterEmbeddedConverter(); + RegisterProviderSettingConverter(); MapRepository.Instance.RegisterTypeConverter(typeof(Int32), new Int32Converter()); MapRepository.Instance.RegisterTypeConverter(typeof(DateTime), new UtcConverter()); @@ -78,10 +81,20 @@ namespace NzbDrone.Core.Datastore MapRepository.Instance.RegisterTypeConverter(typeof(Dictionary), new EmbeddedDocumentConverter()); } + private static void RegisterProviderSettingConverter() + { + var settingTypes = typeof(IProviderConfig).Assembly.ImplementationsOf(); + + var providerSettingConverter = new ProviderSettingConverter(); + foreach (var embeddedType in settingTypes) + { + MapRepository.Instance.RegisterTypeConverter(embeddedType, providerSettingConverter); + } + } + private static void RegisterEmbeddedConverter() { - var embeddedTypes = typeof(IEmbeddedDocument).Assembly.GetTypes() - .Where(c => c.GetInterfaces().Any(i => i == typeof(IEmbeddedDocument))); + var embeddedTypes = typeof(IEmbeddedDocument).Assembly.ImplementationsOf(); var embeddedConvertor = new EmbeddedDocumentConverter(); diff --git a/NzbDrone.Core/DecisionEngine/DownloadDecisionMaker.cs b/src/NzbDrone.Core/DecisionEngine/DownloadDecisionMaker.cs similarity index 100% rename from NzbDrone.Core/DecisionEngine/DownloadDecisionMaker.cs rename to src/NzbDrone.Core/DecisionEngine/DownloadDecisionMaker.cs diff --git a/NzbDrone.Core/DecisionEngine/IDecisionEngineSpecification.cs b/src/NzbDrone.Core/DecisionEngine/IDecisionEngineSpecification.cs similarity index 100% rename from NzbDrone.Core/DecisionEngine/IDecisionEngineSpecification.cs rename to src/NzbDrone.Core/DecisionEngine/IDecisionEngineSpecification.cs diff --git a/NzbDrone.Core/DecisionEngine/IRejectWithReason.cs b/src/NzbDrone.Core/DecisionEngine/IRejectWithReason.cs similarity index 100% rename from NzbDrone.Core/DecisionEngine/IRejectWithReason.cs rename to src/NzbDrone.Core/DecisionEngine/IRejectWithReason.cs diff --git a/NzbDrone.Core/DecisionEngine/QualityUpgradableSpecification.cs b/src/NzbDrone.Core/DecisionEngine/QualityUpgradableSpecification.cs similarity index 100% rename from NzbDrone.Core/DecisionEngine/QualityUpgradableSpecification.cs rename to src/NzbDrone.Core/DecisionEngine/QualityUpgradableSpecification.cs diff --git a/NzbDrone.Core/DecisionEngine/Specifications/AcceptableSizeSpecification.cs b/src/NzbDrone.Core/DecisionEngine/Specifications/AcceptableSizeSpecification.cs similarity index 100% rename from NzbDrone.Core/DecisionEngine/Specifications/AcceptableSizeSpecification.cs rename to src/NzbDrone.Core/DecisionEngine/Specifications/AcceptableSizeSpecification.cs diff --git a/NzbDrone.Core/DecisionEngine/Specifications/CutoffSpecification.cs b/src/NzbDrone.Core/DecisionEngine/Specifications/CutoffSpecification.cs similarity index 100% rename from NzbDrone.Core/DecisionEngine/Specifications/CutoffSpecification.cs rename to src/NzbDrone.Core/DecisionEngine/Specifications/CutoffSpecification.cs diff --git a/NzbDrone.Core/DecisionEngine/Specifications/DownloadDecision.cs b/src/NzbDrone.Core/DecisionEngine/Specifications/DownloadDecision.cs similarity index 100% rename from NzbDrone.Core/DecisionEngine/Specifications/DownloadDecision.cs rename to src/NzbDrone.Core/DecisionEngine/Specifications/DownloadDecision.cs diff --git a/NzbDrone.Core/DecisionEngine/Specifications/LanguageSpecification.cs b/src/NzbDrone.Core/DecisionEngine/Specifications/LanguageSpecification.cs similarity index 100% rename from NzbDrone.Core/DecisionEngine/Specifications/LanguageSpecification.cs rename to src/NzbDrone.Core/DecisionEngine/Specifications/LanguageSpecification.cs diff --git a/NzbDrone.Core/DecisionEngine/Specifications/NotInQueueSpecification.cs b/src/NzbDrone.Core/DecisionEngine/Specifications/NotInQueueSpecification.cs similarity index 100% rename from NzbDrone.Core/DecisionEngine/Specifications/NotInQueueSpecification.cs rename to src/NzbDrone.Core/DecisionEngine/Specifications/NotInQueueSpecification.cs diff --git a/NzbDrone.Core/DecisionEngine/Specifications/NotRestrictedReleaseSpecification.cs b/src/NzbDrone.Core/DecisionEngine/Specifications/NotRestrictedReleaseSpecification.cs similarity index 100% rename from NzbDrone.Core/DecisionEngine/Specifications/NotRestrictedReleaseSpecification.cs rename to src/NzbDrone.Core/DecisionEngine/Specifications/NotRestrictedReleaseSpecification.cs diff --git a/NzbDrone.Core/DecisionEngine/Specifications/NotSampleSpecification.cs b/src/NzbDrone.Core/DecisionEngine/Specifications/NotSampleSpecification.cs similarity index 100% rename from NzbDrone.Core/DecisionEngine/Specifications/NotSampleSpecification.cs rename to src/NzbDrone.Core/DecisionEngine/Specifications/NotSampleSpecification.cs diff --git a/NzbDrone.Core/DecisionEngine/Specifications/QualityAllowedByProfileSpecification.cs b/src/NzbDrone.Core/DecisionEngine/Specifications/QualityAllowedByProfileSpecification.cs similarity index 100% rename from NzbDrone.Core/DecisionEngine/Specifications/QualityAllowedByProfileSpecification.cs rename to src/NzbDrone.Core/DecisionEngine/Specifications/QualityAllowedByProfileSpecification.cs diff --git a/NzbDrone.Core/DecisionEngine/Specifications/RetentionSpecification.cs b/src/NzbDrone.Core/DecisionEngine/Specifications/RetentionSpecification.cs similarity index 100% rename from NzbDrone.Core/DecisionEngine/Specifications/RetentionSpecification.cs rename to src/NzbDrone.Core/DecisionEngine/Specifications/RetentionSpecification.cs diff --git a/NzbDrone.Core/DecisionEngine/Specifications/RssSync/MonitoredEpisodeSpecification.cs b/src/NzbDrone.Core/DecisionEngine/Specifications/RssSync/MonitoredEpisodeSpecification.cs similarity index 100% rename from NzbDrone.Core/DecisionEngine/Specifications/RssSync/MonitoredEpisodeSpecification.cs rename to src/NzbDrone.Core/DecisionEngine/Specifications/RssSync/MonitoredEpisodeSpecification.cs diff --git a/NzbDrone.Core/DecisionEngine/Specifications/RssSync/ProperSpecification.cs b/src/NzbDrone.Core/DecisionEngine/Specifications/RssSync/ProperSpecification.cs similarity index 100% rename from NzbDrone.Core/DecisionEngine/Specifications/RssSync/ProperSpecification.cs rename to src/NzbDrone.Core/DecisionEngine/Specifications/RssSync/ProperSpecification.cs diff --git a/NzbDrone.Core/DecisionEngine/Specifications/RssSync/UpgradeHistorySpecification.cs b/src/NzbDrone.Core/DecisionEngine/Specifications/RssSync/UpgradeHistorySpecification.cs similarity index 100% rename from NzbDrone.Core/DecisionEngine/Specifications/RssSync/UpgradeHistorySpecification.cs rename to src/NzbDrone.Core/DecisionEngine/Specifications/RssSync/UpgradeHistorySpecification.cs diff --git a/NzbDrone.Core/DecisionEngine/Specifications/Search/DailyEpisodeMatchSpecification.cs b/src/NzbDrone.Core/DecisionEngine/Specifications/Search/DailyEpisodeMatchSpecification.cs similarity index 100% rename from NzbDrone.Core/DecisionEngine/Specifications/Search/DailyEpisodeMatchSpecification.cs rename to src/NzbDrone.Core/DecisionEngine/Specifications/Search/DailyEpisodeMatchSpecification.cs diff --git a/NzbDrone.Core/DecisionEngine/Specifications/Search/SeasonMatchSpecification.cs b/src/NzbDrone.Core/DecisionEngine/Specifications/Search/SeasonMatchSpecification.cs similarity index 100% rename from NzbDrone.Core/DecisionEngine/Specifications/Search/SeasonMatchSpecification.cs rename to src/NzbDrone.Core/DecisionEngine/Specifications/Search/SeasonMatchSpecification.cs diff --git a/NzbDrone.Core/DecisionEngine/Specifications/Search/SingleEpisodeMatchSpecification.cs b/src/NzbDrone.Core/DecisionEngine/Specifications/Search/SingleEpisodeMatchSpecification.cs similarity index 100% rename from NzbDrone.Core/DecisionEngine/Specifications/Search/SingleEpisodeMatchSpecification.cs rename to src/NzbDrone.Core/DecisionEngine/Specifications/Search/SingleEpisodeMatchSpecification.cs diff --git a/NzbDrone.Core/DecisionEngine/Specifications/Search/SingleEpisodeSearchMatchSpecification.cs b/src/NzbDrone.Core/DecisionEngine/Specifications/Search/SingleEpisodeSearchMatchSpecification.cs similarity index 100% rename from NzbDrone.Core/DecisionEngine/Specifications/Search/SingleEpisodeSearchMatchSpecification.cs rename to src/NzbDrone.Core/DecisionEngine/Specifications/Search/SingleEpisodeSearchMatchSpecification.cs diff --git a/NzbDrone.Core/DecisionEngine/Specifications/UpgradeDiskSpecification.cs b/src/NzbDrone.Core/DecisionEngine/Specifications/UpgradeDiskSpecification.cs similarity index 100% rename from NzbDrone.Core/DecisionEngine/Specifications/UpgradeDiskSpecification.cs rename to src/NzbDrone.Core/DecisionEngine/Specifications/UpgradeDiskSpecification.cs diff --git a/NzbDrone.Core/Download/Clients/BlackholeProvider.cs b/src/NzbDrone.Core/Download/Clients/BlackholeProvider.cs similarity index 100% rename from NzbDrone.Core/Download/Clients/BlackholeProvider.cs rename to src/NzbDrone.Core/Download/Clients/BlackholeProvider.cs diff --git a/NzbDrone.Core/Download/Clients/Nzbget/EnqueueResponse.cs b/src/NzbDrone.Core/Download/Clients/Nzbget/EnqueueResponse.cs similarity index 100% rename from NzbDrone.Core/Download/Clients/Nzbget/EnqueueResponse.cs rename to src/NzbDrone.Core/Download/Clients/Nzbget/EnqueueResponse.cs diff --git a/NzbDrone.Core/Download/Clients/Nzbget/ErrorModel.cs b/src/NzbDrone.Core/Download/Clients/Nzbget/ErrorModel.cs similarity index 100% rename from NzbDrone.Core/Download/Clients/Nzbget/ErrorModel.cs rename to src/NzbDrone.Core/Download/Clients/Nzbget/ErrorModel.cs diff --git a/NzbDrone.Core/Download/Clients/Nzbget/JsonError.cs b/src/NzbDrone.Core/Download/Clients/Nzbget/JsonError.cs similarity index 100% rename from NzbDrone.Core/Download/Clients/Nzbget/JsonError.cs rename to src/NzbDrone.Core/Download/Clients/Nzbget/JsonError.cs diff --git a/NzbDrone.Core/Download/Clients/Nzbget/JsonRequest.cs b/src/NzbDrone.Core/Download/Clients/Nzbget/JsonRequest.cs similarity index 100% rename from NzbDrone.Core/Download/Clients/Nzbget/JsonRequest.cs rename to src/NzbDrone.Core/Download/Clients/Nzbget/JsonRequest.cs diff --git a/NzbDrone.Core/Download/Clients/Nzbget/NzbGetQueue.cs b/src/NzbDrone.Core/Download/Clients/Nzbget/NzbGetQueue.cs similarity index 100% rename from NzbDrone.Core/Download/Clients/Nzbget/NzbGetQueue.cs rename to src/NzbDrone.Core/Download/Clients/Nzbget/NzbGetQueue.cs diff --git a/NzbDrone.Core/Download/Clients/Nzbget/NzbGetQueueItem.cs b/src/NzbDrone.Core/Download/Clients/Nzbget/NzbGetQueueItem.cs similarity index 100% rename from NzbDrone.Core/Download/Clients/Nzbget/NzbGetQueueItem.cs rename to src/NzbDrone.Core/Download/Clients/Nzbget/NzbGetQueueItem.cs diff --git a/NzbDrone.Core/Download/Clients/Nzbget/NzbgetClient.cs b/src/NzbDrone.Core/Download/Clients/Nzbget/NzbgetClient.cs similarity index 98% rename from NzbDrone.Core/Download/Clients/Nzbget/NzbgetClient.cs rename to src/NzbDrone.Core/Download/Clients/Nzbget/NzbgetClient.cs index ee94a2198..e7a53fde9 100644 --- a/NzbDrone.Core/Download/Clients/Nzbget/NzbgetClient.cs +++ b/src/NzbDrone.Core/Download/Clients/Nzbget/NzbgetClient.cs @@ -73,7 +73,7 @@ namespace NzbDrone.Core.Download.Clients.Nzbget queueItem.Id = nzbGetQueueItem.NzbId.ToString(); queueItem.Title = nzbGetQueueItem.NzbName; queueItem.Size = nzbGetQueueItem.FileSizeMb; - queueItem.SizeLeft = nzbGetQueueItem.RemainingSizeMb; + queueItem.Sizeleft = nzbGetQueueItem.RemainingSizeMb; yield return queueItem; } diff --git a/NzbDrone.Core/Download/Clients/Nzbget/PriorityType.cs b/src/NzbDrone.Core/Download/Clients/Nzbget/PriorityType.cs similarity index 100% rename from NzbDrone.Core/Download/Clients/Nzbget/PriorityType.cs rename to src/NzbDrone.Core/Download/Clients/Nzbget/PriorityType.cs diff --git a/NzbDrone.Core/Download/Clients/Nzbget/VersionModel.cs b/src/NzbDrone.Core/Download/Clients/Nzbget/VersionModel.cs similarity index 100% rename from NzbDrone.Core/Download/Clients/Nzbget/VersionModel.cs rename to src/NzbDrone.Core/Download/Clients/Nzbget/VersionModel.cs diff --git a/NzbDrone.Core/Download/Clients/PneumaticClient.cs b/src/NzbDrone.Core/Download/Clients/PneumaticClient.cs similarity index 100% rename from NzbDrone.Core/Download/Clients/PneumaticClient.cs rename to src/NzbDrone.Core/Download/Clients/PneumaticClient.cs diff --git a/NzbDrone.Core/Download/Clients/Sabnzbd/ConnectionInfoModel.cs b/src/NzbDrone.Core/Download/Clients/Sabnzbd/ConnectionInfoModel.cs similarity index 100% rename from NzbDrone.Core/Download/Clients/Sabnzbd/ConnectionInfoModel.cs rename to src/NzbDrone.Core/Download/Clients/Sabnzbd/ConnectionInfoModel.cs diff --git a/NzbDrone.Core/Download/Clients/Sabnzbd/JsonConverters/SabnzbdPriorityTypeConverter.cs b/src/NzbDrone.Core/Download/Clients/Sabnzbd/JsonConverters/SabnzbdPriorityTypeConverter.cs similarity index 100% rename from NzbDrone.Core/Download/Clients/Sabnzbd/JsonConverters/SabnzbdPriorityTypeConverter.cs rename to src/NzbDrone.Core/Download/Clients/Sabnzbd/JsonConverters/SabnzbdPriorityTypeConverter.cs diff --git a/NzbDrone.Core/Download/Clients/Sabnzbd/JsonConverters/SabnzbdQueueTimeConverter.cs b/src/NzbDrone.Core/Download/Clients/Sabnzbd/JsonConverters/SabnzbdQueueTimeConverter.cs similarity index 100% rename from NzbDrone.Core/Download/Clients/Sabnzbd/JsonConverters/SabnzbdQueueTimeConverter.cs rename to src/NzbDrone.Core/Download/Clients/Sabnzbd/JsonConverters/SabnzbdQueueTimeConverter.cs diff --git a/NzbDrone.Core/Download/Clients/Sabnzbd/SabAddResponse.cs b/src/NzbDrone.Core/Download/Clients/Sabnzbd/SabAddResponse.cs similarity index 100% rename from NzbDrone.Core/Download/Clients/Sabnzbd/SabAddResponse.cs rename to src/NzbDrone.Core/Download/Clients/Sabnzbd/SabAddResponse.cs diff --git a/NzbDrone.Core/Download/Clients/Sabnzbd/SabAutoConfigureService.cs b/src/NzbDrone.Core/Download/Clients/Sabnzbd/SabAutoConfigureService.cs similarity index 100% rename from NzbDrone.Core/Download/Clients/Sabnzbd/SabAutoConfigureService.cs rename to src/NzbDrone.Core/Download/Clients/Sabnzbd/SabAutoConfigureService.cs diff --git a/NzbDrone.Core/Download/Clients/Sabnzbd/SabCategoryModel.cs b/src/NzbDrone.Core/Download/Clients/Sabnzbd/SabCategoryModel.cs similarity index 100% rename from NzbDrone.Core/Download/Clients/Sabnzbd/SabCategoryModel.cs rename to src/NzbDrone.Core/Download/Clients/Sabnzbd/SabCategoryModel.cs diff --git a/NzbDrone.Core/Download/Clients/Sabnzbd/SabHistory.cs b/src/NzbDrone.Core/Download/Clients/Sabnzbd/SabHistory.cs similarity index 100% rename from NzbDrone.Core/Download/Clients/Sabnzbd/SabHistory.cs rename to src/NzbDrone.Core/Download/Clients/Sabnzbd/SabHistory.cs diff --git a/NzbDrone.Core/Download/Clients/Sabnzbd/SabHistoryItem.cs b/src/NzbDrone.Core/Download/Clients/Sabnzbd/SabHistoryItem.cs similarity index 100% rename from NzbDrone.Core/Download/Clients/Sabnzbd/SabHistoryItem.cs rename to src/NzbDrone.Core/Download/Clients/Sabnzbd/SabHistoryItem.cs diff --git a/NzbDrone.Core/Download/Clients/Sabnzbd/SabJsonError.cs b/src/NzbDrone.Core/Download/Clients/Sabnzbd/SabJsonError.cs similarity index 100% rename from NzbDrone.Core/Download/Clients/Sabnzbd/SabJsonError.cs rename to src/NzbDrone.Core/Download/Clients/Sabnzbd/SabJsonError.cs diff --git a/NzbDrone.Core/Download/Clients/Sabnzbd/SabModel.cs b/src/NzbDrone.Core/Download/Clients/Sabnzbd/SabModel.cs similarity index 100% rename from NzbDrone.Core/Download/Clients/Sabnzbd/SabModel.cs rename to src/NzbDrone.Core/Download/Clients/Sabnzbd/SabModel.cs diff --git a/NzbDrone.Core/Download/Clients/Sabnzbd/SabPriorityType.cs b/src/NzbDrone.Core/Download/Clients/Sabnzbd/SabPriorityType.cs similarity index 100% rename from NzbDrone.Core/Download/Clients/Sabnzbd/SabPriorityType.cs rename to src/NzbDrone.Core/Download/Clients/Sabnzbd/SabPriorityType.cs diff --git a/NzbDrone.Core/Download/Clients/Sabnzbd/SabQueue.cs b/src/NzbDrone.Core/Download/Clients/Sabnzbd/SabQueue.cs similarity index 100% rename from NzbDrone.Core/Download/Clients/Sabnzbd/SabQueue.cs rename to src/NzbDrone.Core/Download/Clients/Sabnzbd/SabQueue.cs diff --git a/NzbDrone.Core/Download/Clients/Sabnzbd/SabQueueItem.cs b/src/NzbDrone.Core/Download/Clients/Sabnzbd/SabQueueItem.cs similarity index 95% rename from NzbDrone.Core/Download/Clients/Sabnzbd/SabQueueItem.cs rename to src/NzbDrone.Core/Download/Clients/Sabnzbd/SabQueueItem.cs index b6fcdb0dd..bc233eb84 100644 --- a/NzbDrone.Core/Download/Clients/Sabnzbd/SabQueueItem.cs +++ b/src/NzbDrone.Core/Download/Clients/Sabnzbd/SabQueueItem.cs @@ -27,7 +27,7 @@ namespace NzbDrone.Core.Download.Clients.Sabnzbd public string Category { get; set; } [JsonProperty(PropertyName = "mbleft")] - public decimal SizeLeft { get; set; } + public decimal Sizeleft { get; set; } public int Percentage { get; set; } diff --git a/NzbDrone.Core/Download/Clients/Sabnzbd/SabVersionModel.cs b/src/NzbDrone.Core/Download/Clients/Sabnzbd/SabVersionModel.cs similarity index 100% rename from NzbDrone.Core/Download/Clients/Sabnzbd/SabVersionModel.cs rename to src/NzbDrone.Core/Download/Clients/Sabnzbd/SabVersionModel.cs diff --git a/NzbDrone.Core/Download/Clients/Sabnzbd/SabnzbdClient.cs b/src/NzbDrone.Core/Download/Clients/Sabnzbd/SabnzbdClient.cs similarity index 95% rename from NzbDrone.Core/Download/Clients/Sabnzbd/SabnzbdClient.cs rename to src/NzbDrone.Core/Download/Clients/Sabnzbd/SabnzbdClient.cs index 7a6eac544..3e36e941d 100644 --- a/NzbDrone.Core/Download/Clients/Sabnzbd/SabnzbdClient.cs +++ b/src/NzbDrone.Core/Download/Clients/Sabnzbd/SabnzbdClient.cs @@ -117,9 +117,11 @@ namespace NzbDrone.Core.Download.Clients.Sabnzbd queueItem.Id = sabQueueItem.Id; queueItem.Title = sabQueueItem.Title; queueItem.Size = sabQueueItem.Size; - queueItem.SizeLeft = sabQueueItem.Size; + queueItem.Sizeleft = sabQueueItem.Sizeleft; + queueItem.Timeleft = sabQueueItem.Timeleft; + queueItem.Status = sabQueueItem.Status; - queueItems.Add( queueItem); + queueItems.Add(queueItem); } return queueItems; @@ -221,7 +223,10 @@ namespace NzbDrone.Core.Download.Clients.Sabnzbd private string GetSabRequest(string action) { - return string.Format(@"http://{0}:{1}/api?{2}&apikey={3}&ma_username={4}&ma_password={5}", + var protocol = _configService.SabUseSsl ? "https" : "http"; + + return string.Format(@"{0}://{1}:{2}/api?{3}&apikey={4}&ma_username={5}&ma_password={6}", + protocol, _configService.SabHost, _configService.SabPort, action, diff --git a/NzbDrone.Core/Download/DownloadApprovedReports.cs b/src/NzbDrone.Core/Download/DownloadApprovedReports.cs similarity index 100% rename from NzbDrone.Core/Download/DownloadApprovedReports.cs rename to src/NzbDrone.Core/Download/DownloadApprovedReports.cs diff --git a/NzbDrone.Core/Download/DownloadClientProvider.cs b/src/NzbDrone.Core/Download/DownloadClientProvider.cs similarity index 100% rename from NzbDrone.Core/Download/DownloadClientProvider.cs rename to src/NzbDrone.Core/Download/DownloadClientProvider.cs diff --git a/NzbDrone.Core/Download/DownloadClientType.cs b/src/NzbDrone.Core/Download/DownloadClientType.cs similarity index 100% rename from NzbDrone.Core/Download/DownloadClientType.cs rename to src/NzbDrone.Core/Download/DownloadClientType.cs diff --git a/NzbDrone.Core/Download/DownloadService.cs b/src/NzbDrone.Core/Download/DownloadService.cs similarity index 100% rename from NzbDrone.Core/Download/DownloadService.cs rename to src/NzbDrone.Core/Download/DownloadService.cs diff --git a/NzbDrone.Core/Download/EpisodeGrabbedEvent.cs b/src/NzbDrone.Core/Download/EpisodeGrabbedEvent.cs similarity index 100% rename from NzbDrone.Core/Download/EpisodeGrabbedEvent.cs rename to src/NzbDrone.Core/Download/EpisodeGrabbedEvent.cs diff --git a/NzbDrone.Core/Download/IDownloadClient.cs b/src/NzbDrone.Core/Download/IDownloadClient.cs similarity index 100% rename from NzbDrone.Core/Download/IDownloadClient.cs rename to src/NzbDrone.Core/Download/IDownloadClient.cs diff --git a/NzbDrone.Core/Download/SabQueueItem.cs b/src/NzbDrone.Core/Download/QueueItem.cs similarity index 74% rename from NzbDrone.Core/Download/SabQueueItem.cs rename to src/NzbDrone.Core/Download/QueueItem.cs index eed0879ab..c63d98c1a 100644 --- a/NzbDrone.Core/Download/SabQueueItem.cs +++ b/src/NzbDrone.Core/Download/QueueItem.cs @@ -4,14 +4,11 @@ namespace NzbDrone.Core.Download { public class QueueItem { - public decimal Size { get; set; } - - public string Title { get; set; } - - public decimal SizeLeft { get; set; } - public string Id { get; set; } - + public decimal Size { get; set; } + public string Title { get; set; } + public decimal Sizeleft { get; set; } public TimeSpan Timeleft { get; set; } + public String Status { get; set; } } } diff --git a/NzbDrone.Core/Exceptions/BadRequestException.cs b/src/NzbDrone.Core/Exceptions/BadRequestException.cs similarity index 100% rename from NzbDrone.Core/Exceptions/BadRequestException.cs rename to src/NzbDrone.Core/Exceptions/BadRequestException.cs diff --git a/NzbDrone.Core/Exceptions/DownstreamException.cs b/src/NzbDrone.Core/Exceptions/DownstreamException.cs similarity index 100% rename from NzbDrone.Core/Exceptions/DownstreamException.cs rename to src/NzbDrone.Core/Exceptions/DownstreamException.cs diff --git a/NzbDrone.Core/Exceptions/NzbDroneClientException.cs b/src/NzbDrone.Core/Exceptions/NzbDroneClientException.cs similarity index 100% rename from NzbDrone.Core/Exceptions/NzbDroneClientException.cs rename to src/NzbDrone.Core/Exceptions/NzbDroneClientException.cs diff --git a/NzbDrone.Core/Exceptions/StatusCodeToExceptions.cs b/src/NzbDrone.Core/Exceptions/StatusCodeToExceptions.cs similarity index 100% rename from NzbDrone.Core/Exceptions/StatusCodeToExceptions.cs rename to src/NzbDrone.Core/Exceptions/StatusCodeToExceptions.cs diff --git a/NzbDrone.Core/Fluent.cs b/src/NzbDrone.Core/Fluent.cs similarity index 100% rename from NzbDrone.Core/Fluent.cs rename to src/NzbDrone.Core/Fluent.cs diff --git a/NzbDrone.Core/History/History.cs b/src/NzbDrone.Core/History/History.cs similarity index 100% rename from NzbDrone.Core/History/History.cs rename to src/NzbDrone.Core/History/History.cs diff --git a/NzbDrone.Core/History/HistoryRepository.cs b/src/NzbDrone.Core/History/HistoryRepository.cs similarity index 70% rename from NzbDrone.Core/History/HistoryRepository.cs rename to src/NzbDrone.Core/History/HistoryRepository.cs index a39e117ea..5a6cf5244 100644 --- a/NzbDrone.Core/History/HistoryRepository.cs +++ b/src/NzbDrone.Core/History/HistoryRepository.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Linq.Expressions; using Marr.Data.QGen; using NzbDrone.Core.Datastore; using NzbDrone.Core.Messaging.Events; @@ -11,7 +12,7 @@ namespace NzbDrone.Core.History public interface IHistoryRepository : IBasicRepository { void Trim(); - List GetEpisodeHistory(int episodeId); + List GetBestQualityInHistory(int episodeId); } public class HistoryRepository : BasicRepository, IHistoryRepository @@ -30,7 +31,7 @@ namespace NzbDrone.Core.History Delete(c=> c.Date < cutoff); } - public List GetEpisodeHistory(int episodeId) + public List GetBestQualityInHistory(int episodeId) { var history = Query.Where(c => c.EpisodeId == episodeId); @@ -39,18 +40,20 @@ namespace NzbDrone.Core.History public override PagingSpec GetPaged(PagingSpec pagingSpec) { - var pagingQuery = Query.Join(JoinType.Inner, h => h.Series, (h, s) => h.SeriesId == s.Id) - .Join(JoinType.Inner, h => h.Episode, (h, e) => h.EpisodeId == e.Id) - .OrderBy(pagingSpec.OrderByClause(), pagingSpec.ToSortDirection()) - .Skip(pagingSpec.PagingOffset()) - .Take(pagingSpec.PageSize); - - pagingSpec.Records = pagingQuery.ToList(); - - //TODO: Use the same query for count and records - pagingSpec.TotalRecords = Count(); + pagingSpec.Records = GetPagedQuery(pagingSpec).ToList(); + pagingSpec.TotalRecords = GetPagedQuery(pagingSpec).GetRowCount(); return pagingSpec; } + + private SortBuilder GetPagedQuery(PagingSpec pagingSpec) + { + return Query.Join(JoinType.Inner, h => h.Series, (h, s) => h.SeriesId == s.Id) + .Join(JoinType.Inner, h => h.Episode, (h, e) => h.EpisodeId == e.Id) + .Where(pagingSpec.FilterExpression) + .OrderBy(pagingSpec.OrderByClause(), pagingSpec.ToSortDirection()) + .Skip(pagingSpec.PagingOffset()) + .Take(pagingSpec.PageSize); + } } } \ No newline at end of file diff --git a/NzbDrone.Core/History/HistoryService.cs b/src/NzbDrone.Core/History/HistoryService.cs similarity index 95% rename from NzbDrone.Core/History/HistoryService.cs rename to src/NzbDrone.Core/History/HistoryService.cs index 64736c9f0..ed09ae94e 100644 --- a/NzbDrone.Core/History/HistoryService.cs +++ b/src/NzbDrone.Core/History/HistoryService.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Linq.Expressions; using NLog; using NzbDrone.Core.Datastore; using NzbDrone.Core.Download; @@ -52,7 +53,7 @@ namespace NzbDrone.Core.History public virtual QualityModel GetBestQualityInHistory(int episodeId) { - return _historyRepository.GetEpisodeHistory(episodeId).OrderByDescending(q => q).FirstOrDefault(); + return _historyRepository.GetBestQualityInHistory(episodeId).OrderByDescending(q => q).FirstOrDefault(); } public void Handle(EpisodeGrabbedEvent message) diff --git a/NzbDrone.Core/Housekeeping/Housekeepers/CleanupOrphanedEpisodes.cs b/src/NzbDrone.Core/Housekeeping/Housekeepers/CleanupOrphanedEpisodes.cs similarity index 100% rename from NzbDrone.Core/Housekeeping/Housekeepers/CleanupOrphanedEpisodes.cs rename to src/NzbDrone.Core/Housekeeping/Housekeepers/CleanupOrphanedEpisodes.cs diff --git a/NzbDrone.Core/Housekeeping/Housekeepers/CleanupOrphanedHistoryItems.cs b/src/NzbDrone.Core/Housekeeping/Housekeepers/CleanupOrphanedHistoryItems.cs similarity index 100% rename from NzbDrone.Core/Housekeeping/Housekeepers/CleanupOrphanedHistoryItems.cs rename to src/NzbDrone.Core/Housekeeping/Housekeepers/CleanupOrphanedHistoryItems.cs diff --git a/NzbDrone.Core/Housekeeping/HousekeepingCommand.cs b/src/NzbDrone.Core/Housekeeping/HousekeepingCommand.cs similarity index 100% rename from NzbDrone.Core/Housekeeping/HousekeepingCommand.cs rename to src/NzbDrone.Core/Housekeeping/HousekeepingCommand.cs diff --git a/NzbDrone.Core/Housekeeping/HousekeepingService.cs b/src/NzbDrone.Core/Housekeeping/HousekeepingService.cs similarity index 100% rename from NzbDrone.Core/Housekeeping/HousekeepingService.cs rename to src/NzbDrone.Core/Housekeeping/HousekeepingService.cs diff --git a/NzbDrone.Core/Housekeeping/IHousekeepingTask.cs b/src/NzbDrone.Core/Housekeeping/IHousekeepingTask.cs similarity index 100% rename from NzbDrone.Core/Housekeeping/IHousekeepingTask.cs rename to src/NzbDrone.Core/Housekeeping/IHousekeepingTask.cs diff --git a/NzbDrone.Core/IndexerSearch/Definitions/DailyEpisodeSearchCriteria.cs b/src/NzbDrone.Core/IndexerSearch/Definitions/DailyEpisodeSearchCriteria.cs similarity index 100% rename from NzbDrone.Core/IndexerSearch/Definitions/DailyEpisodeSearchCriteria.cs rename to src/NzbDrone.Core/IndexerSearch/Definitions/DailyEpisodeSearchCriteria.cs diff --git a/NzbDrone.Core/IndexerSearch/Definitions/SearchCriteriaBase.cs b/src/NzbDrone.Core/IndexerSearch/Definitions/SearchCriteriaBase.cs similarity index 100% rename from NzbDrone.Core/IndexerSearch/Definitions/SearchCriteriaBase.cs rename to src/NzbDrone.Core/IndexerSearch/Definitions/SearchCriteriaBase.cs diff --git a/NzbDrone.Core/IndexerSearch/Definitions/SeasonSearchCriteria.cs b/src/NzbDrone.Core/IndexerSearch/Definitions/SeasonSearchCriteria.cs similarity index 100% rename from NzbDrone.Core/IndexerSearch/Definitions/SeasonSearchCriteria.cs rename to src/NzbDrone.Core/IndexerSearch/Definitions/SeasonSearchCriteria.cs diff --git a/NzbDrone.Core/IndexerSearch/Definitions/SingleEpisodeSearchCriteria.cs b/src/NzbDrone.Core/IndexerSearch/Definitions/SingleEpisodeSearchCriteria.cs similarity index 100% rename from NzbDrone.Core/IndexerSearch/Definitions/SingleEpisodeSearchCriteria.cs rename to src/NzbDrone.Core/IndexerSearch/Definitions/SingleEpisodeSearchCriteria.cs diff --git a/NzbDrone.Core/IndexerSearch/EpisodeSearchCommand.cs b/src/NzbDrone.Core/IndexerSearch/EpisodeSearchCommand.cs similarity index 65% rename from NzbDrone.Core/IndexerSearch/EpisodeSearchCommand.cs rename to src/NzbDrone.Core/IndexerSearch/EpisodeSearchCommand.cs index b69659b77..27861c869 100644 --- a/NzbDrone.Core/IndexerSearch/EpisodeSearchCommand.cs +++ b/src/NzbDrone.Core/IndexerSearch/EpisodeSearchCommand.cs @@ -1,10 +1,11 @@ -using NzbDrone.Core.Messaging.Commands; +using System.Collections.Generic; +using NzbDrone.Core.Messaging.Commands; namespace NzbDrone.Core.IndexerSearch { public class EpisodeSearchCommand : Command { - public int EpisodeId { get; set; } + public List EpisodeIds { get; set; } public override bool SendUpdatesToClient { diff --git a/NzbDrone.Core/IndexerSearch/EpisodeSearchService.cs b/src/NzbDrone.Core/IndexerSearch/EpisodeSearchService.cs similarity index 70% rename from NzbDrone.Core/IndexerSearch/EpisodeSearchService.cs rename to src/NzbDrone.Core/IndexerSearch/EpisodeSearchService.cs index 34fba629d..f365b1fd5 100644 --- a/NzbDrone.Core/IndexerSearch/EpisodeSearchService.cs +++ b/src/NzbDrone.Core/IndexerSearch/EpisodeSearchService.cs @@ -22,10 +22,13 @@ namespace NzbDrone.Core.IndexerSearch public void Execute(EpisodeSearchCommand message) { - var decisions = _nzbSearchService.EpisodeSearch(message.EpisodeId); - var downloaded = _downloadApprovedReports.DownloadApproved(decisions); + foreach (var episodeId in message.EpisodeIds) + { + var decisions = _nzbSearchService.EpisodeSearch(episodeId); + var downloaded = _downloadApprovedReports.DownloadApproved(decisions); - _logger.ProgressInfo("Episode search completed. {0} reports downloaded.", downloaded.Count); + _logger.ProgressInfo("Episode search completed. {0} reports downloaded.", downloaded.Count); + } } } } diff --git a/NzbDrone.Core/IndexerSearch/NzbSearchService.cs b/src/NzbDrone.Core/IndexerSearch/NzbSearchService.cs similarity index 96% rename from NzbDrone.Core/IndexerSearch/NzbSearchService.cs rename to src/NzbDrone.Core/IndexerSearch/NzbSearchService.cs index 5770687b8..96b52e8cf 100644 --- a/NzbDrone.Core/IndexerSearch/NzbSearchService.cs +++ b/src/NzbDrone.Core/IndexerSearch/NzbSearchService.cs @@ -24,7 +24,7 @@ namespace NzbDrone.Core.IndexerSearch public class NzbSearchService : ISearchForNzb { - private readonly IIndexerService _indexerService; + private readonly IIndexerFactory _indexerFactory; private readonly IFetchFeedFromIndexers _feedFetcher; private readonly ISceneMappingService _sceneMapping; private readonly ISeriesService _seriesService; @@ -32,7 +32,7 @@ namespace NzbDrone.Core.IndexerSearch private readonly IMakeDownloadDecision _makeDownloadDecision; private readonly Logger _logger; - public NzbSearchService(IIndexerService indexerService, + public NzbSearchService(IIndexerFactory indexerFactory, IFetchFeedFromIndexers feedFetcher, ISceneMappingService sceneMapping, ISeriesService seriesService, @@ -40,7 +40,7 @@ namespace NzbDrone.Core.IndexerSearch IMakeDownloadDecision makeDownloadDecision, Logger logger) { - _indexerService = indexerService; + _indexerFactory = indexerFactory; _feedFetcher = feedFetcher; _sceneMapping = sceneMapping; _seriesService = seriesService; @@ -132,7 +132,7 @@ namespace NzbDrone.Core.IndexerSearch private List Dispatch(Func> searchAction, SearchCriteriaBase criteriaBase) { - var indexers = _indexerService.GetAvailableIndexers().ToList(); + var indexers = _indexerFactory.GetAvailableProviders().ToList(); var reports = new List(); _logger.ProgressInfo("Searching {0} indexers for {1}", indexers.Count, criteriaBase); diff --git a/NzbDrone.Core/IndexerSearch/SearchAndDownloadService.cs b/src/NzbDrone.Core/IndexerSearch/SearchAndDownloadService.cs similarity index 100% rename from NzbDrone.Core/IndexerSearch/SearchAndDownloadService.cs rename to src/NzbDrone.Core/IndexerSearch/SearchAndDownloadService.cs diff --git a/NzbDrone.Core/IndexerSearch/SeasonSearchCommand.cs b/src/NzbDrone.Core/IndexerSearch/SeasonSearchCommand.cs similarity index 100% rename from NzbDrone.Core/IndexerSearch/SeasonSearchCommand.cs rename to src/NzbDrone.Core/IndexerSearch/SeasonSearchCommand.cs diff --git a/NzbDrone.Core/IndexerSearch/SeasonSearchService.cs b/src/NzbDrone.Core/IndexerSearch/SeasonSearchService.cs similarity index 100% rename from NzbDrone.Core/IndexerSearch/SeasonSearchService.cs rename to src/NzbDrone.Core/IndexerSearch/SeasonSearchService.cs diff --git a/NzbDrone.Core/IndexerSearch/SeriesSearchCommand.cs b/src/NzbDrone.Core/IndexerSearch/SeriesSearchCommand.cs similarity index 100% rename from NzbDrone.Core/IndexerSearch/SeriesSearchCommand.cs rename to src/NzbDrone.Core/IndexerSearch/SeriesSearchCommand.cs diff --git a/NzbDrone.Core/IndexerSearch/SeriesSearchService.cs b/src/NzbDrone.Core/IndexerSearch/SeriesSearchService.cs similarity index 100% rename from NzbDrone.Core/IndexerSearch/SeriesSearchService.cs rename to src/NzbDrone.Core/IndexerSearch/SeriesSearchService.cs diff --git a/NzbDrone.Core/Indexers/BasicTorrentRssParser.cs b/src/NzbDrone.Core/Indexers/BasicTorrentRssParser.cs similarity index 100% rename from NzbDrone.Core/Indexers/BasicTorrentRssParser.cs rename to src/NzbDrone.Core/Indexers/BasicTorrentRssParser.cs diff --git a/NzbDrone.Core/Indexers/DownloadProtocols.cs b/src/NzbDrone.Core/Indexers/DownloadProtocols.cs similarity index 100% rename from NzbDrone.Core/Indexers/DownloadProtocols.cs rename to src/NzbDrone.Core/Indexers/DownloadProtocols.cs diff --git a/NzbDrone.Core/Indexers/Exceptions/ApiKeyException.cs b/src/NzbDrone.Core/Indexers/Exceptions/ApiKeyException.cs similarity index 100% rename from NzbDrone.Core/Indexers/Exceptions/ApiKeyException.cs rename to src/NzbDrone.Core/Indexers/Exceptions/ApiKeyException.cs diff --git a/NzbDrone.Core/Indexers/Eztv/Eztv.cs b/src/NzbDrone.Core/Indexers/Eztv/Eztv.cs similarity index 71% rename from NzbDrone.Core/Indexers/Eztv/Eztv.cs rename to src/NzbDrone.Core/Indexers/Eztv/Eztv.cs index 541f3a078..52c55df60 100644 --- a/NzbDrone.Core/Indexers/Eztv/Eztv.cs +++ b/src/NzbDrone.Core/Indexers/Eztv/Eztv.cs @@ -1,28 +1,19 @@ using System; using System.Collections.Generic; +using NzbDrone.Core.ThingiProvider; namespace NzbDrone.Core.Indexers.Eztv { - public class Eztv : IndexerBase + public class Eztv : IndexerBase { - public override string Name - { - get { return "Eztv"; } - } - - public override IndexerKind Kind + public override DownloadProtocol Protocol { get { - return IndexerKind.Torrent; + return DownloadProtocol.Torrent; } } - public override bool EnableByDefault - { - get { return false; } - } - public override IParseFeed Parser { get @@ -35,10 +26,7 @@ namespace NzbDrone.Core.Indexers.Eztv { get { - return new[] - { - "http://www.ezrss.it/feed/" - }; + yield return "http://www.ezrss.it/feed/"; } } @@ -55,7 +43,7 @@ namespace NzbDrone.Core.Indexers.Eztv public override IEnumerable GetDailyEpisodeSearchUrls(string seriesTitle, int tvRageId, DateTime date) { - //EZTV doesn't support searching based on actual epidose airdate. they only support release date. + //EZTV doesn't support searching based on actual episode airdate. they only support release date. return new string[0]; } } diff --git a/NzbDrone.Core/Indexers/FetchAndParseRssService.cs b/src/NzbDrone.Core/Indexers/FetchAndParseRssService.cs similarity index 84% rename from NzbDrone.Core/Indexers/FetchAndParseRssService.cs rename to src/NzbDrone.Core/Indexers/FetchAndParseRssService.cs index c9633c8d0..534668b6b 100644 --- a/NzbDrone.Core/Indexers/FetchAndParseRssService.cs +++ b/src/NzbDrone.Core/Indexers/FetchAndParseRssService.cs @@ -14,13 +14,13 @@ namespace NzbDrone.Core.Indexers public class FetchAndParseRssService : IFetchAndParseRss { - private readonly IIndexerService _indexerService; + private readonly IIndexerFactory _indexerFactory; private readonly IFetchFeedFromIndexers _feedFetcher; private readonly Logger _logger; - public FetchAndParseRssService(IIndexerService indexerService, IFetchFeedFromIndexers feedFetcher, Logger logger) + public FetchAndParseRssService(IIndexerFactory indexerFactory, IFetchFeedFromIndexers feedFetcher, Logger logger) { - _indexerService = indexerService; + _indexerFactory = indexerFactory; _feedFetcher = feedFetcher; _logger = logger; } @@ -29,7 +29,7 @@ namespace NzbDrone.Core.Indexers { var result = new List(); - var indexers = _indexerService.GetAvailableIndexers().ToList(); + var indexers = _indexerFactory.GetAvailableProviders().ToList(); if (!indexers.Any()) { diff --git a/NzbDrone.Core/Indexers/IIndexer.cs b/src/NzbDrone.Core/Indexers/IIndexer.cs similarity index 65% rename from NzbDrone.Core/Indexers/IIndexer.cs rename to src/NzbDrone.Core/Indexers/IIndexer.cs index a681ae3df..34daa6a26 100644 --- a/NzbDrone.Core/Indexers/IIndexer.cs +++ b/src/NzbDrone.Core/Indexers/IIndexer.cs @@ -1,23 +1,15 @@ using System; using System.Collections.Generic; +using NzbDrone.Core.ThingiProvider; namespace NzbDrone.Core.Indexers { - public interface IIndexer + public interface IIndexer : IProvider { - string Name { get; } - - bool EnableByDefault { get; } - - IEnumerable DefaultDefinitions { get; } - - IndexerDefinition InstanceDefinition { get; set; } + IParseFeed Parser { get; } + DownloadProtocol Protocol { get; } IEnumerable RecentFeed { get; } - - IParseFeed Parser { get; } - IndexerKind Kind { get; } - IEnumerable GetEpisodeSearchUrls(string seriesTitle, int tvRageId, int seasonNumber, int episodeNumber); IEnumerable GetDailyEpisodeSearchUrls(string seriesTitle, int tvRageId, DateTime date); IEnumerable GetSeasonSearchUrls(string seriesTitle, int tvRageId, int seasonNumber, int offset); diff --git a/NzbDrone.Core/Indexers/IParseFeed.cs b/src/NzbDrone.Core/Indexers/IParseFeed.cs similarity index 100% rename from NzbDrone.Core/Indexers/IParseFeed.cs rename to src/NzbDrone.Core/Indexers/IParseFeed.cs diff --git a/src/NzbDrone.Core/Indexers/IndexerBase.cs b/src/NzbDrone.Core/Indexers/IndexerBase.cs new file mode 100644 index 000000000..41942d35b --- /dev/null +++ b/src/NzbDrone.Core/Indexers/IndexerBase.cs @@ -0,0 +1,64 @@ +using System; +using System.Collections.Generic; +using NzbDrone.Core.ThingiProvider; + +namespace NzbDrone.Core.Indexers +{ + public abstract class IndexerBase : IIndexer where TSettings : IProviderConfig, new() + { + public Type ConfigContract + { + get + { + return typeof(TSettings); + } + } + + public virtual IEnumerable DefaultDefinitions + { + get + { + var config = (IProviderConfig)new TSettings(); + + yield return new IndexerDefinition + { + Name = GetType().Name, + Enable = config.Validate().IsValid, + Implementation = GetType().Name, + Settings = config + }; + } + } + + public ProviderDefinition Definition { get; set; } + + public abstract DownloadProtocol Protocol { get; } + + protected TSettings Settings + { + get + { + return (TSettings)Definition.Settings; + } + } + + public virtual IParseFeed Parser { get; private set; } + + public abstract IEnumerable RecentFeed { get; } + public abstract IEnumerable GetEpisodeSearchUrls(string seriesTitle, int tvRageId, int seasonNumber, int episodeNumber); + public abstract IEnumerable GetDailyEpisodeSearchUrls(string seriesTitle, int tvRageId, DateTime date); + public abstract IEnumerable GetSeasonSearchUrls(string seriesTitle, int tvRageId, int seasonNumber, int offset); + + + public override string ToString() + { + return GetType().Name; + } + } + + public enum DownloadProtocol + { + Usenet, + Torrent + } +} \ No newline at end of file diff --git a/src/NzbDrone.Core/Indexers/IndexerDefinition.cs b/src/NzbDrone.Core/Indexers/IndexerDefinition.cs new file mode 100644 index 000000000..5909532b4 --- /dev/null +++ b/src/NzbDrone.Core/Indexers/IndexerDefinition.cs @@ -0,0 +1,8 @@ +using NzbDrone.Core.ThingiProvider; + +namespace NzbDrone.Core.Indexers +{ + public class IndexerDefinition : ProviderDefinition + { + } +} \ No newline at end of file diff --git a/src/NzbDrone.Core/Indexers/IndexerFactory.cs b/src/NzbDrone.Core/Indexers/IndexerFactory.cs new file mode 100644 index 000000000..b89f0d539 --- /dev/null +++ b/src/NzbDrone.Core/Indexers/IndexerFactory.cs @@ -0,0 +1,41 @@ +using System.Collections.Generic; +using System.Linq; +using NLog; +using NzbDrone.Core.ThingiProvider; + +namespace NzbDrone.Core.Indexers +{ + public interface IIndexerFactory : IProviderFactory + { + + } + + public class IndexerFactory : ProviderFactory, IIndexerFactory + { + private readonly IIndexerRepository _providerRepository; + private readonly IEnumerable _providers; + + public IndexerFactory(IIndexerRepository providerRepository, IEnumerable providers, Logger logger) + : base(providerRepository, providers, logger) + { + _providerRepository = providerRepository; + _providers = providers; + } + + protected override void InitializeProviders() + { + var definitions = _providers.Where(c => c.Protocol == DownloadProtocol.Usenet) + .SelectMany(indexer => indexer.DefaultDefinitions); + + var currentProviders = All(); + + var newProviders = definitions.Where(def => currentProviders.All(c => c.Implementation != def.Implementation)).ToList(); + + + if (newProviders.Any()) + { + _providerRepository.InsertMany(newProviders.Cast().ToList()); + } + } + } +} \ No newline at end of file diff --git a/NzbDrone.Core/Indexers/IndexerFetchService.cs b/src/NzbDrone.Core/Indexers/IndexerFetchService.cs similarity index 88% rename from NzbDrone.Core/Indexers/IndexerFetchService.cs rename to src/NzbDrone.Core/Indexers/IndexerFetchService.cs index ba284c8b7..b571f6466 100644 --- a/NzbDrone.Core/Indexers/IndexerFetchService.cs +++ b/src/NzbDrone.Core/Indexers/IndexerFetchService.cs @@ -33,11 +33,11 @@ namespace NzbDrone.Core.Indexers public virtual IList FetchRss(IIndexer indexer) { - _logger.Debug("Fetching feeds from " + indexer.Name); + _logger.Debug("Fetching feeds from " + indexer); var result = Fetch(indexer, indexer.RecentFeed); - _logger.Debug("Finished processing feeds from " + indexer.Name); + _logger.Debug("Finished processing feeds from " + indexer); return result; } @@ -48,7 +48,7 @@ namespace NzbDrone.Core.Indexers var result = Fetch(indexer, searchCriteria, 0).DistinctBy(c => c.DownloadUrl).ToList(); - _logger.Info("Finished searching {0} for {1}. Found {2}", indexer.Name, searchCriteria, result.Count); + _logger.Info("Finished searching {0} for {1}. Found {2}", indexer, searchCriteria, result.Count); return result; } @@ -61,7 +61,7 @@ namespace NzbDrone.Core.Indexers var result = Fetch(indexer, searchUrls); - _logger.Info("{0} offset {1}. Found {2}", indexer.Name, searchCriteria, result.Count); + _logger.Info("{0} offset {1}. Found {2}", indexer, searchCriteria, result.Count); if (result.Count > 90) { @@ -79,7 +79,7 @@ namespace NzbDrone.Core.Indexers var result = Fetch(indexer, searchUrls); - _logger.Info("Finished searching {0} for {1}. Found {2}", indexer.Name, searchCriteria, result.Count); + _logger.Info("Finished searching {0} for {1}. Found {2}", indexer, searchCriteria, result.Count); return result; } @@ -90,7 +90,7 @@ namespace NzbDrone.Core.Indexers var searchUrls = indexer.GetDailyEpisodeSearchUrls(searchCriteria.QueryTitle, searchCriteria.Series.TvRageId, searchCriteria.Airtime); var result = Fetch(indexer, searchUrls); - _logger.Info("Finished searching {0} for {1}. Found {2}", indexer.Name, searchCriteria, result.Count); + _logger.Info("Finished searching {0} for {1}. Found {2}", indexer, searchCriteria, result.Count); return result; } @@ -119,17 +119,16 @@ namespace NzbDrone.Core.Indexers if (webException.Message.Contains("502") || webException.Message.Contains("503") || webException.Message.Contains("timed out")) { - _logger.Warn("{0} server is currently unavailable. {1} {2}", indexer.Name, url, - webException.Message); + _logger.Warn("{0} server is currently unavailable. {1} {2}", indexer, url, webException.Message); } else { - _logger.Warn("{0} {1} {2}", indexer.Name, url, webException.Message); + _logger.Warn("{0} {1} {2}", indexer, url, webException.Message); } } catch (ApiKeyException) { - _logger.Warn("Invalid API Key for {0} {1}", indexer.Name, url); + _logger.Warn("Invalid API Key for {0} {1}", indexer, url); } catch (Exception feedEx) { @@ -138,7 +137,7 @@ namespace NzbDrone.Core.Indexers } } - result.ForEach(c => c.Indexer = indexer.Name); + result.ForEach(c => c.Indexer = indexer.Definition.Name); return result; } diff --git a/src/NzbDrone.Core/Indexers/IndexerRepository.cs b/src/NzbDrone.Core/Indexers/IndexerRepository.cs new file mode 100644 index 000000000..269bb5507 --- /dev/null +++ b/src/NzbDrone.Core/Indexers/IndexerRepository.cs @@ -0,0 +1,20 @@ +using NzbDrone.Core.Datastore; +using NzbDrone.Core.Messaging.Events; +using NzbDrone.Core.ThingiProvider; + + +namespace NzbDrone.Core.Indexers +{ + public interface IIndexerRepository : IProviderRepository + { + + } + + public class IndexerRepository : ProviderRepository, IIndexerRepository + { + public IndexerRepository(IDatabase database, IEventAggregator eventAggregator) + : base(database, eventAggregator) + { + } + } +} diff --git a/NzbDrone.Core/Indexers/IndexerSettingUpdatedEvent.cs b/src/NzbDrone.Core/Indexers/IndexerSettingUpdatedEvent.cs similarity index 60% rename from NzbDrone.Core/Indexers/IndexerSettingUpdatedEvent.cs rename to src/NzbDrone.Core/Indexers/IndexerSettingUpdatedEvent.cs index 8b3edc513..783948b2e 100644 --- a/NzbDrone.Core/Indexers/IndexerSettingUpdatedEvent.cs +++ b/src/NzbDrone.Core/Indexers/IndexerSettingUpdatedEvent.cs @@ -1,13 +1,14 @@ using NzbDrone.Common.Messaging; +using NzbDrone.Core.ThingiProvider; namespace NzbDrone.Core.Indexers { public class IndexerSettingUpdatedEvent : IEvent { public string IndexerName { get; private set; } - public IIndexerSetting IndexerSetting { get; private set; } + public IProviderConfig IndexerSetting { get; private set; } - public IndexerSettingUpdatedEvent(string indexerName, IIndexerSetting indexerSetting) + public IndexerSettingUpdatedEvent(string indexerName, IProviderConfig indexerSetting) { IndexerName = indexerName; IndexerSetting = indexerSetting; diff --git a/NzbDrone.Core/Indexers/Newznab/Newznab.cs b/src/NzbDrone.Core/Indexers/Newznab/Newznab.cs similarity index 87% rename from NzbDrone.Core/Indexers/Newznab/Newznab.cs rename to src/NzbDrone.Core/Indexers/Newznab/Newznab.cs index 8a13d2282..a4c106846 100644 --- a/NzbDrone.Core/Indexers/Newznab/Newznab.cs +++ b/src/NzbDrone.Core/Indexers/Newznab/Newznab.cs @@ -2,10 +2,11 @@ using System.Collections.Generic; using System.Linq; using NzbDrone.Common.Serializer; +using NzbDrone.Core.ThingiProvider; namespace NzbDrone.Core.Indexers.Newznab { - public class Newznab : IndexerWithSetting + public class Newznab : IndexerBase { public override IParseFeed Parser { @@ -15,7 +16,7 @@ namespace NzbDrone.Core.Indexers.Newznab } } - public override IEnumerable DefaultDefinitions + public override IEnumerable DefaultDefinitions { get { @@ -51,7 +52,7 @@ namespace NzbDrone.Core.Indexers.Newznab } } - private string GetSettings(string url, List categories) + private NewznabSettings GetSettings(string url, List categories) { var settings = new NewznabSettings { Url = url }; @@ -60,7 +61,7 @@ namespace NzbDrone.Core.Indexers.Newznab settings.Categories = categories; } - return settings.ToJson(); + return settings; } public override IEnumerable RecentFeed @@ -68,7 +69,7 @@ namespace NzbDrone.Core.Indexers.Newznab get { //Todo: We should be able to update settings on start - if (Name.Equals("nzbs.org", StringComparison.InvariantCultureIgnoreCase)) + if (Settings.Url.Contains("nzbs.org")) { Settings.Categories = new List { 5000 }; } @@ -114,19 +115,11 @@ namespace NzbDrone.Core.Indexers.Newznab return RecentFeed.Select(url => String.Format("{0}&limit=100&q={1}&season={2}&offset={3}", url, NewsnabifyTitle(seriesTitle), seasonNumber, offset)); } - public override string Name + public override DownloadProtocol Protocol { get { - return InstanceDefinition.Name; - } - } - - public override IndexerKind Kind - { - get - { - return IndexerKind.Usenet; + return DownloadProtocol.Usenet; } } @@ -135,4 +128,4 @@ namespace NzbDrone.Core.Indexers.Newznab return title.Replace("+", "%20"); } } -} \ No newline at end of file +} diff --git a/NzbDrone.Core/Indexers/Newznab/NewznabException.cs b/src/NzbDrone.Core/Indexers/Newznab/NewznabException.cs similarity index 100% rename from NzbDrone.Core/Indexers/Newznab/NewznabException.cs rename to src/NzbDrone.Core/Indexers/Newznab/NewznabException.cs diff --git a/NzbDrone.Core/Indexers/Newznab/NewznabParser.cs b/src/NzbDrone.Core/Indexers/Newznab/NewznabParser.cs similarity index 100% rename from NzbDrone.Core/Indexers/Newznab/NewznabParser.cs rename to src/NzbDrone.Core/Indexers/Newznab/NewznabParser.cs diff --git a/NzbDrone.Core/Indexers/Newznab/NewznabPreProcessor.cs b/src/NzbDrone.Core/Indexers/Newznab/NewznabPreProcessor.cs similarity index 100% rename from NzbDrone.Core/Indexers/Newznab/NewznabPreProcessor.cs rename to src/NzbDrone.Core/Indexers/Newznab/NewznabPreProcessor.cs diff --git a/NzbDrone.Core/Indexers/Newznab/NewznabSettings.cs b/src/NzbDrone.Core/Indexers/Newznab/NewznabSettings.cs similarity index 91% rename from NzbDrone.Core/Indexers/Newznab/NewznabSettings.cs rename to src/NzbDrone.Core/Indexers/Newznab/NewznabSettings.cs index c83623ace..5f05ba96d 100644 --- a/NzbDrone.Core/Indexers/Newznab/NewznabSettings.cs +++ b/src/NzbDrone.Core/Indexers/Newznab/NewznabSettings.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using FluentValidation; using FluentValidation.Results; using NzbDrone.Core.Annotations; +using NzbDrone.Core.ThingiProvider; using NzbDrone.Core.Validation; namespace NzbDrone.Core.Indexers.Newznab @@ -16,7 +17,7 @@ namespace NzbDrone.Core.Indexers.Newznab } - public class NewznabSettings : IIndexerSetting + public class NewznabSettings : IProviderConfig { private static readonly NewznabSettingsValidator Validator = new NewznabSettingsValidator(); diff --git a/NzbDrone.Core/Indexers/Newznab/SizeParsingException.cs b/src/NzbDrone.Core/Indexers/Newznab/SizeParsingException.cs similarity index 100% rename from NzbDrone.Core/Indexers/Newznab/SizeParsingException.cs rename to src/NzbDrone.Core/Indexers/Newznab/SizeParsingException.cs diff --git a/NzbDrone.Core/Indexers/NewznabTestService.cs b/src/NzbDrone.Core/Indexers/NewznabTestService.cs similarity index 100% rename from NzbDrone.Core/Indexers/NewznabTestService.cs rename to src/NzbDrone.Core/Indexers/NewznabTestService.cs diff --git a/NzbDrone.Core/Indexers/Omgwtfnzbs/Omgwtfnzbs.cs b/src/NzbDrone.Core/Indexers/Omgwtfnzbs/Omgwtfnzbs.cs similarity index 88% rename from NzbDrone.Core/Indexers/Omgwtfnzbs/Omgwtfnzbs.cs rename to src/NzbDrone.Core/Indexers/Omgwtfnzbs/Omgwtfnzbs.cs index 15f6dbbe5..c4daeab66 100644 --- a/NzbDrone.Core/Indexers/Omgwtfnzbs/Omgwtfnzbs.cs +++ b/src/NzbDrone.Core/Indexers/Omgwtfnzbs/Omgwtfnzbs.cs @@ -3,18 +3,13 @@ using System.Collections.Generic; namespace NzbDrone.Core.Indexers.Omgwtfnzbs { - public class Omgwtfnzbs : IndexerWithSetting + public class Omgwtfnzbs : IndexerBase { - public override string Name - { - get { return "omgwtfnzbs"; } - } - - public override IndexerKind Kind + public override DownloadProtocol Protocol { get { - return IndexerKind.Usenet; + return DownloadProtocol.Usenet; } } diff --git a/NzbDrone.Core/Indexers/Omgwtfnzbs/OmgwtfnzbsParser.cs b/src/NzbDrone.Core/Indexers/Omgwtfnzbs/OmgwtfnzbsParser.cs similarity index 100% rename from NzbDrone.Core/Indexers/Omgwtfnzbs/OmgwtfnzbsParser.cs rename to src/NzbDrone.Core/Indexers/Omgwtfnzbs/OmgwtfnzbsParser.cs diff --git a/NzbDrone.Core/Indexers/Omgwtfnzbs/OmgwtfnzbsSettings.cs b/src/NzbDrone.Core/Indexers/Omgwtfnzbs/OmgwtfnzbsSettings.cs similarity index 90% rename from NzbDrone.Core/Indexers/Omgwtfnzbs/OmgwtfnzbsSettings.cs rename to src/NzbDrone.Core/Indexers/Omgwtfnzbs/OmgwtfnzbsSettings.cs index 778b3a48e..900055608 100644 --- a/NzbDrone.Core/Indexers/Omgwtfnzbs/OmgwtfnzbsSettings.cs +++ b/src/NzbDrone.Core/Indexers/Omgwtfnzbs/OmgwtfnzbsSettings.cs @@ -2,6 +2,7 @@ using FluentValidation; using FluentValidation.Results; using NzbDrone.Core.Annotations; +using NzbDrone.Core.ThingiProvider; namespace NzbDrone.Core.Indexers.Omgwtfnzbs { @@ -14,7 +15,7 @@ namespace NzbDrone.Core.Indexers.Omgwtfnzbs } } - public class OmgwtfnzbsSettings : IIndexerSetting + public class OmgwtfnzbsSettings : IProviderConfig { private static readonly OmgwtfnzbsSettingsValidator Validator = new OmgwtfnzbsSettingsValidator(); diff --git a/NzbDrone.Core/Indexers/RssParserBase.cs b/src/NzbDrone.Core/Indexers/RssParserBase.cs similarity index 100% rename from NzbDrone.Core/Indexers/RssParserBase.cs rename to src/NzbDrone.Core/Indexers/RssParserBase.cs diff --git a/NzbDrone.Core/Indexers/RssSyncCommand.cs b/src/NzbDrone.Core/Indexers/RssSyncCommand.cs similarity index 100% rename from NzbDrone.Core/Indexers/RssSyncCommand.cs rename to src/NzbDrone.Core/Indexers/RssSyncCommand.cs diff --git a/NzbDrone.Core/Indexers/RssSyncService.cs b/src/NzbDrone.Core/Indexers/RssSyncService.cs similarity index 100% rename from NzbDrone.Core/Indexers/RssSyncService.cs rename to src/NzbDrone.Core/Indexers/RssSyncService.cs diff --git a/NzbDrone.Core/Indexers/Wombles/Wombles.cs b/src/NzbDrone.Core/Indexers/Wombles/Wombles.cs similarity index 82% rename from NzbDrone.Core/Indexers/Wombles/Wombles.cs rename to src/NzbDrone.Core/Indexers/Wombles/Wombles.cs index 95cd559de..5355d853d 100644 --- a/NzbDrone.Core/Indexers/Wombles/Wombles.cs +++ b/src/NzbDrone.Core/Indexers/Wombles/Wombles.cs @@ -1,20 +1,16 @@ using System; using System.Collections.Generic; +using NzbDrone.Core.ThingiProvider; namespace NzbDrone.Core.Indexers.Wombles { - public class Wombles : IndexerBase + public class Wombles : IndexerBase { - public override string Name - { - get { return "WomblesIndex"; } - } - - public override IndexerKind Kind + public override DownloadProtocol Protocol { get { - return IndexerKind.Usenet; + return DownloadProtocol.Usenet; } } diff --git a/NzbDrone.Core/Indexers/Wombles/WomblesParser.cs b/src/NzbDrone.Core/Indexers/Wombles/WomblesParser.cs similarity index 100% rename from NzbDrone.Core/Indexers/Wombles/WomblesParser.cs rename to src/NzbDrone.Core/Indexers/Wombles/WomblesParser.cs diff --git a/NzbDrone.Core/Indexers/XElementExtensions.cs b/src/NzbDrone.Core/Indexers/XElementExtensions.cs similarity index 100% rename from NzbDrone.Core/Indexers/XElementExtensions.cs rename to src/NzbDrone.Core/Indexers/XElementExtensions.cs diff --git a/NzbDrone.Core/Instrumentation/Commands/ClearLogCommand.cs b/src/NzbDrone.Core/Instrumentation/Commands/ClearLogCommand.cs similarity index 100% rename from NzbDrone.Core/Instrumentation/Commands/ClearLogCommand.cs rename to src/NzbDrone.Core/Instrumentation/Commands/ClearLogCommand.cs diff --git a/NzbDrone.Core/Instrumentation/Commands/DeleteLogFilesCommand.cs b/src/NzbDrone.Core/Instrumentation/Commands/DeleteLogFilesCommand.cs similarity index 100% rename from NzbDrone.Core/Instrumentation/Commands/DeleteLogFilesCommand.cs rename to src/NzbDrone.Core/Instrumentation/Commands/DeleteLogFilesCommand.cs diff --git a/NzbDrone.Core/Instrumentation/Commands/TrimLogCommand.cs b/src/NzbDrone.Core/Instrumentation/Commands/TrimLogCommand.cs similarity index 100% rename from NzbDrone.Core/Instrumentation/Commands/TrimLogCommand.cs rename to src/NzbDrone.Core/Instrumentation/Commands/TrimLogCommand.cs diff --git a/NzbDrone.Core/Instrumentation/DatabaseTarget.cs b/src/NzbDrone.Core/Instrumentation/DatabaseTarget.cs similarity index 100% rename from NzbDrone.Core/Instrumentation/DatabaseTarget.cs rename to src/NzbDrone.Core/Instrumentation/DatabaseTarget.cs diff --git a/NzbDrone.Core/Instrumentation/DeleteLogFilesService.cs b/src/NzbDrone.Core/Instrumentation/DeleteLogFilesService.cs similarity index 100% rename from NzbDrone.Core/Instrumentation/DeleteLogFilesService.cs rename to src/NzbDrone.Core/Instrumentation/DeleteLogFilesService.cs diff --git a/NzbDrone.Core/Instrumentation/Log.cs b/src/NzbDrone.Core/Instrumentation/Log.cs similarity index 100% rename from NzbDrone.Core/Instrumentation/Log.cs rename to src/NzbDrone.Core/Instrumentation/Log.cs diff --git a/NzbDrone.Core/Instrumentation/LogRepository.cs b/src/NzbDrone.Core/Instrumentation/LogRepository.cs similarity index 100% rename from NzbDrone.Core/Instrumentation/LogRepository.cs rename to src/NzbDrone.Core/Instrumentation/LogRepository.cs diff --git a/NzbDrone.Core/Instrumentation/LogService.cs b/src/NzbDrone.Core/Instrumentation/LogService.cs similarity index 100% rename from NzbDrone.Core/Instrumentation/LogService.cs rename to src/NzbDrone.Core/Instrumentation/LogService.cs diff --git a/NzbDrone.Core/Instrumentation/LoggerExtensions.cs b/src/NzbDrone.Core/Instrumentation/LoggerExtensions.cs similarity index 100% rename from NzbDrone.Core/Instrumentation/LoggerExtensions.cs rename to src/NzbDrone.Core/Instrumentation/LoggerExtensions.cs diff --git a/NzbDrone.Core/Instrumentation/SetLoggingLevel.cs b/src/NzbDrone.Core/Instrumentation/SetLoggingLevel.cs similarity index 100% rename from NzbDrone.Core/Instrumentation/SetLoggingLevel.cs rename to src/NzbDrone.Core/Instrumentation/SetLoggingLevel.cs diff --git a/NzbDrone.Core/Jobs/JobRepository.cs b/src/NzbDrone.Core/Jobs/JobRepository.cs similarity index 100% rename from NzbDrone.Core/Jobs/JobRepository.cs rename to src/NzbDrone.Core/Jobs/JobRepository.cs diff --git a/NzbDrone.Core/Jobs/ScheduledTask.cs b/src/NzbDrone.Core/Jobs/ScheduledTask.cs similarity index 100% rename from NzbDrone.Core/Jobs/ScheduledTask.cs rename to src/NzbDrone.Core/Jobs/ScheduledTask.cs diff --git a/NzbDrone.Core/Jobs/Scheduler.cs b/src/NzbDrone.Core/Jobs/Scheduler.cs similarity index 100% rename from NzbDrone.Core/Jobs/Scheduler.cs rename to src/NzbDrone.Core/Jobs/Scheduler.cs diff --git a/NzbDrone.Core/Jobs/TaskManager.cs b/src/NzbDrone.Core/Jobs/TaskManager.cs similarity index 100% rename from NzbDrone.Core/Jobs/TaskManager.cs rename to src/NzbDrone.Core/Jobs/TaskManager.cs diff --git a/NzbDrone.Core/Lifecycle/ApplicationShutdownRequested.cs b/src/NzbDrone.Core/Lifecycle/ApplicationShutdownRequested.cs similarity index 100% rename from NzbDrone.Core/Lifecycle/ApplicationShutdownRequested.cs rename to src/NzbDrone.Core/Lifecycle/ApplicationShutdownRequested.cs diff --git a/NzbDrone.Core/Lifecycle/ApplicationStartedEvent.cs b/src/NzbDrone.Core/Lifecycle/ApplicationStartedEvent.cs similarity index 100% rename from NzbDrone.Core/Lifecycle/ApplicationStartedEvent.cs rename to src/NzbDrone.Core/Lifecycle/ApplicationStartedEvent.cs diff --git a/NzbDrone.Core/MediaCover/CoverAlreadyExistsSpecification.cs b/src/NzbDrone.Core/MediaCover/CoverAlreadyExistsSpecification.cs similarity index 96% rename from NzbDrone.Core/MediaCover/CoverAlreadyExistsSpecification.cs rename to src/NzbDrone.Core/MediaCover/CoverAlreadyExistsSpecification.cs index 5ab40e2f2..587df4392 100644 --- a/NzbDrone.Core/MediaCover/CoverAlreadyExistsSpecification.cs +++ b/src/NzbDrone.Core/MediaCover/CoverAlreadyExistsSpecification.cs @@ -1,50 +1,50 @@ -using NLog; -using NzbDrone.Common; -using NzbDrone.Common.Serializer; - -namespace NzbDrone.Core.MediaCover -{ - public interface ICoverExistsSpecification - { - bool AlreadyExists(string url, string path); - } - - public class CoverAlreadyExistsSpecification : ICoverExistsSpecification - { - private readonly IDiskProvider _diskProvider; - private readonly IHttpProvider _httpProvider; - private readonly Logger _logger; - - public CoverAlreadyExistsSpecification(IDiskProvider diskProvider, IHttpProvider httpProvider, Logger logger) - { - _diskProvider = diskProvider; - _httpProvider = httpProvider; - _logger = logger; - } - - public bool AlreadyExists(string url, string path) - { - if (!_diskProvider.FileExists(path)) - { - return false; - } - - var headers = _httpProvider.GetHeader(url); - - string sizeString; - - if (headers.TryGetValue(HttpProvider.CONTENT_LENGTH_HEADER, out sizeString)) - { - int size; - int.TryParse(sizeString, out size); - var fileSize = _diskProvider.GetFileSize(path); - - return fileSize == size; - } - - _logger.Warn("Couldn't find content-length header {0}", headers.ToJson()); - - return false; - } - } +using NLog; +using NzbDrone.Common; +using NzbDrone.Common.Serializer; + +namespace NzbDrone.Core.MediaCover +{ + public interface ICoverExistsSpecification + { + bool AlreadyExists(string url, string path); + } + + public class CoverAlreadyExistsSpecification : ICoverExistsSpecification + { + private readonly IDiskProvider _diskProvider; + private readonly IHttpProvider _httpProvider; + private readonly Logger _logger; + + public CoverAlreadyExistsSpecification(IDiskProvider diskProvider, IHttpProvider httpProvider, Logger logger) + { + _diskProvider = diskProvider; + _httpProvider = httpProvider; + _logger = logger; + } + + public bool AlreadyExists(string url, string path) + { + if (!_diskProvider.FileExists(path)) + { + return false; + } + + var headers = _httpProvider.GetHeader(url); + + string sizeString; + + if (headers.TryGetValue(HttpProvider.CONTENT_LENGTH_HEADER, out sizeString)) + { + int size; + int.TryParse(sizeString, out size); + var fileSize = _diskProvider.GetFileSize(path); + + return fileSize == size; + } + + _logger.Warn("Couldn't find content-length header {0}", headers.ToJson()); + + return false; + } + } } \ No newline at end of file diff --git a/NzbDrone.Core/MediaCover/MediaCover.cs b/src/NzbDrone.Core/MediaCover/MediaCover.cs similarity index 100% rename from NzbDrone.Core/MediaCover/MediaCover.cs rename to src/NzbDrone.Core/MediaCover/MediaCover.cs diff --git a/NzbDrone.Core/MediaCover/MediaCoverService.cs b/src/NzbDrone.Core/MediaCover/MediaCoverService.cs similarity index 100% rename from NzbDrone.Core/MediaCover/MediaCoverService.cs rename to src/NzbDrone.Core/MediaCover/MediaCoverService.cs diff --git a/NzbDrone.Core/MediaFiles/Commands/BackendCommandAttribute.cs b/src/NzbDrone.Core/MediaFiles/Commands/BackendCommandAttribute.cs similarity index 100% rename from NzbDrone.Core/MediaFiles/Commands/BackendCommandAttribute.cs rename to src/NzbDrone.Core/MediaFiles/Commands/BackendCommandAttribute.cs diff --git a/NzbDrone.Core/MediaFiles/Commands/CleanMediaFileDb.cs b/src/NzbDrone.Core/MediaFiles/Commands/CleanMediaFileDb.cs similarity index 100% rename from NzbDrone.Core/MediaFiles/Commands/CleanMediaFileDb.cs rename to src/NzbDrone.Core/MediaFiles/Commands/CleanMediaFileDb.cs diff --git a/NzbDrone.Core/MediaFiles/Commands/CleanUpRecycleBinCommand.cs b/src/NzbDrone.Core/MediaFiles/Commands/CleanUpRecycleBinCommand.cs similarity index 100% rename from NzbDrone.Core/MediaFiles/Commands/CleanUpRecycleBinCommand.cs rename to src/NzbDrone.Core/MediaFiles/Commands/CleanUpRecycleBinCommand.cs diff --git a/NzbDrone.Core/MediaFiles/Commands/DownloadedEpisodesScanCommand.cs b/src/NzbDrone.Core/MediaFiles/Commands/DownloadedEpisodesScanCommand.cs similarity index 100% rename from NzbDrone.Core/MediaFiles/Commands/DownloadedEpisodesScanCommand.cs rename to src/NzbDrone.Core/MediaFiles/Commands/DownloadedEpisodesScanCommand.cs diff --git a/NzbDrone.Core/MediaFiles/Commands/RenameSeasonCommand.cs b/src/NzbDrone.Core/MediaFiles/Commands/RenameSeasonCommand.cs similarity index 100% rename from NzbDrone.Core/MediaFiles/Commands/RenameSeasonCommand.cs rename to src/NzbDrone.Core/MediaFiles/Commands/RenameSeasonCommand.cs diff --git a/NzbDrone.Core/MediaFiles/Commands/RenameSeriesCommand.cs b/src/NzbDrone.Core/MediaFiles/Commands/RenameSeriesCommand.cs similarity index 100% rename from NzbDrone.Core/MediaFiles/Commands/RenameSeriesCommand.cs rename to src/NzbDrone.Core/MediaFiles/Commands/RenameSeriesCommand.cs diff --git a/NzbDrone.Core/MediaFiles/DiskScanService.cs b/src/NzbDrone.Core/MediaFiles/DiskScanService.cs similarity index 100% rename from NzbDrone.Core/MediaFiles/DiskScanService.cs rename to src/NzbDrone.Core/MediaFiles/DiskScanService.cs diff --git a/NzbDrone.Core/MediaFiles/DownloadedEpisodesImportService.cs b/src/NzbDrone.Core/MediaFiles/DownloadedEpisodesImportService.cs similarity index 100% rename from NzbDrone.Core/MediaFiles/DownloadedEpisodesImportService.cs rename to src/NzbDrone.Core/MediaFiles/DownloadedEpisodesImportService.cs diff --git a/NzbDrone.Core/MediaFiles/EpisodeFile.cs b/src/NzbDrone.Core/MediaFiles/EpisodeFile.cs similarity index 100% rename from NzbDrone.Core/MediaFiles/EpisodeFile.cs rename to src/NzbDrone.Core/MediaFiles/EpisodeFile.cs diff --git a/NzbDrone.Core/MediaFiles/EpisodeFileMovingService.cs b/src/NzbDrone.Core/MediaFiles/EpisodeFileMovingService.cs similarity index 100% rename from NzbDrone.Core/MediaFiles/EpisodeFileMovingService.cs rename to src/NzbDrone.Core/MediaFiles/EpisodeFileMovingService.cs diff --git a/NzbDrone.Core/MediaFiles/EpisodeImport/IImportDecisionEngineSpecification.cs b/src/NzbDrone.Core/MediaFiles/EpisodeImport/IImportDecisionEngineSpecification.cs similarity index 100% rename from NzbDrone.Core/MediaFiles/EpisodeImport/IImportDecisionEngineSpecification.cs rename to src/NzbDrone.Core/MediaFiles/EpisodeImport/IImportDecisionEngineSpecification.cs diff --git a/NzbDrone.Core/MediaFiles/EpisodeImport/ImportApprovedEpisodes.cs b/src/NzbDrone.Core/MediaFiles/EpisodeImport/ImportApprovedEpisodes.cs similarity index 97% rename from NzbDrone.Core/MediaFiles/EpisodeImport/ImportApprovedEpisodes.cs rename to src/NzbDrone.Core/MediaFiles/EpisodeImport/ImportApprovedEpisodes.cs index a725176e7..6b56d4d00 100644 --- a/NzbDrone.Core/MediaFiles/EpisodeImport/ImportApprovedEpisodes.cs +++ b/src/NzbDrone.Core/MediaFiles/EpisodeImport/ImportApprovedEpisodes.cs @@ -70,12 +70,16 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport { episodeFile.SceneName = Path.GetFileNameWithoutExtension(localEpisode.Path.CleanFilePath()); episodeFile.Path = _episodeFileUpgrader.UpgradeEpisodeFile(episodeFile, localEpisode); - _eventAggregator.PublishEvent(new EpisodeImportedEvent(localEpisode, episodeFile)); - _eventAggregator.PublishEvent(new EpisodeDownloadedEvent(localEpisode)); } _mediaFileService.Add(episodeFile); imported.Add(importDecision); + + if (newDownload) + { + _eventAggregator.PublishEvent(new EpisodeImportedEvent(localEpisode, episodeFile)); + _eventAggregator.PublishEvent(new EpisodeDownloadedEvent(localEpisode)); + } } catch (Exception e) { diff --git a/NzbDrone.Core/MediaFiles/EpisodeImport/ImportDecision.cs b/src/NzbDrone.Core/MediaFiles/EpisodeImport/ImportDecision.cs similarity index 100% rename from NzbDrone.Core/MediaFiles/EpisodeImport/ImportDecision.cs rename to src/NzbDrone.Core/MediaFiles/EpisodeImport/ImportDecision.cs diff --git a/NzbDrone.Core/MediaFiles/EpisodeImport/ImportDecisionMaker.cs b/src/NzbDrone.Core/MediaFiles/EpisodeImport/ImportDecisionMaker.cs similarity index 100% rename from NzbDrone.Core/MediaFiles/EpisodeImport/ImportDecisionMaker.cs rename to src/NzbDrone.Core/MediaFiles/EpisodeImport/ImportDecisionMaker.cs diff --git a/NzbDrone.Core/MediaFiles/EpisodeImport/Specifications/FreeSpaceSpecification.cs b/src/NzbDrone.Core/MediaFiles/EpisodeImport/Specifications/FreeSpaceSpecification.cs similarity index 100% rename from NzbDrone.Core/MediaFiles/EpisodeImport/Specifications/FreeSpaceSpecification.cs rename to src/NzbDrone.Core/MediaFiles/EpisodeImport/Specifications/FreeSpaceSpecification.cs diff --git a/NzbDrone.Core/MediaFiles/EpisodeImport/Specifications/NotInUseSpecification.cs b/src/NzbDrone.Core/MediaFiles/EpisodeImport/Specifications/NotInUseSpecification.cs similarity index 100% rename from NzbDrone.Core/MediaFiles/EpisodeImport/Specifications/NotInUseSpecification.cs rename to src/NzbDrone.Core/MediaFiles/EpisodeImport/Specifications/NotInUseSpecification.cs diff --git a/NzbDrone.Core/MediaFiles/EpisodeImport/Specifications/NotSampleSpecification.cs b/src/NzbDrone.Core/MediaFiles/EpisodeImport/Specifications/NotSampleSpecification.cs similarity index 100% rename from NzbDrone.Core/MediaFiles/EpisodeImport/Specifications/NotSampleSpecification.cs rename to src/NzbDrone.Core/MediaFiles/EpisodeImport/Specifications/NotSampleSpecification.cs diff --git a/NzbDrone.Core/MediaFiles/EpisodeImport/Specifications/NotUnpackingSpecification.cs b/src/NzbDrone.Core/MediaFiles/EpisodeImport/Specifications/NotUnpackingSpecification.cs similarity index 100% rename from NzbDrone.Core/MediaFiles/EpisodeImport/Specifications/NotUnpackingSpecification.cs rename to src/NzbDrone.Core/MediaFiles/EpisodeImport/Specifications/NotUnpackingSpecification.cs diff --git a/NzbDrone.Core/MediaFiles/EpisodeImport/Specifications/UpgradeSpecification.cs b/src/NzbDrone.Core/MediaFiles/EpisodeImport/Specifications/UpgradeSpecification.cs similarity index 100% rename from NzbDrone.Core/MediaFiles/EpisodeImport/Specifications/UpgradeSpecification.cs rename to src/NzbDrone.Core/MediaFiles/EpisodeImport/Specifications/UpgradeSpecification.cs diff --git a/NzbDrone.Core/MediaFiles/Events/EpisodeDownloadedEvent.cs b/src/NzbDrone.Core/MediaFiles/Events/EpisodeDownloadedEvent.cs similarity index 100% rename from NzbDrone.Core/MediaFiles/Events/EpisodeDownloadedEvent.cs rename to src/NzbDrone.Core/MediaFiles/Events/EpisodeDownloadedEvent.cs diff --git a/NzbDrone.Core/MediaFiles/Events/EpisodeFileAddedEvent.cs b/src/NzbDrone.Core/MediaFiles/Events/EpisodeFileAddedEvent.cs similarity index 100% rename from NzbDrone.Core/MediaFiles/Events/EpisodeFileAddedEvent.cs rename to src/NzbDrone.Core/MediaFiles/Events/EpisodeFileAddedEvent.cs diff --git a/NzbDrone.Core/MediaFiles/Events/EpisodeFileDeletedEvent.cs b/src/NzbDrone.Core/MediaFiles/Events/EpisodeFileDeletedEvent.cs similarity index 100% rename from NzbDrone.Core/MediaFiles/Events/EpisodeFileDeletedEvent.cs rename to src/NzbDrone.Core/MediaFiles/Events/EpisodeFileDeletedEvent.cs diff --git a/NzbDrone.Core/MediaFiles/Events/EpisodeImportedEvent.cs b/src/NzbDrone.Core/MediaFiles/Events/EpisodeImportedEvent.cs similarity index 100% rename from NzbDrone.Core/MediaFiles/Events/EpisodeImportedEvent.cs rename to src/NzbDrone.Core/MediaFiles/Events/EpisodeImportedEvent.cs diff --git a/NzbDrone.Core/MediaFiles/Events/SeriesRenamedEvent.cs b/src/NzbDrone.Core/MediaFiles/Events/SeriesRenamedEvent.cs similarity index 100% rename from NzbDrone.Core/MediaFiles/Events/SeriesRenamedEvent.cs rename to src/NzbDrone.Core/MediaFiles/Events/SeriesRenamedEvent.cs diff --git a/NzbDrone.Core/MediaFiles/MediaFileExtensions.cs b/src/NzbDrone.Core/MediaFiles/MediaFileExtensions.cs similarity index 100% rename from NzbDrone.Core/MediaFiles/MediaFileExtensions.cs rename to src/NzbDrone.Core/MediaFiles/MediaFileExtensions.cs diff --git a/NzbDrone.Core/MediaFiles/MediaFileRepository.cs b/src/NzbDrone.Core/MediaFiles/MediaFileRepository.cs similarity index 100% rename from NzbDrone.Core/MediaFiles/MediaFileRepository.cs rename to src/NzbDrone.Core/MediaFiles/MediaFileRepository.cs diff --git a/NzbDrone.Core/MediaFiles/MediaFileService.cs b/src/NzbDrone.Core/MediaFiles/MediaFileService.cs similarity index 100% rename from NzbDrone.Core/MediaFiles/MediaFileService.cs rename to src/NzbDrone.Core/MediaFiles/MediaFileService.cs diff --git a/NzbDrone.Core/MediaFiles/MediaFileTableCleanupService.cs b/src/NzbDrone.Core/MediaFiles/MediaFileTableCleanupService.cs similarity index 100% rename from NzbDrone.Core/MediaFiles/MediaFileTableCleanupService.cs rename to src/NzbDrone.Core/MediaFiles/MediaFileTableCleanupService.cs diff --git a/NzbDrone.Core/MediaFiles/MediaInfo/MediaInfoModel.cs b/src/NzbDrone.Core/MediaFiles/MediaInfo/MediaInfoModel.cs similarity index 100% rename from NzbDrone.Core/MediaFiles/MediaInfo/MediaInfoModel.cs rename to src/NzbDrone.Core/MediaFiles/MediaInfo/MediaInfoModel.cs diff --git a/NzbDrone.Core/MediaFiles/MediaInfo/VideoFileInfoReader.cs b/src/NzbDrone.Core/MediaFiles/MediaInfo/VideoFileInfoReader.cs similarity index 100% rename from NzbDrone.Core/MediaFiles/MediaInfo/VideoFileInfoReader.cs rename to src/NzbDrone.Core/MediaFiles/MediaInfo/VideoFileInfoReader.cs diff --git a/NzbDrone.Core/MediaFiles/RecycleBinProvider.cs b/src/NzbDrone.Core/MediaFiles/RecycleBinProvider.cs similarity index 100% rename from NzbDrone.Core/MediaFiles/RecycleBinProvider.cs rename to src/NzbDrone.Core/MediaFiles/RecycleBinProvider.cs diff --git a/NzbDrone.Core/MediaFiles/RenameEpisodeFileService.cs b/src/NzbDrone.Core/MediaFiles/RenameEpisodeFileService.cs similarity index 100% rename from NzbDrone.Core/MediaFiles/RenameEpisodeFileService.cs rename to src/NzbDrone.Core/MediaFiles/RenameEpisodeFileService.cs diff --git a/NzbDrone.Core/MediaFiles/SameFilenameException.cs b/src/NzbDrone.Core/MediaFiles/SameFilenameException.cs similarity index 100% rename from NzbDrone.Core/MediaFiles/SameFilenameException.cs rename to src/NzbDrone.Core/MediaFiles/SameFilenameException.cs diff --git a/NzbDrone.Core/MediaFiles/UpgradeMediaFileService.cs b/src/NzbDrone.Core/MediaFiles/UpgradeMediaFileService.cs similarity index 100% rename from NzbDrone.Core/MediaFiles/UpgradeMediaFileService.cs rename to src/NzbDrone.Core/MediaFiles/UpgradeMediaFileService.cs diff --git a/NzbDrone.Core/MediaInfo.dll b/src/NzbDrone.Core/MediaInfo.dll similarity index 100% rename from NzbDrone.Core/MediaInfo.dll rename to src/NzbDrone.Core/MediaInfo.dll diff --git a/NzbDrone.Core/Messaging/Commands/BackendCommandAttribute.cs b/src/NzbDrone.Core/Messaging/Commands/BackendCommandAttribute.cs similarity index 100% rename from NzbDrone.Core/Messaging/Commands/BackendCommandAttribute.cs rename to src/NzbDrone.Core/Messaging/Commands/BackendCommandAttribute.cs diff --git a/NzbDrone.Core/Messaging/Commands/Command.cs b/src/NzbDrone.Core/Messaging/Commands/Command.cs similarity index 100% rename from NzbDrone.Core/Messaging/Commands/Command.cs rename to src/NzbDrone.Core/Messaging/Commands/Command.cs diff --git a/NzbDrone.Core/Messaging/Commands/CommandEqualityComparer.cs b/src/NzbDrone.Core/Messaging/Commands/CommandEqualityComparer.cs similarity index 73% rename from NzbDrone.Core/Messaging/Commands/CommandEqualityComparer.cs rename to src/NzbDrone.Core/Messaging/Commands/CommandEqualityComparer.cs index 38017fe4e..5f6ef67be 100644 --- a/NzbDrone.Core/Messaging/Commands/CommandEqualityComparer.cs +++ b/src/NzbDrone.Core/Messaging/Commands/CommandEqualityComparer.cs @@ -1,3 +1,5 @@ +using System; +using System.Collections; using System.Collections.Generic; using System.Linq; @@ -46,7 +48,18 @@ namespace NzbDrone.Core.Messaging.Commands return false; } - if (!xValue.Equals(yValue)) + if (typeof(IEnumerable).IsAssignableFrom(xProperty.PropertyType)) + { + var xValueCollection = ((IEnumerable)xValue).Cast().OrderBy(t => t); + var yValueCollection = ((IEnumerable)yValue).Cast().OrderBy(t => t); + + if (!xValueCollection.SequenceEqual(yValueCollection)) + { + return false; + } + } + + else if (!xValue.Equals(yValue)) { return false; } diff --git a/NzbDrone.Core/Messaging/Commands/CommandExecutor.cs b/src/NzbDrone.Core/Messaging/Commands/CommandExecutor.cs similarity index 100% rename from NzbDrone.Core/Messaging/Commands/CommandExecutor.cs rename to src/NzbDrone.Core/Messaging/Commands/CommandExecutor.cs diff --git a/NzbDrone.Core/Messaging/Commands/ICommandExecutor.cs b/src/NzbDrone.Core/Messaging/Commands/ICommandExecutor.cs similarity index 100% rename from NzbDrone.Core/Messaging/Commands/ICommandExecutor.cs rename to src/NzbDrone.Core/Messaging/Commands/ICommandExecutor.cs diff --git a/NzbDrone.Core/Messaging/Commands/IExecute.cs b/src/NzbDrone.Core/Messaging/Commands/IExecute.cs similarity index 100% rename from NzbDrone.Core/Messaging/Commands/IExecute.cs rename to src/NzbDrone.Core/Messaging/Commands/IExecute.cs diff --git a/NzbDrone.Core/Messaging/Commands/TestCommand.cs b/src/NzbDrone.Core/Messaging/Commands/TestCommand.cs similarity index 100% rename from NzbDrone.Core/Messaging/Commands/TestCommand.cs rename to src/NzbDrone.Core/Messaging/Commands/TestCommand.cs diff --git a/NzbDrone.Core/Messaging/Commands/TestCommandExecutor.cs b/src/NzbDrone.Core/Messaging/Commands/TestCommandExecutor.cs similarity index 100% rename from NzbDrone.Core/Messaging/Commands/TestCommandExecutor.cs rename to src/NzbDrone.Core/Messaging/Commands/TestCommandExecutor.cs diff --git a/NzbDrone.Core/Messaging/Commands/Tracking/CommandStatus.cs b/src/NzbDrone.Core/Messaging/Commands/Tracking/CommandStatus.cs similarity index 100% rename from NzbDrone.Core/Messaging/Commands/Tracking/CommandStatus.cs rename to src/NzbDrone.Core/Messaging/Commands/Tracking/CommandStatus.cs diff --git a/NzbDrone.Core/Messaging/Commands/Tracking/CommandTrackingService.cs b/src/NzbDrone.Core/Messaging/Commands/Tracking/CommandTrackingService.cs similarity index 100% rename from NzbDrone.Core/Messaging/Commands/Tracking/CommandTrackingService.cs rename to src/NzbDrone.Core/Messaging/Commands/Tracking/CommandTrackingService.cs diff --git a/NzbDrone.Core/Messaging/Commands/Tracking/ExistingCommand.cs b/src/NzbDrone.Core/Messaging/Commands/Tracking/ExistingCommand.cs similarity index 100% rename from NzbDrone.Core/Messaging/Commands/Tracking/ExistingCommand.cs rename to src/NzbDrone.Core/Messaging/Commands/Tracking/ExistingCommand.cs diff --git a/NzbDrone.Core/Messaging/Commands/Tracking/TrackedCommandCleanupCommand.cs b/src/NzbDrone.Core/Messaging/Commands/Tracking/TrackedCommandCleanupCommand.cs similarity index 100% rename from NzbDrone.Core/Messaging/Commands/Tracking/TrackedCommandCleanupCommand.cs rename to src/NzbDrone.Core/Messaging/Commands/Tracking/TrackedCommandCleanupCommand.cs diff --git a/NzbDrone.Core/Messaging/Events/CommandCreatedEvent.cs b/src/NzbDrone.Core/Messaging/Events/CommandCreatedEvent.cs similarity index 100% rename from NzbDrone.Core/Messaging/Events/CommandCreatedEvent.cs rename to src/NzbDrone.Core/Messaging/Events/CommandCreatedEvent.cs diff --git a/NzbDrone.Core/Messaging/Events/CommandExecutedEvent.cs b/src/NzbDrone.Core/Messaging/Events/CommandExecutedEvent.cs similarity index 100% rename from NzbDrone.Core/Messaging/Events/CommandExecutedEvent.cs rename to src/NzbDrone.Core/Messaging/Events/CommandExecutedEvent.cs diff --git a/NzbDrone.Core/Messaging/Events/EventAggregator.cs b/src/NzbDrone.Core/Messaging/Events/EventAggregator.cs similarity index 100% rename from NzbDrone.Core/Messaging/Events/EventAggregator.cs rename to src/NzbDrone.Core/Messaging/Events/EventAggregator.cs diff --git a/NzbDrone.Core/Messaging/Events/IEventAggregator.cs b/src/NzbDrone.Core/Messaging/Events/IEventAggregator.cs similarity index 100% rename from NzbDrone.Core/Messaging/Events/IEventAggregator.cs rename to src/NzbDrone.Core/Messaging/Events/IEventAggregator.cs diff --git a/NzbDrone.Core/Messaging/Events/IHandle.cs b/src/NzbDrone.Core/Messaging/Events/IHandle.cs similarity index 100% rename from NzbDrone.Core/Messaging/Events/IHandle.cs rename to src/NzbDrone.Core/Messaging/Events/IHandle.cs diff --git a/NzbDrone.Core/Messaging/IProcessMessage.cs b/src/NzbDrone.Core/Messaging/IProcessMessage.cs similarity index 100% rename from NzbDrone.Core/Messaging/IProcessMessage.cs rename to src/NzbDrone.Core/Messaging/IProcessMessage.cs diff --git a/NzbDrone.Core/MetadataSource/IProvideSeriesInfo.cs b/src/NzbDrone.Core/MetadataSource/IProvideSeriesInfo.cs similarity index 100% rename from NzbDrone.Core/MetadataSource/IProvideSeriesInfo.cs rename to src/NzbDrone.Core/MetadataSource/IProvideSeriesInfo.cs diff --git a/NzbDrone.Core/MetadataSource/ISearchForNewSeries.cs b/src/NzbDrone.Core/MetadataSource/ISearchForNewSeries.cs similarity index 100% rename from NzbDrone.Core/MetadataSource/ISearchForNewSeries.cs rename to src/NzbDrone.Core/MetadataSource/ISearchForNewSeries.cs diff --git a/NzbDrone.Core/MetadataSource/Trakt/Episode.cs b/src/NzbDrone.Core/MetadataSource/Trakt/Episode.cs similarity index 100% rename from NzbDrone.Core/MetadataSource/Trakt/Episode.cs rename to src/NzbDrone.Core/MetadataSource/Trakt/Episode.cs diff --git a/NzbDrone.Core/MetadataSource/Trakt/FullShow.cs b/src/NzbDrone.Core/MetadataSource/Trakt/FullShow.cs similarity index 100% rename from NzbDrone.Core/MetadataSource/Trakt/FullShow.cs rename to src/NzbDrone.Core/MetadataSource/Trakt/FullShow.cs diff --git a/NzbDrone.Core/MetadataSource/Trakt/Images.cs b/src/NzbDrone.Core/MetadataSource/Trakt/Images.cs similarity index 100% rename from NzbDrone.Core/MetadataSource/Trakt/Images.cs rename to src/NzbDrone.Core/MetadataSource/Trakt/Images.cs diff --git a/NzbDrone.Core/MetadataSource/Trakt/Season.cs b/src/NzbDrone.Core/MetadataSource/Trakt/Season.cs similarity index 100% rename from NzbDrone.Core/MetadataSource/Trakt/Season.cs rename to src/NzbDrone.Core/MetadataSource/Trakt/Season.cs diff --git a/NzbDrone.Core/MetadataSource/Trakt/TraktException.cs b/src/NzbDrone.Core/MetadataSource/Trakt/TraktException.cs similarity index 100% rename from NzbDrone.Core/MetadataSource/Trakt/TraktException.cs rename to src/NzbDrone.Core/MetadataSource/Trakt/TraktException.cs diff --git a/NzbDrone.Core/MetadataSource/TraktProxy.cs b/src/NzbDrone.Core/MetadataSource/TraktProxy.cs similarity index 100% rename from NzbDrone.Core/MetadataSource/TraktProxy.cs rename to src/NzbDrone.Core/MetadataSource/TraktProxy.cs diff --git a/NzbDrone.Core/Notifications/Email/Email.cs b/src/NzbDrone.Core/Notifications/Email/Email.cs similarity index 100% rename from NzbDrone.Core/Notifications/Email/Email.cs rename to src/NzbDrone.Core/Notifications/Email/Email.cs diff --git a/NzbDrone.Core/Notifications/Email/EmailService.cs b/src/NzbDrone.Core/Notifications/Email/EmailService.cs similarity index 100% rename from NzbDrone.Core/Notifications/Email/EmailService.cs rename to src/NzbDrone.Core/Notifications/Email/EmailService.cs diff --git a/NzbDrone.Core/Notifications/Email/EmailSettings.cs b/src/NzbDrone.Core/Notifications/Email/EmailSettings.cs similarity index 83% rename from NzbDrone.Core/Notifications/Email/EmailSettings.cs rename to src/NzbDrone.Core/Notifications/Email/EmailSettings.cs index 6ee61b6a2..42aa725cd 100644 --- a/NzbDrone.Core/Notifications/Email/EmailSettings.cs +++ b/src/NzbDrone.Core/Notifications/Email/EmailSettings.cs @@ -1,9 +1,11 @@ using System; +using FluentValidation.Results; using NzbDrone.Core.Annotations; +using NzbDrone.Core.ThingiProvider; namespace NzbDrone.Core.Notifications.Email { - public class EmailSettings : INotifcationSettings + public class EmailSettings : IProviderConfig { public EmailSettings() { @@ -38,5 +40,10 @@ namespace NzbDrone.Core.Notifications.Email return !string.IsNullOrWhiteSpace(Server) && Port > 0 && !string.IsNullOrWhiteSpace(From) && !string.IsNullOrWhiteSpace(To); } } + + public ValidationResult Validate() + { + throw new NotImplementedException(); + } } } diff --git a/NzbDrone.Core/Notifications/Email/TestEmailCommand.cs b/src/NzbDrone.Core/Notifications/Email/TestEmailCommand.cs similarity index 100% rename from NzbDrone.Core/Notifications/Email/TestEmailCommand.cs rename to src/NzbDrone.Core/Notifications/Email/TestEmailCommand.cs diff --git a/NzbDrone.Core/Notifications/Growl/Growl.cs b/src/NzbDrone.Core/Notifications/Growl/Growl.cs similarity index 100% rename from NzbDrone.Core/Notifications/Growl/Growl.cs rename to src/NzbDrone.Core/Notifications/Growl/Growl.cs diff --git a/NzbDrone.Core/Notifications/Growl/GrowlService.cs b/src/NzbDrone.Core/Notifications/Growl/GrowlService.cs similarity index 100% rename from NzbDrone.Core/Notifications/Growl/GrowlService.cs rename to src/NzbDrone.Core/Notifications/Growl/GrowlService.cs diff --git a/NzbDrone.Core/Notifications/Growl/GrowlSettings.cs b/src/NzbDrone.Core/Notifications/Growl/GrowlSettings.cs similarity index 74% rename from NzbDrone.Core/Notifications/Growl/GrowlSettings.cs rename to src/NzbDrone.Core/Notifications/Growl/GrowlSettings.cs index c66060a94..dd049268d 100644 --- a/NzbDrone.Core/Notifications/Growl/GrowlSettings.cs +++ b/src/NzbDrone.Core/Notifications/Growl/GrowlSettings.cs @@ -1,9 +1,11 @@ using System; +using FluentValidation.Results; using NzbDrone.Core.Annotations; +using NzbDrone.Core.ThingiProvider; namespace NzbDrone.Core.Notifications.Growl { - public class GrowlSettings : INotifcationSettings + public class GrowlSettings : IProviderConfig { public GrowlSettings() { @@ -26,5 +28,10 @@ namespace NzbDrone.Core.Notifications.Growl return !string.IsNullOrWhiteSpace(Host) && !string.IsNullOrWhiteSpace(Password) && Port > 0; } } + + public ValidationResult Validate() + { + throw new NotImplementedException(); + } } } diff --git a/NzbDrone.Core/Notifications/Growl/TestGrowlCommand.cs b/src/NzbDrone.Core/Notifications/Growl/TestGrowlCommand.cs similarity index 100% rename from NzbDrone.Core/Notifications/Growl/TestGrowlCommand.cs rename to src/NzbDrone.Core/Notifications/Growl/TestGrowlCommand.cs diff --git a/NzbDrone.Core/Notifications/INotification.cs b/src/NzbDrone.Core/Notifications/INotification.cs similarity index 100% rename from NzbDrone.Core/Notifications/INotification.cs rename to src/NzbDrone.Core/Notifications/INotification.cs diff --git a/NzbDrone.Core/Notifications/Notification.cs b/src/NzbDrone.Core/Notifications/Notification.cs similarity index 75% rename from NzbDrone.Core/Notifications/Notification.cs rename to src/NzbDrone.Core/Notifications/Notification.cs index 09919c958..40275ecf9 100644 --- a/NzbDrone.Core/Notifications/Notification.cs +++ b/src/NzbDrone.Core/Notifications/Notification.cs @@ -1,4 +1,6 @@ -namespace NzbDrone.Core.Notifications +using NzbDrone.Core.ThingiProvider; + +namespace NzbDrone.Core.Notifications { public class Notification { @@ -8,7 +10,7 @@ public string Link { get; set; } public bool OnGrab { get; set; } public bool OnDownload { get; set; } - public INotifcationSettings Settings { get; set; } + public IProviderConfig Settings { get; set; } public INotification Instance { get; set; } public string Implementation { get; set; } } diff --git a/NzbDrone.Core/Notifications/NotificationBase.cs b/src/NzbDrone.Core/Notifications/NotificationBase.cs similarity index 90% rename from NzbDrone.Core/Notifications/NotificationBase.cs rename to src/NzbDrone.Core/Notifications/NotificationBase.cs index e8577c978..d121bd44b 100644 --- a/NzbDrone.Core/Notifications/NotificationBase.cs +++ b/src/NzbDrone.Core/Notifications/NotificationBase.cs @@ -1,9 +1,10 @@ using NzbDrone.Common.Serializer; +using NzbDrone.Core.ThingiProvider; using NzbDrone.Core.Tv; namespace NzbDrone.Core.Notifications { - public abstract class NotificationBase : INotification where TSetting : class, INotifcationSettings, new() + public abstract class NotificationBase : INotification where TSetting : class, IProviderConfig, new() { public abstract string Name { get; } public abstract string ImplementationName { get; } diff --git a/NzbDrone.Core/Notifications/NotificationDefinition.cs b/src/NzbDrone.Core/Notifications/NotificationDefinition.cs similarity index 64% rename from NzbDrone.Core/Notifications/NotificationDefinition.cs rename to src/NzbDrone.Core/Notifications/NotificationDefinition.cs index 7456c7783..41fc64509 100644 --- a/NzbDrone.Core/Notifications/NotificationDefinition.cs +++ b/src/NzbDrone.Core/Notifications/NotificationDefinition.cs @@ -1,5 +1,6 @@ using System; using NzbDrone.Core.Datastore; +using NzbDrone.Core.ThingiProvider; namespace NzbDrone.Core.Notifications { @@ -11,4 +12,11 @@ namespace NzbDrone.Core.Notifications public String Settings { get; set; } public String Implementation { get; set; } } + + + public class NotificationProviderModel : ProviderDefinition + { + public Boolean OnGrab { get; set; } + public Boolean OnDownload { get; set; } + } } \ No newline at end of file diff --git a/NzbDrone.Core/Notifications/NotificationRepository.cs b/src/NzbDrone.Core/Notifications/NotificationRepository.cs similarity index 100% rename from NzbDrone.Core/Notifications/NotificationRepository.cs rename to src/NzbDrone.Core/Notifications/NotificationRepository.cs diff --git a/NzbDrone.Core/Notifications/NotificationService.cs b/src/NzbDrone.Core/Notifications/NotificationService.cs similarity index 96% rename from NzbDrone.Core/Notifications/NotificationService.cs rename to src/NzbDrone.Core/Notifications/NotificationService.cs index 0553f4669..458c80d65 100644 --- a/NzbDrone.Core/Notifications/NotificationService.cs +++ b/src/NzbDrone.Core/Notifications/NotificationService.cs @@ -7,6 +7,7 @@ using NzbDrone.Common.Serializer; using NzbDrone.Core.Download; using NzbDrone.Core.MediaFiles.Events; using NzbDrone.Core.Messaging.Events; +using NzbDrone.Core.ThingiProvider; using NzbDrone.Core.Tv; using Omu.ValueInjecter; @@ -18,7 +19,7 @@ namespace NzbDrone.Core.Notifications Notification Get(int id); List Schema(); Notification Create(Notification notification); - Notification Update(Notification notification); + void Update(Notification notification); void Delete(int id); } @@ -71,7 +72,7 @@ namespace NzbDrone.Core.Notifications var instanceType = newNotification.Instance.GetType(); var baseGenArgs = instanceType.BaseType.GetGenericArguments(); - newNotification.Settings = (INotifcationSettings)Activator.CreateInstance(baseGenArgs[0]); + newNotification.Settings = (IProviderConfig)Activator.CreateInstance(baseGenArgs[0]); newNotification.Implementation = type.Name; notifications.Add(newNotification); @@ -93,15 +94,13 @@ namespace NzbDrone.Core.Notifications return notification; } - public Notification Update(Notification notification) + public void Update(Notification notification) { var definition = _notificationRepository.Get(notification.Id); definition.InjectFrom(notification); definition.Settings = notification.Settings.ToJson(); _notificationRepository.Update(definition); - - return notification; } public void Delete(int id) diff --git a/NzbDrone.Core/Notifications/NotificationSettingsProvider.cs b/src/NzbDrone.Core/Notifications/NotificationSettingsProvider.cs similarity index 89% rename from NzbDrone.Core/Notifications/NotificationSettingsProvider.cs rename to src/NzbDrone.Core/Notifications/NotificationSettingsProvider.cs index 53f4d8a58..b26afa1fd 100644 --- a/NzbDrone.Core/Notifications/NotificationSettingsProvider.cs +++ b/src/NzbDrone.Core/Notifications/NotificationSettingsProvider.cs @@ -1,10 +1,11 @@ using NzbDrone.Common.Serializer; +using NzbDrone.Core.ThingiProvider; namespace NzbDrone.Core.Notifications { public interface INotificationSettingsProvider { - TSetting Get(INotification indexer) where TSetting : INotifcationSettings, new(); + TSetting Get(INotification indexer) where TSetting : IProviderConfig, new(); } public class NotificationSettingsProvider : INotificationSettingsProvider @@ -16,7 +17,7 @@ namespace NzbDrone.Core.Notifications _notificationRepository = notificationRepository; } - public TSetting Get(INotification indexer) where TSetting : INotifcationSettings, new() + public TSetting Get(INotification indexer) where TSetting : IProviderConfig, new() { var indexerDef = _notificationRepository.Find(indexer.Name); diff --git a/NzbDrone.Core/Notifications/NotifyMyAndroid/NotifyMyAndroid.cs b/src/NzbDrone.Core/Notifications/NotifyMyAndroid/NotifyMyAndroid.cs similarity index 100% rename from NzbDrone.Core/Notifications/NotifyMyAndroid/NotifyMyAndroid.cs rename to src/NzbDrone.Core/Notifications/NotifyMyAndroid/NotifyMyAndroid.cs diff --git a/NzbDrone.Core/Notifications/NotifyMyAndroid/NotifyMyAndroidPriority.cs b/src/NzbDrone.Core/Notifications/NotifyMyAndroid/NotifyMyAndroidPriority.cs similarity index 100% rename from NzbDrone.Core/Notifications/NotifyMyAndroid/NotifyMyAndroidPriority.cs rename to src/NzbDrone.Core/Notifications/NotifyMyAndroid/NotifyMyAndroidPriority.cs diff --git a/NzbDrone.Core/Notifications/NotifyMyAndroid/NotifyMyAndroidProxy.cs b/src/NzbDrone.Core/Notifications/NotifyMyAndroid/NotifyMyAndroidProxy.cs similarity index 100% rename from NzbDrone.Core/Notifications/NotifyMyAndroid/NotifyMyAndroidProxy.cs rename to src/NzbDrone.Core/Notifications/NotifyMyAndroid/NotifyMyAndroidProxy.cs diff --git a/NzbDrone.Core/Notifications/NotifyMyAndroid/NotifyMyAndroidSettings.cs b/src/NzbDrone.Core/Notifications/NotifyMyAndroid/NotifyMyAndroidSettings.cs similarity index 72% rename from NzbDrone.Core/Notifications/NotifyMyAndroid/NotifyMyAndroidSettings.cs rename to src/NzbDrone.Core/Notifications/NotifyMyAndroid/NotifyMyAndroidSettings.cs index c8c941239..48c8c6fc6 100644 --- a/NzbDrone.Core/Notifications/NotifyMyAndroid/NotifyMyAndroidSettings.cs +++ b/src/NzbDrone.Core/Notifications/NotifyMyAndroid/NotifyMyAndroidSettings.cs @@ -1,9 +1,11 @@ using System; +using FluentValidation.Results; using NzbDrone.Core.Annotations; +using NzbDrone.Core.ThingiProvider; namespace NzbDrone.Core.Notifications.NotifyMyAndroid { - public class NotifyMyAndroidSettings : INotifcationSettings + public class NotifyMyAndroidSettings : IProviderConfig { [FieldDefinition(0, Label = "API Key", HelpLink = "http://www.notifymyandroid.com/")] public String ApiKey { get; set; } @@ -18,5 +20,10 @@ namespace NzbDrone.Core.Notifications.NotifyMyAndroid return !String.IsNullOrWhiteSpace(ApiKey) && Priority != null & Priority >= -1 && Priority <= 2; } } + + public ValidationResult Validate() + { + throw new NotImplementedException(); + } } } diff --git a/NzbDrone.Core/Notifications/NotifyMyAndroid/TestNotifyMyAndroidCommand.cs b/src/NzbDrone.Core/Notifications/NotifyMyAndroid/TestNotifyMyAndroidCommand.cs similarity index 100% rename from NzbDrone.Core/Notifications/NotifyMyAndroid/TestNotifyMyAndroidCommand.cs rename to src/NzbDrone.Core/Notifications/NotifyMyAndroid/TestNotifyMyAndroidCommand.cs diff --git a/NzbDrone.Core/Notifications/Plex/PlexClient.cs b/src/NzbDrone.Core/Notifications/Plex/PlexClient.cs similarity index 100% rename from NzbDrone.Core/Notifications/Plex/PlexClient.cs rename to src/NzbDrone.Core/Notifications/Plex/PlexClient.cs diff --git a/NzbDrone.Core/Notifications/Plex/PlexClientSettings.cs b/src/NzbDrone.Core/Notifications/Plex/PlexClientSettings.cs similarity index 74% rename from NzbDrone.Core/Notifications/Plex/PlexClientSettings.cs rename to src/NzbDrone.Core/Notifications/Plex/PlexClientSettings.cs index 130552e52..a0d762406 100644 --- a/NzbDrone.Core/Notifications/Plex/PlexClientSettings.cs +++ b/src/NzbDrone.Core/Notifications/Plex/PlexClientSettings.cs @@ -1,9 +1,11 @@ using System; +using FluentValidation.Results; using NzbDrone.Core.Annotations; +using NzbDrone.Core.ThingiProvider; namespace NzbDrone.Core.Notifications.Plex { - public class PlexClientSettings : INotifcationSettings + public class PlexClientSettings : IProviderConfig { public PlexClientSettings() { @@ -29,5 +31,10 @@ namespace NzbDrone.Core.Notifications.Plex return !string.IsNullOrWhiteSpace(Host); } } + + public ValidationResult Validate() + { + throw new NotImplementedException(); + } } } diff --git a/NzbDrone.Core/Notifications/Plex/PlexServer.cs b/src/NzbDrone.Core/Notifications/Plex/PlexServer.cs similarity index 100% rename from NzbDrone.Core/Notifications/Plex/PlexServer.cs rename to src/NzbDrone.Core/Notifications/Plex/PlexServer.cs diff --git a/NzbDrone.Core/Notifications/Plex/PlexServerSettings.cs b/src/NzbDrone.Core/Notifications/Plex/PlexServerSettings.cs similarity index 73% rename from NzbDrone.Core/Notifications/Plex/PlexServerSettings.cs rename to src/NzbDrone.Core/Notifications/Plex/PlexServerSettings.cs index 40b05a2c0..ed410767b 100644 --- a/NzbDrone.Core/Notifications/Plex/PlexServerSettings.cs +++ b/src/NzbDrone.Core/Notifications/Plex/PlexServerSettings.cs @@ -1,9 +1,11 @@ using System; +using FluentValidation.Results; using NzbDrone.Core.Annotations; +using NzbDrone.Core.ThingiProvider; namespace NzbDrone.Core.Notifications.Plex { - public class PlexServerSettings : INotifcationSettings + public class PlexServerSettings : IProviderConfig { public PlexServerSettings() { @@ -26,5 +28,10 @@ namespace NzbDrone.Core.Notifications.Plex return !string.IsNullOrWhiteSpace(Host); } } + + public ValidationResult Validate() + { + throw new NotImplementedException(); + } } } diff --git a/NzbDrone.Core/Notifications/Plex/PlexService.cs b/src/NzbDrone.Core/Notifications/Plex/PlexService.cs similarity index 100% rename from NzbDrone.Core/Notifications/Plex/PlexService.cs rename to src/NzbDrone.Core/Notifications/Plex/PlexService.cs diff --git a/NzbDrone.Core/Notifications/Plex/TestPlexClientCommand.cs b/src/NzbDrone.Core/Notifications/Plex/TestPlexClientCommand.cs similarity index 100% rename from NzbDrone.Core/Notifications/Plex/TestPlexClientCommand.cs rename to src/NzbDrone.Core/Notifications/Plex/TestPlexClientCommand.cs diff --git a/NzbDrone.Core/Notifications/Plex/TestPlexServerCommand.cs b/src/NzbDrone.Core/Notifications/Plex/TestPlexServerCommand.cs similarity index 100% rename from NzbDrone.Core/Notifications/Plex/TestPlexServerCommand.cs rename to src/NzbDrone.Core/Notifications/Plex/TestPlexServerCommand.cs diff --git a/NzbDrone.Core/Notifications/Prowl/InvalidApiKeyException.cs b/src/NzbDrone.Core/Notifications/Prowl/InvalidApiKeyException.cs similarity index 100% rename from NzbDrone.Core/Notifications/Prowl/InvalidApiKeyException.cs rename to src/NzbDrone.Core/Notifications/Prowl/InvalidApiKeyException.cs diff --git a/NzbDrone.Core/Notifications/Prowl/Prowl.cs b/src/NzbDrone.Core/Notifications/Prowl/Prowl.cs similarity index 100% rename from NzbDrone.Core/Notifications/Prowl/Prowl.cs rename to src/NzbDrone.Core/Notifications/Prowl/Prowl.cs diff --git a/NzbDrone.Core/Notifications/Prowl/ProwlPriority.cs b/src/NzbDrone.Core/Notifications/Prowl/ProwlPriority.cs similarity index 100% rename from NzbDrone.Core/Notifications/Prowl/ProwlPriority.cs rename to src/NzbDrone.Core/Notifications/Prowl/ProwlPriority.cs diff --git a/NzbDrone.Core/Notifications/Prowl/ProwlService.cs b/src/NzbDrone.Core/Notifications/Prowl/ProwlService.cs similarity index 100% rename from NzbDrone.Core/Notifications/Prowl/ProwlService.cs rename to src/NzbDrone.Core/Notifications/Prowl/ProwlService.cs diff --git a/NzbDrone.Core/Notifications/Prowl/ProwlSettings.cs b/src/NzbDrone.Core/Notifications/Prowl/ProwlSettings.cs similarity index 73% rename from NzbDrone.Core/Notifications/Prowl/ProwlSettings.cs rename to src/NzbDrone.Core/Notifications/Prowl/ProwlSettings.cs index f6b9a7603..66b574179 100644 --- a/NzbDrone.Core/Notifications/Prowl/ProwlSettings.cs +++ b/src/NzbDrone.Core/Notifications/Prowl/ProwlSettings.cs @@ -1,9 +1,11 @@ using System; +using FluentValidation.Results; using NzbDrone.Core.Annotations; +using NzbDrone.Core.ThingiProvider; namespace NzbDrone.Core.Notifications.Prowl { - public class ProwlSettings : INotifcationSettings + public class ProwlSettings : IProviderConfig { [FieldDefinition(0, Label = "API Key", HelpLink = "https://www.prowlapp.com/api_settings.php")] public String ApiKey { get; set; } @@ -18,5 +20,10 @@ namespace NzbDrone.Core.Notifications.Prowl return !string.IsNullOrWhiteSpace(ApiKey) && Priority != null & Priority >= -2 && Priority <= 2; } } + + public ValidationResult Validate() + { + throw new NotImplementedException(); + } } } diff --git a/NzbDrone.Core/Notifications/Prowl/TestProwlCommand.cs b/src/NzbDrone.Core/Notifications/Prowl/TestProwlCommand.cs similarity index 100% rename from NzbDrone.Core/Notifications/Prowl/TestProwlCommand.cs rename to src/NzbDrone.Core/Notifications/Prowl/TestProwlCommand.cs diff --git a/NzbDrone.Core/Notifications/PushBullet/PushBullet.cs b/src/NzbDrone.Core/Notifications/PushBullet/PushBullet.cs similarity index 100% rename from NzbDrone.Core/Notifications/PushBullet/PushBullet.cs rename to src/NzbDrone.Core/Notifications/PushBullet/PushBullet.cs diff --git a/NzbDrone.Core/Notifications/PushBullet/PushBulletProxy.cs b/src/NzbDrone.Core/Notifications/PushBullet/PushBulletProxy.cs similarity index 100% rename from NzbDrone.Core/Notifications/PushBullet/PushBulletProxy.cs rename to src/NzbDrone.Core/Notifications/PushBullet/PushBulletProxy.cs diff --git a/NzbDrone.Core/Notifications/PushBullet/PushBulletSettings.cs b/src/NzbDrone.Core/Notifications/PushBullet/PushBulletSettings.cs similarity index 68% rename from NzbDrone.Core/Notifications/PushBullet/PushBulletSettings.cs rename to src/NzbDrone.Core/Notifications/PushBullet/PushBulletSettings.cs index f7a492622..1886991d8 100644 --- a/NzbDrone.Core/Notifications/PushBullet/PushBulletSettings.cs +++ b/src/NzbDrone.Core/Notifications/PushBullet/PushBulletSettings.cs @@ -1,9 +1,11 @@ using System; +using FluentValidation.Results; using NzbDrone.Core.Annotations; +using NzbDrone.Core.ThingiProvider; namespace NzbDrone.Core.Notifications.PushBullet { - public class PushBulletSettings : INotifcationSettings + public class PushBulletSettings : IProviderConfig { [FieldDefinition(0, Label = "API Key", HelpLink = "https://www.pushbullet.com/")] public String ApiKey { get; set; } @@ -18,5 +20,10 @@ namespace NzbDrone.Core.Notifications.PushBullet return !String.IsNullOrWhiteSpace(ApiKey) && DeviceId > 0; } } + + public ValidationResult Validate() + { + throw new NotImplementedException(); + } } } diff --git a/NzbDrone.Core/Notifications/PushBullet/TestPushBulletCommand.cs b/src/NzbDrone.Core/Notifications/PushBullet/TestPushBulletCommand.cs similarity index 100% rename from NzbDrone.Core/Notifications/PushBullet/TestPushBulletCommand.cs rename to src/NzbDrone.Core/Notifications/PushBullet/TestPushBulletCommand.cs diff --git a/NzbDrone.Core/Notifications/Pushover/InvalidResponseException.cs b/src/NzbDrone.Core/Notifications/Pushover/InvalidResponseException.cs similarity index 100% rename from NzbDrone.Core/Notifications/Pushover/InvalidResponseException.cs rename to src/NzbDrone.Core/Notifications/Pushover/InvalidResponseException.cs diff --git a/NzbDrone.Core/Notifications/Pushover/Pushover.cs b/src/NzbDrone.Core/Notifications/Pushover/Pushover.cs similarity index 100% rename from NzbDrone.Core/Notifications/Pushover/Pushover.cs rename to src/NzbDrone.Core/Notifications/Pushover/Pushover.cs diff --git a/NzbDrone.Core/Notifications/Pushover/PushoverPriority.cs b/src/NzbDrone.Core/Notifications/Pushover/PushoverPriority.cs similarity index 100% rename from NzbDrone.Core/Notifications/Pushover/PushoverPriority.cs rename to src/NzbDrone.Core/Notifications/Pushover/PushoverPriority.cs diff --git a/NzbDrone.Core/Notifications/Pushover/PushoverService.cs b/src/NzbDrone.Core/Notifications/Pushover/PushoverService.cs similarity index 100% rename from NzbDrone.Core/Notifications/Pushover/PushoverService.cs rename to src/NzbDrone.Core/Notifications/Pushover/PushoverService.cs diff --git a/NzbDrone.Core/Notifications/Pushover/PushoverSettings.cs b/src/NzbDrone.Core/Notifications/Pushover/PushoverSettings.cs similarity index 72% rename from NzbDrone.Core/Notifications/Pushover/PushoverSettings.cs rename to src/NzbDrone.Core/Notifications/Pushover/PushoverSettings.cs index 43c7937b6..ca4c332c7 100644 --- a/NzbDrone.Core/Notifications/Pushover/PushoverSettings.cs +++ b/src/NzbDrone.Core/Notifications/Pushover/PushoverSettings.cs @@ -1,9 +1,11 @@ using System; +using FluentValidation.Results; using NzbDrone.Core.Annotations; +using NzbDrone.Core.ThingiProvider; namespace NzbDrone.Core.Notifications.Pushover { - public class PushoverSettings : INotifcationSettings + public class PushoverSettings : IProviderConfig { [FieldDefinition(0, Label = "User Key", HelpLink = "https://pushover.net/")] public String UserKey { get; set; } @@ -18,5 +20,10 @@ namespace NzbDrone.Core.Notifications.Pushover return !string.IsNullOrWhiteSpace(UserKey) && Priority != null & Priority >= -1 && Priority <= 2; } } + + public ValidationResult Validate() + { + throw new NotImplementedException(); + } } } diff --git a/NzbDrone.Core/Notifications/Pushover/TestPushoverCommand.cs b/src/NzbDrone.Core/Notifications/Pushover/TestPushoverCommand.cs similarity index 100% rename from NzbDrone.Core/Notifications/Pushover/TestPushoverCommand.cs rename to src/NzbDrone.Core/Notifications/Pushover/TestPushoverCommand.cs diff --git a/NzbDrone.Core/Notifications/Xbmc/HttpApiProvider.cs b/src/NzbDrone.Core/Notifications/Xbmc/HttpApiProvider.cs similarity index 100% rename from NzbDrone.Core/Notifications/Xbmc/HttpApiProvider.cs rename to src/NzbDrone.Core/Notifications/Xbmc/HttpApiProvider.cs diff --git a/NzbDrone.Core/Notifications/Xbmc/IApiProvider.cs b/src/NzbDrone.Core/Notifications/Xbmc/IApiProvider.cs similarity index 100% rename from NzbDrone.Core/Notifications/Xbmc/IApiProvider.cs rename to src/NzbDrone.Core/Notifications/Xbmc/IApiProvider.cs diff --git a/NzbDrone.Core/Notifications/Xbmc/InvalidXbmcVersionException.cs b/src/NzbDrone.Core/Notifications/Xbmc/InvalidXbmcVersionException.cs similarity index 100% rename from NzbDrone.Core/Notifications/Xbmc/InvalidXbmcVersionException.cs rename to src/NzbDrone.Core/Notifications/Xbmc/InvalidXbmcVersionException.cs diff --git a/NzbDrone.Core/Notifications/Xbmc/JsonApiProvider.cs b/src/NzbDrone.Core/Notifications/Xbmc/JsonApiProvider.cs similarity index 100% rename from NzbDrone.Core/Notifications/Xbmc/JsonApiProvider.cs rename to src/NzbDrone.Core/Notifications/Xbmc/JsonApiProvider.cs diff --git a/NzbDrone.Core/Notifications/Xbmc/Model/ActivePlayer.cs b/src/NzbDrone.Core/Notifications/Xbmc/Model/ActivePlayer.cs similarity index 100% rename from NzbDrone.Core/Notifications/Xbmc/Model/ActivePlayer.cs rename to src/NzbDrone.Core/Notifications/Xbmc/Model/ActivePlayer.cs diff --git a/NzbDrone.Core/Notifications/Xbmc/Model/ActivePlayersDharmaResult.cs b/src/NzbDrone.Core/Notifications/Xbmc/Model/ActivePlayersDharmaResult.cs similarity index 100% rename from NzbDrone.Core/Notifications/Xbmc/Model/ActivePlayersDharmaResult.cs rename to src/NzbDrone.Core/Notifications/Xbmc/Model/ActivePlayersDharmaResult.cs diff --git a/NzbDrone.Core/Notifications/Xbmc/Model/ActivePlayersEdenResult.cs b/src/NzbDrone.Core/Notifications/Xbmc/Model/ActivePlayersEdenResult.cs similarity index 100% rename from NzbDrone.Core/Notifications/Xbmc/Model/ActivePlayersEdenResult.cs rename to src/NzbDrone.Core/Notifications/Xbmc/Model/ActivePlayersEdenResult.cs diff --git a/NzbDrone.Core/Notifications/Xbmc/Model/ErrorResult.cs b/src/NzbDrone.Core/Notifications/Xbmc/Model/ErrorResult.cs similarity index 100% rename from NzbDrone.Core/Notifications/Xbmc/Model/ErrorResult.cs rename to src/NzbDrone.Core/Notifications/Xbmc/Model/ErrorResult.cs diff --git a/NzbDrone.Core/Notifications/Xbmc/Model/TvShow.cs b/src/NzbDrone.Core/Notifications/Xbmc/Model/TvShow.cs similarity index 100% rename from NzbDrone.Core/Notifications/Xbmc/Model/TvShow.cs rename to src/NzbDrone.Core/Notifications/Xbmc/Model/TvShow.cs diff --git a/NzbDrone.Core/Notifications/Xbmc/Model/TvShowResponse.cs b/src/NzbDrone.Core/Notifications/Xbmc/Model/TvShowResponse.cs similarity index 100% rename from NzbDrone.Core/Notifications/Xbmc/Model/TvShowResponse.cs rename to src/NzbDrone.Core/Notifications/Xbmc/Model/TvShowResponse.cs diff --git a/NzbDrone.Core/Notifications/Xbmc/Model/TvShowResult.cs b/src/NzbDrone.Core/Notifications/Xbmc/Model/TvShowResult.cs similarity index 100% rename from NzbDrone.Core/Notifications/Xbmc/Model/TvShowResult.cs rename to src/NzbDrone.Core/Notifications/Xbmc/Model/TvShowResult.cs diff --git a/NzbDrone.Core/Notifications/Xbmc/Model/VersionResult.cs b/src/NzbDrone.Core/Notifications/Xbmc/Model/VersionResult.cs similarity index 100% rename from NzbDrone.Core/Notifications/Xbmc/Model/VersionResult.cs rename to src/NzbDrone.Core/Notifications/Xbmc/Model/VersionResult.cs diff --git a/NzbDrone.Core/Notifications/Xbmc/Model/XbmcJsonResult.cs b/src/NzbDrone.Core/Notifications/Xbmc/Model/XbmcJsonResult.cs similarity index 100% rename from NzbDrone.Core/Notifications/Xbmc/Model/XbmcJsonResult.cs rename to src/NzbDrone.Core/Notifications/Xbmc/Model/XbmcJsonResult.cs diff --git a/NzbDrone.Core/Notifications/Xbmc/Model/XbmcVersion.cs b/src/NzbDrone.Core/Notifications/Xbmc/Model/XbmcVersion.cs similarity index 100% rename from NzbDrone.Core/Notifications/Xbmc/Model/XbmcVersion.cs rename to src/NzbDrone.Core/Notifications/Xbmc/Model/XbmcVersion.cs diff --git a/NzbDrone.Core/Notifications/Xbmc/TestXbmcCommand.cs b/src/NzbDrone.Core/Notifications/Xbmc/TestXbmcCommand.cs similarity index 100% rename from NzbDrone.Core/Notifications/Xbmc/TestXbmcCommand.cs rename to src/NzbDrone.Core/Notifications/Xbmc/TestXbmcCommand.cs diff --git a/NzbDrone.Core/Notifications/Xbmc/Xbmc.cs b/src/NzbDrone.Core/Notifications/Xbmc/Xbmc.cs similarity index 100% rename from NzbDrone.Core/Notifications/Xbmc/Xbmc.cs rename to src/NzbDrone.Core/Notifications/Xbmc/Xbmc.cs diff --git a/NzbDrone.Core/Notifications/Xbmc/XbmcService.cs b/src/NzbDrone.Core/Notifications/Xbmc/XbmcService.cs similarity index 100% rename from NzbDrone.Core/Notifications/Xbmc/XbmcService.cs rename to src/NzbDrone.Core/Notifications/Xbmc/XbmcService.cs diff --git a/NzbDrone.Core/Notifications/Xbmc/XbmcSettings.cs b/src/NzbDrone.Core/Notifications/Xbmc/XbmcSettings.cs similarity index 88% rename from NzbDrone.Core/Notifications/Xbmc/XbmcSettings.cs rename to src/NzbDrone.Core/Notifications/Xbmc/XbmcSettings.cs index 0a09d9d57..2c0569c89 100644 --- a/NzbDrone.Core/Notifications/Xbmc/XbmcSettings.cs +++ b/src/NzbDrone.Core/Notifications/Xbmc/XbmcSettings.cs @@ -1,11 +1,13 @@ using System; using System.ComponentModel; +using FluentValidation.Results; using Newtonsoft.Json; using NzbDrone.Core.Annotations; +using NzbDrone.Core.ThingiProvider; namespace NzbDrone.Core.Notifications.Xbmc { - public class XbmcSettings : INotifcationSettings + public class XbmcSettings : IProviderConfig { public XbmcSettings() { @@ -51,5 +53,10 @@ namespace NzbDrone.Core.Notifications.Xbmc return !string.IsNullOrWhiteSpace(Host) && Port > 0; } } + + public ValidationResult Validate() + { + throw new NotImplementedException(); + } } } diff --git a/NzbDrone.Core/NzbDrone.Core.csproj b/src/NzbDrone.Core/NzbDrone.Core.csproj similarity index 96% rename from NzbDrone.Core/NzbDrone.Core.csproj rename to src/NzbDrone.Core/NzbDrone.Core.csproj index 23d3657e3..7afcb1bb1 100644 --- a/NzbDrone.Core/NzbDrone.Core.csproj +++ b/src/NzbDrone.Core/NzbDrone.Core.csproj @@ -37,7 +37,7 @@ true full false - ..\_output\ + ..\..\_output\ DEBUG;TRACE prompt 4 @@ -46,7 +46,7 @@ x86 pdbonly true - ..\_output\ + ..\..\_output\ TRACE prompt 4 @@ -110,6 +110,7 @@ + @@ -140,6 +141,7 @@ + @@ -171,6 +173,8 @@ + + @@ -216,7 +220,7 @@ - + @@ -240,12 +244,10 @@ - - @@ -342,13 +344,11 @@ - - @@ -370,7 +370,6 @@ - @@ -416,12 +415,25 @@ + + + + + + + + + + + + + @@ -500,7 +512,7 @@ Code - + Code diff --git a/NzbDrone.Core/Organizer/EpisodeSortingType.cs b/src/NzbDrone.Core/Organizer/EpisodeSortingType.cs similarity index 100% rename from NzbDrone.Core/Organizer/EpisodeSortingType.cs rename to src/NzbDrone.Core/Organizer/EpisodeSortingType.cs diff --git a/NzbDrone.Core/Organizer/FileNameBuilder.cs b/src/NzbDrone.Core/Organizer/FileNameBuilder.cs similarity index 97% rename from NzbDrone.Core/Organizer/FileNameBuilder.cs rename to src/NzbDrone.Core/Organizer/FileNameBuilder.cs index cab26aa10..837fbae3b 100644 --- a/NzbDrone.Core/Organizer/FileNameBuilder.cs +++ b/src/NzbDrone.Core/Organizer/FileNameBuilder.cs @@ -170,12 +170,22 @@ namespace NzbDrone.Core.Organizer string path = series.Path; if (series.SeasonFolder) { - var seasonFolder = _configService.SeasonFolderFormat + string seasonFolder; + + if (seasonNumber == 0) + { + seasonFolder = "Specials"; + } + + else + { + seasonFolder = _configService.SeasonFolderFormat .Replace("%sn", series.Title) .Replace("%s.n", series.Title.Replace(' ', '.')) .Replace("%s_n", series.Title.Replace(' ', '_')) .Replace("%0s", seasonNumber.ToString("00")) .Replace("%s", seasonNumber.ToString()); + } path = Path.Combine(path, seasonFolder); } diff --git a/NzbDrone.Core/Organizer/NamingConfig.cs b/src/NzbDrone.Core/Organizer/NamingConfig.cs similarity index 100% rename from NzbDrone.Core/Organizer/NamingConfig.cs rename to src/NzbDrone.Core/Organizer/NamingConfig.cs diff --git a/NzbDrone.Core/Parser/Language.cs b/src/NzbDrone.Core/Parser/Language.cs similarity index 100% rename from NzbDrone.Core/Parser/Language.cs rename to src/NzbDrone.Core/Parser/Language.cs diff --git a/NzbDrone.Core/Parser/Model/LocalEpisode.cs b/src/NzbDrone.Core/Parser/Model/LocalEpisode.cs similarity index 100% rename from NzbDrone.Core/Parser/Model/LocalEpisode.cs rename to src/NzbDrone.Core/Parser/Model/LocalEpisode.cs diff --git a/NzbDrone.Core/Parser/Model/ParsedEpisodeInfo.cs b/src/NzbDrone.Core/Parser/Model/ParsedEpisodeInfo.cs similarity index 100% rename from NzbDrone.Core/Parser/Model/ParsedEpisodeInfo.cs rename to src/NzbDrone.Core/Parser/Model/ParsedEpisodeInfo.cs diff --git a/NzbDrone.Core/Parser/Model/ReleaseInfo.cs b/src/NzbDrone.Core/Parser/Model/ReleaseInfo.cs similarity index 100% rename from NzbDrone.Core/Parser/Model/ReleaseInfo.cs rename to src/NzbDrone.Core/Parser/Model/ReleaseInfo.cs diff --git a/NzbDrone.Core/Parser/Model/RemoteEpisode.cs b/src/NzbDrone.Core/Parser/Model/RemoteEpisode.cs similarity index 100% rename from NzbDrone.Core/Parser/Model/RemoteEpisode.cs rename to src/NzbDrone.Core/Parser/Model/RemoteEpisode.cs diff --git a/NzbDrone.Core/Parser/Model/TorrentInfo.cs b/src/NzbDrone.Core/Parser/Model/TorrentInfo.cs similarity index 100% rename from NzbDrone.Core/Parser/Model/TorrentInfo.cs rename to src/NzbDrone.Core/Parser/Model/TorrentInfo.cs diff --git a/NzbDrone.Core/Parser/Parser.cs b/src/NzbDrone.Core/Parser/Parser.cs similarity index 100% rename from NzbDrone.Core/Parser/Parser.cs rename to src/NzbDrone.Core/Parser/Parser.cs diff --git a/NzbDrone.Core/Parser/ParsingService.cs b/src/NzbDrone.Core/Parser/ParsingService.cs similarity index 100% rename from NzbDrone.Core/Parser/ParsingService.cs rename to src/NzbDrone.Core/Parser/ParsingService.cs diff --git a/NzbDrone.Core/Parser/QualityParser.cs b/src/NzbDrone.Core/Parser/QualityParser.cs similarity index 100% rename from NzbDrone.Core/Parser/QualityParser.cs rename to src/NzbDrone.Core/Parser/QualityParser.cs diff --git a/NzbDrone.Core/progressmessaging/CommandUpdatedEvent.cs b/src/NzbDrone.Core/ProgressMessaging/CommandUpdatedEvent.cs similarity index 100% rename from NzbDrone.Core/progressmessaging/CommandUpdatedEvent.cs rename to src/NzbDrone.Core/ProgressMessaging/CommandUpdatedEvent.cs diff --git a/NzbDrone.Core/ProgressMessaging/ProgressMessageTarget.cs b/src/NzbDrone.Core/ProgressMessaging/ProgressMessageTarget.cs similarity index 100% rename from NzbDrone.Core/ProgressMessaging/ProgressMessageTarget.cs rename to src/NzbDrone.Core/ProgressMessaging/ProgressMessageTarget.cs diff --git a/NzbDrone.Core/Properties/AnalysisRules.ruleset b/src/NzbDrone.Core/Properties/AnalysisRules.ruleset similarity index 100% rename from NzbDrone.Core/Properties/AnalysisRules.ruleset rename to src/NzbDrone.Core/Properties/AnalysisRules.ruleset diff --git a/NzbDrone.Core/Properties/AssemblyInfo.cs b/src/NzbDrone.Core/Properties/AssemblyInfo.cs similarity index 100% rename from NzbDrone.Core/Properties/AssemblyInfo.cs rename to src/NzbDrone.Core/Properties/AssemblyInfo.cs diff --git a/NzbDrone.Core/Qualities/Quality.cs b/src/NzbDrone.Core/Qualities/Quality.cs similarity index 100% rename from NzbDrone.Core/Qualities/Quality.cs rename to src/NzbDrone.Core/Qualities/Quality.cs diff --git a/NzbDrone.Core/Qualities/QualityProfile.cs b/src/NzbDrone.Core/Qualities/QualityProfile.cs similarity index 100% rename from NzbDrone.Core/Qualities/QualityProfile.cs rename to src/NzbDrone.Core/Qualities/QualityProfile.cs diff --git a/NzbDrone.Core/Qualities/QualityProfileInUseException.cs b/src/NzbDrone.Core/Qualities/QualityProfileInUseException.cs similarity index 100% rename from NzbDrone.Core/Qualities/QualityProfileInUseException.cs rename to src/NzbDrone.Core/Qualities/QualityProfileInUseException.cs diff --git a/NzbDrone.Core/Qualities/QualityProfileRepository.cs b/src/NzbDrone.Core/Qualities/QualityProfileRepository.cs similarity index 100% rename from NzbDrone.Core/Qualities/QualityProfileRepository.cs rename to src/NzbDrone.Core/Qualities/QualityProfileRepository.cs diff --git a/NzbDrone.Core/Qualities/QualityProfileService.cs b/src/NzbDrone.Core/Qualities/QualityProfileService.cs similarity index 100% rename from NzbDrone.Core/Qualities/QualityProfileService.cs rename to src/NzbDrone.Core/Qualities/QualityProfileService.cs diff --git a/NzbDrone.Core/Qualities/QualitySize.cs b/src/NzbDrone.Core/Qualities/QualitySize.cs similarity index 100% rename from NzbDrone.Core/Qualities/QualitySize.cs rename to src/NzbDrone.Core/Qualities/QualitySize.cs diff --git a/NzbDrone.Core/Qualities/QualitySizeRepository.cs b/src/NzbDrone.Core/Qualities/QualitySizeRepository.cs similarity index 100% rename from NzbDrone.Core/Qualities/QualitySizeRepository.cs rename to src/NzbDrone.Core/Qualities/QualitySizeRepository.cs diff --git a/NzbDrone.Core/Qualities/QualitySizeService.cs b/src/NzbDrone.Core/Qualities/QualitySizeService.cs similarity index 100% rename from NzbDrone.Core/Qualities/QualitySizeService.cs rename to src/NzbDrone.Core/Qualities/QualitySizeService.cs diff --git a/src/NzbDrone.Core/Queue/Queue.cs b/src/NzbDrone.Core/Queue/Queue.cs new file mode 100644 index 000000000..e1ceb3ff8 --- /dev/null +++ b/src/NzbDrone.Core/Queue/Queue.cs @@ -0,0 +1,18 @@ +using System; +using NzbDrone.Core.Datastore; +using NzbDrone.Core.Tv; + +namespace NzbDrone.Core.Queue +{ + public class Queue : ModelBase + { + public Series Series { get; set; } + public Episode Episode { get; set; } + public QualityModel Quality { get; set; } + public Decimal Size { get; set; } + public String Title { get; set; } + public Decimal Sizeleft { get; set; } + public TimeSpan Timeleft { get; set; } + public String Status { get; set; } + } +} diff --git a/src/NzbDrone.Core/Queue/QueueScheduler.cs b/src/NzbDrone.Core/Queue/QueueScheduler.cs new file mode 100644 index 000000000..bce64d8f3 --- /dev/null +++ b/src/NzbDrone.Core/Queue/QueueScheduler.cs @@ -0,0 +1,58 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using NzbDrone.Common.TPL; +using NzbDrone.Core.Lifecycle; +using NzbDrone.Core.Messaging.Events; +using Timer = System.Timers.Timer; + +namespace NzbDrone.Core.Queue +{ + public class QueueScheduler : IHandle, + IHandle + { + private readonly IEventAggregator _eventAggregator; + private static readonly Timer Timer = new Timer(); + private static CancellationTokenSource _cancellationTokenSource; + + public QueueScheduler(IEventAggregator eventAggregator) + { + _eventAggregator = eventAggregator; + } + + private void CheckQueue() + { + try + { + Timer.Enabled = false; + _eventAggregator.PublishEvent(new UpdateQueueEvent()); + } + finally + { + if (!_cancellationTokenSource.IsCancellationRequested) + { + Timer.Enabled = true; + } + } + } + + public void Handle(ApplicationStartedEvent message) + { + _cancellationTokenSource = new CancellationTokenSource(); + Timer.Interval = 1000 * 30; + Timer.Elapsed += (o, args) => Task.Factory.StartNew(CheckQueue, _cancellationTokenSource.Token) + .LogExceptions(); + + Timer.Start(); + } + + public void Handle(ApplicationShutdownRequested message) + { + _cancellationTokenSource.Cancel(true); + Timer.Stop(); + } + } +} diff --git a/src/NzbDrone.Core/Queue/QueueService.cs b/src/NzbDrone.Core/Queue/QueueService.cs new file mode 100644 index 000000000..e3e78c7ac --- /dev/null +++ b/src/NzbDrone.Core/Queue/QueueService.cs @@ -0,0 +1,73 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using NLog; +using NzbDrone.Core.Download; +using NzbDrone.Core.Parser; + +namespace NzbDrone.Core.Queue +{ + public interface IQueueService + { + List GetQueue(); + } + + public class QueueService : IQueueService + { + private readonly IProvideDownloadClient _downloadClientProvider; + private readonly IParsingService _parsingService; + private readonly Logger _logger; + + public QueueService(IProvideDownloadClient downloadClientProvider, IParsingService parsingService, Logger logger) + { + _downloadClientProvider = downloadClientProvider; + _parsingService = parsingService; + _logger = logger; + } + + public List GetQueue() + { + var downloadClient = _downloadClientProvider.GetDownloadClient(); + var queueItems = downloadClient.GetQueue(); + + return MapQueue(queueItems); + } + + private List MapQueue(IEnumerable queueItems) + { + var queued = new List(); + + foreach (var queueItem in queueItems) + { + var parsedEpisodeInfo = Parser.Parser.ParseTitle(queueItem.Title); + + if (parsedEpisodeInfo != null && !string.IsNullOrWhiteSpace(parsedEpisodeInfo.SeriesTitle)) + { + var remoteEpisode = _parsingService.Map(parsedEpisodeInfo, 0); + + if (remoteEpisode.Series == null) + { + continue; + } + + foreach (var episode in remoteEpisode.Episodes) + { + var queue = new Queue(); + queue.Id = queueItem.Id.GetHashCode(); + queue.Series = remoteEpisode.Series; + queue.Episode = episode; + queue.Quality = remoteEpisode.ParsedEpisodeInfo.Quality; + queue.Title = queueItem.Title; + queue.Size = queueItem.Size; + queue.Sizeleft = queueItem.Sizeleft; + queue.Timeleft = queueItem.Timeleft; + queue.Status = queueItem.Status; + queued.Add(queue); + } + } + } + + return queued; + } + } +} diff --git a/src/NzbDrone.Core/Queue/UpdateQueueEvent.cs b/src/NzbDrone.Core/Queue/UpdateQueueEvent.cs new file mode 100644 index 000000000..38535a89d --- /dev/null +++ b/src/NzbDrone.Core/Queue/UpdateQueueEvent.cs @@ -0,0 +1,8 @@ +using NzbDrone.Common.Messaging; + +namespace NzbDrone.Core.Queue +{ + public class UpdateQueueEvent : IEvent + { + } +} diff --git a/NzbDrone.Core/Rest/RestException.cs b/src/NzbDrone.Core/Rest/RestException.cs similarity index 100% rename from NzbDrone.Core/Rest/RestException.cs rename to src/NzbDrone.Core/Rest/RestException.cs diff --git a/NzbDrone.Core/Rest/RestSharpExtensions.cs b/src/NzbDrone.Core/Rest/RestSharpExtensions.cs similarity index 100% rename from NzbDrone.Core/Rest/RestSharpExtensions.cs rename to src/NzbDrone.Core/Rest/RestSharpExtensions.cs diff --git a/NzbDrone.Core/RootFolders/RootFolder.cs b/src/NzbDrone.Core/RootFolders/RootFolder.cs similarity index 100% rename from NzbDrone.Core/RootFolders/RootFolder.cs rename to src/NzbDrone.Core/RootFolders/RootFolder.cs diff --git a/NzbDrone.Core/RootFolders/RootFolderService.cs b/src/NzbDrone.Core/RootFolders/RootFolderService.cs similarity index 100% rename from NzbDrone.Core/RootFolders/RootFolderService.cs rename to src/NzbDrone.Core/RootFolders/RootFolderService.cs diff --git a/NzbDrone.Core/RootFolders/UnmappedFolder.cs b/src/NzbDrone.Core/RootFolders/UnmappedFolder.cs similarity index 100% rename from NzbDrone.Core/RootFolders/UnmappedFolder.cs rename to src/NzbDrone.Core/RootFolders/UnmappedFolder.cs diff --git a/NzbDrone.Core/SeriesStats/SeriesStatistics.cs b/src/NzbDrone.Core/SeriesStats/SeriesStatistics.cs similarity index 100% rename from NzbDrone.Core/SeriesStats/SeriesStatistics.cs rename to src/NzbDrone.Core/SeriesStats/SeriesStatistics.cs diff --git a/NzbDrone.Core/SeriesStats/SeriesStatisticsRepository.cs b/src/NzbDrone.Core/SeriesStats/SeriesStatisticsRepository.cs similarity index 100% rename from NzbDrone.Core/SeriesStats/SeriesStatisticsRepository.cs rename to src/NzbDrone.Core/SeriesStats/SeriesStatisticsRepository.cs diff --git a/NzbDrone.Core/SeriesStats/SeriesStatisticsService.cs b/src/NzbDrone.Core/SeriesStats/SeriesStatisticsService.cs similarity index 100% rename from NzbDrone.Core/SeriesStats/SeriesStatisticsService.cs rename to src/NzbDrone.Core/SeriesStats/SeriesStatisticsService.cs diff --git a/src/NzbDrone.Core/ThingiProvider/ConfigContractNotFoundException.cs b/src/NzbDrone.Core/ThingiProvider/ConfigContractNotFoundException.cs new file mode 100644 index 000000000..47d6ecdf3 --- /dev/null +++ b/src/NzbDrone.Core/ThingiProvider/ConfigContractNotFoundException.cs @@ -0,0 +1,13 @@ +using NzbDrone.Common.Exceptions; + +namespace NzbDrone.Core.ThingiProvider +{ + public class ConfigContractNotFoundException : NzbDroneException + { + public ConfigContractNotFoundException(string contract) + : base("Couldn't find config contract " + contract) + { + } + + } +} diff --git a/src/NzbDrone.Core/ThingiProvider/IProvider.cs b/src/NzbDrone.Core/ThingiProvider/IProvider.cs new file mode 100644 index 000000000..4947c3d8b --- /dev/null +++ b/src/NzbDrone.Core/ThingiProvider/IProvider.cs @@ -0,0 +1,14 @@ + +using System; +using System.Collections.Generic; + +namespace NzbDrone.Core.ThingiProvider +{ + public interface IProvider + { + Type ConfigContract { get; } + + IEnumerable DefaultDefinitions { get; } + ProviderDefinition Definition { get; set; } + } +} \ No newline at end of file diff --git a/NzbDrone.Core/Indexers/IIndexerSetting.cs b/src/NzbDrone.Core/ThingiProvider/IProviderConfig.cs similarity index 53% rename from NzbDrone.Core/Indexers/IIndexerSetting.cs rename to src/NzbDrone.Core/ThingiProvider/IProviderConfig.cs index 4f9cf16de..46501fb34 100644 --- a/NzbDrone.Core/Indexers/IIndexerSetting.cs +++ b/src/NzbDrone.Core/ThingiProvider/IProviderConfig.cs @@ -1,9 +1,9 @@ using FluentValidation.Results; -namespace NzbDrone.Core.Indexers +namespace NzbDrone.Core.ThingiProvider { - public interface IIndexerSetting + public interface IProviderConfig { ValidationResult Validate(); } -} +} \ No newline at end of file diff --git a/src/NzbDrone.Core/ThingiProvider/IProviderFactory.cs b/src/NzbDrone.Core/ThingiProvider/IProviderFactory.cs new file mode 100644 index 000000000..54e8315a6 --- /dev/null +++ b/src/NzbDrone.Core/ThingiProvider/IProviderFactory.cs @@ -0,0 +1,17 @@ +using System.Collections.Generic; + +namespace NzbDrone.Core.ThingiProvider +{ + public interface IProviderFactory + where TProviderDefinition : ProviderDefinition, new() + where TProvider : IProvider + { + List All(); + List GetAvailableProviders(); + TProviderDefinition Get(int id); + TProviderDefinition Create(TProviderDefinition indexer); + void Update(TProviderDefinition indexer); + void Delete(int id); + List Templates(); + } +} \ No newline at end of file diff --git a/src/NzbDrone.Core/ThingiProvider/IProviderRepository.cs b/src/NzbDrone.Core/ThingiProvider/IProviderRepository.cs new file mode 100644 index 000000000..13043b64d --- /dev/null +++ b/src/NzbDrone.Core/ThingiProvider/IProviderRepository.cs @@ -0,0 +1,8 @@ +using NzbDrone.Core.Datastore; + +namespace NzbDrone.Core.ThingiProvider +{ + public interface IProviderRepository : IBasicRepository where TProvider : ModelBase, new() + { + } +} \ No newline at end of file diff --git a/NzbDrone.Core/Indexers/NullSetting.cs b/src/NzbDrone.Core/ThingiProvider/NullConfig.cs similarity index 50% rename from NzbDrone.Core/Indexers/NullSetting.cs rename to src/NzbDrone.Core/ThingiProvider/NullConfig.cs index a7013335a..6eea2e66c 100644 --- a/NzbDrone.Core/Indexers/NullSetting.cs +++ b/src/NzbDrone.Core/ThingiProvider/NullConfig.cs @@ -1,10 +1,10 @@ using FluentValidation.Results; -namespace NzbDrone.Core.Indexers +namespace NzbDrone.Core.ThingiProvider { - public class NullSetting : IIndexerSetting + public class NullConfig : IProviderConfig { - public static readonly NullSetting Instance = new NullSetting(); + public static readonly NullConfig Instance = new NullConfig(); public ValidationResult Validate() { diff --git a/src/NzbDrone.Core/ThingiProvider/ProviderDefinition.cs b/src/NzbDrone.Core/ThingiProvider/ProviderDefinition.cs new file mode 100644 index 000000000..ef21d3206 --- /dev/null +++ b/src/NzbDrone.Core/ThingiProvider/ProviderDefinition.cs @@ -0,0 +1,30 @@ +using NzbDrone.Core.Datastore; + +namespace NzbDrone.Core.ThingiProvider +{ + public abstract class ProviderDefinition : ModelBase + { + private IProviderConfig _settings; + public string Name { get; set; } + public string Implementation { get; set; } + public bool Enable { get; set; } + + public string ConfigContract { get; set; } + + public IProviderConfig Settings + { + get + { + return _settings; + } + set + { + _settings = value; + if (value != null) + { + ConfigContract = value.GetType().Name; + } + } + } + } +} \ No newline at end of file diff --git a/src/NzbDrone.Core/ThingiProvider/ProviderFactory.cs b/src/NzbDrone.Core/ThingiProvider/ProviderFactory.cs new file mode 100644 index 000000000..bbd909bb3 --- /dev/null +++ b/src/NzbDrone.Core/ThingiProvider/ProviderFactory.cs @@ -0,0 +1,104 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using NLog; +using NzbDrone.Core.Lifecycle; +using NzbDrone.Core.Messaging.Events; + +namespace NzbDrone.Core.ThingiProvider +{ + public abstract class ProviderFactory : IProviderFactory, IHandle + where TProviderDefinition : ProviderDefinition, new() + where TProvider : IProvider + { + private readonly IProviderRepository _providerRepository; + private readonly Logger _logger; + + private readonly List _providers; + + protected ProviderFactory(IProviderRepository providerRepository, IEnumerable providers, Logger logger) + { + _providerRepository = providerRepository; + _providers = providers.ToList(); + _logger = logger; + } + + public List All() + { + return _providerRepository.All().ToList(); + } + + public List Templates() + { + return _providers.Select(p => new TProviderDefinition() + { + ConfigContract = p.ConfigContract.Name, + Implementation = p.GetType().Name, + Settings = (IProviderConfig)Activator.CreateInstance(p.ConfigContract) + }).ToList(); + } + + public List GetAvailableProviders() + { + return All().Where(c => c.Enable && c.Settings.Validate().IsValid) + .Select(GetInstance).ToList(); + } + + public TProviderDefinition Get(int id) + { + return _providerRepository.Get(id); + } + + public TProviderDefinition Create(TProviderDefinition provider) + { + return _providerRepository.Insert(provider); + } + + public void Update(TProviderDefinition definition) + { + _providerRepository.Update(definition); + } + + public void Delete(int id) + { + _providerRepository.Delete(id); + } + + private TProvider GetInstance(TProviderDefinition definition) + { + var type = GetImplementation(definition); + var instance = (TProvider)Activator.CreateInstance(type); + instance.Definition = definition; + return instance; + } + + private Type GetImplementation(TProviderDefinition definition) + { + return _providers.Select(c => c.GetType()).SingleOrDefault(c => c.Name.Equals(definition.Implementation, StringComparison.InvariantCultureIgnoreCase)); + } + + public void Handle(ApplicationStartedEvent message) + { + _logger.Debug("Initializing Providers. Count {0}", _providers.Count); + + RemoveMissingImplementations(); + + InitializeProviders(); + } + + protected virtual void InitializeProviders() + { + } + + private void RemoveMissingImplementations() + { + var storedProvider = _providerRepository.All(); + + foreach (var invalidDefinition in storedProvider.Where(def => GetImplementation(def) == null)) + { + _logger.Debug("Removing {0} ", invalidDefinition.Name); + _providerRepository.Delete(invalidDefinition); + } + } + } +} \ No newline at end of file diff --git a/src/NzbDrone.Core/ThingiProvider/ProviderRepository.cs b/src/NzbDrone.Core/ThingiProvider/ProviderRepository.cs new file mode 100644 index 000000000..cceaaefcb --- /dev/null +++ b/src/NzbDrone.Core/ThingiProvider/ProviderRepository.cs @@ -0,0 +1,16 @@ +using System; +using NzbDrone.Core.Datastore; +using NzbDrone.Core.Messaging.Events; + +namespace NzbDrone.Core.ThingiProvider +{ + public class ProviderRepository : BasicRepository, IProviderRepository + where TProviderDefinition : ModelBase, + new() + { + protected ProviderRepository(IDatabase database, IEventAggregator eventAggregator) + : base(database, eventAggregator) + { + } + } +} \ No newline at end of file diff --git a/NzbDrone.Core/Tv/Commands/RefreshSeriesCommand.cs b/src/NzbDrone.Core/Tv/Commands/RefreshSeriesCommand.cs similarity index 100% rename from NzbDrone.Core/Tv/Commands/RefreshSeriesCommand.cs rename to src/NzbDrone.Core/Tv/Commands/RefreshSeriesCommand.cs diff --git a/NzbDrone.Core/Tv/Episode.cs b/src/NzbDrone.Core/Tv/Episode.cs similarity index 100% rename from NzbDrone.Core/Tv/Episode.cs rename to src/NzbDrone.Core/Tv/Episode.cs diff --git a/NzbDrone.Core/Tv/EpisodeRepository.cs b/src/NzbDrone.Core/Tv/EpisodeRepository.cs similarity index 97% rename from NzbDrone.Core/Tv/EpisodeRepository.cs rename to src/NzbDrone.Core/Tv/EpisodeRepository.cs index 3a9ade8d9..57d8acbc1 100644 --- a/NzbDrone.Core/Tv/EpisodeRepository.cs +++ b/src/NzbDrone.Core/Tv/EpisodeRepository.cs @@ -1,139 +1,139 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using Marr.Data.QGen; -using NzbDrone.Core.Datastore; -using NzbDrone.Core.Messaging.Events; - - -namespace NzbDrone.Core.Tv -{ - public interface IEpisodeRepository : IBasicRepository - { - Episode Find(int seriesId, int season, int episodeNumber); - Episode Get(int seriesId, DateTime date); - Episode Find(int seriesId, DateTime date); - List GetEpisodes(int seriesId); - List GetEpisodes(int seriesId, int seasonNumber); - List GetEpisodeByFileId(int fileId); - PagingSpec EpisodesWithoutFiles(PagingSpec pagingSpec, bool includeSpecials); - Episode FindEpisodeBySceneNumbering(int seriesId, int seasonNumber, int episodeNumber); - List EpisodesBetweenDates(DateTime startDate, DateTime endDate); - void SetMonitoredFlat(Episode episode, bool monitored); - void SetMonitoredBySeason(int seriesId, int seasonNumber, bool monitored); - void SetFileId(int episodeId, int fileId); - } - - public class EpisodeRepository : BasicRepository, IEpisodeRepository - { - private readonly IDatabase _database; - - public EpisodeRepository(IDatabase database, IEventAggregator eventAggregator) - : base(database, eventAggregator) - { - _database = database; - } - - public Episode Find(int seriesId, int season, int episodeNumber) - { - return Query.SingleOrDefault(s => s.SeriesId == seriesId && s.SeasonNumber == season && s.EpisodeNumber == episodeNumber); - } - - public Episode Get(int seriesId, DateTime date) - { - return Query.Single(s => s.SeriesId == seriesId && s.AirDate == date.ToString(Episode.AIR_DATE_FORMAT)); - } - - public Episode Find(int seriesId, DateTime date) - { - return Query.SingleOrDefault(s => s.SeriesId == seriesId && s.AirDate == date.ToString(Episode.AIR_DATE_FORMAT)); - } - - public List GetEpisodes(int seriesId) - { - return Query.Where(s => s.SeriesId == seriesId).ToList(); - } - - public List GetEpisodes(int seriesId, int seasonNumber) - { - return Query.Where(s => s.SeriesId == seriesId && s.SeasonNumber == seasonNumber).ToList(); - } - - public List GetEpisodeByFileId(int fileId) - { - return Query.Where(e => e.EpisodeFileId == fileId).ToList(); - } - - public PagingSpec EpisodesWithoutFiles(PagingSpec pagingSpec, bool includeSpecials) - { - var currentTime = DateTime.UtcNow; - var startingSeasonNumber = 1; - - if (includeSpecials) - { - startingSeasonNumber = 0; - } - - pagingSpec.Records = GetEpisodesWithoutFilesQuery(pagingSpec, currentTime, startingSeasonNumber).ToList(); - pagingSpec.TotalRecords = GetEpisodesWithoutFilesQuery(pagingSpec, currentTime, startingSeasonNumber).GetRowCount(); - - return pagingSpec; - } - - public Episode FindEpisodeBySceneNumbering(int seriesId, int seasonNumber, int episodeNumber) - { - return Query.SingleOrDefault(s => s.SeriesId == seriesId && s.SceneSeasonNumber == seasonNumber && s.SceneEpisodeNumber == episodeNumber); - } - - - public List EpisodesBetweenDates(DateTime startDate, DateTime endDate) - { - return Query.Join(JoinType.Inner, e => e.Series, (e, s) => e.SeriesId == s.Id) - .Where(e => e.AirDateUtc >= startDate) - .AndWhere(e => e.AirDateUtc <= endDate) - .AndWhere(e => e.Monitored) - .AndWhere(e => e.Series.Monitored) - .ToList(); - } - - public void SetMonitoredFlat(Episode episode, bool monitored) - { - episode.Monitored = monitored; - SetFields(episode, p => p.Monitored); - } - - public void SetMonitoredBySeason(int seriesId, int seasonNumber, bool monitored) - { - var mapper = _database.GetDataMapper(); - - mapper.AddParameter("seriesId", seriesId); - mapper.AddParameter("seasonNumber", seasonNumber); - mapper.AddParameter("monitored", monitored); - - const string sql = "UPDATE Episodes " + - "SET Monitored = @monitored " + - "WHERE SeriesId = @seriesId " + - "AND SeasonNumber = @seasonNumber"; - - mapper.ExecuteNonQuery(sql); - } - - public void SetFileId(int episodeId, int fileId) - { - SetFields(new Episode { Id = episodeId, EpisodeFileId = fileId }, episode => episode.EpisodeFileId); - } - - private SortBuilder GetEpisodesWithoutFilesQuery(PagingSpec pagingSpec, DateTime currentTime, int startingSeasonNumber) - { - return Query.Join(JoinType.Inner, e => e.Series, (e, s) => e.SeriesId == s.Id) - .Where(e => e.EpisodeFileId == 0) - .AndWhere(e => e.SeasonNumber >= startingSeasonNumber) - .AndWhere(e => e.AirDateUtc <= currentTime) - .AndWhere(e => e.Monitored) - .AndWhere(e => e.Series.Monitored) - .OrderBy(pagingSpec.OrderByClause(), pagingSpec.ToSortDirection()) - .Skip(pagingSpec.PagingOffset()) - .Take(pagingSpec.PageSize); - } - } -} +using System; +using System.Collections.Generic; +using System.Linq; +using Marr.Data.QGen; +using NzbDrone.Core.Datastore; +using NzbDrone.Core.Messaging.Events; + + +namespace NzbDrone.Core.Tv +{ + public interface IEpisodeRepository : IBasicRepository + { + Episode Find(int seriesId, int season, int episodeNumber); + Episode Get(int seriesId, DateTime date); + Episode Find(int seriesId, DateTime date); + List GetEpisodes(int seriesId); + List GetEpisodes(int seriesId, int seasonNumber); + List GetEpisodeByFileId(int fileId); + PagingSpec EpisodesWithoutFiles(PagingSpec pagingSpec, bool includeSpecials); + Episode FindEpisodeBySceneNumbering(int seriesId, int seasonNumber, int episodeNumber); + List EpisodesBetweenDates(DateTime startDate, DateTime endDate); + void SetMonitoredFlat(Episode episode, bool monitored); + void SetMonitoredBySeason(int seriesId, int seasonNumber, bool monitored); + void SetFileId(int episodeId, int fileId); + } + + public class EpisodeRepository : BasicRepository, IEpisodeRepository + { + private readonly IDatabase _database; + + public EpisodeRepository(IDatabase database, IEventAggregator eventAggregator) + : base(database, eventAggregator) + { + _database = database; + } + + public Episode Find(int seriesId, int season, int episodeNumber) + { + return Query.SingleOrDefault(s => s.SeriesId == seriesId && s.SeasonNumber == season && s.EpisodeNumber == episodeNumber); + } + + public Episode Get(int seriesId, DateTime date) + { + return Query.Single(s => s.SeriesId == seriesId && s.AirDate == date.ToString(Episode.AIR_DATE_FORMAT)); + } + + public Episode Find(int seriesId, DateTime date) + { + return Query.SingleOrDefault(s => s.SeriesId == seriesId && s.AirDate == date.ToString(Episode.AIR_DATE_FORMAT)); + } + + public List GetEpisodes(int seriesId) + { + return Query.Where(s => s.SeriesId == seriesId).ToList(); + } + + public List GetEpisodes(int seriesId, int seasonNumber) + { + return Query.Where(s => s.SeriesId == seriesId && s.SeasonNumber == seasonNumber).ToList(); + } + + public List GetEpisodeByFileId(int fileId) + { + return Query.Where(e => e.EpisodeFileId == fileId).ToList(); + } + + public PagingSpec EpisodesWithoutFiles(PagingSpec pagingSpec, bool includeSpecials) + { + var currentTime = DateTime.UtcNow; + var startingSeasonNumber = 1; + + if (includeSpecials) + { + startingSeasonNumber = 0; + } + + pagingSpec.Records = GetEpisodesWithoutFilesQuery(pagingSpec, currentTime, startingSeasonNumber).ToList(); + pagingSpec.TotalRecords = GetEpisodesWithoutFilesQuery(pagingSpec, currentTime, startingSeasonNumber).GetRowCount(); + + return pagingSpec; + } + + public Episode FindEpisodeBySceneNumbering(int seriesId, int seasonNumber, int episodeNumber) + { + return Query.SingleOrDefault(s => s.SeriesId == seriesId && s.SceneSeasonNumber == seasonNumber && s.SceneEpisodeNumber == episodeNumber); + } + + + public List EpisodesBetweenDates(DateTime startDate, DateTime endDate) + { + return Query.Join(JoinType.Inner, e => e.Series, (e, s) => e.SeriesId == s.Id) + .Where(e => e.AirDateUtc >= startDate) + .AndWhere(e => e.AirDateUtc <= endDate) + .AndWhere(e => e.Monitored) + .AndWhere(e => e.Series.Monitored) + .ToList(); + } + + public void SetMonitoredFlat(Episode episode, bool monitored) + { + episode.Monitored = monitored; + SetFields(episode, p => p.Monitored); + } + + public void SetMonitoredBySeason(int seriesId, int seasonNumber, bool monitored) + { + var mapper = _database.GetDataMapper(); + + mapper.AddParameter("seriesId", seriesId); + mapper.AddParameter("seasonNumber", seasonNumber); + mapper.AddParameter("monitored", monitored); + + const string sql = "UPDATE Episodes " + + "SET Monitored = @monitored " + + "WHERE SeriesId = @seriesId " + + "AND SeasonNumber = @seasonNumber"; + + mapper.ExecuteNonQuery(sql); + } + + public void SetFileId(int episodeId, int fileId) + { + SetFields(new Episode { Id = episodeId, EpisodeFileId = fileId }, episode => episode.EpisodeFileId); + } + + private SortBuilder GetEpisodesWithoutFilesQuery(PagingSpec pagingSpec, DateTime currentTime, int startingSeasonNumber) + { + return Query.Join(JoinType.Inner, e => e.Series, (e, s) => e.SeriesId == s.Id) + .Where(e => e.EpisodeFileId == 0) + .AndWhere(e => e.SeasonNumber >= startingSeasonNumber) + .AndWhere(e => e.AirDateUtc <= currentTime) + .AndWhere(e => e.Monitored) + .AndWhere(e => e.Series.Monitored) + .OrderBy(pagingSpec.OrderByClause(), pagingSpec.ToSortDirection()) + .Skip(pagingSpec.PagingOffset()) + .Take(pagingSpec.PageSize); + } + } +} diff --git a/NzbDrone.Core/Tv/EpisodeService.cs b/src/NzbDrone.Core/Tv/EpisodeService.cs similarity index 100% rename from NzbDrone.Core/Tv/EpisodeService.cs rename to src/NzbDrone.Core/Tv/EpisodeService.cs diff --git a/NzbDrone.Core/Tv/Events/EpisodeInfoAddedEvent.cs b/src/NzbDrone.Core/Tv/Events/EpisodeInfoAddedEvent.cs similarity index 100% rename from NzbDrone.Core/Tv/Events/EpisodeInfoAddedEvent.cs rename to src/NzbDrone.Core/Tv/Events/EpisodeInfoAddedEvent.cs diff --git a/NzbDrone.Core/Tv/Events/EpisodeInfoDeletedEvent.cs b/src/NzbDrone.Core/Tv/Events/EpisodeInfoDeletedEvent.cs similarity index 100% rename from NzbDrone.Core/Tv/Events/EpisodeInfoDeletedEvent.cs rename to src/NzbDrone.Core/Tv/Events/EpisodeInfoDeletedEvent.cs diff --git a/NzbDrone.Core/Tv/Events/EpisodeInfoUpdatedEvent.cs b/src/NzbDrone.Core/Tv/Events/EpisodeInfoUpdatedEvent.cs similarity index 100% rename from NzbDrone.Core/Tv/Events/EpisodeInfoUpdatedEvent.cs rename to src/NzbDrone.Core/Tv/Events/EpisodeInfoUpdatedEvent.cs diff --git a/NzbDrone.Core/Tv/Events/SeriesAddedEvent.cs b/src/NzbDrone.Core/Tv/Events/SeriesAddedEvent.cs similarity index 100% rename from NzbDrone.Core/Tv/Events/SeriesAddedEvent.cs rename to src/NzbDrone.Core/Tv/Events/SeriesAddedEvent.cs diff --git a/NzbDrone.Core/Tv/Events/SeriesDeletedEvent.cs b/src/NzbDrone.Core/Tv/Events/SeriesDeletedEvent.cs similarity index 100% rename from NzbDrone.Core/Tv/Events/SeriesDeletedEvent.cs rename to src/NzbDrone.Core/Tv/Events/SeriesDeletedEvent.cs diff --git a/NzbDrone.Core/Tv/Events/SeriesUpdatedEvent.cs b/src/NzbDrone.Core/Tv/Events/SeriesUpdatedEvent.cs similarity index 100% rename from NzbDrone.Core/Tv/Events/SeriesUpdatedEvent.cs rename to src/NzbDrone.Core/Tv/Events/SeriesUpdatedEvent.cs diff --git a/NzbDrone.Core/Tv/QualityModel.cs b/src/NzbDrone.Core/Tv/QualityModel.cs similarity index 100% rename from NzbDrone.Core/Tv/QualityModel.cs rename to src/NzbDrone.Core/Tv/QualityModel.cs diff --git a/NzbDrone.Core/Tv/RefreshEpisodeService.cs b/src/NzbDrone.Core/Tv/RefreshEpisodeService.cs similarity index 97% rename from NzbDrone.Core/Tv/RefreshEpisodeService.cs rename to src/NzbDrone.Core/Tv/RefreshEpisodeService.cs index 31a90761d..1d1ca0a5b 100644 --- a/NzbDrone.Core/Tv/RefreshEpisodeService.cs +++ b/src/NzbDrone.Core/Tv/RefreshEpisodeService.cs @@ -1,144 +1,144 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using NLog; -using NzbDrone.Common; -using NzbDrone.Core.Messaging.Events; -using NzbDrone.Core.Tv.Events; - -namespace NzbDrone.Core.Tv -{ - public interface IRefreshEpisodeService - { - void RefreshEpisodeInfo(Series series, IEnumerable remoteEpisodes); - } - - public class RefreshEpisodeService : IRefreshEpisodeService - { - private readonly IEpisodeService _episodeService; - private readonly IEventAggregator _eventAggregator; - private readonly Logger _logger; - - public RefreshEpisodeService(IEpisodeService episodeService, IEventAggregator eventAggregator, Logger logger) - { - _episodeService = episodeService; - _eventAggregator = eventAggregator; - _logger = logger; - } - - public void RefreshEpisodeInfo(Series series, IEnumerable remoteEpisodes) - { - _logger.Info("Starting episode info refresh for: {0}", series); - var successCount = 0; - var failCount = 0; - - var existingEpisodes = _episodeService.GetEpisodeBySeries(series.Id); - var seasons = series.Seasons; - - var updateList = new List(); - var newList = new List(); - var dupeFreeRemoteEpisodes = remoteEpisodes.DistinctBy(m => new { m.SeasonNumber, m.EpisodeNumber }).ToList(); - - foreach (var episode in dupeFreeRemoteEpisodes.OrderBy(e => e.SeasonNumber).ThenBy(e => e.EpisodeNumber)) - { - try - { - var episodeToUpdate = existingEpisodes.FirstOrDefault(e => e.SeasonNumber == episode.SeasonNumber && e.EpisodeNumber == episode.EpisodeNumber); - - if (episodeToUpdate != null) - { - existingEpisodes.Remove(episodeToUpdate); - updateList.Add(episodeToUpdate); - } - else - { - episodeToUpdate = new Episode(); - episodeToUpdate.Monitored = GetMonitoredStatus(episode, seasons); - newList.Add(episodeToUpdate); - } - - episodeToUpdate.SeriesId = series.Id; - episodeToUpdate.TvDbEpisodeId = episode.TvDbEpisodeId; - episodeToUpdate.EpisodeNumber = episode.EpisodeNumber; - episodeToUpdate.SeasonNumber = episode.SeasonNumber; - episodeToUpdate.Title = episode.Title; - episodeToUpdate.Overview = episode.Overview; - episodeToUpdate.AirDate = episode.AirDate; - episodeToUpdate.AirDateUtc = episode.AirDateUtc; - - successCount++; - } - catch (Exception e) - { - _logger.FatalException(String.Format("An error has occurred while updating episode info for series {0}. {1}", series, episode), e); - failCount++; - } - } - - var allEpisodes = new List(); - allEpisodes.AddRange(newList); - allEpisodes.AddRange(updateList); - - AdjustMultiEpisodeAirTime(series, allEpisodes); - - _episodeService.DeleteMany(existingEpisodes); - _episodeService.UpdateMany(updateList); - _episodeService.InsertMany(newList); - - if (newList.Any()) - { - _eventAggregator.PublishEvent(new EpisodeInfoAddedEvent(newList, series)); - } - - if (updateList.Any()) - { - _eventAggregator.PublishEvent(new EpisodeInfoUpdatedEvent(updateList)); - } - - if (existingEpisodes.Any()) - { - _eventAggregator.PublishEvent(new EpisodeInfoDeletedEvent(updateList)); - } - - if (failCount != 0) - { - _logger.Info("Finished episode refresh for series: {0}. Successful: {1} - Failed: {2} ", - series.Title, successCount, failCount); - } - else - { - _logger.Info("Finished episode refresh for series: {0}.", series); - } - } - - private static bool GetMonitoredStatus(Episode episode, IEnumerable seasons) - { - if (episode.EpisodeNumber == 0 && episode.SeasonNumber != 1) - { - return false; - } - - var season = seasons.SingleOrDefault(c => c.SeasonNumber == episode.SeasonNumber); - return season == null || season.Monitored; - } - - private static void AdjustMultiEpisodeAirTime(Series series, IEnumerable allEpisodes) - { - var groups = - allEpisodes.Where(c => c.AirDateUtc.HasValue) - .GroupBy(e => new { e.SeasonNumber, e.AirDate }) - .Where(g => g.Count() > 1) - .ToList(); - - foreach (var group in groups) - { - var episodeCount = 0; - foreach (var episode in @group.OrderBy(e => e.SeasonNumber).ThenBy(e => e.EpisodeNumber)) - { - episode.AirDateUtc = episode.AirDateUtc.Value.AddMinutes(series.Runtime * episodeCount); - episodeCount++; - } - } - } - } +using System; +using System.Collections.Generic; +using System.Linq; +using NLog; +using NzbDrone.Common; +using NzbDrone.Core.Messaging.Events; +using NzbDrone.Core.Tv.Events; + +namespace NzbDrone.Core.Tv +{ + public interface IRefreshEpisodeService + { + void RefreshEpisodeInfo(Series series, IEnumerable remoteEpisodes); + } + + public class RefreshEpisodeService : IRefreshEpisodeService + { + private readonly IEpisodeService _episodeService; + private readonly IEventAggregator _eventAggregator; + private readonly Logger _logger; + + public RefreshEpisodeService(IEpisodeService episodeService, IEventAggregator eventAggregator, Logger logger) + { + _episodeService = episodeService; + _eventAggregator = eventAggregator; + _logger = logger; + } + + public void RefreshEpisodeInfo(Series series, IEnumerable remoteEpisodes) + { + _logger.Info("Starting episode info refresh for: {0}", series); + var successCount = 0; + var failCount = 0; + + var existingEpisodes = _episodeService.GetEpisodeBySeries(series.Id); + var seasons = series.Seasons; + + var updateList = new List(); + var newList = new List(); + var dupeFreeRemoteEpisodes = remoteEpisodes.DistinctBy(m => new { m.SeasonNumber, m.EpisodeNumber }).ToList(); + + foreach (var episode in dupeFreeRemoteEpisodes.OrderBy(e => e.SeasonNumber).ThenBy(e => e.EpisodeNumber)) + { + try + { + var episodeToUpdate = existingEpisodes.FirstOrDefault(e => e.SeasonNumber == episode.SeasonNumber && e.EpisodeNumber == episode.EpisodeNumber); + + if (episodeToUpdate != null) + { + existingEpisodes.Remove(episodeToUpdate); + updateList.Add(episodeToUpdate); + } + else + { + episodeToUpdate = new Episode(); + episodeToUpdate.Monitored = GetMonitoredStatus(episode, seasons); + newList.Add(episodeToUpdate); + } + + episodeToUpdate.SeriesId = series.Id; + episodeToUpdate.TvDbEpisodeId = episode.TvDbEpisodeId; + episodeToUpdate.EpisodeNumber = episode.EpisodeNumber; + episodeToUpdate.SeasonNumber = episode.SeasonNumber; + episodeToUpdate.Title = episode.Title; + episodeToUpdate.Overview = episode.Overview; + episodeToUpdate.AirDate = episode.AirDate; + episodeToUpdate.AirDateUtc = episode.AirDateUtc; + + successCount++; + } + catch (Exception e) + { + _logger.FatalException(String.Format("An error has occurred while updating episode info for series {0}. {1}", series, episode), e); + failCount++; + } + } + + var allEpisodes = new List(); + allEpisodes.AddRange(newList); + allEpisodes.AddRange(updateList); + + AdjustMultiEpisodeAirTime(series, allEpisodes); + + _episodeService.DeleteMany(existingEpisodes); + _episodeService.UpdateMany(updateList); + _episodeService.InsertMany(newList); + + if (newList.Any()) + { + _eventAggregator.PublishEvent(new EpisodeInfoAddedEvent(newList, series)); + } + + if (updateList.Any()) + { + _eventAggregator.PublishEvent(new EpisodeInfoUpdatedEvent(updateList)); + } + + if (existingEpisodes.Any()) + { + _eventAggregator.PublishEvent(new EpisodeInfoDeletedEvent(updateList)); + } + + if (failCount != 0) + { + _logger.Info("Finished episode refresh for series: {0}. Successful: {1} - Failed: {2} ", + series.Title, successCount, failCount); + } + else + { + _logger.Info("Finished episode refresh for series: {0}.", series); + } + } + + private static bool GetMonitoredStatus(Episode episode, IEnumerable seasons) + { + if (episode.EpisodeNumber == 0 && episode.SeasonNumber != 1) + { + return false; + } + + var season = seasons.SingleOrDefault(c => c.SeasonNumber == episode.SeasonNumber); + return season == null || season.Monitored; + } + + private static void AdjustMultiEpisodeAirTime(Series series, IEnumerable allEpisodes) + { + var groups = + allEpisodes.Where(c => c.AirDateUtc.HasValue) + .GroupBy(e => new { e.SeasonNumber, e.AirDate }) + .Where(g => g.Count() > 1) + .ToList(); + + foreach (var group in groups) + { + var episodeCount = 0; + foreach (var episode in @group.OrderBy(e => e.SeasonNumber).ThenBy(e => e.EpisodeNumber)) + { + episode.AirDateUtc = episode.AirDateUtc.Value.AddMinutes(series.Runtime * episodeCount); + episodeCount++; + } + } + } + } } \ No newline at end of file diff --git a/NzbDrone.Core/Tv/RefreshSeriesService.cs b/src/NzbDrone.Core/Tv/RefreshSeriesService.cs similarity index 100% rename from NzbDrone.Core/Tv/RefreshSeriesService.cs rename to src/NzbDrone.Core/Tv/RefreshSeriesService.cs diff --git a/NzbDrone.Core/Tv/Season.cs b/src/NzbDrone.Core/Tv/Season.cs similarity index 100% rename from NzbDrone.Core/Tv/Season.cs rename to src/NzbDrone.Core/Tv/Season.cs diff --git a/NzbDrone.Core/Tv/Series.cs b/src/NzbDrone.Core/Tv/Series.cs similarity index 100% rename from NzbDrone.Core/Tv/Series.cs rename to src/NzbDrone.Core/Tv/Series.cs diff --git a/NzbDrone.Core/Tv/SeriesRepository.cs b/src/NzbDrone.Core/Tv/SeriesRepository.cs similarity index 100% rename from NzbDrone.Core/Tv/SeriesRepository.cs rename to src/NzbDrone.Core/Tv/SeriesRepository.cs diff --git a/NzbDrone.Core/Tv/SeriesService.cs b/src/NzbDrone.Core/Tv/SeriesService.cs similarity index 100% rename from NzbDrone.Core/Tv/SeriesService.cs rename to src/NzbDrone.Core/Tv/SeriesService.cs diff --git a/NzbDrone.Core/Tv/SeriesStatusType.cs b/src/NzbDrone.Core/Tv/SeriesStatusType.cs similarity index 100% rename from NzbDrone.Core/Tv/SeriesStatusType.cs rename to src/NzbDrone.Core/Tv/SeriesStatusType.cs diff --git a/NzbDrone.Core/Tv/SeriesTypes.cs b/src/NzbDrone.Core/Tv/SeriesTypes.cs similarity index 100% rename from NzbDrone.Core/Tv/SeriesTypes.cs rename to src/NzbDrone.Core/Tv/SeriesTypes.cs diff --git a/NzbDrone.Core/Update/Commands/ApplicationUpdateCommand.cs b/src/NzbDrone.Core/Update/Commands/ApplicationUpdateCommand.cs similarity index 100% rename from NzbDrone.Core/Update/Commands/ApplicationUpdateCommand.cs rename to src/NzbDrone.Core/Update/Commands/ApplicationUpdateCommand.cs diff --git a/NzbDrone.Core/Update/InstallUpdateService.cs b/src/NzbDrone.Core/Update/InstallUpdateService.cs similarity index 91% rename from NzbDrone.Core/Update/InstallUpdateService.cs rename to src/NzbDrone.Core/Update/InstallUpdateService.cs index b0088ee87..6b4b10ab3 100644 --- a/NzbDrone.Core/Update/InstallUpdateService.cs +++ b/src/NzbDrone.Core/Update/InstallUpdateService.cs @@ -1,5 +1,6 @@ using System; using System.IO; +using System.Security.Cryptography.X509Certificates; using NLog; using NzbDrone.Common; using NzbDrone.Common.EnvironmentInfo; @@ -10,7 +11,12 @@ using NzbDrone.Core.Instrumentation; namespace NzbDrone.Core.Update { - public class InstallUpdateService : IExecute + public interface IInstallUpdates + { + void InstallUpdate(UpdatePackage updatePackage); + } + + public class InstallUpdateService : IInstallUpdates, IExecute { private readonly ICheckUpdateService _checkUpdateService; private readonly Logger _logger; @@ -35,19 +41,7 @@ namespace NzbDrone.Core.Update _logger = logger; } - - public void Execute(ApplicationUpdateCommand message) - { - _logger.ProgressDebug("Checking for updates"); - var latestAvailable = _checkUpdateService.AvailableUpdate(); - - if (latestAvailable != null) - { - InstallUpdate(latestAvailable); - } - } - - private void InstallUpdate(UpdatePackage updatePackage) + public void InstallUpdate(UpdatePackage updatePackage) { try { @@ -84,5 +78,16 @@ namespace NzbDrone.Core.Update _logger.ErrorException("Update process failed", ex); } } + + public void Execute(ApplicationUpdateCommand message) + { + _logger.ProgressDebug("Checking for updates"); + var latestAvailable = _checkUpdateService.AvailableUpdate(); + + if (latestAvailable != null) + { + InstallUpdate(latestAvailable); + } + } } } diff --git a/NzbDrone.Core/Update/RecentUpdateProvider.cs b/src/NzbDrone.Core/Update/RecentUpdateProvider.cs similarity index 100% rename from NzbDrone.Core/Update/RecentUpdateProvider.cs rename to src/NzbDrone.Core/Update/RecentUpdateProvider.cs diff --git a/NzbDrone.Core/Update/UpdateChanges.cs b/src/NzbDrone.Core/Update/UpdateChanges.cs similarity index 100% rename from NzbDrone.Core/Update/UpdateChanges.cs rename to src/NzbDrone.Core/Update/UpdateChanges.cs diff --git a/NzbDrone.Core/Update/UpdateCheckService.cs b/src/NzbDrone.Core/Update/UpdateCheckService.cs similarity index 100% rename from NzbDrone.Core/Update/UpdateCheckService.cs rename to src/NzbDrone.Core/Update/UpdateCheckService.cs diff --git a/NzbDrone.Core/Update/UpdatePackage.cs b/src/NzbDrone.Core/Update/UpdatePackage.cs similarity index 89% rename from NzbDrone.Core/Update/UpdatePackage.cs rename to src/NzbDrone.Core/Update/UpdatePackage.cs index f8159686a..a7ed63b5a 100644 --- a/NzbDrone.Core/Update/UpdatePackage.cs +++ b/src/NzbDrone.Core/Update/UpdatePackage.cs @@ -5,15 +5,11 @@ namespace NzbDrone.Core.Update { public class UpdatePackage { - public string Id { get; set; } - public Version Version { get; set; } - public String Branch { get; set; } public DateTime ReleaseDate { get; set; } public String FileName { get; set; } public String Url { get; set; } - public UpdateChanges Changes { get; set; } } } diff --git a/NzbDrone.Core/Update/UpdatePackageAvailable.cs b/src/NzbDrone.Core/Update/UpdatePackageAvailable.cs similarity index 100% rename from NzbDrone.Core/Update/UpdatePackageAvailable.cs rename to src/NzbDrone.Core/Update/UpdatePackageAvailable.cs diff --git a/NzbDrone.Core/Update/UpdatePackageProvider.cs b/src/NzbDrone.Core/Update/UpdatePackageProvider.cs similarity index 100% rename from NzbDrone.Core/Update/UpdatePackageProvider.cs rename to src/NzbDrone.Core/Update/UpdatePackageProvider.cs diff --git a/NzbDrone.Core/Validation/RuleBuilderExtensions.cs b/src/NzbDrone.Core/Validation/RuleBuilderExtensions.cs similarity index 100% rename from NzbDrone.Core/Validation/RuleBuilderExtensions.cs rename to src/NzbDrone.Core/Validation/RuleBuilderExtensions.cs diff --git a/NzbDrone.Core/packages.config b/src/NzbDrone.Core/packages.config similarity index 100% rename from NzbDrone.Core/packages.config rename to src/NzbDrone.Core/packages.config diff --git a/NzbDrone.Host/AccessControl/FirewallAdapter.cs b/src/NzbDrone.Host/AccessControl/FirewallAdapter.cs similarity index 100% rename from NzbDrone.Host/AccessControl/FirewallAdapter.cs rename to src/NzbDrone.Host/AccessControl/FirewallAdapter.cs diff --git a/NzbDrone.Host/AccessControl/NetshProvider.cs b/src/NzbDrone.Host/AccessControl/NetshProvider.cs similarity index 100% rename from NzbDrone.Host/AccessControl/NetshProvider.cs rename to src/NzbDrone.Host/AccessControl/NetshProvider.cs diff --git a/NzbDrone.Host/AccessControl/SslAdapter.cs b/src/NzbDrone.Host/AccessControl/SslAdapter.cs similarity index 100% rename from NzbDrone.Host/AccessControl/SslAdapter.cs rename to src/NzbDrone.Host/AccessControl/SslAdapter.cs diff --git a/NzbDrone.Host/AccessControl/UrlAclAdapter.cs b/src/NzbDrone.Host/AccessControl/UrlAclAdapter.cs similarity index 100% rename from NzbDrone.Host/AccessControl/UrlAclAdapter.cs rename to src/NzbDrone.Host/AccessControl/UrlAclAdapter.cs diff --git a/NzbDrone.Host/ApplicationModes.cs b/src/NzbDrone.Host/ApplicationModes.cs similarity index 100% rename from NzbDrone.Host/ApplicationModes.cs rename to src/NzbDrone.Host/ApplicationModes.cs diff --git a/NzbDrone.Host/ApplicationServer.cs b/src/NzbDrone.Host/ApplicationServer.cs similarity index 100% rename from NzbDrone.Host/ApplicationServer.cs rename to src/NzbDrone.Host/ApplicationServer.cs diff --git a/NzbDrone.Host/Bootstrap.cs b/src/NzbDrone.Host/Bootstrap.cs similarity index 100% rename from NzbDrone.Host/Bootstrap.cs rename to src/NzbDrone.Host/Bootstrap.cs diff --git a/NzbDrone.Host/IUserAlert.cs b/src/NzbDrone.Host/IUserAlert.cs similarity index 100% rename from NzbDrone.Host/IUserAlert.cs rename to src/NzbDrone.Host/IUserAlert.cs diff --git a/NzbDrone.Host/MainAppContainerBuilder.cs b/src/NzbDrone.Host/MainAppContainerBuilder.cs similarity index 100% rename from NzbDrone.Host/MainAppContainerBuilder.cs rename to src/NzbDrone.Host/MainAppContainerBuilder.cs diff --git a/NzbDrone.Host/NLog.xsd b/src/NzbDrone.Host/NLog.xsd similarity index 100% rename from NzbDrone.Host/NLog.xsd rename to src/NzbDrone.Host/NLog.xsd diff --git a/NzbDrone.Host/NzbDrone.Host.csproj b/src/NzbDrone.Host/NzbDrone.Host.csproj similarity index 99% rename from NzbDrone.Host/NzbDrone.Host.csproj rename to src/NzbDrone.Host/NzbDrone.Host.csproj index ff8922c0c..b4aa2ad35 100644 --- a/NzbDrone.Host/NzbDrone.Host.csproj +++ b/src/NzbDrone.Host/NzbDrone.Host.csproj @@ -37,7 +37,7 @@ true full false - ..\_output\ + ..\..\_output\ DEBUG;TRACE prompt 4 @@ -48,7 +48,7 @@ x86 pdbonly true - ..\_output\ + ..\..\_output\ TRACE prompt 4 diff --git a/NzbDrone.Host/NzbDrone.ico b/src/NzbDrone.Host/NzbDrone.ico similarity index 100% rename from NzbDrone.Host/NzbDrone.ico rename to src/NzbDrone.Host/NzbDrone.ico diff --git a/NzbDrone.Host/Owin/IHostController.cs b/src/NzbDrone.Host/Owin/IHostController.cs similarity index 100% rename from NzbDrone.Host/Owin/IHostController.cs rename to src/NzbDrone.Host/Owin/IHostController.cs diff --git a/NzbDrone.Host/Owin/MiddleWare/IOwinMiddleWare.cs b/src/NzbDrone.Host/Owin/MiddleWare/IOwinMiddleWare.cs similarity index 100% rename from NzbDrone.Host/Owin/MiddleWare/IOwinMiddleWare.cs rename to src/NzbDrone.Host/Owin/MiddleWare/IOwinMiddleWare.cs diff --git a/NzbDrone.Host/Owin/MiddleWare/NancyMiddleWare.cs b/src/NzbDrone.Host/Owin/MiddleWare/NancyMiddleWare.cs similarity index 100% rename from NzbDrone.Host/Owin/MiddleWare/NancyMiddleWare.cs rename to src/NzbDrone.Host/Owin/MiddleWare/NancyMiddleWare.cs diff --git a/NzbDrone.Host/Owin/MiddleWare/SignalRMiddleWare.cs b/src/NzbDrone.Host/Owin/MiddleWare/SignalRMiddleWare.cs similarity index 100% rename from NzbDrone.Host/Owin/MiddleWare/SignalRMiddleWare.cs rename to src/NzbDrone.Host/Owin/MiddleWare/SignalRMiddleWare.cs diff --git a/NzbDrone.Host/Owin/NlogTextWriter.cs b/src/NzbDrone.Host/Owin/NlogTextWriter.cs similarity index 100% rename from NzbDrone.Host/Owin/NlogTextWriter.cs rename to src/NzbDrone.Host/Owin/NlogTextWriter.cs diff --git a/NzbDrone.Host/Owin/OwinHostController.cs b/src/NzbDrone.Host/Owin/OwinHostController.cs similarity index 100% rename from NzbDrone.Host/Owin/OwinHostController.cs rename to src/NzbDrone.Host/Owin/OwinHostController.cs diff --git a/NzbDrone.Host/Owin/OwinServiceProvider.cs b/src/NzbDrone.Host/Owin/OwinServiceProvider.cs similarity index 100% rename from NzbDrone.Host/Owin/OwinServiceProvider.cs rename to src/NzbDrone.Host/Owin/OwinServiceProvider.cs diff --git a/NzbDrone.Host/Owin/OwinTraceOutputFactory.cs b/src/NzbDrone.Host/Owin/OwinTraceOutputFactory.cs similarity index 100% rename from NzbDrone.Host/Owin/OwinTraceOutputFactory.cs rename to src/NzbDrone.Host/Owin/OwinTraceOutputFactory.cs diff --git a/NzbDrone.Host/Owin/PortInUseException.cs b/src/NzbDrone.Host/Owin/PortInUseException.cs similarity index 100% rename from NzbDrone.Host/Owin/PortInUseException.cs rename to src/NzbDrone.Host/Owin/PortInUseException.cs diff --git a/NzbDrone.Host/PlatformValidation.cs b/src/NzbDrone.Host/PlatformValidation.cs similarity index 100% rename from NzbDrone.Host/PlatformValidation.cs rename to src/NzbDrone.Host/PlatformValidation.cs diff --git a/NzbDrone.Host/PriorityMonitor.cs b/src/NzbDrone.Host/PriorityMonitor.cs similarity index 100% rename from NzbDrone.Host/PriorityMonitor.cs rename to src/NzbDrone.Host/PriorityMonitor.cs diff --git a/NzbDrone.Host/Properties/AssemblyInfo.cs b/src/NzbDrone.Host/Properties/AssemblyInfo.cs similarity index 100% rename from NzbDrone.Host/Properties/AssemblyInfo.cs rename to src/NzbDrone.Host/Properties/AssemblyInfo.cs diff --git a/NzbDrone.Host/Router.cs b/src/NzbDrone.Host/Router.cs similarity index 100% rename from NzbDrone.Host/Router.cs rename to src/NzbDrone.Host/Router.cs diff --git a/NzbDrone.Host/TerminateApplicationException.cs b/src/NzbDrone.Host/TerminateApplicationException.cs similarity index 100% rename from NzbDrone.Host/TerminateApplicationException.cs rename to src/NzbDrone.Host/TerminateApplicationException.cs diff --git a/NzbDrone.Host/app.config b/src/NzbDrone.Host/app.config similarity index 100% rename from NzbDrone.Host/app.config rename to src/NzbDrone.Host/app.config diff --git a/NzbDrone.Host/packages.config b/src/NzbDrone.Host/packages.config similarity index 100% rename from NzbDrone.Host/packages.config rename to src/NzbDrone.Host/packages.config diff --git a/NzbDrone.Integration.Test/Client/ClientBase.cs b/src/NzbDrone.Integration.Test/Client/ClientBase.cs similarity index 96% rename from NzbDrone.Integration.Test/Client/ClientBase.cs rename to src/NzbDrone.Integration.Test/Client/ClientBase.cs index 9cd0b4b7a..a93bfad43 100644 --- a/NzbDrone.Integration.Test/Client/ClientBase.cs +++ b/src/NzbDrone.Integration.Test/Client/ClientBase.cs @@ -1,154 +1,154 @@ -using System.Collections.Generic; -using System.Net; -using FluentAssertions; -using NLog; -using NzbDrone.Api; -using NzbDrone.Api.REST; -using NzbDrone.Common.Serializer; -using RestSharp; -using System.Linq; - -namespace NzbDrone.Integration.Test.Client -{ - public class ClientBase where TResource : RestResource, new() - { - private readonly IRestClient _restClient; - private readonly string _resource; - private readonly string _apiKey; - private readonly Logger _logger; - - public ClientBase(IRestClient restClient, string apiKey, string resource = null) - { - if (resource == null) - { - resource = new TResource().ResourceName; - } - - _restClient = restClient; - _resource = resource; - _apiKey = apiKey; - - _logger = LogManager.GetLogger("REST"); - } - - public List All() - { - var request = BuildRequest(); - return Get>(request); - } - - public PagingResource GetPaged(int pageNumber, int pageSize, string sortKey, string sortDir) - { - var request = BuildRequest(); - request.AddParameter("page", pageNumber); - request.AddParameter("pageSize", pageSize); - request.AddParameter("sortKey", sortKey); - request.AddParameter("sortDir", sortDir); - return Get>(request); - - } - - public TResource Post(TResource body) - { - var request = BuildRequest(); - request.AddBody(body); - return Post(request); - } - - public TResource Put(TResource body) - { - var request = BuildRequest(); - request.AddBody(body); - return Put(request); - } - - public TResource Get(int id, HttpStatusCode statusCode = HttpStatusCode.OK) - { - var request = BuildRequest(id.ToString()); - return Get(request, statusCode); - } - - public TResource GetSingle(HttpStatusCode statusCode = HttpStatusCode.OK) - { - var request = BuildRequest(); - return Get(request, statusCode); - } - - public void Delete(int id) - { - var request = BuildRequest(id.ToString()); - Delete(request); - } - - public List InvalidPost(TResource body) - { - var request = BuildRequest(); - request.AddBody(body); - return Post>(request, HttpStatusCode.BadRequest); - } - - public RestRequest BuildRequest(string command = "") - { - var request = new RestRequest(_resource + "/" + command.Trim('/')) - { - RequestFormat = DataFormat.Json, - }; - - request.AddHeader("Authorization", _apiKey); - - return request; - } - - public T Get(IRestRequest request, HttpStatusCode statusCode = HttpStatusCode.OK) where T : class, new() - { - request.Method = Method.GET; - return Execute(request, statusCode); - } - - public T Post(IRestRequest request, HttpStatusCode statusCode = HttpStatusCode.Created) where T : class, new() - { - request.Method = Method.POST; - return Execute(request, statusCode); - } - - public T Put(IRestRequest request, HttpStatusCode statusCode = HttpStatusCode.Accepted) where T : class, new() - { - request.Method = Method.PUT; - return Execute(request, statusCode); - } - - public void Delete(IRestRequest request, HttpStatusCode statusCode = HttpStatusCode.OK) - { - request.Method = Method.DELETE; - Execute(request, statusCode); - } - - private T Execute(IRestRequest request, HttpStatusCode statusCode) where T : class, new() - { - _logger.Info("{0}: {1}", request.Method, _restClient.BuildUri(request)); - - var response = _restClient.Execute(request); - _logger.Info("Response: {0}", response.Content); - - if (response.ErrorException != null) - { - throw response.ErrorException; - } - - AssertDisableCache(response.Headers); - - response.ErrorMessage.Should().BeBlank(); - - response.StatusCode.Should().Be(statusCode); - - return Json.Deserialize(response.Content); - } - - private static void AssertDisableCache(IList headers) - { - headers.Single(c => c.Name == "Cache-Control").Value.Should().Be("no-cache, no-store, must-revalidate"); - headers.Single(c => c.Name == "Pragma").Value.Should().Be("no-cache"); - headers.Single(c => c.Name == "Expires").Value.Should().Be("0"); - } - } +using System.Collections.Generic; +using System.Net; +using FluentAssertions; +using NLog; +using NzbDrone.Api; +using NzbDrone.Api.REST; +using NzbDrone.Common.Serializer; +using RestSharp; +using System.Linq; + +namespace NzbDrone.Integration.Test.Client +{ + public class ClientBase where TResource : RestResource, new() + { + private readonly IRestClient _restClient; + private readonly string _resource; + private readonly string _apiKey; + private readonly Logger _logger; + + public ClientBase(IRestClient restClient, string apiKey, string resource = null) + { + if (resource == null) + { + resource = new TResource().ResourceName; + } + + _restClient = restClient; + _resource = resource; + _apiKey = apiKey; + + _logger = LogManager.GetLogger("REST"); + } + + public List All() + { + var request = BuildRequest(); + return Get>(request); + } + + public PagingResource GetPaged(int pageNumber, int pageSize, string sortKey, string sortDir) + { + var request = BuildRequest(); + request.AddParameter("page", pageNumber); + request.AddParameter("pageSize", pageSize); + request.AddParameter("sortKey", sortKey); + request.AddParameter("sortDir", sortDir); + return Get>(request); + + } + + public TResource Post(TResource body) + { + var request = BuildRequest(); + request.AddBody(body); + return Post(request); + } + + public TResource Put(TResource body) + { + var request = BuildRequest(); + request.AddBody(body); + return Put(request); + } + + public TResource Get(int id, HttpStatusCode statusCode = HttpStatusCode.OK) + { + var request = BuildRequest(id.ToString()); + return Get(request, statusCode); + } + + public TResource GetSingle(HttpStatusCode statusCode = HttpStatusCode.OK) + { + var request = BuildRequest(); + return Get(request, statusCode); + } + + public void Delete(int id) + { + var request = BuildRequest(id.ToString()); + Delete(request); + } + + public List InvalidPost(TResource body) + { + var request = BuildRequest(); + request.AddBody(body); + return Post>(request, HttpStatusCode.BadRequest); + } + + public RestRequest BuildRequest(string command = "") + { + var request = new RestRequest(_resource + "/" + command.Trim('/')) + { + RequestFormat = DataFormat.Json, + }; + + request.AddHeader("Authorization", _apiKey); + + return request; + } + + public T Get(IRestRequest request, HttpStatusCode statusCode = HttpStatusCode.OK) where T : class, new() + { + request.Method = Method.GET; + return Execute(request, statusCode); + } + + public T Post(IRestRequest request, HttpStatusCode statusCode = HttpStatusCode.Created) where T : class, new() + { + request.Method = Method.POST; + return Execute(request, statusCode); + } + + public T Put(IRestRequest request, HttpStatusCode statusCode = HttpStatusCode.Accepted) where T : class, new() + { + request.Method = Method.PUT; + return Execute(request, statusCode); + } + + public void Delete(IRestRequest request, HttpStatusCode statusCode = HttpStatusCode.OK) + { + request.Method = Method.DELETE; + Execute(request, statusCode); + } + + private T Execute(IRestRequest request, HttpStatusCode statusCode) where T : class, new() + { + _logger.Info("{0}: {1}", request.Method, _restClient.BuildUri(request)); + + var response = _restClient.Execute(request); + _logger.Info("Response: {0}", response.Content); + + if (response.ErrorException != null) + { + throw response.ErrorException; + } + + AssertDisableCache(response.Headers); + + response.ErrorMessage.Should().BeBlank(); + + response.StatusCode.Should().Be(statusCode); + + return Json.Deserialize(response.Content); + } + + private static void AssertDisableCache(IList headers) + { + headers.Single(c => c.Name == "Cache-Control").Value.Should().Be("no-cache, no-store, must-revalidate"); + headers.Single(c => c.Name == "Pragma").Value.Should().Be("no-cache"); + headers.Single(c => c.Name == "Expires").Value.Should().Be("0"); + } + } } \ No newline at end of file diff --git a/NzbDrone.Integration.Test/Client/EpisodeClient.cs b/src/NzbDrone.Integration.Test/Client/EpisodeClient.cs similarity index 100% rename from NzbDrone.Integration.Test/Client/EpisodeClient.cs rename to src/NzbDrone.Integration.Test/Client/EpisodeClient.cs diff --git a/NzbDrone.Integration.Test/Client/IndexerClient.cs b/src/NzbDrone.Integration.Test/Client/IndexerClient.cs similarity index 100% rename from NzbDrone.Integration.Test/Client/IndexerClient.cs rename to src/NzbDrone.Integration.Test/Client/IndexerClient.cs diff --git a/NzbDrone.Integration.Test/Client/ReleaseClient.cs b/src/NzbDrone.Integration.Test/Client/ReleaseClient.cs similarity index 100% rename from NzbDrone.Integration.Test/Client/ReleaseClient.cs rename to src/NzbDrone.Integration.Test/Client/ReleaseClient.cs diff --git a/NzbDrone.Integration.Test/Client/SeriesClient.cs b/src/NzbDrone.Integration.Test/Client/SeriesClient.cs similarity index 100% rename from NzbDrone.Integration.Test/Client/SeriesClient.cs rename to src/NzbDrone.Integration.Test/Client/SeriesClient.cs diff --git a/NzbDrone.Integration.Test/CommandIntegerationTests.cs b/src/NzbDrone.Integration.Test/CommandIntegerationTests.cs similarity index 100% rename from NzbDrone.Integration.Test/CommandIntegerationTests.cs rename to src/NzbDrone.Integration.Test/CommandIntegerationTests.cs diff --git a/NzbDrone.Integration.Test/EpisodeIntegrationTests.cs b/src/NzbDrone.Integration.Test/EpisodeIntegrationTests.cs similarity index 100% rename from NzbDrone.Integration.Test/EpisodeIntegrationTests.cs rename to src/NzbDrone.Integration.Test/EpisodeIntegrationTests.cs diff --git a/NzbDrone.Integration.Test/HistoryIntegrationTest.cs b/src/NzbDrone.Integration.Test/HistoryIntegrationTest.cs similarity index 100% rename from NzbDrone.Integration.Test/HistoryIntegrationTest.cs rename to src/NzbDrone.Integration.Test/HistoryIntegrationTest.cs diff --git a/NzbDrone.Integration.Test/IndexerIntegrationFixture.cs b/src/NzbDrone.Integration.Test/IndexerIntegrationFixture.cs similarity index 67% rename from NzbDrone.Integration.Test/IndexerIntegrationFixture.cs rename to src/NzbDrone.Integration.Test/IndexerIntegrationFixture.cs index 33fb6e0ab..96003762b 100644 --- a/NzbDrone.Integration.Test/IndexerIntegrationFixture.cs +++ b/src/NzbDrone.Integration.Test/IndexerIntegrationFixture.cs @@ -1,5 +1,7 @@ -using FluentAssertions; +using System.Linq; +using FluentAssertions; using NUnit.Framework; +using NzbDrone.Core.ThingiProvider; namespace NzbDrone.Integration.Test { @@ -13,6 +15,7 @@ namespace NzbDrone.Integration.Test indexers.Should().NotBeEmpty(); indexers.Should().NotContain(c => string.IsNullOrWhiteSpace(c.Name)); + indexers.Where(c => c.ConfigContract == typeof(NullConfig).Name).Should().OnlyContain(c => c.Enable); } } } \ No newline at end of file diff --git a/NzbDrone.Integration.Test/IntegrationTest.cs b/src/NzbDrone.Integration.Test/IntegrationTest.cs similarity index 100% rename from NzbDrone.Integration.Test/IntegrationTest.cs rename to src/NzbDrone.Integration.Test/IntegrationTest.cs diff --git a/NzbDrone.Integration.Test/IntegrationTestDirectoryInfo.cs b/src/NzbDrone.Integration.Test/IntegrationTestDirectoryInfo.cs similarity index 100% rename from NzbDrone.Integration.Test/IntegrationTestDirectoryInfo.cs rename to src/NzbDrone.Integration.Test/IntegrationTestDirectoryInfo.cs diff --git a/NzbDrone.Integration.Test/NamingConfigTests.cs b/src/NzbDrone.Integration.Test/NamingConfigTests.cs similarity index 100% rename from NzbDrone.Integration.Test/NamingConfigTests.cs rename to src/NzbDrone.Integration.Test/NamingConfigTests.cs diff --git a/NzbDrone.Integration.Test/NzbDrone.Integration.Test.csproj b/src/NzbDrone.Integration.Test/NzbDrone.Integration.Test.csproj similarity index 100% rename from NzbDrone.Integration.Test/NzbDrone.Integration.Test.csproj rename to src/NzbDrone.Integration.Test/NzbDrone.Integration.Test.csproj diff --git a/NzbDrone.Integration.Test/NzbDroneRunner.cs b/src/NzbDrone.Integration.Test/NzbDroneRunner.cs similarity index 100% rename from NzbDrone.Integration.Test/NzbDroneRunner.cs rename to src/NzbDrone.Integration.Test/NzbDroneRunner.cs diff --git a/NzbDrone.Integration.Test/Properties/AssemblyInfo.cs b/src/NzbDrone.Integration.Test/Properties/AssemblyInfo.cs similarity index 100% rename from NzbDrone.Integration.Test/Properties/AssemblyInfo.cs rename to src/NzbDrone.Integration.Test/Properties/AssemblyInfo.cs diff --git a/NzbDrone.Integration.Test/QualityProfileIntegrationTest.cs b/src/NzbDrone.Integration.Test/QualityProfileIntegrationTest.cs similarity index 100% rename from NzbDrone.Integration.Test/QualityProfileIntegrationTest.cs rename to src/NzbDrone.Integration.Test/QualityProfileIntegrationTest.cs diff --git a/NzbDrone.Integration.Test/ReleaseIntegrationTest.cs b/src/NzbDrone.Integration.Test/ReleaseIntegrationTest.cs similarity index 85% rename from NzbDrone.Integration.Test/ReleaseIntegrationTest.cs rename to src/NzbDrone.Integration.Test/ReleaseIntegrationTest.cs index b9a86674e..eb76f1255 100644 --- a/NzbDrone.Integration.Test/ReleaseIntegrationTest.cs +++ b/src/NzbDrone.Integration.Test/ReleaseIntegrationTest.cs @@ -1,4 +1,5 @@ -using FluentAssertions; +using System.Threading; +using FluentAssertions; using NUnit.Framework; using NzbDrone.Api.Indexers; @@ -10,10 +11,13 @@ namespace NzbDrone.Integration.Test [Test] public void should_only_have_unknown_series_releases() { + var releases = Releases.All(); + var indexers = Indexers.All(); + releases.Should().OnlyContain(c => c.Rejections.Contains("Unknown Series")); - releases.Should().OnlyContain(c=>BeValidRelease(c)); + releases.Should().OnlyContain(c => BeValidRelease(c)); } diff --git a/NzbDrone.Integration.Test/RootFolderIntegrationTest.cs b/src/NzbDrone.Integration.Test/RootFolderIntegrationTest.cs similarity index 100% rename from NzbDrone.Integration.Test/RootFolderIntegrationTest.cs rename to src/NzbDrone.Integration.Test/RootFolderIntegrationTest.cs diff --git a/NzbDrone.Integration.Test/SeriesIntegrationTest.cs b/src/NzbDrone.Integration.Test/SeriesIntegrationTest.cs similarity index 100% rename from NzbDrone.Integration.Test/SeriesIntegrationTest.cs rename to src/NzbDrone.Integration.Test/SeriesIntegrationTest.cs diff --git a/NzbDrone.Integration.Test/packages.config b/src/NzbDrone.Integration.Test/packages.config similarity index 100% rename from NzbDrone.Integration.Test/packages.config rename to src/NzbDrone.Integration.Test/packages.config diff --git a/NzbDrone.Libraries.Test/JsonTests/JsonFixture.cs b/src/NzbDrone.Libraries.Test/JsonTests/JsonFixture.cs similarity index 100% rename from NzbDrone.Libraries.Test/JsonTests/JsonFixture.cs rename to src/NzbDrone.Libraries.Test/JsonTests/JsonFixture.cs diff --git a/NzbDrone.Libraries.Test/NzbDrone.Libraries.Test.csproj b/src/NzbDrone.Libraries.Test/NzbDrone.Libraries.Test.csproj similarity index 100% rename from NzbDrone.Libraries.Test/NzbDrone.Libraries.Test.csproj rename to src/NzbDrone.Libraries.Test/NzbDrone.Libraries.Test.csproj diff --git a/NzbDrone.Libraries.Test/Properties/AssemblyInfo.cs b/src/NzbDrone.Libraries.Test/Properties/AssemblyInfo.cs similarity index 100% rename from NzbDrone.Libraries.Test/Properties/AssemblyInfo.cs rename to src/NzbDrone.Libraries.Test/Properties/AssemblyInfo.cs diff --git a/NzbDrone.Libraries.Test/packages.config b/src/NzbDrone.Libraries.Test/packages.config similarity index 100% rename from NzbDrone.Libraries.Test/packages.config rename to src/NzbDrone.Libraries.Test/packages.config diff --git a/NzbDrone.SignalR/BroadcastSignalRMessage.cs b/src/NzbDrone.SignalR/BroadcastSignalRMessage.cs similarity index 100% rename from NzbDrone.SignalR/BroadcastSignalRMessage.cs rename to src/NzbDrone.SignalR/BroadcastSignalRMessage.cs diff --git a/NzbDrone.SignalR/NoOpPerformanceCounterManager.cs b/src/NzbDrone.SignalR/NoOpPerformanceCounterManager.cs similarity index 100% rename from NzbDrone.SignalR/NoOpPerformanceCounterManager.cs rename to src/NzbDrone.SignalR/NoOpPerformanceCounterManager.cs diff --git a/NzbDrone.SignalR/NzbDrone.SignalR.csproj b/src/NzbDrone.SignalR/NzbDrone.SignalR.csproj similarity index 97% rename from NzbDrone.SignalR/NzbDrone.SignalR.csproj rename to src/NzbDrone.SignalR/NzbDrone.SignalR.csproj index 859651305..c3110ef29 100644 --- a/NzbDrone.SignalR/NzbDrone.SignalR.csproj +++ b/src/NzbDrone.SignalR/NzbDrone.SignalR.csproj @@ -16,7 +16,7 @@ true - bin\x86\Debug\ + ..\..\_output\ DEBUG;TRACE full x86 @@ -24,7 +24,7 @@ MinimumRecommendedRules.ruleset - bin\x86\Release\ + ..\..\_output\ TRACE true pdbonly diff --git a/NzbDrone.SignalR/NzbDronePersistentConnection.cs b/src/NzbDrone.SignalR/NzbDronePersistentConnection.cs similarity index 100% rename from NzbDrone.SignalR/NzbDronePersistentConnection.cs rename to src/NzbDrone.SignalR/NzbDronePersistentConnection.cs diff --git a/NzbDrone.SignalR/Properties/AssemblyInfo.cs b/src/NzbDrone.SignalR/Properties/AssemblyInfo.cs similarity index 100% rename from NzbDrone.SignalR/Properties/AssemblyInfo.cs rename to src/NzbDrone.SignalR/Properties/AssemblyInfo.cs diff --git a/NzbDrone.SignalR/Serializer.cs b/src/NzbDrone.SignalR/Serializer.cs similarity index 100% rename from NzbDrone.SignalR/Serializer.cs rename to src/NzbDrone.SignalR/Serializer.cs diff --git a/NzbDrone.SignalR/SignalRMessage.cs b/src/NzbDrone.SignalR/SignalRMessage.cs similarity index 100% rename from NzbDrone.SignalR/SignalRMessage.cs rename to src/NzbDrone.SignalR/SignalRMessage.cs diff --git a/NzbDrone.SignalR/SignalrDependencyResolver.cs b/src/NzbDrone.SignalR/SignalrDependencyResolver.cs similarity index 100% rename from NzbDrone.SignalR/SignalrDependencyResolver.cs rename to src/NzbDrone.SignalR/SignalrDependencyResolver.cs diff --git a/NzbDrone.SignalR/packages.config b/src/NzbDrone.SignalR/packages.config similarity index 100% rename from NzbDrone.SignalR/packages.config rename to src/NzbDrone.SignalR/packages.config diff --git a/NzbDrone.Test.Common/App.config b/src/NzbDrone.Test.Common/App.config similarity index 100% rename from NzbDrone.Test.Common/App.config rename to src/NzbDrone.Test.Common/App.config diff --git a/NzbDrone.Test.Common/AutoMoq/AutoMoqer.cs b/src/NzbDrone.Test.Common/AutoMoq/AutoMoqer.cs similarity index 100% rename from NzbDrone.Test.Common/AutoMoq/AutoMoqer.cs rename to src/NzbDrone.Test.Common/AutoMoq/AutoMoqer.cs diff --git a/NzbDrone.Test.Common/AutoMoq/License.txt b/src/NzbDrone.Test.Common/AutoMoq/License.txt similarity index 100% rename from NzbDrone.Test.Common/AutoMoq/License.txt rename to src/NzbDrone.Test.Common/AutoMoq/License.txt diff --git a/NzbDrone.Test.Common/AutoMoq/Unity/AutoMockingBuilderStrategy.cs b/src/NzbDrone.Test.Common/AutoMoq/Unity/AutoMockingBuilderStrategy.cs similarity index 100% rename from NzbDrone.Test.Common/AutoMoq/Unity/AutoMockingBuilderStrategy.cs rename to src/NzbDrone.Test.Common/AutoMoq/Unity/AutoMockingBuilderStrategy.cs diff --git a/NzbDrone.Test.Common/AutoMoq/Unity/AutoMockingContainerExtension.cs b/src/NzbDrone.Test.Common/AutoMoq/Unity/AutoMockingContainerExtension.cs similarity index 100% rename from NzbDrone.Test.Common/AutoMoq/Unity/AutoMockingContainerExtension.cs rename to src/NzbDrone.Test.Common/AutoMoq/Unity/AutoMockingContainerExtension.cs diff --git a/NzbDrone.Test.Common/Categories/DiskAccessTestAttribute.cs b/src/NzbDrone.Test.Common/Categories/DiskAccessTestAttribute.cs similarity index 100% rename from NzbDrone.Test.Common/Categories/DiskAccessTestAttribute.cs rename to src/NzbDrone.Test.Common/Categories/DiskAccessTestAttribute.cs diff --git a/NzbDrone.Test.Common/Categories/IntegrationTestAttribute.cs b/src/NzbDrone.Test.Common/Categories/IntegrationTestAttribute.cs similarity index 100% rename from NzbDrone.Test.Common/Categories/IntegrationTestAttribute.cs rename to src/NzbDrone.Test.Common/Categories/IntegrationTestAttribute.cs diff --git a/NzbDrone.Test.Common/ConcurrencyCounter.cs b/src/NzbDrone.Test.Common/ConcurrencyCounter.cs similarity index 100% rename from NzbDrone.Test.Common/ConcurrencyCounter.cs rename to src/NzbDrone.Test.Common/ConcurrencyCounter.cs diff --git a/NzbDrone.Test.Common/ExceptionVerification.cs b/src/NzbDrone.Test.Common/ExceptionVerification.cs similarity index 100% rename from NzbDrone.Test.Common/ExceptionVerification.cs rename to src/NzbDrone.Test.Common/ExceptionVerification.cs diff --git a/NzbDrone.Test.Common/License.txt b/src/NzbDrone.Test.Common/License.txt similarity index 100% rename from NzbDrone.Test.Common/License.txt rename to src/NzbDrone.Test.Common/License.txt diff --git a/NzbDrone.Test.Common/LoggingTest.cs b/src/NzbDrone.Test.Common/LoggingTest.cs similarity index 100% rename from NzbDrone.Test.Common/LoggingTest.cs rename to src/NzbDrone.Test.Common/LoggingTest.cs diff --git a/NzbDrone.Test.Common/MockerExtensions.cs b/src/NzbDrone.Test.Common/MockerExtensions.cs similarity index 100% rename from NzbDrone.Test.Common/MockerExtensions.cs rename to src/NzbDrone.Test.Common/MockerExtensions.cs diff --git a/NzbDrone.Test.Common/NzbDrone.Test.Common.csproj b/src/NzbDrone.Test.Common/NzbDrone.Test.Common.csproj similarity index 100% rename from NzbDrone.Test.Common/NzbDrone.Test.Common.csproj rename to src/NzbDrone.Test.Common/NzbDrone.Test.Common.csproj diff --git a/NzbDrone.Test.Common/ObjectExtentions.cs b/src/NzbDrone.Test.Common/ObjectExtentions.cs similarity index 100% rename from NzbDrone.Test.Common/ObjectExtentions.cs rename to src/NzbDrone.Test.Common/ObjectExtentions.cs diff --git a/NzbDrone.Test.Common/Properties/AssemblyInfo.cs b/src/NzbDrone.Test.Common/Properties/AssemblyInfo.cs similarity index 100% rename from NzbDrone.Test.Common/Properties/AssemblyInfo.cs rename to src/NzbDrone.Test.Common/Properties/AssemblyInfo.cs diff --git a/NzbDrone.Test.Common/ReflectionExtensions.cs b/src/NzbDrone.Test.Common/ReflectionExtensions.cs similarity index 100% rename from NzbDrone.Test.Common/ReflectionExtensions.cs rename to src/NzbDrone.Test.Common/ReflectionExtensions.cs diff --git a/NzbDrone.Test.Common/StringExtensions.cs b/src/NzbDrone.Test.Common/StringExtensions.cs similarity index 100% rename from NzbDrone.Test.Common/StringExtensions.cs rename to src/NzbDrone.Test.Common/StringExtensions.cs diff --git a/NzbDrone.Test.Common/TestBase.cs b/src/NzbDrone.Test.Common/TestBase.cs similarity index 100% rename from NzbDrone.Test.Common/TestBase.cs rename to src/NzbDrone.Test.Common/TestBase.cs diff --git a/NzbDrone.Test.Common/TestException.cs b/src/NzbDrone.Test.Common/TestException.cs similarity index 100% rename from NzbDrone.Test.Common/TestException.cs rename to src/NzbDrone.Test.Common/TestException.cs diff --git a/NzbDrone.Test.Common/packages.config b/src/NzbDrone.Test.Common/packages.config similarity index 100% rename from NzbDrone.Test.Common/packages.config rename to src/NzbDrone.Test.Common/packages.config diff --git a/NzbDrone.Test.Dummy/DummyApp.cs b/src/NzbDrone.Test.Dummy/DummyApp.cs similarity index 100% rename from NzbDrone.Test.Dummy/DummyApp.cs rename to src/NzbDrone.Test.Dummy/DummyApp.cs diff --git a/NzbDrone.Test.Dummy/NzbDrone.Test.Dummy.csproj b/src/NzbDrone.Test.Dummy/NzbDrone.Test.Dummy.csproj similarity index 100% rename from NzbDrone.Test.Dummy/NzbDrone.Test.Dummy.csproj rename to src/NzbDrone.Test.Dummy/NzbDrone.Test.Dummy.csproj diff --git a/NzbDrone.Test.Dummy/Properties/AssemblyInfo.cs b/src/NzbDrone.Test.Dummy/Properties/AssemblyInfo.cs similarity index 100% rename from NzbDrone.Test.Dummy/Properties/AssemblyInfo.cs rename to src/NzbDrone.Test.Dummy/Properties/AssemblyInfo.cs diff --git a/NzbDrone.Test.Dummy/app.config b/src/NzbDrone.Test.Dummy/app.config similarity index 100% rename from NzbDrone.Test.Dummy/app.config rename to src/NzbDrone.Test.Dummy/app.config diff --git a/NzbDrone.Update.Test/InstallUpdateServiceFixture.cs b/src/NzbDrone.Update.Test/InstallUpdateServiceFixture.cs similarity index 100% rename from NzbDrone.Update.Test/InstallUpdateServiceFixture.cs rename to src/NzbDrone.Update.Test/InstallUpdateServiceFixture.cs diff --git a/NzbDrone.Update.Test/License.txt b/src/NzbDrone.Update.Test/License.txt similarity index 100% rename from NzbDrone.Update.Test/License.txt rename to src/NzbDrone.Update.Test/License.txt diff --git a/NzbDrone.Update.Test/NzbDrone.Update.Test.csproj b/src/NzbDrone.Update.Test/NzbDrone.Update.Test.csproj similarity index 100% rename from NzbDrone.Update.Test/NzbDrone.Update.Test.csproj rename to src/NzbDrone.Update.Test/NzbDrone.Update.Test.csproj diff --git a/NzbDrone.Update.Test/ProgramFixture.cs b/src/NzbDrone.Update.Test/ProgramFixture.cs similarity index 100% rename from NzbDrone.Update.Test/ProgramFixture.cs rename to src/NzbDrone.Update.Test/ProgramFixture.cs diff --git a/NzbDrone.Update.Test/Properties/AssemblyInfo.cs b/src/NzbDrone.Update.Test/Properties/AssemblyInfo.cs similarity index 100% rename from NzbDrone.Update.Test/Properties/AssemblyInfo.cs rename to src/NzbDrone.Update.Test/Properties/AssemblyInfo.cs diff --git a/NzbDrone.Update.Test/StartNzbDroneService.cs b/src/NzbDrone.Update.Test/StartNzbDroneService.cs similarity index 100% rename from NzbDrone.Update.Test/StartNzbDroneService.cs rename to src/NzbDrone.Update.Test/StartNzbDroneService.cs diff --git a/NzbDrone.Update.Test/UpdateProviderStartFixture.cs b/src/NzbDrone.Update.Test/UpdateProviderStartFixture.cs similarity index 100% rename from NzbDrone.Update.Test/UpdateProviderStartFixture.cs rename to src/NzbDrone.Update.Test/UpdateProviderStartFixture.cs diff --git a/NzbDrone.Update.Test/packages.config b/src/NzbDrone.Update.Test/packages.config similarity index 100% rename from NzbDrone.Update.Test/packages.config rename to src/NzbDrone.Update.Test/packages.config diff --git a/NzbDrone.Update/AppType.cs b/src/NzbDrone.Update/AppType.cs similarity index 100% rename from NzbDrone.Update/AppType.cs rename to src/NzbDrone.Update/AppType.cs diff --git a/NzbDrone.Update/NLog.xsd b/src/NzbDrone.Update/NLog.xsd similarity index 100% rename from NzbDrone.Update/NLog.xsd rename to src/NzbDrone.Update/NLog.xsd diff --git a/NzbDrone.Update/NzbDrone.Update.csproj b/src/NzbDrone.Update/NzbDrone.Update.csproj similarity index 96% rename from NzbDrone.Update/NzbDrone.Update.csproj rename to src/NzbDrone.Update/NzbDrone.Update.csproj index d52120d91..3aa8ea3a4 100644 --- a/NzbDrone.Update/NzbDrone.Update.csproj +++ b/src/NzbDrone.Update/NzbDrone.Update.csproj @@ -22,7 +22,7 @@ true full false - ..\_output\NzbDrone.Update\ + ..\..\_output\NzbDrone.Update\ DEBUG;TRACE prompt 4 @@ -31,7 +31,7 @@ x86 pdbonly true - ..\_output\NzbDrone.Update\ + ..\..\_output\NzbDrone.Update\ TRACE prompt 4 diff --git a/NzbDrone.Update/Properties/AssemblyInfo.cs b/src/NzbDrone.Update/Properties/AssemblyInfo.cs similarity index 100% rename from NzbDrone.Update/Properties/AssemblyInfo.cs rename to src/NzbDrone.Update/Properties/AssemblyInfo.cs diff --git a/NzbDrone.Update/UpdateApp.cs b/src/NzbDrone.Update/UpdateApp.cs similarity index 100% rename from NzbDrone.Update/UpdateApp.cs rename to src/NzbDrone.Update/UpdateApp.cs diff --git a/NzbDrone.Update/UpdateContainerBuilder.cs b/src/NzbDrone.Update/UpdateContainerBuilder.cs similarity index 100% rename from NzbDrone.Update/UpdateContainerBuilder.cs rename to src/NzbDrone.Update/UpdateContainerBuilder.cs diff --git a/NzbDrone.Update/UpdateEngine/BackupAndRestore.cs b/src/NzbDrone.Update/UpdateEngine/BackupAndRestore.cs similarity index 100% rename from NzbDrone.Update/UpdateEngine/BackupAndRestore.cs rename to src/NzbDrone.Update/UpdateEngine/BackupAndRestore.cs diff --git a/NzbDrone.Update/UpdateEngine/DetectApplicationType.cs b/src/NzbDrone.Update/UpdateEngine/DetectApplicationType.cs similarity index 100% rename from NzbDrone.Update/UpdateEngine/DetectApplicationType.cs rename to src/NzbDrone.Update/UpdateEngine/DetectApplicationType.cs diff --git a/NzbDrone.Update/UpdateEngine/InstallUpdateService.cs b/src/NzbDrone.Update/UpdateEngine/InstallUpdateService.cs similarity index 100% rename from NzbDrone.Update/UpdateEngine/InstallUpdateService.cs rename to src/NzbDrone.Update/UpdateEngine/InstallUpdateService.cs diff --git a/NzbDrone.Update/UpdateEngine/StartNzbDrone.cs b/src/NzbDrone.Update/UpdateEngine/StartNzbDrone.cs similarity index 100% rename from NzbDrone.Update/UpdateEngine/StartNzbDrone.cs rename to src/NzbDrone.Update/UpdateEngine/StartNzbDrone.cs diff --git a/NzbDrone.Update/UpdateEngine/TerminateNzbDrone.cs b/src/NzbDrone.Update/UpdateEngine/TerminateNzbDrone.cs similarity index 100% rename from NzbDrone.Update/UpdateEngine/TerminateNzbDrone.cs rename to src/NzbDrone.Update/UpdateEngine/TerminateNzbDrone.cs diff --git a/NzbDrone.Update/app.config b/src/NzbDrone.Update/app.config similarity index 100% rename from NzbDrone.Update/app.config rename to src/NzbDrone.Update/app.config diff --git a/NzbDrone.Update/packages.config b/src/NzbDrone.Update/packages.config similarity index 100% rename from NzbDrone.Update/packages.config rename to src/NzbDrone.Update/packages.config diff --git a/NzbDrone.sln b/src/NzbDrone.sln similarity index 100% rename from NzbDrone.sln rename to src/NzbDrone.sln diff --git a/NzbDrone.sln.DotSettings b/src/NzbDrone.sln.DotSettings similarity index 100% rename from NzbDrone.sln.DotSettings rename to src/NzbDrone.sln.DotSettings diff --git a/NzbDrone/MessageBoxUserAlert.cs b/src/NzbDrone/MessageBoxUserAlert.cs similarity index 100% rename from NzbDrone/MessageBoxUserAlert.cs rename to src/NzbDrone/MessageBoxUserAlert.cs diff --git a/NzbDrone/NzbDrone.csproj b/src/NzbDrone/NzbDrone.csproj similarity index 98% rename from NzbDrone/NzbDrone.csproj rename to src/NzbDrone/NzbDrone.csproj index 5d45930cd..f428eae7b 100644 --- a/NzbDrone/NzbDrone.csproj +++ b/src/NzbDrone/NzbDrone.csproj @@ -37,7 +37,7 @@ true full false - ..\_output\ + ..\..\_output\ DEBUG;TRACE prompt 4 @@ -48,7 +48,7 @@ x86 pdbonly true - ..\_output\ + ..\..\_output\ TRACE prompt 4 diff --git a/NzbDrone/Properties/AssemblyInfo.cs b/src/NzbDrone/Properties/AssemblyInfo.cs similarity index 100% rename from NzbDrone/Properties/AssemblyInfo.cs rename to src/NzbDrone/Properties/AssemblyInfo.cs diff --git a/NzbDrone/Properties/Resources.Designer.cs b/src/NzbDrone/Properties/Resources.Designer.cs similarity index 100% rename from NzbDrone/Properties/Resources.Designer.cs rename to src/NzbDrone/Properties/Resources.Designer.cs diff --git a/NzbDrone/Properties/Resources.resx b/src/NzbDrone/Properties/Resources.resx similarity index 100% rename from NzbDrone/Properties/Resources.resx rename to src/NzbDrone/Properties/Resources.resx diff --git a/NzbDrone/SysTray/SysTrayApp.cs b/src/NzbDrone/SysTray/SysTrayApp.cs similarity index 100% rename from NzbDrone/SysTray/SysTrayApp.cs rename to src/NzbDrone/SysTray/SysTrayApp.cs diff --git a/NzbDrone/WindowsApp.cs b/src/NzbDrone/WindowsApp.cs similarity index 100% rename from NzbDrone/WindowsApp.cs rename to src/NzbDrone/WindowsApp.cs diff --git a/src/NzbDrone/app.config b/src/NzbDrone/app.config new file mode 100644 index 000000000..a6a2b7fa9 --- /dev/null +++ b/src/NzbDrone/app.config @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/NzbDrone/packages.config b/src/NzbDrone/packages.config similarity index 100% rename from NzbDrone/packages.config rename to src/NzbDrone/packages.config diff --git a/ServiceHelpers/ServiceInstall/Program.cs b/src/ServiceHelpers/ServiceInstall/Program.cs similarity index 100% rename from ServiceHelpers/ServiceInstall/Program.cs rename to src/ServiceHelpers/ServiceInstall/Program.cs diff --git a/ServiceHelpers/ServiceInstall/Properties/AssemblyInfo.cs b/src/ServiceHelpers/ServiceInstall/Properties/AssemblyInfo.cs similarity index 100% rename from ServiceHelpers/ServiceInstall/Properties/AssemblyInfo.cs rename to src/ServiceHelpers/ServiceInstall/Properties/AssemblyInfo.cs diff --git a/ServiceHelpers/ServiceInstall/ServiceHelper.cs b/src/ServiceHelpers/ServiceInstall/ServiceHelper.cs similarity index 100% rename from ServiceHelpers/ServiceInstall/ServiceHelper.cs rename to src/ServiceHelpers/ServiceInstall/ServiceHelper.cs diff --git a/ServiceHelpers/ServiceInstall/ServiceInstall.csproj b/src/ServiceHelpers/ServiceInstall/ServiceInstall.csproj similarity index 96% rename from ServiceHelpers/ServiceInstall/ServiceInstall.csproj rename to src/ServiceHelpers/ServiceInstall/ServiceInstall.csproj index 9433f32e3..928fce634 100644 --- a/ServiceHelpers/ServiceInstall/ServiceInstall.csproj +++ b/src/ServiceHelpers/ServiceInstall/ServiceInstall.csproj @@ -22,7 +22,7 @@ true full false - ..\..\_output\ + ..\..\..\_output\ DEBUG;TRACE prompt 4 @@ -31,7 +31,7 @@ x86 pdbonly true - ..\..\_output\ + ..\..\..\_output\ TRACE prompt 4 diff --git a/ServiceHelpers/ServiceInstall/app.config b/src/ServiceHelpers/ServiceInstall/app.config similarity index 100% rename from ServiceHelpers/ServiceInstall/app.config rename to src/ServiceHelpers/ServiceInstall/app.config diff --git a/ServiceHelpers/ServiceInstall/app.manifest b/src/ServiceHelpers/ServiceInstall/app.manifest similarity index 100% rename from ServiceHelpers/ServiceInstall/app.manifest rename to src/ServiceHelpers/ServiceInstall/app.manifest diff --git a/ServiceHelpers/ServiceInstall/green_puzzle.ico b/src/ServiceHelpers/ServiceInstall/green_puzzle.ico similarity index 100% rename from ServiceHelpers/ServiceInstall/green_puzzle.ico rename to src/ServiceHelpers/ServiceInstall/green_puzzle.ico diff --git a/ServiceHelpers/ServiceUninstall/Program.cs b/src/ServiceHelpers/ServiceUninstall/Program.cs similarity index 100% rename from ServiceHelpers/ServiceUninstall/Program.cs rename to src/ServiceHelpers/ServiceUninstall/Program.cs diff --git a/ServiceHelpers/ServiceUninstall/Properties/AssemblyInfo.cs b/src/ServiceHelpers/ServiceUninstall/Properties/AssemblyInfo.cs similarity index 100% rename from ServiceHelpers/ServiceUninstall/Properties/AssemblyInfo.cs rename to src/ServiceHelpers/ServiceUninstall/Properties/AssemblyInfo.cs diff --git a/ServiceHelpers/ServiceUninstall/ServiceHelper.cs b/src/ServiceHelpers/ServiceUninstall/ServiceHelper.cs similarity index 100% rename from ServiceHelpers/ServiceUninstall/ServiceHelper.cs rename to src/ServiceHelpers/ServiceUninstall/ServiceHelper.cs diff --git a/ServiceHelpers/ServiceUninstall/ServiceUninstall.csproj b/src/ServiceHelpers/ServiceUninstall/ServiceUninstall.csproj similarity index 96% rename from ServiceHelpers/ServiceUninstall/ServiceUninstall.csproj rename to src/ServiceHelpers/ServiceUninstall/ServiceUninstall.csproj index 338b4e7fb..66adb5935 100644 --- a/ServiceHelpers/ServiceUninstall/ServiceUninstall.csproj +++ b/src/ServiceHelpers/ServiceUninstall/ServiceUninstall.csproj @@ -22,7 +22,7 @@ true full false - ..\..\_output\ + ..\..\..\_output\ DEBUG;TRACE prompt 4 @@ -31,7 +31,7 @@ x86 pdbonly true - ..\..\_output\ + ..\..\..\_output\ TRACE prompt 4 diff --git a/ServiceHelpers/ServiceUninstall/app.config b/src/ServiceHelpers/ServiceUninstall/app.config similarity index 100% rename from ServiceHelpers/ServiceUninstall/app.config rename to src/ServiceHelpers/ServiceUninstall/app.config diff --git a/ServiceHelpers/ServiceUninstall/app.manifest b/src/ServiceHelpers/ServiceUninstall/app.manifest similarity index 100% rename from ServiceHelpers/ServiceUninstall/app.manifest rename to src/ServiceHelpers/ServiceUninstall/app.manifest diff --git a/ServiceHelpers/ServiceUninstall/red_puzzle.ico b/src/ServiceHelpers/ServiceUninstall/red_puzzle.ico similarity index 100% rename from ServiceHelpers/ServiceUninstall/red_puzzle.ico rename to src/ServiceHelpers/ServiceUninstall/red_puzzle.ico diff --git a/SharedLiveTemplates.xml b/src/SharedLiveTemplates.xml similarity index 100% rename from SharedLiveTemplates.xml rename to src/SharedLiveTemplates.xml diff --git a/UI/.idea/.name b/src/UI/.idea/.name similarity index 100% rename from UI/.idea/.name rename to src/UI/.idea/.name diff --git a/UI/.idea/NzbDrone.UI.iml b/src/UI/.idea/NzbDrone.UI.iml similarity index 100% rename from UI/.idea/NzbDrone.UI.iml rename to src/UI/.idea/NzbDrone.UI.iml diff --git a/UI/.idea/codeStyleSettings.xml b/src/UI/.idea/codeStyleSettings.xml similarity index 100% rename from UI/.idea/codeStyleSettings.xml rename to src/UI/.idea/codeStyleSettings.xml diff --git a/UI/.idea/dictionaries/Keivan.xml b/src/UI/.idea/dictionaries/Keivan.xml similarity index 100% rename from UI/.idea/dictionaries/Keivan.xml rename to src/UI/.idea/dictionaries/Keivan.xml diff --git a/UI/.idea/dictionaries/Keivan_Beigi.xml b/src/UI/.idea/dictionaries/Keivan_Beigi.xml similarity index 100% rename from UI/.idea/dictionaries/Keivan_Beigi.xml rename to src/UI/.idea/dictionaries/Keivan_Beigi.xml diff --git a/UI/.idea/dictionaries/Mark.xml b/src/UI/.idea/dictionaries/Mark.xml similarity index 100% rename from UI/.idea/dictionaries/Mark.xml rename to src/UI/.idea/dictionaries/Mark.xml diff --git a/UI/.idea/encodings.xml b/src/UI/.idea/encodings.xml similarity index 100% rename from UI/.idea/encodings.xml rename to src/UI/.idea/encodings.xml diff --git a/UI/.idea/inspectionProfiles/Project_Default.xml b/src/UI/.idea/inspectionProfiles/Project_Default.xml similarity index 100% rename from UI/.idea/inspectionProfiles/Project_Default.xml rename to src/UI/.idea/inspectionProfiles/Project_Default.xml diff --git a/UI/.idea/inspectionProfiles/profiles_settings.xml b/src/UI/.idea/inspectionProfiles/profiles_settings.xml similarity index 100% rename from UI/.idea/inspectionProfiles/profiles_settings.xml rename to src/UI/.idea/inspectionProfiles/profiles_settings.xml diff --git a/UI/.idea/jsLibraryMappings.xml b/src/UI/.idea/jsLibraryMappings.xml similarity index 100% rename from UI/.idea/jsLibraryMappings.xml rename to src/UI/.idea/jsLibraryMappings.xml diff --git a/UI/.idea/jsLinters/jshint.xml b/src/UI/.idea/jsLinters/jshint.xml similarity index 100% rename from UI/.idea/jsLinters/jshint.xml rename to src/UI/.idea/jsLinters/jshint.xml diff --git a/UI/.idea/jsLinters/jslint.xml b/src/UI/.idea/jsLinters/jslint.xml similarity index 100% rename from UI/.idea/jsLinters/jslint.xml rename to src/UI/.idea/jsLinters/jslint.xml diff --git a/UI/.idea/misc.xml b/src/UI/.idea/misc.xml similarity index 100% rename from UI/.idea/misc.xml rename to src/UI/.idea/misc.xml diff --git a/UI/.idea/modules.xml b/src/UI/.idea/modules.xml similarity index 100% rename from UI/.idea/modules.xml rename to src/UI/.idea/modules.xml diff --git a/UI/.idea/runConfigurations/Debug___Chrome.xml b/src/UI/.idea/runConfigurations/Debug___Chrome.xml similarity index 100% rename from UI/.idea/runConfigurations/Debug___Chrome.xml rename to src/UI/.idea/runConfigurations/Debug___Chrome.xml diff --git a/UI/.idea/runConfigurations/Debug___Firefox.xml b/src/UI/.idea/runConfigurations/Debug___Firefox.xml similarity index 100% rename from UI/.idea/runConfigurations/Debug___Firefox.xml rename to src/UI/.idea/runConfigurations/Debug___Firefox.xml diff --git a/UI/.idea/scopes/NzbDrone.xml b/src/UI/.idea/scopes/NzbDrone.xml similarity index 100% rename from UI/.idea/scopes/NzbDrone.xml rename to src/UI/.idea/scopes/NzbDrone.xml diff --git a/UI/.idea/scopes/scope_settings.xml b/src/UI/.idea/scopes/scope_settings.xml similarity index 100% rename from UI/.idea/scopes/scope_settings.xml rename to src/UI/.idea/scopes/scope_settings.xml diff --git a/UI/.idea/vcs.xml b/src/UI/.idea/vcs.xml similarity index 69% rename from UI/.idea/vcs.xml rename to src/UI/.idea/vcs.xml index 21cbaa607..9ab281ac8 100644 --- a/UI/.idea/vcs.xml +++ b/src/UI/.idea/vcs.xml @@ -1,7 +1,7 @@ - + diff --git a/UI/AddSeries/AddSeriesCollection.js b/src/UI/AddSeries/AddSeriesCollection.js similarity index 100% rename from UI/AddSeries/AddSeriesCollection.js rename to src/UI/AddSeries/AddSeriesCollection.js diff --git a/UI/AddSeries/AddSeriesLayout.js b/src/UI/AddSeries/AddSeriesLayout.js similarity index 95% rename from UI/AddSeries/AddSeriesLayout.js rename to src/UI/AddSeries/AddSeriesLayout.js index 14f11c356..9d5eaa04c 100644 --- a/UI/AddSeries/AddSeriesLayout.js +++ b/src/UI/AddSeries/AddSeriesLayout.js @@ -35,7 +35,7 @@ define( initialize: function () { QualityProfileCollection.fetch(); - RootFolderCollection.promise = RootFolderCollection.fetch(); + RootFolderCollection.fetch(); }, onShow: function () { diff --git a/UI/AddSeries/AddSeriesLayoutTemplate.html b/src/UI/AddSeries/AddSeriesLayoutTemplate.html similarity index 100% rename from UI/AddSeries/AddSeriesLayoutTemplate.html rename to src/UI/AddSeries/AddSeriesLayoutTemplate.html diff --git a/UI/AddSeries/AddSeriesView.js b/src/UI/AddSeries/AddSeriesView.js similarity index 98% rename from UI/AddSeries/AddSeriesView.js rename to src/UI/AddSeries/AddSeriesView.js index 957b2cabc..2eb2596d6 100644 --- a/UI/AddSeries/AddSeriesView.js +++ b/src/UI/AddSeries/AddSeriesView.js @@ -99,7 +99,7 @@ define( else if (!this.isExisting) { this.collection.reset(); - this.searchResult.show(this.resultCollectionView); + this.searchResult.close(); this.ui.seriesSearch.val(''); this.ui.seriesSearch.focus(); } diff --git a/UI/AddSeries/AddSeriesViewTemplate.html b/src/UI/AddSeries/AddSeriesViewTemplate.html similarity index 100% rename from UI/AddSeries/AddSeriesViewTemplate.html rename to src/UI/AddSeries/AddSeriesViewTemplate.html diff --git a/UI/AddSeries/Existing/AddExistingSeriesCollectionView.js b/src/UI/AddSeries/Existing/AddExistingSeriesCollectionView.js similarity index 100% rename from UI/AddSeries/Existing/AddExistingSeriesCollectionView.js rename to src/UI/AddSeries/Existing/AddExistingSeriesCollectionView.js diff --git a/UI/AddSeries/Existing/UnmappedFolderCollection.js b/src/UI/AddSeries/Existing/UnmappedFolderCollection.js similarity index 100% rename from UI/AddSeries/Existing/UnmappedFolderCollection.js rename to src/UI/AddSeries/Existing/UnmappedFolderCollection.js diff --git a/UI/AddSeries/Existing/UnmappedFolderModel.js b/src/UI/AddSeries/Existing/UnmappedFolderModel.js similarity index 100% rename from UI/AddSeries/Existing/UnmappedFolderModel.js rename to src/UI/AddSeries/Existing/UnmappedFolderModel.js diff --git a/UI/AddSeries/NotFoundTemplate.html b/src/UI/AddSeries/NotFoundTemplate.html similarity index 100% rename from UI/AddSeries/NotFoundTemplate.html rename to src/UI/AddSeries/NotFoundTemplate.html diff --git a/UI/AddSeries/NotFoundView.js b/src/UI/AddSeries/NotFoundView.js similarity index 100% rename from UI/AddSeries/NotFoundView.js rename to src/UI/AddSeries/NotFoundView.js diff --git a/UI/AddSeries/RootFolders/Collection.js b/src/UI/AddSeries/RootFolders/Collection.js similarity index 100% rename from UI/AddSeries/RootFolders/Collection.js rename to src/UI/AddSeries/RootFolders/Collection.js diff --git a/UI/AddSeries/RootFolders/CollectionView.js b/src/UI/AddSeries/RootFolders/CollectionView.js similarity index 100% rename from UI/AddSeries/RootFolders/CollectionView.js rename to src/UI/AddSeries/RootFolders/CollectionView.js diff --git a/UI/AddSeries/RootFolders/ItemView.js b/src/UI/AddSeries/RootFolders/ItemView.js similarity index 100% rename from UI/AddSeries/RootFolders/ItemView.js rename to src/UI/AddSeries/RootFolders/ItemView.js diff --git a/UI/AddSeries/RootFolders/ItemViewTemplate.html b/src/UI/AddSeries/RootFolders/ItemViewTemplate.html similarity index 100% rename from UI/AddSeries/RootFolders/ItemViewTemplate.html rename to src/UI/AddSeries/RootFolders/ItemViewTemplate.html diff --git a/UI/AddSeries/RootFolders/Layout.js b/src/UI/AddSeries/RootFolders/Layout.js similarity index 85% rename from UI/AddSeries/RootFolders/Layout.js rename to src/UI/AddSeries/RootFolders/Layout.js index 3a75c0f9f..795f62edc 100644 --- a/UI/AddSeries/RootFolders/Layout.js +++ b/src/UI/AddSeries/RootFolders/Layout.js @@ -31,15 +31,15 @@ define( this.rootfolderListView = new RootFolderCollectionView({ collection: RootFolderCollection }); this.listenTo(this.rootfolderListView, 'itemview:folderSelected', this._onFolderSelected); + this.listenTo(RootFolderCollection, 'sync', this._showCurrentDirs); }, onRender: function () { - var self = this; this.currentDirs.show(new LoadingView()); - RootFolderCollection.promise.done(function () { - self.currentDirs.show(self.rootfolderListView); - }); + if (RootFolderCollection.any()) { + this._showCurrentDirs(); + } this.ui.pathInput.autoComplete('/directories'); }, @@ -49,7 +49,6 @@ define( }, _addFolder: function () { - var self = this; var newDir = new RootFolderModel({ @@ -62,10 +61,12 @@ define( RootFolderCollection.add(newDir); self.trigger('folderSelected', {model: newDir}); }); + }, + + _showCurrentDirs: function () { + this.currentDirs.show(this.rootfolderListView); } }); - return AsValidatedView.apply(layout); - }); diff --git a/UI/AddSeries/RootFolders/LayoutTemplate.html b/src/UI/AddSeries/RootFolders/LayoutTemplate.html similarity index 100% rename from UI/AddSeries/RootFolders/LayoutTemplate.html rename to src/UI/AddSeries/RootFolders/LayoutTemplate.html diff --git a/UI/AddSeries/RootFolders/Model.js b/src/UI/AddSeries/RootFolders/Model.js similarity index 100% rename from UI/AddSeries/RootFolders/Model.js rename to src/UI/AddSeries/RootFolders/Model.js diff --git a/UI/AddSeries/RootFolders/RootFolderSelectionPartial.html b/src/UI/AddSeries/RootFolders/RootFolderSelectionPartial.html similarity index 100% rename from UI/AddSeries/RootFolders/RootFolderSelectionPartial.html rename to src/UI/AddSeries/RootFolders/RootFolderSelectionPartial.html diff --git a/UI/AddSeries/RootFolders/StartingSeasonSelectionPartial.html b/src/UI/AddSeries/RootFolders/StartingSeasonSelectionPartial.html similarity index 100% rename from UI/AddSeries/RootFolders/StartingSeasonSelectionPartial.html rename to src/UI/AddSeries/RootFolders/StartingSeasonSelectionPartial.html diff --git a/UI/AddSeries/SearchResultCollectionView.js b/src/UI/AddSeries/SearchResultCollectionView.js similarity index 100% rename from UI/AddSeries/SearchResultCollectionView.js rename to src/UI/AddSeries/SearchResultCollectionView.js diff --git a/UI/AddSeries/SearchResultView.js b/src/UI/AddSeries/SearchResultView.js similarity index 97% rename from UI/AddSeries/SearchResultView.js rename to src/UI/AddSeries/SearchResultView.js index 218bf0ff0..a25d36e5c 100644 --- a/UI/AddSeries/SearchResultView.js +++ b/src/UI/AddSeries/SearchResultView.js @@ -1,161 +1,161 @@ -'use strict'; -define( - [ - 'app', - 'underscore', - 'marionette', - 'Quality/QualityProfileCollection', - 'AddSeries/RootFolders/Collection', - 'AddSeries/RootFolders/Layout', - 'Series/SeriesCollection', - 'Config', - 'Shared/Messenger', - 'Mixins/AsValidatedView', - 'jquery.dotdotdot' - ], function (App, _, Marionette, QualityProfiles, RootFolders, RootFolderLayout, SeriesCollection, Config, Messenger, AsValidatedView) { - - var view = Marionette.ItemView.extend({ - - template: 'AddSeries/SearchResultViewTemplate', - - ui: { - qualityProfile: '.x-quality-profile', - rootFolder : '.x-root-folder', - addButton : '.x-add', - overview : '.x-overview', - startingSeason: '.x-starting-season' - }, - - events: { - 'click .x-add' : '_addSeries', - 'change .x-quality-profile': '_qualityProfileChanged', - 'change .x-root-folder' : '_rootFolderChanged' - }, - - initialize: function () { - - if (!this.model) { - throw 'model is required'; - } - - this.templateHelpers = {}; - this._configureTemplateHelpers(); - - this.listenTo(App.vent, Config.Events.ConfigUpdatedEvent, this._onConfigUpdated); - this.listenTo(this.model, 'change', this.render); - this.listenTo(RootFolders, 'all', this.render); - - this.rootFolderLayout = new RootFolderLayout(); - this.listenTo(this.rootFolderLayout, 'folderSelected', this._setRootFolder); - }, - - onRender: function () { - - var defaultQuality = Config.getValue(Config.Keys.DefaultQualityProfileId); - var defaultRoot = Config.getValue(Config.Keys.DefaultRootFolderId); - - if (QualityProfiles.get(defaultQuality)) { - this.ui.qualityProfile.val(defaultQuality); - } - - if (RootFolders.get(defaultRoot)) { - this.ui.rootFolder.val(defaultRoot); - } - - var minSeasonNotZero = _.min(_.reject(this.model.get('seasons'), { seasonNumber: 0 }), 'seasonNumber'); - - if (minSeasonNotZero) { - this.ui.startingSeason.val(minSeasonNotZero.seasonNumber); - } - - //TODO: make this work via onRender, FM? - //works with onShow, but stops working after the first render - this.ui.overview.dotdotdot({ - height: 120 - }); - }, - - _configureTemplateHelpers: function () { - var existingSeries = SeriesCollection.where({tvdbId: this.model.get('tvdbId')}); - - if (existingSeries.length > 0) { - this.templateHelpers.existing = existingSeries[0].toJSON(); - } - - this.templateHelpers.qualityProfiles = QualityProfiles.toJSON(); - - if (!this.model.get('isExisting')) { - this.templateHelpers.rootFolders = RootFolders.toJSON(); - } - }, - - _onConfigUpdated: function (options) { - if (options.key === Config.Keys.DefaultQualityProfileId) { - this.ui.qualityProfile.val(options.value); - } - else if (options.key === Config.Keys.DefaultRootFolderId) { - this.ui.rootFolder.val(options.value); - } - }, - - _qualityProfileChanged: function () { - Config.setValue(Config.Keys.DefaultQualityProfileId, this.ui.qualityProfile.val()); - }, - - _rootFolderChanged: function () { - var rootFolderValue = this.ui.rootFolder.val(); - if (rootFolderValue === 'addNew') { - App.modalRegion.show(this.rootFolderLayout); - } - else { - Config.setValue(Config.Keys.DefaultRootFolderId, rootFolderValue); - } - }, - - _setRootFolder: function (options) { - App.vent.trigger(App.Commands.CloseModalCommand); - this.ui.rootFolder.val(options.model.id); - this._rootFolderChanged(); - }, - - _addSeries: function () { - var icon = this.ui.addButton.find('icon'); - icon.removeClass('icon-plus').addClass('icon-spin icon-spinner disabled'); - - var quality = this.ui.qualityProfile.val(); - var rootFolderPath = this.ui.rootFolder.children(':selected').text(); - var startingSeason = this.ui.startingSeason.val(); - - this.model.set('qualityProfileId', quality); - this.model.set('rootFolderPath', rootFolderPath); - this.model.setSeasonPass(startingSeason); - - var self = this; - - SeriesCollection.add(this.model); - - - var promise = this.model.save(); - - promise.done(function () { - self.close(); - icon.removeClass('icon-spin icon-spinner disabled').addClass('icon-search'); - - Messenger.show({ - message: 'Added: ' + self.model.get('title') - }); - - App.vent.trigger(App.Events.SeriesAdded, { series: self.model }); - }); - - promise.fail(function () { - icon.removeClass('icon-spin icon-spinner disabled').addClass('icon-search'); - }); - } - }); - - - AsValidatedView.apply(view); - - return view; - }); +'use strict'; +define( + [ + 'app', + 'underscore', + 'marionette', + 'Quality/QualityProfileCollection', + 'AddSeries/RootFolders/Collection', + 'AddSeries/RootFolders/Layout', + 'Series/SeriesCollection', + 'Config', + 'Shared/Messenger', + 'Mixins/AsValidatedView', + 'jquery.dotdotdot' + ], function (App, _, Marionette, QualityProfiles, RootFolders, RootFolderLayout, SeriesCollection, Config, Messenger, AsValidatedView) { + + var view = Marionette.ItemView.extend({ + + template: 'AddSeries/SearchResultViewTemplate', + + ui: { + qualityProfile: '.x-quality-profile', + rootFolder : '.x-root-folder', + addButton : '.x-add', + overview : '.x-overview', + startingSeason: '.x-starting-season' + }, + + events: { + 'click .x-add' : '_addSeries', + 'change .x-quality-profile': '_qualityProfileChanged', + 'change .x-root-folder' : '_rootFolderChanged' + }, + + initialize: function () { + + if (!this.model) { + throw 'model is required'; + } + + this.templateHelpers = {}; + this._configureTemplateHelpers(); + + this.listenTo(App.vent, Config.Events.ConfigUpdatedEvent, this._onConfigUpdated); + this.listenTo(this.model, 'change', this.render); + this.listenTo(RootFolders, 'all', this.render); + + this.rootFolderLayout = new RootFolderLayout(); + this.listenTo(this.rootFolderLayout, 'folderSelected', this._setRootFolder); + }, + + onRender: function () { + + var defaultQuality = Config.getValue(Config.Keys.DefaultQualityProfileId); + var defaultRoot = Config.getValue(Config.Keys.DefaultRootFolderId); + + if (QualityProfiles.get(defaultQuality)) { + this.ui.qualityProfile.val(defaultQuality); + } + + if (RootFolders.get(defaultRoot)) { + this.ui.rootFolder.val(defaultRoot); + } + + var minSeasonNotZero = _.min(_.reject(this.model.get('seasons'), { seasonNumber: 0 }), 'seasonNumber'); + + if (minSeasonNotZero) { + this.ui.startingSeason.val(minSeasonNotZero.seasonNumber); + } + + //TODO: make this work via onRender, FM? + //works with onShow, but stops working after the first render + this.ui.overview.dotdotdot({ + height: 120 + }); + }, + + _configureTemplateHelpers: function () { + var existingSeries = SeriesCollection.where({tvdbId: this.model.get('tvdbId')}); + + if (existingSeries.length > 0) { + this.templateHelpers.existing = existingSeries[0].toJSON(); + } + + this.templateHelpers.qualityProfiles = QualityProfiles.toJSON(); + + if (!this.model.get('isExisting')) { + this.templateHelpers.rootFolders = RootFolders.toJSON(); + } + }, + + _onConfigUpdated: function (options) { + if (options.key === Config.Keys.DefaultQualityProfileId) { + this.ui.qualityProfile.val(options.value); + } + else if (options.key === Config.Keys.DefaultRootFolderId) { + this.ui.rootFolder.val(options.value); + } + }, + + _qualityProfileChanged: function () { + Config.setValue(Config.Keys.DefaultQualityProfileId, this.ui.qualityProfile.val()); + }, + + _rootFolderChanged: function () { + var rootFolderValue = this.ui.rootFolder.val(); + if (rootFolderValue === 'addNew') { + App.modalRegion.show(this.rootFolderLayout); + } + else { + Config.setValue(Config.Keys.DefaultRootFolderId, rootFolderValue); + } + }, + + _setRootFolder: function (options) { + App.vent.trigger(App.Commands.CloseModalCommand); + this.ui.rootFolder.val(options.model.id); + this._rootFolderChanged(); + }, + + _addSeries: function () { + var icon = this.ui.addButton.find('icon'); + icon.removeClass('icon-plus').addClass('icon-spin icon-spinner disabled'); + + var quality = this.ui.qualityProfile.val(); + var rootFolderPath = this.ui.rootFolder.children(':selected').text(); + var startingSeason = this.ui.startingSeason.val(); + + this.model.set('qualityProfileId', quality); + this.model.set('rootFolderPath', rootFolderPath); + this.model.setSeasonPass(startingSeason); + + var self = this; + + SeriesCollection.add(this.model); + + + var promise = this.model.save(); + + promise.done(function () { + self.close(); + icon.removeClass('icon-spin icon-spinner disabled').addClass('icon-search'); + + Messenger.show({ + message: 'Added: ' + self.model.get('title') + }); + + App.vent.trigger(App.Events.SeriesAdded, { series: self.model }); + }); + + promise.fail(function () { + icon.removeClass('icon-spin icon-spinner disabled').addClass('icon-search'); + }); + } + }); + + + AsValidatedView.apply(view); + + return view; + }); diff --git a/UI/AddSeries/SearchResultViewTemplate.html b/src/UI/AddSeries/SearchResultViewTemplate.html similarity index 100% rename from UI/AddSeries/SearchResultViewTemplate.html rename to src/UI/AddSeries/SearchResultViewTemplate.html diff --git a/UI/AddSeries/addSeries.less b/src/UI/AddSeries/addSeries.less similarity index 100% rename from UI/AddSeries/addSeries.less rename to src/UI/AddSeries/addSeries.less diff --git a/UI/Calendar/CalendarLayout.js b/src/UI/Calendar/CalendarLayout.js similarity index 100% rename from UI/Calendar/CalendarLayout.js rename to src/UI/Calendar/CalendarLayout.js diff --git a/UI/Calendar/CalendarLayoutTemplate.html b/src/UI/Calendar/CalendarLayoutTemplate.html similarity index 100% rename from UI/Calendar/CalendarLayoutTemplate.html rename to src/UI/Calendar/CalendarLayoutTemplate.html diff --git a/UI/Calendar/CalendarView.js b/src/UI/Calendar/CalendarView.js similarity index 98% rename from UI/Calendar/CalendarView.js rename to src/UI/Calendar/CalendarView.js index 38c3affea..ec4012a8e 100644 --- a/UI/Calendar/CalendarView.js +++ b/src/UI/Calendar/CalendarView.js @@ -21,6 +21,7 @@ define( allDayDefault : false, ignoreTimezone: false, weekMode : 'variable', + firstDay : window.NzbDrone.ServerStatus.startOfWeek, timeFormat : 'h(:mm)tt', header : { left : 'prev,next today', diff --git a/UI/Calendar/Collection.js b/src/UI/Calendar/Collection.js similarity index 100% rename from UI/Calendar/Collection.js rename to src/UI/Calendar/Collection.js diff --git a/UI/Calendar/UpcomingCollection.js b/src/UI/Calendar/UpcomingCollection.js similarity index 100% rename from UI/Calendar/UpcomingCollection.js rename to src/UI/Calendar/UpcomingCollection.js diff --git a/UI/Calendar/UpcomingCollectionView.js b/src/UI/Calendar/UpcomingCollectionView.js similarity index 100% rename from UI/Calendar/UpcomingCollectionView.js rename to src/UI/Calendar/UpcomingCollectionView.js diff --git a/UI/Calendar/UpcomingItemView.js b/src/UI/Calendar/UpcomingItemView.js similarity index 100% rename from UI/Calendar/UpcomingItemView.js rename to src/UI/Calendar/UpcomingItemView.js diff --git a/UI/Calendar/UpcomingItemViewTemplate.html b/src/UI/Calendar/UpcomingItemViewTemplate.html similarity index 100% rename from UI/Calendar/UpcomingItemViewTemplate.html rename to src/UI/Calendar/UpcomingItemViewTemplate.html diff --git a/UI/Calendar/calendar.less b/src/UI/Calendar/calendar.less similarity index 100% rename from UI/Calendar/calendar.less rename to src/UI/Calendar/calendar.less diff --git a/UI/Cells/ApprovalStatusCell.js b/src/UI/Cells/ApprovalStatusCell.js similarity index 100% rename from UI/Cells/ApprovalStatusCell.js rename to src/UI/Cells/ApprovalStatusCell.js diff --git a/UI/Cells/ApprovalStatusCellTemplate.html b/src/UI/Cells/ApprovalStatusCellTemplate.html similarity index 100% rename from UI/Cells/ApprovalStatusCellTemplate.html rename to src/UI/Cells/ApprovalStatusCellTemplate.html diff --git a/UI/Cells/Edit/QualityCellEditor.js b/src/UI/Cells/Edit/QualityCellEditor.js similarity index 100% rename from UI/Cells/Edit/QualityCellEditor.js rename to src/UI/Cells/Edit/QualityCellEditor.js diff --git a/UI/Cells/Edit/QualityCellEditorTemplate.html b/src/UI/Cells/Edit/QualityCellEditorTemplate.html similarity index 100% rename from UI/Cells/Edit/QualityCellEditorTemplate.html rename to src/UI/Cells/Edit/QualityCellEditorTemplate.html diff --git a/UI/Cells/EpisodeActionsCell.js b/src/UI/Cells/EpisodeActionsCell.js similarity index 96% rename from UI/Cells/EpisodeActionsCell.js rename to src/UI/Cells/EpisodeActionsCell.js index 27bcd893e..229c52f06 100644 --- a/UI/Cells/EpisodeActionsCell.js +++ b/src/UI/Cells/EpisodeActionsCell.js @@ -43,7 +43,7 @@ define( _automaticSearch: function () { CommandController.Execute('episodeSearch', { name : 'episodeSearch', - episodeId: this.model.get('id') + episodeIds: [ this.model.get('id') ] }); }, diff --git a/UI/Cells/EpisodeActionsCellTemplate.html b/src/UI/Cells/EpisodeActionsCellTemplate.html similarity index 100% rename from UI/Cells/EpisodeActionsCellTemplate.html rename to src/UI/Cells/EpisodeActionsCellTemplate.html diff --git a/UI/Cells/EpisodeNumberCell.js b/src/UI/Cells/EpisodeNumberCell.js similarity index 99% rename from UI/Cells/EpisodeNumberCell.js rename to src/UI/Cells/EpisodeNumberCell.js index 85be40255..0daf55b81 100644 --- a/UI/Cells/EpisodeNumberCell.js +++ b/src/UI/Cells/EpisodeNumberCell.js @@ -1,4 +1,4 @@ -'use strict'; + 'use strict'; define( [ diff --git a/UI/Cells/EpisodeProgressCell.js b/src/UI/Cells/EpisodeProgressCell.js similarity index 100% rename from UI/Cells/EpisodeProgressCell.js rename to src/UI/Cells/EpisodeProgressCell.js diff --git a/UI/Cells/EpisodeProgressCellTemplate.html b/src/UI/Cells/EpisodeProgressCellTemplate.html similarity index 100% rename from UI/Cells/EpisodeProgressCellTemplate.html rename to src/UI/Cells/EpisodeProgressCellTemplate.html diff --git a/UI/Cells/EpisodeStatusCell.js b/src/UI/Cells/EpisodeStatusCell.js similarity index 78% rename from UI/Cells/EpisodeStatusCell.js rename to src/UI/Cells/EpisodeStatusCell.js index 091064380..a8f5c8c00 100644 --- a/UI/Cells/EpisodeStatusCell.js +++ b/src/UI/Cells/EpisodeStatusCell.js @@ -3,15 +3,25 @@ define( [ 'app', + 'underscore', 'Cells/NzbDroneCell', + 'History/Queue/QueueCollection', 'moment', 'Shared/FormatHelpers' - ], function (App, NzbDroneCell, Moment, FormatHelpers) { + ], function (App, _, NzbDroneCell, QueueCollection, Moment, FormatHelpers) { return NzbDroneCell.extend({ className: 'episode-status-cell', render: function () { + this.listenTo(QueueCollection, 'sync', this._renderCell); + + this._renderCell(); + + return this; + }, + + _renderCell: function () { this.$el.empty(); if (this.model) { @@ -41,10 +51,17 @@ define( this.$el.html('{1}'.format(title, quality.quality.name)); } - return this; + return; } + else { - if (this.model.get('downloading')) { + var model = this.model; + + var downloading = _.find(QueueCollection.models, function (queueModel) { + return queueModel.get('episode').id === model.get('id'); + }); + + if (downloading || this.model.get('downloading')) { icon = 'icon-nd-downloading'; tooltip = 'Episode is downloading'; } @@ -66,8 +83,6 @@ define( this.$el.html(''.format(icon, tooltip)); } - - return this; } }); }); diff --git a/UI/Cells/EpisodeTitleCell.js b/src/UI/Cells/EpisodeTitleCell.js similarity index 100% rename from UI/Cells/EpisodeTitleCell.js rename to src/UI/Cells/EpisodeTitleCell.js diff --git a/UI/History/EventTypeCell.js b/src/UI/Cells/EventTypeCell.js similarity index 92% rename from UI/History/EventTypeCell.js rename to src/UI/Cells/EventTypeCell.js index d328b9bf1..3b9bb8b0a 100644 --- a/UI/History/EventTypeCell.js +++ b/src/UI/Cells/EventTypeCell.js @@ -35,7 +35,7 @@ define( } - this.$el.html(''.format(icon, toolTip)); + this.$el.html(''.format(icon, toolTip)); } return this; diff --git a/UI/Cells/FileSizeCell.js b/src/UI/Cells/FileSizeCell.js similarity index 100% rename from UI/Cells/FileSizeCell.js rename to src/UI/Cells/FileSizeCell.js diff --git a/UI/Cells/Header/QualityHeaderCell.js b/src/UI/Cells/Header/QualityHeaderCell.js similarity index 100% rename from UI/Cells/Header/QualityHeaderCell.js rename to src/UI/Cells/Header/QualityHeaderCell.js diff --git a/UI/Cells/IndexerCell.js b/src/UI/Cells/IndexerCell.js similarity index 100% rename from UI/Cells/IndexerCell.js rename to src/UI/Cells/IndexerCell.js diff --git a/UI/Cells/NzbDroneCell.js b/src/UI/Cells/NzbDroneCell.js similarity index 100% rename from UI/Cells/NzbDroneCell.js rename to src/UI/Cells/NzbDroneCell.js diff --git a/UI/Cells/QualityCell.js b/src/UI/Cells/QualityCell.js similarity index 100% rename from UI/Cells/QualityCell.js rename to src/UI/Cells/QualityCell.js diff --git a/UI/Cells/QualityCellTemplate.html b/src/UI/Cells/QualityCellTemplate.html similarity index 100% rename from UI/Cells/QualityCellTemplate.html rename to src/UI/Cells/QualityCellTemplate.html diff --git a/UI/Cells/QualityProfileCell.js b/src/UI/Cells/QualityProfileCell.js similarity index 100% rename from UI/Cells/QualityProfileCell.js rename to src/UI/Cells/QualityProfileCell.js diff --git a/UI/Cells/RelativeDateCell.js b/src/UI/Cells/RelativeDateCell.js similarity index 77% rename from UI/Cells/RelativeDateCell.js rename to src/UI/Cells/RelativeDateCell.js index 4f8eb8a30..0ffb11d76 100644 --- a/UI/Cells/RelativeDateCell.js +++ b/src/UI/Cells/RelativeDateCell.js @@ -14,7 +14,7 @@ define( var date = this.model.get(this.column.get('name')); if (date) { - this.$el.html("" + FormatHelpers.dateHelper(date) + "' + FormatHelpers.dateHelper(date) + ''); } return this; diff --git a/UI/Cells/SeriesActionsCell.js b/src/UI/Cells/SeriesActionsCell.js similarity index 100% rename from UI/Cells/SeriesActionsCell.js rename to src/UI/Cells/SeriesActionsCell.js diff --git a/UI/Cells/SeriesStatusCell.js b/src/UI/Cells/SeriesStatusCell.js similarity index 100% rename from UI/Cells/SeriesStatusCell.js rename to src/UI/Cells/SeriesStatusCell.js diff --git a/UI/Cells/SeriesTitleCell.js b/src/UI/Cells/SeriesTitleCell.js similarity index 100% rename from UI/Cells/SeriesTitleCell.js rename to src/UI/Cells/SeriesTitleCell.js diff --git a/UI/Cells/SeriesTitleTemplate.html b/src/UI/Cells/SeriesTitleTemplate.html similarity index 100% rename from UI/Cells/SeriesTitleTemplate.html rename to src/UI/Cells/SeriesTitleTemplate.html diff --git a/UI/Cells/TemplatedCell.js b/src/UI/Cells/TemplatedCell.js similarity index 100% rename from UI/Cells/TemplatedCell.js rename to src/UI/Cells/TemplatedCell.js diff --git a/UI/Cells/ToggleCell.js b/src/UI/Cells/ToggleCell.js similarity index 100% rename from UI/Cells/ToggleCell.js rename to src/UI/Cells/ToggleCell.js diff --git a/UI/Cells/cells.less b/src/UI/Cells/cells.less similarity index 88% rename from UI/Cells/cells.less rename to src/UI/Cells/cells.less index 38789980c..c85561a67 100644 --- a/UI/Cells/cells.less +++ b/src/UI/Cells/cells.less @@ -91,4 +91,18 @@ td.episode-status-cell, td.quality-cell { .series-actions-cell { width: 40px; +} + +.timeleft-cell { + cursor: default; + width: 80px; +} + +.queue-status-cell { + width: 20px; + text-align: center !important; +} + +.download-log-cell { + width: 80px; } \ No newline at end of file diff --git a/UI/Commands/CommandCollection.js b/src/UI/Commands/CommandCollection.js similarity index 100% rename from UI/Commands/CommandCollection.js rename to src/UI/Commands/CommandCollection.js diff --git a/UI/Commands/CommandController.js b/src/UI/Commands/CommandController.js similarity index 100% rename from UI/Commands/CommandController.js rename to src/UI/Commands/CommandController.js diff --git a/UI/Commands/CommandMessengerCollectionView.js b/src/UI/Commands/CommandMessengerCollectionView.js similarity index 100% rename from UI/Commands/CommandMessengerCollectionView.js rename to src/UI/Commands/CommandMessengerCollectionView.js diff --git a/UI/Commands/CommandMessengerItemView.js b/src/UI/Commands/CommandMessengerItemView.js similarity index 100% rename from UI/Commands/CommandMessengerItemView.js rename to src/UI/Commands/CommandMessengerItemView.js diff --git a/UI/Commands/CommandModel.js b/src/UI/Commands/CommandModel.js similarity index 100% rename from UI/Commands/CommandModel.js rename to src/UI/Commands/CommandModel.js diff --git a/UI/Config.js b/src/UI/Config.js similarity index 100% rename from UI/Config.js rename to src/UI/Config.js diff --git a/UI/Content/Backgrid/backgrid.less b/src/UI/Content/Backgrid/backgrid.less similarity index 66% rename from UI/Content/Backgrid/backgrid.less rename to src/UI/Content/Backgrid/backgrid.less index 969597665..ae1d46943 100644 --- a/UI/Content/Backgrid/backgrid.less +++ b/src/UI/Content/Backgrid/backgrid.less @@ -1,2 +1,3 @@ @import "filter"; @import "paginator"; +@import "selectall"; \ No newline at end of file diff --git a/UI/Content/Backgrid/filter.less b/src/UI/Content/Backgrid/filter.less similarity index 100% rename from UI/Content/Backgrid/filter.less rename to src/UI/Content/Backgrid/filter.less diff --git a/UI/Content/Backgrid/paginator.less b/src/UI/Content/Backgrid/paginator.less similarity index 100% rename from UI/Content/Backgrid/paginator.less rename to src/UI/Content/Backgrid/paginator.less diff --git a/src/UI/Content/Backgrid/selectall.less b/src/UI/Content/Backgrid/selectall.less new file mode 100644 index 000000000..86f6e0107 --- /dev/null +++ b/src/UI/Content/Backgrid/selectall.less @@ -0,0 +1,13 @@ +/* + backgrid-select-all + http://github.com/wyuenho/backgrid + + Copyright (c) 2013 Jimmy Yuen Ho Wong and contributors + Licensed under the MIT @license. +*/ + +.backgrid { + .select-row-cell, .select-all-header-cell { + text-align: center; + } +} \ No newline at end of file diff --git a/UI/Content/Bootstrap/accordion.less b/src/UI/Content/Bootstrap/accordion.less similarity index 100% rename from UI/Content/Bootstrap/accordion.less rename to src/UI/Content/Bootstrap/accordion.less diff --git a/UI/Content/Bootstrap/alerts.less b/src/UI/Content/Bootstrap/alerts.less similarity index 100% rename from UI/Content/Bootstrap/alerts.less rename to src/UI/Content/Bootstrap/alerts.less diff --git a/UI/Content/Bootstrap/bootstrap.less b/src/UI/Content/Bootstrap/bootstrap.less similarity index 100% rename from UI/Content/Bootstrap/bootstrap.less rename to src/UI/Content/Bootstrap/bootstrap.less diff --git a/UI/Content/Bootstrap/breadcrumbs.less b/src/UI/Content/Bootstrap/breadcrumbs.less similarity index 100% rename from UI/Content/Bootstrap/breadcrumbs.less rename to src/UI/Content/Bootstrap/breadcrumbs.less diff --git a/UI/Content/Bootstrap/button-groups.less b/src/UI/Content/Bootstrap/button-groups.less similarity index 100% rename from UI/Content/Bootstrap/button-groups.less rename to src/UI/Content/Bootstrap/button-groups.less diff --git a/UI/Content/Bootstrap/buttons.less b/src/UI/Content/Bootstrap/buttons.less similarity index 100% rename from UI/Content/Bootstrap/buttons.less rename to src/UI/Content/Bootstrap/buttons.less diff --git a/UI/Content/Bootstrap/carousel.less b/src/UI/Content/Bootstrap/carousel.less similarity index 100% rename from UI/Content/Bootstrap/carousel.less rename to src/UI/Content/Bootstrap/carousel.less diff --git a/UI/Content/Bootstrap/close.less b/src/UI/Content/Bootstrap/close.less similarity index 100% rename from UI/Content/Bootstrap/close.less rename to src/UI/Content/Bootstrap/close.less diff --git a/UI/Content/Bootstrap/code.less b/src/UI/Content/Bootstrap/code.less similarity index 100% rename from UI/Content/Bootstrap/code.less rename to src/UI/Content/Bootstrap/code.less diff --git a/UI/Content/Bootstrap/component-animations.less b/src/UI/Content/Bootstrap/component-animations.less similarity index 100% rename from UI/Content/Bootstrap/component-animations.less rename to src/UI/Content/Bootstrap/component-animations.less diff --git a/UI/Content/Bootstrap/dropdowns.less b/src/UI/Content/Bootstrap/dropdowns.less similarity index 100% rename from UI/Content/Bootstrap/dropdowns.less rename to src/UI/Content/Bootstrap/dropdowns.less diff --git a/UI/Content/Bootstrap/forms.less b/src/UI/Content/Bootstrap/forms.less similarity index 100% rename from UI/Content/Bootstrap/forms.less rename to src/UI/Content/Bootstrap/forms.less diff --git a/UI/Content/Bootstrap/grid.less b/src/UI/Content/Bootstrap/grid.less similarity index 100% rename from UI/Content/Bootstrap/grid.less rename to src/UI/Content/Bootstrap/grid.less diff --git a/UI/Content/Bootstrap/hero-unit.less b/src/UI/Content/Bootstrap/hero-unit.less similarity index 100% rename from UI/Content/Bootstrap/hero-unit.less rename to src/UI/Content/Bootstrap/hero-unit.less diff --git a/UI/Content/Bootstrap/labels-badges.less b/src/UI/Content/Bootstrap/labels-badges.less similarity index 100% rename from UI/Content/Bootstrap/labels-badges.less rename to src/UI/Content/Bootstrap/labels-badges.less diff --git a/UI/Content/Bootstrap/layouts.less b/src/UI/Content/Bootstrap/layouts.less similarity index 100% rename from UI/Content/Bootstrap/layouts.less rename to src/UI/Content/Bootstrap/layouts.less diff --git a/UI/Content/Bootstrap/media.less b/src/UI/Content/Bootstrap/media.less similarity index 100% rename from UI/Content/Bootstrap/media.less rename to src/UI/Content/Bootstrap/media.less diff --git a/UI/Content/Bootstrap/mixins.less b/src/UI/Content/Bootstrap/mixins.less similarity index 100% rename from UI/Content/Bootstrap/mixins.less rename to src/UI/Content/Bootstrap/mixins.less diff --git a/UI/Content/Bootstrap/modals.less b/src/UI/Content/Bootstrap/modals.less similarity index 100% rename from UI/Content/Bootstrap/modals.less rename to src/UI/Content/Bootstrap/modals.less diff --git a/UI/Content/Bootstrap/navbar.less b/src/UI/Content/Bootstrap/navbar.less similarity index 100% rename from UI/Content/Bootstrap/navbar.less rename to src/UI/Content/Bootstrap/navbar.less diff --git a/UI/Content/Bootstrap/navs.less b/src/UI/Content/Bootstrap/navs.less similarity index 100% rename from UI/Content/Bootstrap/navs.less rename to src/UI/Content/Bootstrap/navs.less diff --git a/UI/Content/Bootstrap/pager.less b/src/UI/Content/Bootstrap/pager.less similarity index 100% rename from UI/Content/Bootstrap/pager.less rename to src/UI/Content/Bootstrap/pager.less diff --git a/UI/Content/Bootstrap/pagination.less b/src/UI/Content/Bootstrap/pagination.less similarity index 100% rename from UI/Content/Bootstrap/pagination.less rename to src/UI/Content/Bootstrap/pagination.less diff --git a/UI/Content/Bootstrap/popovers.less b/src/UI/Content/Bootstrap/popovers.less similarity index 100% rename from UI/Content/Bootstrap/popovers.less rename to src/UI/Content/Bootstrap/popovers.less diff --git a/UI/Content/Bootstrap/progress-bars.less b/src/UI/Content/Bootstrap/progress-bars.less similarity index 100% rename from UI/Content/Bootstrap/progress-bars.less rename to src/UI/Content/Bootstrap/progress-bars.less diff --git a/UI/Content/Bootstrap/reset.less b/src/UI/Content/Bootstrap/reset.less similarity index 100% rename from UI/Content/Bootstrap/reset.less rename to src/UI/Content/Bootstrap/reset.less diff --git a/UI/Content/Bootstrap/scaffolding.less b/src/UI/Content/Bootstrap/scaffolding.less similarity index 100% rename from UI/Content/Bootstrap/scaffolding.less rename to src/UI/Content/Bootstrap/scaffolding.less diff --git a/UI/Content/Bootstrap/sprites.less b/src/UI/Content/Bootstrap/sprites.less similarity index 100% rename from UI/Content/Bootstrap/sprites.less rename to src/UI/Content/Bootstrap/sprites.less diff --git a/UI/Content/Bootstrap/tables.less b/src/UI/Content/Bootstrap/tables.less similarity index 100% rename from UI/Content/Bootstrap/tables.less rename to src/UI/Content/Bootstrap/tables.less diff --git a/UI/Content/Bootstrap/thumbnails.less b/src/UI/Content/Bootstrap/thumbnails.less similarity index 100% rename from UI/Content/Bootstrap/thumbnails.less rename to src/UI/Content/Bootstrap/thumbnails.less diff --git a/UI/Content/Bootstrap/tooltip.less b/src/UI/Content/Bootstrap/tooltip.less similarity index 100% rename from UI/Content/Bootstrap/tooltip.less rename to src/UI/Content/Bootstrap/tooltip.less diff --git a/UI/Content/Bootstrap/type.less b/src/UI/Content/Bootstrap/type.less similarity index 100% rename from UI/Content/Bootstrap/type.less rename to src/UI/Content/Bootstrap/type.less diff --git a/UI/Content/Bootstrap/utilities.less b/src/UI/Content/Bootstrap/utilities.less similarity index 100% rename from UI/Content/Bootstrap/utilities.less rename to src/UI/Content/Bootstrap/utilities.less diff --git a/UI/Content/Bootstrap/variables.less b/src/UI/Content/Bootstrap/variables.less similarity index 100% rename from UI/Content/Bootstrap/variables.less rename to src/UI/Content/Bootstrap/variables.less diff --git a/UI/Content/Bootstrap/wells.less b/src/UI/Content/Bootstrap/wells.less similarity index 100% rename from UI/Content/Bootstrap/wells.less rename to src/UI/Content/Bootstrap/wells.less diff --git a/UI/Content/FontAwesome/fontawesome.otf b/src/UI/Content/FontAwesome/FontAwesome.otf similarity index 100% rename from UI/Content/FontAwesome/fontawesome.otf rename to src/UI/Content/FontAwesome/FontAwesome.otf diff --git a/UI/Content/FontAwesome/bootstrap.less b/src/UI/Content/FontAwesome/bootstrap.less similarity index 100% rename from UI/Content/FontAwesome/bootstrap.less rename to src/UI/Content/FontAwesome/bootstrap.less diff --git a/UI/Content/FontAwesome/core.less b/src/UI/Content/FontAwesome/core.less similarity index 100% rename from UI/Content/FontAwesome/core.less rename to src/UI/Content/FontAwesome/core.less diff --git a/UI/Content/FontAwesome/extras.less b/src/UI/Content/FontAwesome/extras.less similarity index 100% rename from UI/Content/FontAwesome/extras.less rename to src/UI/Content/FontAwesome/extras.less diff --git a/UI/Content/FontAwesome/font-awesome-ie7.less b/src/UI/Content/FontAwesome/font-awesome-ie7.less similarity index 100% rename from UI/Content/FontAwesome/font-awesome-ie7.less rename to src/UI/Content/FontAwesome/font-awesome-ie7.less diff --git a/UI/Content/FontAwesome/font-awesome.less b/src/UI/Content/FontAwesome/font-awesome.less similarity index 100% rename from UI/Content/FontAwesome/font-awesome.less rename to src/UI/Content/FontAwesome/font-awesome.less diff --git a/UI/Content/FontAwesome/fontawesome-webfont.eot b/src/UI/Content/FontAwesome/fontawesome-webfont.eot similarity index 100% rename from UI/Content/FontAwesome/fontawesome-webfont.eot rename to src/UI/Content/FontAwesome/fontawesome-webfont.eot diff --git a/UI/Content/FontAwesome/fontawesome-webfont.svg b/src/UI/Content/FontAwesome/fontawesome-webfont.svg similarity index 100% rename from UI/Content/FontAwesome/fontawesome-webfont.svg rename to src/UI/Content/FontAwesome/fontawesome-webfont.svg diff --git a/UI/Content/FontAwesome/fontawesome-webfont.ttf b/src/UI/Content/FontAwesome/fontawesome-webfont.ttf similarity index 100% rename from UI/Content/FontAwesome/fontawesome-webfont.ttf rename to src/UI/Content/FontAwesome/fontawesome-webfont.ttf diff --git a/UI/Content/FontAwesome/fontawesome-webfont.woff b/src/UI/Content/FontAwesome/fontawesome-webfont.woff similarity index 100% rename from UI/Content/FontAwesome/fontawesome-webfont.woff rename to src/UI/Content/FontAwesome/fontawesome-webfont.woff diff --git a/UI/Content/FontAwesome/icons.less b/src/UI/Content/FontAwesome/icons.less similarity index 100% rename from UI/Content/FontAwesome/icons.less rename to src/UI/Content/FontAwesome/icons.less diff --git a/UI/Content/FontAwesome/mixins.less b/src/UI/Content/FontAwesome/mixins.less similarity index 100% rename from UI/Content/FontAwesome/mixins.less rename to src/UI/Content/FontAwesome/mixins.less diff --git a/UI/Content/FontAwesome/path.less b/src/UI/Content/FontAwesome/path.less similarity index 100% rename from UI/Content/FontAwesome/path.less rename to src/UI/Content/FontAwesome/path.less diff --git a/UI/Content/FontAwesome/variables.less b/src/UI/Content/FontAwesome/variables.less similarity index 100% rename from UI/Content/FontAwesome/variables.less rename to src/UI/Content/FontAwesome/variables.less diff --git a/UI/Content/Images/404.png b/src/UI/Content/Images/404.png similarity index 100% rename from UI/Content/Images/404.png rename to src/UI/Content/Images/404.png diff --git a/UI/Content/Images/black_linen_v2.png b/src/UI/Content/Images/black_linen_v2.png similarity index 100% rename from UI/Content/Images/black_linen_v2.png rename to src/UI/Content/Images/black_linen_v2.png diff --git a/UI/Content/Images/logo.png b/src/UI/Content/Images/logo.png similarity index 100% rename from UI/Content/Images/logo.png rename to src/UI/Content/Images/logo.png diff --git a/UI/Content/Images/pattern.png b/src/UI/Content/Images/pattern.png similarity index 100% rename from UI/Content/Images/pattern.png rename to src/UI/Content/Images/pattern.png diff --git a/UI/Content/Images/poster-dark.jpg b/src/UI/Content/Images/poster-dark.jpg similarity index 100% rename from UI/Content/Images/poster-dark.jpg rename to src/UI/Content/Images/poster-dark.jpg diff --git a/UI/Content/Images/touch/114.png b/src/UI/Content/Images/touch/114.png similarity index 100% rename from UI/Content/Images/touch/114.png rename to src/UI/Content/Images/touch/114.png diff --git a/UI/Content/Images/touch/144.png b/src/UI/Content/Images/touch/144.png similarity index 100% rename from UI/Content/Images/touch/144.png rename to src/UI/Content/Images/touch/144.png diff --git a/UI/Content/Images/touch/57.png b/src/UI/Content/Images/touch/57.png similarity index 100% rename from UI/Content/Images/touch/57.png rename to src/UI/Content/Images/touch/57.png diff --git a/UI/Content/Images/touch/72.png b/src/UI/Content/Images/touch/72.png similarity index 100% rename from UI/Content/Images/touch/72.png rename to src/UI/Content/Images/touch/72.png diff --git a/UI/Content/Messenger/messenger.css b/src/UI/Content/Messenger/messenger.css similarity index 100% rename from UI/Content/Messenger/messenger.css rename to src/UI/Content/Messenger/messenger.css diff --git a/UI/Content/Messenger/messenger.future.css b/src/UI/Content/Messenger/messenger.future.css similarity index 100% rename from UI/Content/Messenger/messenger.future.css rename to src/UI/Content/Messenger/messenger.future.css diff --git a/UI/Content/Overrides/bootstrap.less b/src/UI/Content/Overrides/bootstrap.less similarity index 100% rename from UI/Content/Overrides/bootstrap.less rename to src/UI/Content/Overrides/bootstrap.less diff --git a/UI/Content/Overrides/bootstrap.toggle-switch.less b/src/UI/Content/Overrides/bootstrap.toggle-switch.less similarity index 100% rename from UI/Content/Overrides/bootstrap.toggle-switch.less rename to src/UI/Content/Overrides/bootstrap.toggle-switch.less diff --git a/UI/Content/Overrides/browser.less b/src/UI/Content/Overrides/browser.less similarity index 100% rename from UI/Content/Overrides/browser.less rename to src/UI/Content/Overrides/browser.less diff --git a/UI/Content/bootstrap.toggle-switch.css b/src/UI/Content/bootstrap.toggle-switch.css similarity index 100% rename from UI/Content/bootstrap.toggle-switch.css rename to src/UI/Content/bootstrap.toggle-switch.css diff --git a/src/UI/Content/font.less b/src/UI/Content/font.less new file mode 100644 index 000000000..71636bcd6 --- /dev/null +++ b/src/UI/Content/font.less @@ -0,0 +1,35 @@ +@font-face { + font-family: 'Open Sans'; + font-style: normal; + font-weight: 300; + src: url('/Content/fonts/opensans-light.eot'); + src: local('Open Sans Light'), + local('OpenSans-Light'), + url('/Content/fonts/opensans-light.eot?#iefix') format('embedded-opentype'), + url('/Content/fonts/opensans-light.woff') format('woff'), + url('/Content/fonts/opensans-light.ttf') format('truetype'); +} + +@font-face { + font-family: 'Open Sans'; + font-style: normal; + font-weight: 400; + src: url('/Content/fonts/opensans-regular.eot'); + src: local('Open Sans'), + local('OpenSans'), + url('/Content/fonts/opensans-regular.eot?#iefix') format('embedded-opentype'), + url('/Content/fonts/opensans-regular.woff') format('woff'), + url('/Content/fonts/opensans-regular.ttf') format('truetype') +} + +@font-face { + font-family: 'Open Sans'; + font-style: normal; + font-weight: 600; + src: url('/Content/fonts/opensans-semibold.eot'); + src: local('Open Sans SemiBold'), + local('OpenSans-SemiBold'), + url('/Content/fonts/opensans-semibold.eot?#iefix') format('embedded-opentype'), + url('/Content/fonts/opensans-semibold.woff') format('woff'), + url('/Content/fonts/opensans-semibold.ttf') format('truetype') +} diff --git a/UI/Content/fonts/OpenSans-Light.eot b/src/UI/Content/fonts/opensans-light.eot similarity index 100% rename from UI/Content/fonts/OpenSans-Light.eot rename to src/UI/Content/fonts/opensans-light.eot diff --git a/UI/Content/fonts/OpenSans-Light.ttf b/src/UI/Content/fonts/opensans-light.ttf similarity index 100% rename from UI/Content/fonts/OpenSans-Light.ttf rename to src/UI/Content/fonts/opensans-light.ttf diff --git a/UI/Content/fonts/OpenSans-Light.woff b/src/UI/Content/fonts/opensans-light.woff similarity index 100% rename from UI/Content/fonts/OpenSans-Light.woff rename to src/UI/Content/fonts/opensans-light.woff diff --git a/UI/Content/fonts/OpenSans-Regular.eot b/src/UI/Content/fonts/opensans-regular.eot similarity index 100% rename from UI/Content/fonts/OpenSans-Regular.eot rename to src/UI/Content/fonts/opensans-regular.eot diff --git a/UI/Content/fonts/OpenSans-Regular.ttf b/src/UI/Content/fonts/opensans-regular.ttf similarity index 100% rename from UI/Content/fonts/OpenSans-Regular.ttf rename to src/UI/Content/fonts/opensans-regular.ttf diff --git a/UI/Content/fonts/OpenSans-Regular.woff b/src/UI/Content/fonts/opensans-regular.woff similarity index 100% rename from UI/Content/fonts/OpenSans-Regular.woff rename to src/UI/Content/fonts/opensans-regular.woff diff --git a/UI/Content/fonts/OpenSans-SemiBold.eot b/src/UI/Content/fonts/opensans-semibold.eot similarity index 100% rename from UI/Content/fonts/OpenSans-SemiBold.eot rename to src/UI/Content/fonts/opensans-semibold.eot diff --git a/UI/Content/fonts/OpenSans-Semibold.ttf b/src/UI/Content/fonts/opensans-semibold.ttf similarity index 100% rename from UI/Content/fonts/OpenSans-Semibold.ttf rename to src/UI/Content/fonts/opensans-semibold.ttf diff --git a/UI/Content/fonts/OpenSans-SemiBold.woff b/src/UI/Content/fonts/opensans-semibold.woff similarity index 100% rename from UI/Content/fonts/OpenSans-SemiBold.woff rename to src/UI/Content/fonts/opensans-semibold.woff diff --git a/UI/Content/form.less b/src/UI/Content/form.less similarity index 100% rename from UI/Content/form.less rename to src/UI/Content/form.less diff --git a/UI/Content/fullcalendar.css b/src/UI/Content/fullcalendar.css similarity index 100% rename from UI/Content/fullcalendar.css rename to src/UI/Content/fullcalendar.css diff --git a/UI/Content/icons.less b/src/UI/Content/icons.less similarity index 86% rename from UI/Content/icons.less rename to src/UI/Content/icons.less index 0a253e951..131e82b07 100644 --- a/UI/Content/icons.less +++ b/src/UI/Content/icons.less @@ -126,4 +126,34 @@ .icon-nd-unmonitored:before { .icon(@bookmark-empty); +} + +.icon-info:before { + .icon(@info-sign); + color : dodgerblue; +} + +.icon-debug:before { + .icon(@info-sign); + color : gray; +} + +.icon-trace:before { + .icon(@info-sign); + color : lightgrey; +} + +.icon-warn:before { + .icon(@exclamation-sign); + color : orange; +} + +.icon-error:before { + .icon(@bug); + color : red; +} + +.icon-fatal:before { + .icon(@remove-sign); + color : purple; } \ No newline at end of file diff --git a/UI/Content/legend.less b/src/UI/Content/legend.less similarity index 100% rename from UI/Content/legend.less rename to src/UI/Content/legend.less diff --git a/UI/Content/menu.less b/src/UI/Content/menu.less similarity index 100% rename from UI/Content/menu.less rename to src/UI/Content/menu.less diff --git a/UI/Content/overrides.less b/src/UI/Content/overrides.less similarity index 100% rename from UI/Content/overrides.less rename to src/UI/Content/overrides.less diff --git a/UI/Content/prefixer.less b/src/UI/Content/prefixer.less similarity index 100% rename from UI/Content/prefixer.less rename to src/UI/Content/prefixer.less diff --git a/UI/Content/spinner.less b/src/UI/Content/spinner.less similarity index 100% rename from UI/Content/spinner.less rename to src/UI/Content/spinner.less diff --git a/UI/Content/theme.less b/src/UI/Content/theme.less similarity index 100% rename from UI/Content/theme.less rename to src/UI/Content/theme.less diff --git a/UI/Content/variables.less b/src/UI/Content/variables.less similarity index 100% rename from UI/Content/variables.less rename to src/UI/Content/variables.less diff --git a/UI/Controller.js b/src/UI/Controller.js similarity index 71% rename from UI/Controller.js rename to src/UI/Controller.js index a4bc4d1f9..97efe7b3d 100644 --- a/UI/Controller.js +++ b/src/UI/Controller.js @@ -11,16 +11,27 @@ define( 'Series/SeriesCollection', 'Missing/MissingLayout', 'Calendar/CalendarLayout', - 'Logs/Layout', - 'Logs/Files/Layout', 'Release/Layout', - 'System/Layout', + 'System/SystemLayout', 'SeasonPass/SeasonPassLayout', - 'Update/UpdateLayout', + 'System/Update/UpdateLayout', 'Shared/NotFoundView', 'Shared/Modal/Region' - ], function (App, Marionette, HistoryLayout, SettingsLayout, AddSeriesLayout, SeriesIndexLayout, SeriesDetailsLayout, SeriesCollection, MissingLayout, CalendarLayout, - LogsLayout, LogFileLayout, ReleaseLayout, SystemLayout, SeasonPassLayout, UpdateLayout, NotFoundView) { + ], function (App, + Marionette, + HistoryLayout, + SettingsLayout, + AddSeriesLayout, + SeriesIndexLayout, + SeriesDetailsLayout, + SeriesCollection, + MissingLayout, + CalendarLayout, + ReleaseLayout, + SystemLayout, + SeasonPassLayout, + UpdateLayout, + NotFoundView) { return Marionette.Controller.extend({ series: function () { @@ -31,7 +42,7 @@ define( seriesDetails: function (query) { var series = SeriesCollection.where({titleSlug: query}); - if (series.length != 0) { + if (series.length !== 0) { var targetSeries = series[0]; this._setTitle(targetSeries.get('title')); App.mainRegion.show(new SeriesDetailsLayout({ model: targetSeries })); @@ -53,7 +64,7 @@ define( settings: function (action) { this._setTitle('Settings'); - App.mainRegion.show(new SettingsLayout({action: action})); + App.mainRegion.show(new SettingsLayout({ action: action })); }, missing: function () { @@ -62,10 +73,10 @@ define( App.mainRegion.show(new MissingLayout()); }, - history: function () { + history: function (action) { this._setTitle('History'); - App.mainRegion.show(new HistoryLayout()); + App.mainRegion.show(new HistoryLayout({ action: action })); }, rss: function () { @@ -73,21 +84,9 @@ define( App.mainRegion.show(new ReleaseLayout()); }, - logs: function (action) { - if (action) { - this._setTitle('log files'); - App.mainRegion.show(new LogFileLayout()); - } - - else { - this._setTitle('logs'); - App.mainRegion.show(new LogsLayout()); - } - }, - - system: function () { - this._setTitle('system'); - App.mainRegion.show(new SystemLayout()); + system: function (action) { + this._setTitle('System'); + App.mainRegion.show(new SystemLayout({ action: action })); }, seasonPass: function () { diff --git a/src/UI/Episode/Activity/EpisodeActivityLayout.js b/src/UI/Episode/Activity/EpisodeActivityLayout.js new file mode 100644 index 000000000..ccfb3f128 --- /dev/null +++ b/src/UI/Episode/Activity/EpisodeActivityLayout.js @@ -0,0 +1,74 @@ +'use strict'; +define( + [ + 'app', + 'marionette', + 'backgrid', + 'History/HistoryCollection', + 'Cells/EventTypeCell', + 'Cells/QualityCell', + 'Cells/RelativeDateCell', + 'Episode/Activity/NoActivityView', + 'Shared/LoadingView' + ], function (App, Marionette, Backgrid, HistoryCollection, EventTypeCell, QualityCell, RelativeDateCell, NoActivityView, LoadingView) { + + return Marionette.Layout.extend({ + template: 'Episode/Activity/EpisodeActivityLayoutTemplate', + + regions: { + activityTable: '.activity-table' + }, + + columns: + [ + { + name : 'eventType', + label : '', + cell : EventTypeCell, + cellValue: 'this' + }, + { + name : 'sourceTitle', + label: 'Source Title', + cell : 'string' + }, + { + name : 'quality', + label: 'Quality', + cell : QualityCell + }, + { + name : 'date', + label: 'Date', + cell : RelativeDateCell + } + ], + + initialize: function (options) { + this.model = options.model; + this.series = options.series; + + this.collection = new HistoryCollection({ episodeId: this.model.id }); + this.collection.fetch(); + this.listenTo(this.collection, 'sync', this._showTable); + }, + + onRender: function () { + this.activityTable.show(new LoadingView()); + }, + + _showTable: function () { + if (this.collection.any()) { + this.activityTable.show(new Backgrid.Grid({ + collection: this.collection, + columns : this.columns, + className : 'table table-hover table-condensed' + })); + } + + else { + this.activityTable.show(new NoActivityView()); + } + } + }); + }); diff --git a/src/UI/Episode/Activity/EpisodeActivityLayoutTemplate.html b/src/UI/Episode/Activity/EpisodeActivityLayoutTemplate.html new file mode 100644 index 000000000..459032937 --- /dev/null +++ b/src/UI/Episode/Activity/EpisodeActivityLayoutTemplate.html @@ -0,0 +1 @@ +
\ No newline at end of file diff --git a/UI/System/About/View.js b/src/UI/Episode/Activity/NoActivityView.js similarity index 68% rename from UI/System/About/View.js rename to src/UI/Episode/Activity/NoActivityView.js index d737002f2..863e09cf0 100644 --- a/UI/System/About/View.js +++ b/src/UI/Episode/Activity/NoActivityView.js @@ -3,7 +3,9 @@ define( [ 'marionette' ], function (Marionette) { + return Marionette.ItemView.extend({ - template: 'System/About/ViewTemplate' + template: 'Episode/Activity/NoActivityViewTemplate' }); + }); diff --git a/src/UI/Episode/Activity/NoActivityViewTemplate.html b/src/UI/Episode/Activity/NoActivityViewTemplate.html new file mode 100644 index 000000000..ea9d127af --- /dev/null +++ b/src/UI/Episode/Activity/NoActivityViewTemplate.html @@ -0,0 +1,3 @@ +

+ No activity for this episode. +

\ No newline at end of file diff --git a/UI/Episode/EpisodeDetailsLayout.js b/src/UI/Episode/EpisodeDetailsLayout.js similarity index 90% rename from UI/Episode/EpisodeDetailsLayout.js rename to src/UI/Episode/EpisodeDetailsLayout.js index 590351b40..bc17cd0c1 100644 --- a/UI/Episode/EpisodeDetailsLayout.js +++ b/src/UI/Episode/EpisodeDetailsLayout.js @@ -4,8 +4,9 @@ define( 'marionette', 'Episode/Summary/EpisodeSummaryLayout', 'Episode/Search/EpisodeSearchLayout', + 'Episode/Activity/EpisodeActivityLayout', 'Series/SeriesCollection' - ], function (Marionette, SummaryLayout, SearchLayout, SeriesCollection) { + ], function (Marionette, SummaryLayout, SearchLayout, EpisodeActivityLayout, SeriesCollection) { return Marionette.Layout.extend({ template: 'Episode/EpisodeDetailsLayoutTemplate', @@ -38,7 +39,9 @@ define( this.series = SeriesCollection.find({ id: this.model.get('seriesId') }); this.templateHelpers.series = this.series.toJSON(); - this.openingTab = options.openingTab || 'summary' + this.openingTab = options.openingTab || 'summary'; + + this.listenTo(this.model, 'sync', this._setMonitoredState); }, onShow: function () { @@ -71,6 +74,7 @@ define( } this.ui.activity.tab('show'); + this.activity.show(new EpisodeActivityLayout({model: this.model, series: this.series})); }, _showSearch: function (e) { @@ -83,17 +87,11 @@ define( }, _toggleMonitored: function () { - var self = this; var name = 'monitored'; this.model.set(name, !this.model.get(name), { silent: true }); this.ui.monitored.addClass('icon-spinner icon-spin'); - - var promise = this.model.save(); - - promise.always(function () { - self._setMonitoredState(); - }); + this.model.save(); }, _setMonitoredState: function () { diff --git a/UI/Episode/EpisodeDetailsLayoutTemplate.html b/src/UI/Episode/EpisodeDetailsLayoutTemplate.html similarity index 88% rename from UI/Episode/EpisodeDetailsLayoutTemplate.html rename to src/UI/Episode/EpisodeDetailsLayoutTemplate.html index 982110d6a..1031118b1 100644 --- a/UI/Episode/EpisodeDetailsLayoutTemplate.html +++ b/src/UI/Episode/EpisodeDetailsLayoutTemplate.html @@ -15,12 +15,12 @@ + +
+ + +
+
diff --git a/UI/Settings/General/GeneralSettingsModel.js b/src/UI/Settings/General/GeneralSettingsModel.js similarity index 100% rename from UI/Settings/General/GeneralSettingsModel.js rename to src/UI/Settings/General/GeneralSettingsModel.js diff --git a/UI/Settings/General/GeneralTemplate.html b/src/UI/Settings/General/GeneralTemplate.html similarity index 100% rename from UI/Settings/General/GeneralTemplate.html rename to src/UI/Settings/General/GeneralTemplate.html diff --git a/UI/Settings/General/GeneralView.js b/src/UI/Settings/General/GeneralView.js similarity index 100% rename from UI/Settings/General/GeneralView.js rename to src/UI/Settings/General/GeneralView.js diff --git a/UI/Settings/Indexers/Collection.js b/src/UI/Settings/Indexers/Collection.js similarity index 100% rename from UI/Settings/Indexers/Collection.js rename to src/UI/Settings/Indexers/Collection.js diff --git a/UI/Settings/Indexers/CollectionTemplate.html b/src/UI/Settings/Indexers/CollectionTemplate.html similarity index 100% rename from UI/Settings/Indexers/CollectionTemplate.html rename to src/UI/Settings/Indexers/CollectionTemplate.html diff --git a/UI/Settings/Indexers/CollectionView.js b/src/UI/Settings/Indexers/CollectionView.js similarity index 100% rename from UI/Settings/Indexers/CollectionView.js rename to src/UI/Settings/Indexers/CollectionView.js diff --git a/UI/Settings/Indexers/DeleteTemplate.html b/src/UI/Settings/Indexers/DeleteTemplate.html similarity index 100% rename from UI/Settings/Indexers/DeleteTemplate.html rename to src/UI/Settings/Indexers/DeleteTemplate.html diff --git a/UI/Settings/Indexers/DeleteView.js b/src/UI/Settings/Indexers/DeleteView.js similarity index 100% rename from UI/Settings/Indexers/DeleteView.js rename to src/UI/Settings/Indexers/DeleteView.js diff --git a/UI/Settings/Indexers/EditTemplate.html b/src/UI/Settings/Indexers/EditTemplate.html similarity index 100% rename from UI/Settings/Indexers/EditTemplate.html rename to src/UI/Settings/Indexers/EditTemplate.html diff --git a/UI/Settings/Indexers/EditView.js b/src/UI/Settings/Indexers/EditView.js similarity index 100% rename from UI/Settings/Indexers/EditView.js rename to src/UI/Settings/Indexers/EditView.js diff --git a/UI/Settings/Indexers/IndexerLayout.js b/src/UI/Settings/Indexers/IndexerLayout.js similarity index 100% rename from UI/Settings/Indexers/IndexerLayout.js rename to src/UI/Settings/Indexers/IndexerLayout.js diff --git a/UI/Settings/Indexers/IndexerLayoutTemplate.html b/src/UI/Settings/Indexers/IndexerLayoutTemplate.html similarity index 100% rename from UI/Settings/Indexers/IndexerLayoutTemplate.html rename to src/UI/Settings/Indexers/IndexerLayoutTemplate.html diff --git a/UI/Settings/Indexers/ItemTemplate.html b/src/UI/Settings/Indexers/ItemTemplate.html similarity index 100% rename from UI/Settings/Indexers/ItemTemplate.html rename to src/UI/Settings/Indexers/ItemTemplate.html diff --git a/UI/Settings/Indexers/ItemView.js b/src/UI/Settings/Indexers/ItemView.js similarity index 100% rename from UI/Settings/Indexers/ItemView.js rename to src/UI/Settings/Indexers/ItemView.js diff --git a/src/UI/Settings/Indexers/Model.js b/src/UI/Settings/Indexers/Model.js new file mode 100644 index 000000000..ecfee73b8 --- /dev/null +++ b/src/UI/Settings/Indexers/Model.js @@ -0,0 +1,24 @@ +'use strict'; +define([ + 'Settings/SettingsModelBase'], function (ModelBase) { + return ModelBase.extend({ + + baseInitialize: ModelBase.prototype.initialize, + + initialize: function () { + var name = this.get('name'); + + if (name) { + this.successMessage = 'Saved indexer: ' + name; + this.errorMessage = 'Couldn\'t save indexer: ' + name; + } + + else { + this.successMessage = 'Saved indexer'; + this.errorMessage = 'Couldn\'t save indexer'; + } + + this.baseInitialize.call(this); + } + }); +}); diff --git a/UI/Settings/Indexers/Options/IndexerOptionsView.js b/src/UI/Settings/Indexers/Options/IndexerOptionsView.js similarity index 100% rename from UI/Settings/Indexers/Options/IndexerOptionsView.js rename to src/UI/Settings/Indexers/Options/IndexerOptionsView.js diff --git a/UI/Settings/Indexers/Options/IndexerOptionsViewTemplate.html b/src/UI/Settings/Indexers/Options/IndexerOptionsViewTemplate.html similarity index 100% rename from UI/Settings/Indexers/Options/IndexerOptionsViewTemplate.html rename to src/UI/Settings/Indexers/Options/IndexerOptionsViewTemplate.html diff --git a/UI/Settings/Indexers/indexers.less b/src/UI/Settings/Indexers/indexers.less similarity index 100% rename from UI/Settings/Indexers/indexers.less rename to src/UI/Settings/Indexers/indexers.less diff --git a/UI/Settings/MediaManagement/FileManagement/FileManagementView.js b/src/UI/Settings/MediaManagement/FileManagement/FileManagementView.js similarity index 100% rename from UI/Settings/MediaManagement/FileManagement/FileManagementView.js rename to src/UI/Settings/MediaManagement/FileManagement/FileManagementView.js diff --git a/UI/Settings/MediaManagement/FileManagement/FileManagementViewTemplate.html b/src/UI/Settings/MediaManagement/FileManagement/FileManagementViewTemplate.html similarity index 100% rename from UI/Settings/MediaManagement/FileManagement/FileManagementViewTemplate.html rename to src/UI/Settings/MediaManagement/FileManagement/FileManagementViewTemplate.html diff --git a/UI/Settings/MediaManagement/MediaManagementLayout.js b/src/UI/Settings/MediaManagement/MediaManagementLayout.js similarity index 95% rename from UI/Settings/MediaManagement/MediaManagementLayout.js rename to src/UI/Settings/MediaManagement/MediaManagementLayout.js index 47d670a40..eb31dcb77 100644 --- a/UI/Settings/MediaManagement/MediaManagementLayout.js +++ b/src/UI/Settings/MediaManagement/MediaManagementLayout.js @@ -3,7 +3,7 @@ define( [ 'marionette', - 'Settings/MediaManagement/Naming/View', + 'Settings/MediaManagement/Naming/NamingView', 'Settings/MediaManagement/Sorting/View', 'Settings/MediaManagement/FileManagement/FileManagementView' ], function (Marionette, NamingView, SortingView, FileManagementView) { diff --git a/UI/Settings/MediaManagement/MediaManagementLayoutTemplate.html b/src/UI/Settings/MediaManagement/MediaManagementLayoutTemplate.html similarity index 100% rename from UI/Settings/MediaManagement/MediaManagementLayoutTemplate.html rename to src/UI/Settings/MediaManagement/MediaManagementLayoutTemplate.html diff --git a/UI/Settings/MediaManagement/Naming/Model.js b/src/UI/Settings/MediaManagement/Naming/Model.js similarity index 100% rename from UI/Settings/MediaManagement/Naming/Model.js rename to src/UI/Settings/MediaManagement/Naming/Model.js diff --git a/src/UI/Settings/MediaManagement/Naming/NamingSampleModel.js b/src/UI/Settings/MediaManagement/Naming/NamingSampleModel.js new file mode 100644 index 000000000..fd833e32f --- /dev/null +++ b/src/UI/Settings/MediaManagement/Naming/NamingSampleModel.js @@ -0,0 +1,10 @@ +'use strict'; +define( + [ + 'backbone' + ], function (Backbone) { + return Backbone.Model.extend({ + url: window.NzbDrone.ApiRoot + '/config/naming/samples' + }); + + }); diff --git a/UI/Settings/MediaManagement/Naming/View.js b/src/UI/Settings/MediaManagement/Naming/NamingView.js similarity index 60% rename from UI/Settings/MediaManagement/Naming/View.js rename to src/UI/Settings/MediaManagement/Naming/NamingView.js index 8cd0027d2..3acadee56 100644 --- a/UI/Settings/MediaManagement/Naming/View.js +++ b/src/UI/Settings/MediaManagement/Naming/NamingView.js @@ -2,11 +2,12 @@ define( [ 'marionette', + 'Settings/MediaManagement/Naming/NamingSampleModel', 'Mixins/AsModelBoundView' - ], function (Marionette, AsModelBoundView) { + ], function (Marionette, NamingSampleModel, AsModelBoundView) { var view = Marionette.ItemView.extend({ - template: 'Settings/MediaManagement/Naming/ViewTemplate', + template: 'Settings/MediaManagement/Naming/NamingViewTemplate', ui: { namingOptions : '.x-naming-options', @@ -24,8 +25,11 @@ define( this.ui.namingOptions.hide(); } - this.listenTo(this.model, 'change', this._updateExamples); - this._updateExamples(); + this.namingSampleModel = new NamingSampleModel(); + + this.listenTo(this.model, 'change', this._updateSamples); + this.listenTo(this.namingSampleModel, 'sync', this._showSamples); + this._updateSamples(); }, _setNamingOptionsVisibility: function () { @@ -39,20 +43,13 @@ define( } }, - _updateExamples: function () { + _updateSamples: function () { + this.namingSampleModel.fetch({ data: this.model.toJSON() }); + }, - var self = this; - - var promise = $.ajax({ - type: 'GET', - url : window.NzbDrone.ApiRoot + '/config/naming/samples', - data: this.model.toJSON() - }); - - promise.done(function (result) { - self.ui.singleEpisodeExample.html(result.singleEpisodeExample); - self.ui.multiEpisodeExample.html(result.multiEpisodeExample); - }); + _showSamples: function () { + this.ui.singleEpisodeExample.html(this.namingSampleModel.get('singleEpisodeExample')); + this.ui.multiEpisodeExample.html(this.namingSampleModel.get('multiEpisodeExample')); } }); diff --git a/UI/Settings/MediaManagement/Naming/ViewTemplate.html b/src/UI/Settings/MediaManagement/Naming/NamingViewTemplate.html similarity index 100% rename from UI/Settings/MediaManagement/Naming/ViewTemplate.html rename to src/UI/Settings/MediaManagement/Naming/NamingViewTemplate.html diff --git a/UI/Settings/MediaManagement/Sorting/View.js b/src/UI/Settings/MediaManagement/Sorting/View.js similarity index 100% rename from UI/Settings/MediaManagement/Sorting/View.js rename to src/UI/Settings/MediaManagement/Sorting/View.js diff --git a/UI/Settings/MediaManagement/Sorting/ViewTemplate.html b/src/UI/Settings/MediaManagement/Sorting/ViewTemplate.html similarity index 100% rename from UI/Settings/MediaManagement/Sorting/ViewTemplate.html rename to src/UI/Settings/MediaManagement/Sorting/ViewTemplate.html diff --git a/UI/Settings/Notifications/AddItemTemplate.html b/src/UI/Settings/Notifications/AddItemTemplate.html similarity index 100% rename from UI/Settings/Notifications/AddItemTemplate.html rename to src/UI/Settings/Notifications/AddItemTemplate.html diff --git a/UI/Settings/Notifications/AddItemView.js b/src/UI/Settings/Notifications/AddItemView.js similarity index 100% rename from UI/Settings/Notifications/AddItemView.js rename to src/UI/Settings/Notifications/AddItemView.js diff --git a/UI/Settings/Notifications/AddTemplate.html b/src/UI/Settings/Notifications/AddTemplate.html similarity index 100% rename from UI/Settings/Notifications/AddTemplate.html rename to src/UI/Settings/Notifications/AddTemplate.html diff --git a/UI/Settings/Notifications/AddView.js b/src/UI/Settings/Notifications/AddView.js similarity index 100% rename from UI/Settings/Notifications/AddView.js rename to src/UI/Settings/Notifications/AddView.js diff --git a/UI/Settings/Notifications/Collection.js b/src/UI/Settings/Notifications/Collection.js similarity index 100% rename from UI/Settings/Notifications/Collection.js rename to src/UI/Settings/Notifications/Collection.js diff --git a/UI/Settings/Notifications/CollectionTemplate.html b/src/UI/Settings/Notifications/CollectionTemplate.html similarity index 100% rename from UI/Settings/Notifications/CollectionTemplate.html rename to src/UI/Settings/Notifications/CollectionTemplate.html diff --git a/UI/Settings/Notifications/CollectionView.js b/src/UI/Settings/Notifications/CollectionView.js similarity index 100% rename from UI/Settings/Notifications/CollectionView.js rename to src/UI/Settings/Notifications/CollectionView.js diff --git a/UI/Settings/Notifications/DeleteTemplate.html b/src/UI/Settings/Notifications/DeleteTemplate.html similarity index 100% rename from UI/Settings/Notifications/DeleteTemplate.html rename to src/UI/Settings/Notifications/DeleteTemplate.html diff --git a/UI/Settings/Notifications/DeleteView.js b/src/UI/Settings/Notifications/DeleteView.js similarity index 100% rename from UI/Settings/Notifications/DeleteView.js rename to src/UI/Settings/Notifications/DeleteView.js diff --git a/UI/Settings/Notifications/EditTemplate.html b/src/UI/Settings/Notifications/EditTemplate.html similarity index 100% rename from UI/Settings/Notifications/EditTemplate.html rename to src/UI/Settings/Notifications/EditTemplate.html diff --git a/UI/Settings/Notifications/EditView.js b/src/UI/Settings/Notifications/EditView.js similarity index 100% rename from UI/Settings/Notifications/EditView.js rename to src/UI/Settings/Notifications/EditView.js diff --git a/UI/Settings/Notifications/ItemTemplate.html b/src/UI/Settings/Notifications/ItemTemplate.html similarity index 100% rename from UI/Settings/Notifications/ItemTemplate.html rename to src/UI/Settings/Notifications/ItemTemplate.html diff --git a/UI/Settings/Notifications/ItemView.js b/src/UI/Settings/Notifications/ItemView.js similarity index 100% rename from UI/Settings/Notifications/ItemView.js rename to src/UI/Settings/Notifications/ItemView.js diff --git a/UI/Settings/Notifications/Model.js b/src/UI/Settings/Notifications/Model.js similarity index 100% rename from UI/Settings/Notifications/Model.js rename to src/UI/Settings/Notifications/Model.js diff --git a/UI/Settings/Notifications/SchemaModal.js b/src/UI/Settings/Notifications/SchemaModal.js similarity index 100% rename from UI/Settings/Notifications/SchemaModal.js rename to src/UI/Settings/Notifications/SchemaModal.js diff --git a/UI/Settings/Notifications/notifications.less b/src/UI/Settings/Notifications/notifications.less similarity index 100% rename from UI/Settings/Notifications/notifications.less rename to src/UI/Settings/Notifications/notifications.less diff --git a/UI/Settings/Quality/Profile/AllowedLabeler.js b/src/UI/Settings/Quality/Profile/AllowedLabeler.js similarity index 100% rename from UI/Settings/Quality/Profile/AllowedLabeler.js rename to src/UI/Settings/Quality/Profile/AllowedLabeler.js diff --git a/UI/Settings/Quality/Profile/DeleteTemplate.html b/src/UI/Settings/Quality/Profile/DeleteTemplate.html similarity index 100% rename from UI/Settings/Quality/Profile/DeleteTemplate.html rename to src/UI/Settings/Quality/Profile/DeleteTemplate.html diff --git a/UI/Settings/Quality/Profile/DeleteView.js b/src/UI/Settings/Quality/Profile/DeleteView.js similarity index 100% rename from UI/Settings/Quality/Profile/DeleteView.js rename to src/UI/Settings/Quality/Profile/DeleteView.js diff --git a/UI/Settings/Quality/Profile/EditQualityProfileTemplate.html b/src/UI/Settings/Quality/Profile/EditQualityProfileTemplate.html similarity index 100% rename from UI/Settings/Quality/Profile/EditQualityProfileTemplate.html rename to src/UI/Settings/Quality/Profile/EditQualityProfileTemplate.html diff --git a/UI/Settings/Quality/Profile/EditQualityProfileView.js b/src/UI/Settings/Quality/Profile/EditQualityProfileView.js similarity index 100% rename from UI/Settings/Quality/Profile/EditQualityProfileView.js rename to src/UI/Settings/Quality/Profile/EditQualityProfileView.js diff --git a/UI/Settings/Quality/Profile/QualityProfileCollectionTemplate.html b/src/UI/Settings/Quality/Profile/QualityProfileCollectionTemplate.html similarity index 100% rename from UI/Settings/Quality/Profile/QualityProfileCollectionTemplate.html rename to src/UI/Settings/Quality/Profile/QualityProfileCollectionTemplate.html diff --git a/UI/Settings/Quality/Profile/QualityProfileCollectionView.js b/src/UI/Settings/Quality/Profile/QualityProfileCollectionView.js similarity index 100% rename from UI/Settings/Quality/Profile/QualityProfileCollectionView.js rename to src/UI/Settings/Quality/Profile/QualityProfileCollectionView.js diff --git a/UI/Settings/Quality/Profile/QualityProfileSchemaCollection.js b/src/UI/Settings/Quality/Profile/QualityProfileSchemaCollection.js similarity index 100% rename from UI/Settings/Quality/Profile/QualityProfileSchemaCollection.js rename to src/UI/Settings/Quality/Profile/QualityProfileSchemaCollection.js diff --git a/UI/Settings/Quality/Profile/QualityProfileTemplate.html b/src/UI/Settings/Quality/Profile/QualityProfileTemplate.html similarity index 100% rename from UI/Settings/Quality/Profile/QualityProfileTemplate.html rename to src/UI/Settings/Quality/Profile/QualityProfileTemplate.html diff --git a/UI/Settings/Quality/Profile/QualityProfileView.js b/src/UI/Settings/Quality/Profile/QualityProfileView.js similarity index 100% rename from UI/Settings/Quality/Profile/QualityProfileView.js rename to src/UI/Settings/Quality/Profile/QualityProfileView.js diff --git a/UI/Settings/Quality/QualityLayout.js b/src/UI/Settings/Quality/QualityLayout.js similarity index 100% rename from UI/Settings/Quality/QualityLayout.js rename to src/UI/Settings/Quality/QualityLayout.js diff --git a/UI/Settings/Quality/QualityLayoutTemplate.html b/src/UI/Settings/Quality/QualityLayoutTemplate.html similarity index 70% rename from UI/Settings/Quality/QualityLayoutTemplate.html rename to src/UI/Settings/Quality/QualityLayoutTemplate.html index b1f7ec6d5..5954e5eb4 100644 --- a/UI/Settings/Quality/QualityLayoutTemplate.html +++ b/src/UI/Settings/Quality/QualityLayoutTemplate.html @@ -1,6 +1,9 @@ 
- +
diff --git a/UI/Settings/Quality/Size/QualitySizeCollectionTemplate.html b/src/UI/Settings/Quality/Size/QualitySizeCollectionTemplate.html similarity index 100% rename from UI/Settings/Quality/Size/QualitySizeCollectionTemplate.html rename to src/UI/Settings/Quality/Size/QualitySizeCollectionTemplate.html diff --git a/UI/Settings/Quality/Size/QualitySizeCollectionView.js b/src/UI/Settings/Quality/Size/QualitySizeCollectionView.js similarity index 100% rename from UI/Settings/Quality/Size/QualitySizeCollectionView.js rename to src/UI/Settings/Quality/Size/QualitySizeCollectionView.js diff --git a/UI/Settings/Quality/Size/QualitySizeTemplate.html b/src/UI/Settings/Quality/Size/QualitySizeTemplate.html similarity index 93% rename from UI/Settings/Quality/Size/QualitySizeTemplate.html rename to src/UI/Settings/Quality/Size/QualitySizeTemplate.html index c131fb64f..657922e73 100644 --- a/UI/Settings/Quality/Size/QualitySizeTemplate.html +++ b/src/UI/Settings/Quality/Size/QualitySizeTemplate.html @@ -1,5 +1,5 @@ 
-

{{name}}

+

{{name}}

diff --git a/UI/Settings/Quality/Size/QualitySizeView.js b/src/UI/Settings/Quality/Size/QualitySizeView.js similarity index 100% rename from UI/Settings/Quality/Size/QualitySizeView.js rename to src/UI/Settings/Quality/Size/QualitySizeView.js diff --git a/UI/Settings/Quality/quality.less b/src/UI/Settings/Quality/quality.less similarity index 98% rename from UI/Settings/Quality/quality.less rename to src/UI/Settings/Quality/quality.less index 6460b2a15..95d9f3a4f 100644 --- a/UI/Settings/Quality/quality.less +++ b/src/UI/Settings/Quality/quality.less @@ -41,7 +41,7 @@ text-align: center; width: 200px; - height: 220px; + height: 210px; padding: 10px 15px; h3 { diff --git a/UI/Settings/SettingsLayout.js b/src/UI/Settings/SettingsLayout.js similarity index 100% rename from UI/Settings/SettingsLayout.js rename to src/UI/Settings/SettingsLayout.js diff --git a/UI/Settings/SettingsLayoutTemplate.html b/src/UI/Settings/SettingsLayoutTemplate.html similarity index 100% rename from UI/Settings/SettingsLayoutTemplate.html rename to src/UI/Settings/SettingsLayoutTemplate.html diff --git a/UI/Settings/SettingsModel.js b/src/UI/Settings/SettingsModel.js similarity index 100% rename from UI/Settings/SettingsModel.js rename to src/UI/Settings/SettingsModel.js diff --git a/UI/Settings/SettingsModelBase.js b/src/UI/Settings/SettingsModelBase.js similarity index 100% rename from UI/Settings/SettingsModelBase.js rename to src/UI/Settings/SettingsModelBase.js diff --git a/UI/Settings/settings.less b/src/UI/Settings/settings.less similarity index 100% rename from UI/Settings/settings.less rename to src/UI/Settings/settings.less diff --git a/UI/Shared/Footer/Template.html b/src/UI/Shared/Footer/Template.html similarity index 100% rename from UI/Shared/Footer/Template.html rename to src/UI/Shared/Footer/Template.html diff --git a/UI/Shared/Footer/View.js b/src/UI/Shared/Footer/View.js similarity index 100% rename from UI/Shared/Footer/View.js rename to src/UI/Shared/Footer/View.js diff --git a/UI/Shared/FormatHelpers.js b/src/UI/Shared/FormatHelpers.js similarity index 100% rename from UI/Shared/FormatHelpers.js rename to src/UI/Shared/FormatHelpers.js diff --git a/UI/Shared/Grid/DateHeaderCell.js b/src/UI/Shared/Grid/DateHeaderCell.js similarity index 100% rename from UI/Shared/Grid/DateHeaderCell.js rename to src/UI/Shared/Grid/DateHeaderCell.js diff --git a/UI/Shared/Grid/HeaderCell.js b/src/UI/Shared/Grid/HeaderCell.js similarity index 100% rename from UI/Shared/Grid/HeaderCell.js rename to src/UI/Shared/Grid/HeaderCell.js diff --git a/UI/Shared/Grid/Pager.js b/src/UI/Shared/Grid/Pager.js similarity index 100% rename from UI/Shared/Grid/Pager.js rename to src/UI/Shared/Grid/Pager.js diff --git a/UI/Shared/Grid/PagerTemplate.html b/src/UI/Shared/Grid/PagerTemplate.html similarity index 75% rename from UI/Shared/Grid/PagerTemplate.html rename to src/UI/Shared/Grid/PagerTemplate.html index 74b8eadab..3e829409e 100644 --- a/UI/Shared/Grid/PagerTemplate.html +++ b/src/UI/Shared/Grid/PagerTemplate.html @@ -10,6 +10,6 @@ {{/each}} - - Total Records: {{Number state.totalRecords}} - \ No newline at end of file + + Total Records: {{Number state.totalRecords}} + \ No newline at end of file diff --git a/UI/Shared/LoadingTemplate.html b/src/UI/Shared/LoadingTemplate.html similarity index 100% rename from UI/Shared/LoadingTemplate.html rename to src/UI/Shared/LoadingTemplate.html diff --git a/UI/Shared/LoadingView.js b/src/UI/Shared/LoadingView.js similarity index 100% rename from UI/Shared/LoadingView.js rename to src/UI/Shared/LoadingView.js diff --git a/UI/Shared/Messenger.js b/src/UI/Shared/Messenger.js similarity index 100% rename from UI/Shared/Messenger.js rename to src/UI/Shared/Messenger.js diff --git a/UI/Shared/Modal/Controller.js b/src/UI/Shared/Modal/Controller.js similarity index 100% rename from UI/Shared/Modal/Controller.js rename to src/UI/Shared/Modal/Controller.js diff --git a/UI/Shared/Modal/Region.js b/src/UI/Shared/Modal/Region.js similarity index 100% rename from UI/Shared/Modal/Region.js rename to src/UI/Shared/Modal/Region.js diff --git a/UI/Shared/NotFoundTemplate.html b/src/UI/Shared/NotFoundTemplate.html similarity index 100% rename from UI/Shared/NotFoundTemplate.html rename to src/UI/Shared/NotFoundTemplate.html diff --git a/UI/Shared/NotFoundView.js b/src/UI/Shared/NotFoundView.js similarity index 100% rename from UI/Shared/NotFoundView.js rename to src/UI/Shared/NotFoundView.js diff --git a/UI/Shared/SignalRBroadcaster.js b/src/UI/Shared/SignalRBroadcaster.js similarity index 94% rename from UI/Shared/SignalRBroadcaster.js rename to src/UI/Shared/SignalRBroadcaster.js index 5a58dcb1d..14f322fd1 100644 --- a/UI/Shared/SignalRBroadcaster.js +++ b/src/UI/Shared/SignalRBroadcaster.js @@ -24,7 +24,7 @@ define( } }; - this.signalRconnection = $.connection("/signalr"); + this.signalRconnection = $.connection('/signalr'); this.signalRconnection.stateChanged(function (change) { console.debug('SignalR: [{0}]'.format(getStatus(change.newState))); @@ -36,7 +36,7 @@ define( 'app' ], function (app) { app.vent.trigger('server:' + message.name, message.body); - }) + }); }); this.signalRconnection.start({ transport: diff --git a/UI/Shared/Styles/card.less b/src/UI/Shared/Styles/card.less similarity index 100% rename from UI/Shared/Styles/card.less rename to src/UI/Shared/Styles/card.less diff --git a/UI/Shared/Styles/clickable.less b/src/UI/Shared/Styles/clickable.less similarity index 100% rename from UI/Shared/Styles/clickable.less rename to src/UI/Shared/Styles/clickable.less diff --git a/UI/Shared/Toolbar/Button/ButtonCollectionView.js b/src/UI/Shared/Toolbar/Button/ButtonCollectionView.js similarity index 100% rename from UI/Shared/Toolbar/Button/ButtonCollectionView.js rename to src/UI/Shared/Toolbar/Button/ButtonCollectionView.js diff --git a/UI/Shared/Toolbar/Button/ButtonView.js b/src/UI/Shared/Toolbar/Button/ButtonView.js similarity index 87% rename from UI/Shared/Toolbar/Button/ButtonView.js rename to src/UI/Shared/Toolbar/Button/ButtonView.js index 1bcd36679..5a16c7d3c 100644 --- a/UI/Shared/Toolbar/Button/ButtonView.js +++ b/src/UI/Shared/Toolbar/Button/ButtonView.js @@ -3,8 +3,9 @@ define( [ 'app', 'marionette', + 'underscore', 'Commands/CommandController' - ], function (App, Marionette, CommandController) { + ], function (App, Marionette, _, CommandController) { return Marionette.ItemView.extend({ template : 'Shared/Toolbar/ButtonTemplate', @@ -30,8 +31,10 @@ define( var command = this.model.get('command'); if (command) { + var properties = _.extend({ name: command }, this.model.get('properties')); + CommandController.bindToCommand({ - command: {name: command}, + command: properties, element: this.$el }); } @@ -51,7 +54,7 @@ define( invokeCommand: function () { var command = this.model.get('command'); if (command) { - CommandController.Execute(command); + CommandController.Execute(command, this.model.get('properties')); } }, diff --git a/UI/Shared/Toolbar/ButtonCollection.js b/src/UI/Shared/Toolbar/ButtonCollection.js similarity index 100% rename from UI/Shared/Toolbar/ButtonCollection.js rename to src/UI/Shared/Toolbar/ButtonCollection.js diff --git a/UI/Shared/Toolbar/ButtonModel.js b/src/UI/Shared/Toolbar/ButtonModel.js similarity index 100% rename from UI/Shared/Toolbar/ButtonModel.js rename to src/UI/Shared/Toolbar/ButtonModel.js diff --git a/UI/Shared/Toolbar/ButtonTemplate.html b/src/UI/Shared/Toolbar/ButtonTemplate.html similarity index 100% rename from UI/Shared/Toolbar/ButtonTemplate.html rename to src/UI/Shared/Toolbar/ButtonTemplate.html diff --git a/UI/Shared/Toolbar/Radio/RadioButtonCollectionView.js b/src/UI/Shared/Toolbar/Radio/RadioButtonCollectionView.js similarity index 100% rename from UI/Shared/Toolbar/Radio/RadioButtonCollectionView.js rename to src/UI/Shared/Toolbar/Radio/RadioButtonCollectionView.js diff --git a/UI/Shared/Toolbar/Radio/RadioButtonView.js b/src/UI/Shared/Toolbar/Radio/RadioButtonView.js similarity index 100% rename from UI/Shared/Toolbar/Radio/RadioButtonView.js rename to src/UI/Shared/Toolbar/Radio/RadioButtonView.js diff --git a/UI/Shared/Toolbar/ToolbarLayout.js b/src/UI/Shared/Toolbar/ToolbarLayout.js similarity index 100% rename from UI/Shared/Toolbar/ToolbarLayout.js rename to src/UI/Shared/Toolbar/ToolbarLayout.js diff --git a/UI/Shared/Toolbar/ToolbarLayoutTemplate.html b/src/UI/Shared/Toolbar/ToolbarLayoutTemplate.html similarity index 100% rename from UI/Shared/Toolbar/ToolbarLayoutTemplate.html rename to src/UI/Shared/Toolbar/ToolbarLayoutTemplate.html diff --git a/src/UI/System/About/AboutView.js b/src/UI/System/About/AboutView.js new file mode 100644 index 000000000..f87b8758e --- /dev/null +++ b/src/UI/System/About/AboutView.js @@ -0,0 +1,14 @@ +'use strict'; +define( + [ + 'marionette', + 'System/StatusModel' + ], function (Marionette, StatusModel) { + return Marionette.ItemView.extend({ + template: 'System/About/AboutViewTemplate', + + initialize: function () { + this.model = StatusModel; + } + }); + }); diff --git a/UI/System/About/ViewTemplate.html b/src/UI/System/About/AboutViewTemplate.html similarity index 100% rename from UI/System/About/ViewTemplate.html rename to src/UI/System/About/AboutViewTemplate.html diff --git a/src/UI/System/Logs/Files/ContentsModel.js b/src/UI/System/Logs/Files/ContentsModel.js new file mode 100644 index 000000000..b2c912a7f --- /dev/null +++ b/src/UI/System/Logs/Files/ContentsModel.js @@ -0,0 +1,17 @@ +'use strict'; +define( + [ + 'backbone' + ], function (Backbone) { + return Backbone.Model.extend({ + url: function () { + return '/log/' + this.get('filename'); + }, + + parse: function (contents) { + var response = {}; + response.contents = contents; + return response; + } + }); + }); diff --git a/UI/Logs/Files/ContentsView.js b/src/UI/System/Logs/Files/ContentsView.js similarity index 72% rename from UI/Logs/Files/ContentsView.js rename to src/UI/System/Logs/Files/ContentsView.js index 9105467bc..2fd2cd1a1 100644 --- a/UI/Logs/Files/ContentsView.js +++ b/src/UI/System/Logs/Files/ContentsView.js @@ -6,6 +6,6 @@ define( 'marionette' ], function (App, Marionette) { return Marionette.ItemView.extend({ - template: 'Logs/Files/ContentsViewTemplate' + template: 'System/Logs/Files/ContentsViewTemplate' }); }); diff --git a/UI/Logs/Files/ContentsViewTemplate.html b/src/UI/System/Logs/Files/ContentsViewTemplate.html similarity index 100% rename from UI/Logs/Files/ContentsViewTemplate.html rename to src/UI/System/Logs/Files/ContentsViewTemplate.html diff --git a/src/UI/System/Logs/Files/DownloadLogCell.js b/src/UI/System/Logs/Files/DownloadLogCell.js new file mode 100644 index 000000000..c29335e24 --- /dev/null +++ b/src/UI/System/Logs/Files/DownloadLogCell.js @@ -0,0 +1,17 @@ +'use strict'; +define( + [ + 'Cells/NzbDroneCell' + ], function (NzbDroneCell) { + return NzbDroneCell.extend({ + + className: 'download-log-cell', + + render: function () { + this.$el.empty(); + this.$el.html('Download'.format(this.cellValue)); + + return this; + } + }); + }); diff --git a/UI/Logs/Files/FilenameCell.js b/src/UI/System/Logs/Files/FilenameCell.js similarity index 100% rename from UI/Logs/Files/FilenameCell.js rename to src/UI/System/Logs/Files/FilenameCell.js diff --git a/UI/Logs/Files/Collection.js b/src/UI/System/Logs/Files/LogFileCollection.js similarity index 85% rename from UI/Logs/Files/Collection.js rename to src/UI/System/Logs/Files/LogFileCollection.js index 0b2a5c8bb..b26a983fe 100644 --- a/UI/Logs/Files/Collection.js +++ b/src/UI/System/Logs/Files/LogFileCollection.js @@ -1,5 +1,6 @@ 'use strict'; -define(['Logs/Files/Model' ], + +define(['System/Logs/Files/LogFileModel' ], function (LogFileModel) { return Backbone.Collection.extend({ url : window.NzbDrone.ApiRoot + '/log/files', diff --git a/UI/Logs/Files/Layout.js b/src/UI/System/Logs/Files/LogFileLayout.js similarity index 53% rename from UI/Logs/Files/Layout.js rename to src/UI/System/Logs/Files/LogFileLayout.js index 43d9145c6..8af432ce3 100644 --- a/UI/Logs/Files/Layout.js +++ b/src/UI/System/Logs/Files/LogFileLayout.js @@ -4,16 +4,29 @@ define( 'app', 'marionette', 'backgrid', - 'Logs/Files/FilenameCell', + 'System/Logs/Files/FilenameCell', 'Cells/RelativeDateCell', - 'Logs/Files/Collection', - 'Logs/Files/Row', - 'Logs/Files/ContentsView', - 'Logs/Files/ContentsModel', - 'Shared/Toolbar/ToolbarLayout' - ], function (App, Marionette, Backgrid, FilenameCell, RelativeDateCell, LogFileCollection, LogFileRow, ContentsView, ContentsModel, ToolbarLayout) { + 'System/Logs/Files/DownloadLogCell', + 'System/Logs/Files/LogFileCollection', + 'System/Logs/Files/Row', + 'System/Logs/Files/ContentsView', + 'System/Logs/Files/ContentsModel', + 'Shared/Toolbar/ToolbarLayout', + 'Shared/LoadingView' + ], function (App, + Marionette, + Backgrid, + FilenameCell, + RelativeDateCell, + DownloadLogCell, + LogFileCollection, + LogFileRow, + ContentsView, + ContentsModel, + ToolbarLayout, + LoadingView) { return Marionette.Layout.extend({ - template: 'Logs/Files/LayoutTemplate', + template: 'System/Logs/Files/LogFileLayoutTemplate', regions: { toolbar : '#x-toolbar', @@ -32,34 +45,33 @@ define( name : 'lastWriteTime', label: 'Last Write Time', cell : RelativeDateCell + }, + { + name : 'filename', + label : '', + cell : DownloadLogCell, + sortable: false } ], initialize: function () { this.collection = new LogFileCollection(); + App.vent.on(App.Commands.ShowLogFile, this._fetchLogFileContents, this); + App.vent.on(App.Events.CommandComplete, this._commandComplete, this); + this.listenTo(this.collection, 'sync', this._collectionSynced); - App.vent.on(App.Commands.ShowLogFile, this._showLogFile, this); + this.collection.fetch(); }, onShow: function () { - this._fetchAndShow(); this._showToolbar(); this._showTable(); }, - _fetchAndShow: function () { - var self = this; - - var promise = this.collection.fetch(); - promise.done(function () { - self._showLogFile({ model: self.collection.first() }); - }); - }, - _showToolbar: function () { - var leftSideButtons = { + var rightSideButtons = { type : 'default', storeState: false, items : @@ -76,17 +88,15 @@ define( icon : 'icon-trash', command : 'deleteLogFiles', successMessage : 'Log files have been deleted', - errorMessage : 'Failed to delete log files', - ownerContext : this, - onSuccess: this._refreshLogs + errorMessage : 'Failed to delete log files' } ] }; this.toolbar.show(new ToolbarLayout({ - left : + right : [ - leftSideButtons + rightSideButtons ], context: this })); @@ -101,32 +111,43 @@ define( })); }, - _showLogFile: function (options) { - - this.contents.close(); - - if (!options.model) { + _collectionSynced: function () { + if (!this.collection.any()) { return; } - var self = this; - var filename = options.model.get('filename'); + var model = this.collection.first(); + this._fetchLogFileContents({ model: model }); + }, - $.ajax({ - url: '/log/' + filename, - success: function (data) { - var model = new ContentsModel({ - filename: filename, - contents: data - }); + _fetchLogFileContents: function (options) { + this.contents.show(new LoadingView()); - self.contents.show(new ContentsView({ model: model })); - } + var model = options.model; + var filename = model.get('filename'); + + var contentsModel = new ContentsModel({ + filename: filename }); + + this.listenToOnce(contentsModel, 'sync', this._showContents); + + contentsModel.fetch({ dataType: 'text' }); + }, + + _showContents: function (model) { + this.contents.show(new ContentsView({ model: model })); }, _refreshLogs: function () { - this._fetchAndShow(); + this.contents.close(); + this.collection.fetch(); + }, + + _commandComplete: function (options) { + if (options.command.get('name') === 'deletelogfiles') { + this._refreshLogs(); + } } }); }); diff --git a/UI/Logs/Files/LayoutTemplate.html b/src/UI/System/Logs/Files/LogFileLayoutTemplate.html similarity index 72% rename from UI/Logs/Files/LayoutTemplate.html rename to src/UI/System/Logs/Files/LogFileLayoutTemplate.html index df28d4b8a..024af966d 100644 --- a/UI/Logs/Files/LayoutTemplate.html +++ b/src/UI/System/Logs/Files/LogFileLayoutTemplate.html @@ -1,12 +1,12 @@ 
-
+
-
+
\ No newline at end of file diff --git a/UI/Logs/Files/ContentsModel.js b/src/UI/System/Logs/Files/LogFileModel.js similarity index 100% rename from UI/Logs/Files/ContentsModel.js rename to src/UI/System/Logs/Files/LogFileModel.js diff --git a/UI/Logs/Files/Row.js b/src/UI/System/Logs/Files/Row.js similarity index 100% rename from UI/Logs/Files/Row.js rename to src/UI/System/Logs/Files/Row.js diff --git a/src/UI/System/Logs/Logs.less b/src/UI/System/Logs/Logs.less new file mode 100644 index 000000000..c61c3a135 --- /dev/null +++ b/src/UI/System/Logs/Logs.less @@ -0,0 +1,21 @@ +@import "../../Shared/Styles/clickable"; + +#logs-screen { + + .log-time-cell{ + width: 80px; + } + + .log-level-cell{ + width: 12px; + font-size: 14px; + } + + td{ + font-size: 13px; + } +} + +.log-file-row { + .clickable; +} \ No newline at end of file diff --git a/UI/Logs/Collection.js b/src/UI/System/Logs/LogsCollection.js similarity index 89% rename from UI/Logs/Collection.js rename to src/UI/System/Logs/LogsCollection.js index 9b755203a..14c80374f 100644 --- a/UI/Logs/Collection.js +++ b/src/UI/System/Logs/LogsCollection.js @@ -1,5 +1,7 @@ 'use strict'; -define(['backbone.pageable', 'Logs/Model', ], function (PagableCollection, LogsModel) { + +define(['backbone.pageable', 'System/Logs/LogsModel'], + function (PagableCollection, LogsModel) { return PagableCollection.extend({ url : window.NzbDrone.ApiRoot + '/log', model: LogsModel, diff --git a/src/UI/System/Logs/LogsLayout.js b/src/UI/System/Logs/LogsLayout.js new file mode 100644 index 000000000..15511b431 --- /dev/null +++ b/src/UI/System/Logs/LogsLayout.js @@ -0,0 +1,48 @@ +'use strict'; +define( + [ + 'marionette', + 'System/Logs/Table/LogsTableLayout', + 'System/Logs/Files/LogFileLayout' + ], function (Marionette, LogsTableLayout, LogsFileLayout) { + return Marionette.Layout.extend({ + template: 'System/Logs/LogsLayoutTemplate', + + ui: { + tableTab: '.x-table-tab', + filesTab: '.x-files-tab' + }, + + regions: { + table: '#table', + files: '#files' + }, + + events: { + 'click .x-table-tab': '_showTable', + 'click .x-files-tab': '_showFiles' + }, + + onShow: function () { + this._showTable(); + }, + + _showTable: function (e) { + if (e) { + e.preventDefault(); + } + + this.ui.tableTab.tab('show'); + this.table.show(new LogsTableLayout()); + }, + + _showFiles: function (e) { + if (e) { + e.preventDefault(); + } + + this.ui.filesTab.tab('show'); + this.files.show(new LogsFileLayout()); + } + }); + }); diff --git a/src/UI/System/Logs/LogsLayoutTemplate.html b/src/UI/System/Logs/LogsLayoutTemplate.html new file mode 100644 index 000000000..23881fc79 --- /dev/null +++ b/src/UI/System/Logs/LogsLayoutTemplate.html @@ -0,0 +1,11 @@ +
+ + +
+
+
+
+
\ No newline at end of file diff --git a/UI/Logs/Files/Model.js b/src/UI/System/Logs/LogsModel.js similarity index 100% rename from UI/Logs/Files/Model.js rename to src/UI/System/Logs/LogsModel.js diff --git a/UI/Logs/LogLevelCell.js b/src/UI/System/Logs/Table/LogLevelCell.js similarity index 100% rename from UI/Logs/LogLevelCell.js rename to src/UI/System/Logs/Table/LogLevelCell.js diff --git a/UI/Logs/LogTimeCell.js b/src/UI/System/Logs/Table/LogTimeCell.js similarity index 100% rename from UI/Logs/LogTimeCell.js rename to src/UI/System/Logs/Table/LogTimeCell.js diff --git a/UI/Logs/Layout.js b/src/UI/System/Logs/Table/LogsTableLayout.js similarity index 73% rename from UI/Logs/Layout.js rename to src/UI/System/Logs/Table/LogsTableLayout.js index 807ca580e..9512e4105 100644 --- a/UI/Logs/Layout.js +++ b/src/UI/System/Logs/Table/LogsTableLayout.js @@ -1,16 +1,18 @@ 'use strict'; define( [ + 'app', 'marionette', 'backgrid', - 'Logs/LogTimeCell', - 'Logs/LogLevelCell', + 'System/Logs/Table/LogTimeCell', + 'System/Logs/Table/LogLevelCell', 'Shared/Grid/Pager', - 'Logs/Collection', - 'Shared/Toolbar/ToolbarLayout' - ], function (Marionette, Backgrid, LogTimeCell, LogLevelCell, GridPager, LogCollection, ToolbarLayout) { + 'System/Logs/LogsCollection', + 'Shared/Toolbar/ToolbarLayout', + 'Shared/LoadingView' + ], function (App, Marionette, Backgrid, LogTimeCell, LogLevelCell, GridPager, LogCollection, ToolbarLayout, LoadingView) { return Marionette.Layout.extend({ - template: 'Logs/LayoutTemplate', + template: 'System/Logs/Table/LogsTableLayoutTemplate', regions: { grid : '#x-grid', @@ -55,16 +57,25 @@ define( initialize: function () { this.collection = new LogCollection(); - this.collection.fetch(); + this.collectionPromise = this.collection.fetch(); + + App.vent.on(App.Events.CommandComplete, this._commandComplete, this); + }, + + onRender: function () { + this.grid.show(new LoadingView()); }, onShow: function () { + var self = this; this._showToolbar(); - this._showTable(); + + this.collectionPromise.done(function () { + self._showTable(); + }); }, _showTable: function () { - this.grid.show(new Backgrid.Grid({ row : Backgrid.Row, columns : this.columns, @@ -79,7 +90,7 @@ define( }, _showToolbar: function () { - var leftSideButtons = { + var rightSideButtons = { type : 'default', storeState: false, items : @@ -94,25 +105,15 @@ define( { title : 'Clear Logs', icon : 'icon-trash', - command : 'clearLog', - successMessage : 'Logs have been cleared', - errorMessage : 'Failed to clear logs', - ownerContext : this, - onSuccess : this._refreshLogs - }, - - { - title: 'Files', - icon : 'icon-file', - route: 'logs/files' + command : 'clearLog' } ] }; this.toolbar.show(new ToolbarLayout({ - left : + right : [ - leftSideButtons + rightSideButtons ], context: this })); @@ -122,6 +123,12 @@ define( this.collection.state.currentPage = 1; this.collection.fetch({ reset: true }); this._showTable(); + }, + + _commandComplete: function (options) { + if (options.command.get('name') === 'clearlog') { + this._refreshLogs(); + } } }); }); diff --git a/UI/Logs/LayoutTemplate.html b/src/UI/System/Logs/Table/LogsTableLayoutTemplate.html similarity index 75% rename from UI/Logs/LayoutTemplate.html rename to src/UI/System/Logs/Table/LogsTableLayoutTemplate.html index 43529ab0f..aae6c4dfc 100644 --- a/UI/Logs/LayoutTemplate.html +++ b/src/UI/System/Logs/Table/LogsTableLayoutTemplate.html @@ -1,11 +1,11 @@ 
-
+
-
+
diff --git a/UI/System/StatusModel.js b/src/UI/System/StatusModel.js similarity index 69% rename from UI/System/StatusModel.js rename to src/UI/System/StatusModel.js index 20805cec7..3210fe3e6 100644 --- a/UI/System/StatusModel.js +++ b/src/UI/System/StatusModel.js @@ -4,12 +4,12 @@ define( 'backbone' ], function (Backbone) { - var model = Backbone.Model.extend({ + var StatusModel = Backbone.Model.extend({ url: window.NzbDrone.ApiRoot + '/system/status' }); - var instance = new model(); + var instance = new StatusModel(); instance.fetch(); return instance; }); diff --git a/src/UI/System/SystemLayout.js b/src/UI/System/SystemLayout.js new file mode 100644 index 000000000..ed41fd345 --- /dev/null +++ b/src/UI/System/SystemLayout.js @@ -0,0 +1,91 @@ +'use strict'; +define( + [ + 'app', + 'marionette', + 'System/About/AboutView', + 'System/Logs/LogsLayout', + 'System/Update/UpdateLayout' + ], function (App, + Marionette, + AboutView, + LogsLayout, + UpdateLayout) { + return Marionette.Layout.extend({ + template: 'System/SystemLayoutTemplate', + + regions: { + about : '#about', + logs : '#logs', + updates : '#updates' + }, + + ui: { + aboutTab : '.x-about-tab', + logsTab : '.x-logs-tab', + updatesTab: '.x-updates-tab' + }, + + events: { + 'click .x-about-tab' : '_showAbout', + 'click .x-logs-tab' : '_showLogs', + 'click .x-updates-tab': '_showUpdates' + }, + + initialize: function (options) { + if (options.action) { + this.action = options.action.toLowerCase(); + } + }, + + onShow: function () { + switch (this.action) { + case 'logs': + this._showLogs(); + break; + case 'updates': + this._showUpdates(); + break; + default: + this._showAbout(); + } + }, + + _navigate:function(route){ + require(['Router'], function(){ + App.Router.navigate(route); + }); + }, + + _showAbout: function (e) { + if (e) { + e.preventDefault(); + } + + this.about.show(new AboutView()); + this.ui.aboutTab.tab('show'); + this._navigate('system/about'); + }, + + _showLogs: function (e) { + if (e) { + e.preventDefault(); + } + + this.logs.show(new LogsLayout()); + this.ui.logsTab.tab('show'); + this._navigate('system/logs'); + }, + + _showUpdates: function (e) { + if (e) { + e.preventDefault(); + } + + this.updates.show(new UpdateLayout()); + this.ui.updatesTab.tab('show'); + this._navigate('system/updates'); + } + }); + }); + diff --git a/src/UI/System/SystemLayoutTemplate.html b/src/UI/System/SystemLayoutTemplate.html new file mode 100644 index 000000000..bddcf83b0 --- /dev/null +++ b/src/UI/System/SystemLayoutTemplate.html @@ -0,0 +1,11 @@ + + +
+
+
+
+
\ No newline at end of file diff --git a/UI/Update/UpdateCollection.js b/src/UI/System/Update/UpdateCollection.js similarity index 87% rename from UI/Update/UpdateCollection.js rename to src/UI/System/Update/UpdateCollection.js index b1e7bcf60..a6d5accf6 100644 --- a/UI/Update/UpdateCollection.js +++ b/src/UI/System/Update/UpdateCollection.js @@ -2,7 +2,7 @@ define( [ 'backbone', - 'Update/UpdateModel' + 'System/Update/UpdateModel' ], function (Backbone, UpdateModel) { return Backbone.Collection.extend({ url : window.NzbDrone.ApiRoot + '/update', diff --git a/UI/Update/UpdateCollectionView.js b/src/UI/System/Update/UpdateCollectionView.js similarity index 83% rename from UI/Update/UpdateCollectionView.js rename to src/UI/System/Update/UpdateCollectionView.js index 267af7f85..77f210d75 100644 --- a/UI/Update/UpdateCollectionView.js +++ b/src/UI/System/Update/UpdateCollectionView.js @@ -2,7 +2,7 @@ define( [ 'marionette', - 'Update/UpdateItemView' + 'System/Update/UpdateItemView' ], function (Marionette, UpdateItemView) { return Marionette.CollectionView.extend({ itemView: UpdateItemView diff --git a/src/UI/System/Update/UpdateItemView.js b/src/UI/System/Update/UpdateItemView.js new file mode 100644 index 000000000..682b5d77f --- /dev/null +++ b/src/UI/System/Update/UpdateItemView.js @@ -0,0 +1,19 @@ +'use strict'; + +define( + [ + 'app', + 'marionette' + ], function (App, Marionette) { + return Marionette.ItemView.extend({ + template: 'System/Update/UpdateItemViewTemplate', + + events: { + 'click .x-install-update': '_installUpdate' + }, + + _installUpdate: function () { + this.model.save(); + } + }); + }); diff --git a/UI/Update/UpdateItemViewTemplate.html b/src/UI/System/Update/UpdateItemViewTemplate.html similarity index 57% rename from UI/Update/UpdateItemViewTemplate.html rename to src/UI/System/Update/UpdateItemViewTemplate.html index 6c9df0a15..6944ff71f 100644 --- a/UI/Update/UpdateItemViewTemplate.html +++ b/src/UI/System/Update/UpdateItemViewTemplate.html @@ -1,6 +1,15 @@ 
- {{version}} - {{ShortDate releaseDate}} {{currentVersion version}} + {{version}} + + - {{ShortDate releaseDate}} + {{#if installed}}{{/if}} + + {{#if_windows}} + {{#if isUpgrade}}Install{{/if}} + {{/if_windows}} + + {{#with changes}} {{#each new}} diff --git a/src/UI/System/Update/UpdateLayout.js b/src/UI/System/Update/UpdateLayout.js new file mode 100644 index 000000000..026170265 --- /dev/null +++ b/src/UI/System/Update/UpdateLayout.js @@ -0,0 +1,32 @@ +'use strict'; +define( + [ + 'marionette', + 'backgrid', + 'System/Update/UpdateCollection', + 'System/Update/UpdateCollectionView', + 'Shared/LoadingView' + ], function (Marionette, Backgrid, UpdateCollection, UpdateCollectionView, LoadingView) { + return Marionette.Layout.extend({ + template: 'System/Update/UpdateLayoutTemplate', + + regions: { + updates: '#x-updates' + }, + + initialize: function () { + this.updateCollection = new UpdateCollection(); + }, + + onRender: function () { + this.updates.show(new LoadingView()); + + var self = this; + var promise = this.updateCollection.fetch(); + + promise.done(function (){ + self.updates.show(new UpdateCollectionView({ collection: self.updateCollection })); + }); + } + }); + }); diff --git a/UI/Update/UpdateLayoutTemplate.html b/src/UI/System/Update/UpdateLayoutTemplate.html similarity index 62% rename from UI/Update/UpdateLayoutTemplate.html rename to src/UI/System/Update/UpdateLayoutTemplate.html index c405cb562..e77ec44f7 100644 --- a/UI/Update/UpdateLayoutTemplate.html +++ b/src/UI/System/Update/UpdateLayoutTemplate.html @@ -1,5 +1,4 @@ -
-
+
diff --git a/UI/Update/UpdateModel.js b/src/UI/System/Update/UpdateModel.js similarity index 100% rename from UI/Update/UpdateModel.js rename to src/UI/System/Update/UpdateModel.js diff --git a/UI/Update/update.less b/src/UI/System/Update/update.less similarity index 73% rename from UI/Update/update.less rename to src/UI/System/Update/update.less index e25b23b70..26751cd49 100644 --- a/UI/Update/update.less +++ b/src/UI/System/Update/update.less @@ -1,3 +1,5 @@ +@import '../../Shared/Styles/clickable'; + .update { margin-bottom: 30px; @@ -22,4 +24,9 @@ margin-bottom: 2px; font-size: 13px; } + + .install-update { + .clickable(); + margin-left: 10px; + } } \ No newline at end of file diff --git a/UI/app.js b/src/UI/app.js similarity index 88% rename from UI/app.js rename to src/UI/app.js index e1f0ad981..66c7197f9 100644 --- a/UI/app.js +++ b/src/UI/app.js @@ -16,6 +16,7 @@ require.config({ 'backbone.modelbinder': 'JsLibraries/backbone.modelbinder', 'backgrid' : 'JsLibraries/backbone.backgrid', 'backgrid.paginator' : 'JsLibraries/backbone.backgrid.paginator', + 'backgrid.selectall' : 'JsLibraries/backbone.backgrid.selectall', 'fullcalendar' : 'JsLibraries/fullcalendar', 'backstrech' : 'JsLibraries/jquery.backstretch', '$' : 'JsLibraries/jquery', @@ -171,6 +172,15 @@ require.config({ exports: 'Backgrid.Extension.Paginator', + deps: + [ + 'backgrid' + ] + }, + 'backgrid.selectall': { + + exports: 'Backgrid.Extension.SelectAll', + deps: [ 'backgrid' @@ -196,13 +206,13 @@ define( }; app.Commands = { - EditSeriesCommand : 'EditSeriesCommand', - DeleteSeriesCommand: 'DeleteSeriesCommand', - CloseModalCommand : 'CloseModalCommand', - ShowEpisodeDetails : 'ShowEpisodeDetails', - ShowHistoryDetails : 'ShowHistryDetails', - SaveSettings : 'saveSettings', - ShowLogFile : 'showLogFile' + EditSeriesCommand : 'EditSeriesCommand', + DeleteSeriesCommand : 'DeleteSeriesCommand', + CloseModalCommand : 'CloseModalCommand', + ShowEpisodeDetails : 'ShowEpisodeDetails', + ShowHistoryDetails : 'ShowHistoryDetails', + SaveSettings : 'saveSettings', + ShowLogFile : 'showLogFile' }; app.Reqres = { @@ -213,7 +223,7 @@ define( console.log('starting application'); }); - app.addInitializer(SignalRBroadcaster.appInitializer, {app: app}); + app.addInitializer(SignalRBroadcaster.appInitializer, { app: app }); app.addRegions({ navbarRegion: '#nav-region', diff --git a/UI/favicon.ico b/src/UI/favicon.ico similarity index 100% rename from UI/favicon.ico rename to src/UI/favicon.ico diff --git a/UI/index.html b/src/UI/index.html similarity index 95% rename from UI/index.html rename to src/UI/index.html index 093473a8a..3e57b6590 100644 --- a/UI/index.html +++ b/src/UI/index.html @@ -11,11 +11,11 @@ - + - + diff --git a/UI/jQuery/RouteBinder.js b/src/UI/jQuery/RouteBinder.js similarity index 100% rename from UI/jQuery/RouteBinder.js rename to src/UI/jQuery/RouteBinder.js diff --git a/UI/jQuery/ToTheTop.js b/src/UI/jQuery/ToTheTop.js similarity index 100% rename from UI/jQuery/ToTheTop.js rename to src/UI/jQuery/ToTheTop.js diff --git a/UI/jQuery/TooltipBinder.js b/src/UI/jQuery/TooltipBinder.js similarity index 100% rename from UI/jQuery/TooltipBinder.js rename to src/UI/jQuery/TooltipBinder.js diff --git a/UI/jQuery/jquery.spin.js b/src/UI/jQuery/jquery.spin.js similarity index 100% rename from UI/jQuery/jquery.spin.js rename to src/UI/jQuery/jquery.spin.js diff --git a/UI/jQuery/jquery.validation.js b/src/UI/jQuery/jquery.validation.js similarity index 100% rename from UI/jQuery/jquery.validation.js rename to src/UI/jQuery/jquery.validation.js diff --git a/UI/polyfills.js b/src/UI/polyfills.js similarity index 100% rename from UI/polyfills.js rename to src/UI/polyfills.js