From 5411225fa03d76e693a8c58f9e5a48ebf0433f18 Mon Sep 17 00:00:00 2001 From: tidusjar Date: Wed, 27 Jul 2016 19:43:41 +0100 Subject: [PATCH] #254 having an issue with Sonarr --- PlexRequests.Api.Interfaces/ISonarrApi.cs | 2 +- .../Sonarr/SonarrAddSeries.cs | 100 ++-- PlexRequests.Api/MockApiData.Designer.cs | 139 ----- PlexRequests.Api/MockApiData.resx | 485 ------------------ PlexRequests.Api/Mocks/MockSonarrApi.cs | 89 ---- PlexRequests.Api/PlexRequests.Api.csproj | 12 - PlexRequests.Api/SonarrApi.cs | 11 +- PlexRequests.UI/Helpers/TvSender.cs | 2 +- .../Models/SearchTvShowViewModel.cs | 6 +- PlexRequests.UI/Modules/SearchModule.cs | 2 +- 10 files changed, 66 insertions(+), 782 deletions(-) delete mode 100644 PlexRequests.Api/MockApiData.Designer.cs delete mode 100644 PlexRequests.Api/MockApiData.resx delete mode 100644 PlexRequests.Api/Mocks/MockSonarrApi.cs diff --git a/PlexRequests.Api.Interfaces/ISonarrApi.cs b/PlexRequests.Api.Interfaces/ISonarrApi.cs index eddc51c9f..27e9637a0 100644 --- a/PlexRequests.Api.Interfaces/ISonarrApi.cs +++ b/PlexRequests.Api.Interfaces/ISonarrApi.cs @@ -36,7 +36,7 @@ namespace PlexRequests.Api.Interfaces List GetProfiles(string apiKey, Uri baseUrl); SonarrAddSeries AddSeries(int tvdbId, string title, int qualityId, bool seasonFolders, string rootPath, - int seasonCount, int[] seasons, string apiKey, Uri baseUrl); + int seasonCount, int[] seasons, string apiKey, Uri baseUrl, bool notMonitored = true); SystemStatus SystemStatus(string apiKey, Uri baseUrl); diff --git a/PlexRequests.Api.Models/Sonarr/SonarrAddSeries.cs b/PlexRequests.Api.Models/Sonarr/SonarrAddSeries.cs index d489fca2b..af50a5ae9 100644 --- a/PlexRequests.Api.Models/Sonarr/SonarrAddSeries.cs +++ b/PlexRequests.Api.Models/Sonarr/SonarrAddSeries.cs @@ -1,50 +1,50 @@ -using System.Collections.Generic; - -using Newtonsoft.Json; -using System; - -namespace PlexRequests.Api.Models.Sonarr -{ - public class Season - { - public int seasonNumber { get; set; } - public bool monitored { get; set; } - public Statistics statistics { get; set; } - } - - public class Statistics - { - public int episodeFileCount { get; set; } - public int episodeCount { get; set; } - public int totalEpisodeCount { get; set; } - public long sizeOnDisk { get; set; } - public float percentOfEpisodes { get; set; } - public DateTime previousAiring { get; set; } - } - - public class SonarrAddSeries - { - public AddOptions addOptions { get; set; } - public string title { get; set; } - public List seasons { get; set; } - public string rootFolderPath { get; set; } - public int qualityProfileId { get; set; } - public bool seasonFolder { get; set; } - public bool monitored { get; set; } - public int tvdbId { get; set; } - public int tvRageId { get; set; } - public string cleanTitle { get; set; } - public string imdbId { get; set; } - public string titleSlug { get; set; } - public int id { get; set; } - [JsonIgnore] - public List ErrorMessages { get; set; } - } - - public class AddOptions - { - public bool ignoreEpisodesWithFiles { get; set; } - public bool ignoreEpisodesWithoutFiles { get; set; } - public bool searchForMissingEpisodes { get; set; } - } -} +using System.Collections.Generic; + +using Newtonsoft.Json; +using System; + +namespace PlexRequests.Api.Models.Sonarr +{ + public class Season + { + public int seasonNumber { get; set; } + public bool monitored { get; set; } + public Statistics statistics { get; set; } + } + + public class Statistics + { + public int episodeFileCount { get; set; } + public int episodeCount { get; set; } + public int totalEpisodeCount { get; set; } + public long sizeOnDisk { get; set; } + public float percentOfEpisodes { get; set; } + public DateTime previousAiring { get; set; } + } + + public class SonarrAddSeries + { + public AddOptions addOptions { get; set; } + public string title { get; set; } + public List seasons { get; set; } + public string rootFolderPath { get; set; } + public int qualityProfileId { get; set; } + public bool seasonFolder { get; set; } + public bool monitored { get; set; } + public int tvdbId { get; set; } + public int tvRageId { get; set; } + public string cleanTitle { get; set; } + public string imdbId { get; set; } + public string titleSlug { get; set; } + public int id { get; set; } + [JsonIgnore] + public List ErrorMessages { get; set; } + } + + public class AddOptions + { + public bool ignoreEpisodesWithFiles { get; set; } + public bool ignoreEpisodesWithoutFiles { get; set; } + public bool searchForMissingEpisodes { get; set; } + } +} diff --git a/PlexRequests.Api/MockApiData.Designer.cs b/PlexRequests.Api/MockApiData.Designer.cs deleted file mode 100644 index 0b729f577..000000000 --- a/PlexRequests.Api/MockApiData.Designer.cs +++ /dev/null @@ -1,139 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace PlexRequests.Api { - using System; - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class MockApiData { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal MockApiData() { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("PlexRequests.Api.MockApiData", typeof(MockApiData).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - - /// - /// Looks up a localized string similar to { - /// "title": "Archer (2009)", - /// "seasons": [ - /// { - /// "seasonNumber": 5, - /// "monitored": true - /// }, - /// { - /// "seasonNumber": 4, - /// "monitored": true - /// }, - /// { - /// "seasonNumber": 3, - /// "monitored": true - /// }, - /// { - /// "seasonNumber": 2, - /// "monitored": true - /// }, - /// { - /// "seasonNumber": 1, - /// "monitored": true - /// }, - /// { - /// "seasonNumber": 0, - /// "monitored": false - /// } - /// ], - /// "pat [rest of string was truncated]";. - /// - internal static string Sonarr_AddSeriesResult { - get { - return ResourceManager.GetString("Sonarr_AddSeriesResult", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to [ - /// { - /// "name": "SD", - /// "cutoff": { - /// "id": 1, - /// "name": "SDTV" - /// }, - /// "items": [ - /// { - /// "quality": { - /// "id": 1, - /// "name": "SDTV" - /// }, - /// "allowed": true - /// }, - /// { - /// "quality": { - /// "id": 8, - /// "name": "WEBDL-480p" - /// }, - /// "allowed": true - /// }, - /// { - /// "quality": { - /// "id": 2, - /// "name": "DVD" - /// }, - /// "allowed": true - /// }, - /// { - /// "quality": { [rest of string was truncated]";. - /// - internal static string Sonarr_Profiles { - get { - return ResourceManager.GetString("Sonarr_Profiles", resourceCulture); - } - } - } -} diff --git a/PlexRequests.Api/MockApiData.resx b/PlexRequests.Api/MockApiData.resx deleted file mode 100644 index ead341dac..000000000 --- a/PlexRequests.Api/MockApiData.resx +++ /dev/null @@ -1,485 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - { - "title": "Archer (2009)", - "seasons": [ - { - "seasonNumber": 5, - "monitored": true - }, - { - "seasonNumber": 4, - "monitored": true - }, - { - "seasonNumber": 3, - "monitored": true - }, - { - "seasonNumber": 2, - "monitored": true - }, - { - "seasonNumber": 1, - "monitored": true - }, - { - "seasonNumber": 0, - "monitored": false - } - ], - "path": "T:\\Archer (2009)", - "qualityProfileId": 1, - "seasonFolder": true, - "monitored": true, - "tvdbId": 110381, - "tvRageId": 23354, - "cleanTitle": "archer2009", - "imdbId": "tt1486217", - "titleSlug": "archer-2009", - "id": 1 - } - - - [ - { - "name": "SD", - "cutoff": { - "id": 1, - "name": "SDTV" - }, - "items": [ - { - "quality": { - "id": 1, - "name": "SDTV" - }, - "allowed": true - }, - { - "quality": { - "id": 8, - "name": "WEBDL-480p" - }, - "allowed": true - }, - { - "quality": { - "id": 2, - "name": "DVD" - }, - "allowed": true - }, - { - "quality": { - "id": 4, - "name": "HDTV-720p" - }, - "allowed": false - }, - { - "quality": { - "id": 9, - "name": "HDTV-1080p" - }, - "allowed": false - }, - { - "quality": { - "id": 10, - "name": "Raw-HD" - }, - "allowed": false - }, - { - "quality": { - "id": 5, - "name": "WEBDL-720p" - }, - "allowed": false - }, - { - "quality": { - "id": 6, - "name": "Bluray-720p" - }, - "allowed": false - }, - { - "quality": { - "id": 3, - "name": "WEBDL-1080p" - }, - "allowed": false - }, - { - "quality": { - "id": 7, - "name": "Bluray-1080p" - }, - "allowed": false - } - ], - "id": 1 - }, - { - "name": "HD 720p", - "cutoff": { - "id": 4, - "name": "HDTV-720p" - }, - "items": [ - { - "quality": { - "id": 1, - "name": "SDTV" - }, - "allowed": false - }, - { - "quality": { - "id": 8, - "name": "WEBDL-480p" - }, - "allowed": false - }, - { - "quality": { - "id": 2, - "name": "DVD" - }, - "allowed": false - }, - { - "quality": { - "id": 4, - "name": "HDTV-720p" - }, - "allowed": true - }, - { - "quality": { - "id": 9, - "name": "HDTV-1080p" - }, - "allowed": false - }, - { - "quality": { - "id": 10, - "name": "Raw-HD" - }, - "allowed": false - }, - { - "quality": { - "id": 5, - "name": "WEBDL-720p" - }, - "allowed": true - }, - { - "quality": { - "id": 6, - "name": "Bluray-720p" - }, - "allowed": true - }, - { - "quality": { - "id": 3, - "name": "WEBDL-1080p" - }, - "allowed": false - }, - { - "quality": { - "id": 7, - "name": "Bluray-1080p" - }, - "allowed": false - } - ], - "id": 2 - }, - { - "name": "HD 1080p", - "cutoff": { - "id": 9, - "name": "HDTV-1080p" - }, - "items": [ - { - "quality": { - "id": 1, - "name": "SDTV" - }, - "allowed": false - }, - { - "quality": { - "id": 8, - "name": "WEBDL-480p" - }, - "allowed": false - }, - { - "quality": { - "id": 2, - "name": "DVD" - }, - "allowed": false - }, - { - "quality": { - "id": 4, - "name": "HDTV-720p" - }, - "allowed": false - }, - { - "quality": { - "id": 9, - "name": "HDTV-1080p" - }, - "allowed": true - }, - { - "quality": { - "id": 10, - "name": "Raw-HD" - }, - "allowed": false - }, - { - "quality": { - "id": 5, - "name": "WEBDL-720p" - }, - "allowed": false - }, - { - "quality": { - "id": 6, - "name": "Bluray-720p" - }, - "allowed": false - }, - { - "quality": { - "id": 3, - "name": "WEBDL-1080p" - }, - "allowed": true - }, - { - "quality": { - "id": 7, - "name": "Bluray-1080p" - }, - "allowed": true - } - ], - "id": 3 - }, - { - "name": "HD - All", - "cutoff": { - "id": 4, - "name": "HDTV-720p" - }, - "items": [ - { - "quality": { - "id": 1, - "name": "SDTV" - }, - "allowed": false - }, - { - "quality": { - "id": 8, - "name": "WEBDL-480p" - }, - "allowed": false - }, - { - "quality": { - "id": 2, - "name": "DVD" - }, - "allowed": false - }, - { - "quality": { - "id": 4, - "name": "HDTV-720p" - }, - "allowed": true - }, - { - "quality": { - "id": 9, - "name": "HDTV-1080p" - }, - "allowed": true - }, - { - "quality": { - "id": 10, - "name": "Raw-HD" - }, - "allowed": false - }, - { - "quality": { - "id": 5, - "name": "WEBDL-720p" - }, - "allowed": true - }, - { - "quality": { - "id": 6, - "name": "Bluray-720p" - }, - "allowed": true - }, - { - "quality": { - "id": 3, - "name": "WEBDL-1080p" - }, - "allowed": true - }, - { - "quality": { - "id": 7, - "name": "Bluray-1080p" - }, - "allowed": true - } - ], - "id": 4 - } -] - - \ No newline at end of file diff --git a/PlexRequests.Api/Mocks/MockSonarrApi.cs b/PlexRequests.Api/Mocks/MockSonarrApi.cs deleted file mode 100644 index 17f77ea91..000000000 --- a/PlexRequests.Api/Mocks/MockSonarrApi.cs +++ /dev/null @@ -1,89 +0,0 @@ -#region Copyright -// /************************************************************************ -// Copyright (c) 2016 Jamie Rees -// File: MockSonarrApi.cs -// Created By: Jamie Rees -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// ************************************************************************/ -#endregion -using System; -using System.Collections.Generic; - -using Newtonsoft.Json; - -using PlexRequests.Api.Interfaces; -using PlexRequests.Api.Models.Sonarr; - -namespace PlexRequests.Api.Mocks -{ - public class MockSonarrApi : ISonarrApi - { - public List GetProfiles(string apiKey, Uri baseUrl) - { - var json = MockApiData.Sonarr_Profiles; - var obj = JsonConvert.DeserializeObject>(json); - return obj; - } - - public SonarrAddSeries AddSeries(int tvdbId, string title, int qualityId, bool seasonFolders, string rootPath, int seasonCount, int[] seasons, - string apiKey, Uri baseUrl) - { - var json = MockApiData.Sonarr_AddSeriesResult; - var obj = JsonConvert.DeserializeObject(json); - return obj; - } - - public SystemStatus SystemStatus(string apiKey, Uri baseUrl) - { - throw new NotImplementedException(); - } - - public List GetSeries(string apiKey, Uri baseUrl) - { - throw new NotImplementedException(); - } - - public Series GetSeries(string seriesId, string apiKey, Uri baseUrl) - { - throw new NotImplementedException(); - } - - public IEnumerable GetEpisodes(string seriesId, string apiKey, Uri baseUrl) - { - throw new NotImplementedException(); - } - - public SonarrEpisode GetEpisode(string episodeId, string apiKey, Uri baseUrl) - { - throw new NotImplementedException(); - } - - public SonarrEpisode UpdateEpisode(SonarrEpisode episodeInfo, string apiKey, Uri baseUrl) - { - throw new NotImplementedException(); - } - - public SonarrAddEpisodeResult SearchForEpisodes(int[] episodeIds, string apiKey, Uri baseUrl) - { - throw new NotImplementedException(); - } - } -} \ No newline at end of file diff --git a/PlexRequests.Api/PlexRequests.Api.csproj b/PlexRequests.Api/PlexRequests.Api.csproj index e22fba7cb..9711c12f4 100644 --- a/PlexRequests.Api/PlexRequests.Api.csproj +++ b/PlexRequests.Api/PlexRequests.Api.csproj @@ -67,12 +67,6 @@ - - True - True - MockApiData.resx - - @@ -108,12 +102,6 @@ PlexRequests.Helpers - - - ResXFileCodeGenerator - MockApiData.Designer.cs - -