#254 having an issue with Sonarr

pull/470/head
tidusjar 8 years ago
parent cd135d824c
commit 5411225fa0

@ -36,7 +36,7 @@ namespace PlexRequests.Api.Interfaces
List<SonarrProfile> 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);

@ -1,139 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 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.
// </auto-generated>
//------------------------------------------------------------------------------
namespace PlexRequests.Api {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// 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() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[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;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// Looks up a localized string similar to {
/// &quot;title&quot;: &quot;Archer (2009)&quot;,
/// &quot;seasons&quot;: [
/// {
/// &quot;seasonNumber&quot;: 5,
/// &quot;monitored&quot;: true
/// },
/// {
/// &quot;seasonNumber&quot;: 4,
/// &quot;monitored&quot;: true
/// },
/// {
/// &quot;seasonNumber&quot;: 3,
/// &quot;monitored&quot;: true
/// },
/// {
/// &quot;seasonNumber&quot;: 2,
/// &quot;monitored&quot;: true
/// },
/// {
/// &quot;seasonNumber&quot;: 1,
/// &quot;monitored&quot;: true
/// },
/// {
/// &quot;seasonNumber&quot;: 0,
/// &quot;monitored&quot;: false
/// }
/// ],
/// &quot;pat [rest of string was truncated]&quot;;.
/// </summary>
internal static string Sonarr_AddSeriesResult {
get {
return ResourceManager.GetString("Sonarr_AddSeriesResult", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to [
/// {
/// &quot;name&quot;: &quot;SD&quot;,
/// &quot;cutoff&quot;: {
/// &quot;id&quot;: 1,
/// &quot;name&quot;: &quot;SDTV&quot;
/// },
/// &quot;items&quot;: [
/// {
/// &quot;quality&quot;: {
/// &quot;id&quot;: 1,
/// &quot;name&quot;: &quot;SDTV&quot;
/// },
/// &quot;allowed&quot;: true
/// },
/// {
/// &quot;quality&quot;: {
/// &quot;id&quot;: 8,
/// &quot;name&quot;: &quot;WEBDL-480p&quot;
/// },
/// &quot;allowed&quot;: true
/// },
/// {
/// &quot;quality&quot;: {
/// &quot;id&quot;: 2,
/// &quot;name&quot;: &quot;DVD&quot;
/// },
/// &quot;allowed&quot;: true
/// },
/// {
/// &quot;quality&quot;: { [rest of string was truncated]&quot;;.
/// </summary>
internal static string Sonarr_Profiles {
get {
return ResourceManager.GetString("Sonarr_Profiles", resourceCulture);
}
}
}
}

@ -1,485 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="Sonarr_AddSeriesResult" xml:space="preserve">
<value>{
"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
}</value>
</data>
<data name="Sonarr_Profiles" xml:space="preserve">
<value>[
{
"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
}
]</value>
</data>
</root>

@ -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<SonarrProfile> GetProfiles(string apiKey, Uri baseUrl)
{
var json = MockApiData.Sonarr_Profiles;
var obj = JsonConvert.DeserializeObject<List<SonarrProfile>>(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<SonarrAddSeries>(json);
return obj;
}
public SystemStatus SystemStatus(string apiKey, Uri baseUrl)
{
throw new NotImplementedException();
}
public List<Series> GetSeries(string apiKey, Uri baseUrl)
{
throw new NotImplementedException();
}
public Series GetSeries(string seriesId, string apiKey, Uri baseUrl)
{
throw new NotImplementedException();
}
public IEnumerable<SonarrEpisodes> 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();
}
}
}

@ -67,12 +67,6 @@
<ItemGroup>
<Compile Include="ApiRequest.cs" />
<Compile Include="MusicBrainzApi.cs" />
<Compile Include="MockApiData.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>MockApiData.resx</DependentUpon>
</Compile>
<Compile Include="Mocks\MockSonarrApi.cs" />
<Compile Include="SlackApi.cs" />
<Compile Include="PushoverApi.cs" />
<Compile Include="PushbulletApi.cs" />
@ -108,12 +102,6 @@
<Name>PlexRequests.Helpers</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="MockApiData.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>MockApiData.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.

@ -64,7 +64,7 @@ namespace PlexRequests.Api
return obj;
}
public SonarrAddSeries AddSeries(int tvdbId, string title, int qualityId, bool seasonFolders, string rootPath, int seasonCount, int[] seasons, string apiKey, Uri baseUrl)
public SonarrAddSeries AddSeries(int tvdbId, string title, int qualityId, bool seasonFolders, string rootPath, int seasonCount, int[] seasons, string apiKey, Uri baseUrl, bool monitor = true)
{
Log.Debug("Adding series {0}", title);
Log.Debug("Seasons = {0}, out of {1} seasons", seasons.DumpJson(), seasonCount);
@ -82,7 +82,7 @@ namespace PlexRequests.Api
tvdbId = tvdbId,
titleSlug = title,
seasons = new List<Season>(),
rootFolderPath = rootPath
rootFolderPath = rootPath,
};
for (var i = 1; i <= seasonCount; i++)
@ -95,6 +95,11 @@ namespace PlexRequests.Api
options.seasons.Add(season);
}
if (!monitor)
{
options.monitored = false;
}
Log.Debug("Sonarr API Options:");
Log.Debug(options.DumpJson());

@ -89,7 +89,7 @@ namespace PlexRequests.UI.Helpers
// Series doesn't exist, need to add it as unmonitored.
var addResult = await Task.Run(() => SonarrApi.AddSeries(model.ProviderId, model.Title, qualityProfile,
sonarrSettings.SeasonFolders, sonarrSettings.RootPath, 0, new int[0], sonarrSettings.ApiKey,
sonarrSettings.FullUri));
sonarrSettings.FullUri, false));
if (string.IsNullOrEmpty(addResult?.title))
{

@ -31,6 +31,10 @@ namespace PlexRequests.UI.Models
{
public class SearchTvShowViewModel : SearchViewModel
{
public SearchTvShowViewModel()
{
Episodes = new List<Store.EpisodesModel>();
}
public int Id { get; set; }
public string SeriesName { get; set; }
public List<string> Aliases { get; set; }
@ -49,7 +53,7 @@ namespace PlexRequests.UI.Models
public string Rating { get; set; }
public string ImdbId { get; set; }
public int SiteRating { get; set; }
public Store.EpisodesModel[] Episodes { get; set; }
public List<Store.EpisodesModel> Episodes { get; set; }
public bool TvFullyAvailable { get; set; }
}
}

@ -355,7 +355,7 @@ namespace PlexRequests.UI.Modules
var dbt = dbTv[tvdbid];
viewT.Requested = true;
viewT.Episodes = dbt.Episodes;
viewT.Episodes = dbt.Episodes.ToList();
viewT.Approved = dbt.Approved;
viewT.Available = dbt.Available;
}

Loading…
Cancel
Save