This commit is contained in:
TidusJar 2016-11-02 21:34:33 +00:00
parent 220004f432
commit 683e4831c4
114 changed files with 5916 additions and 5885 deletions

View file

@ -1,22 +1,22 @@
If this is a bug report please make sure you have filled the following in: If this is a bug report please make sure you have filled the following in:
(If it's not a bug and a feature request then just remove the below) (If it's not a bug and a feature request then just remove the below)
#### Plex Requests.Net Version: #### Plex Requests.Net Version:
#### Operating System: #### Operating System:
#### Mono Version: #### Mono Version:
#### Applicable Logs (from `/logs/` directory or the Admin page): #### Applicable Logs (from `/logs/` directory or the Admin page):
``` ```
Logs go here (Please make sure you remove any personal information from the logs) Logs go here (Please make sure you remove any personal information from the logs)
``` ```
#### Reproduction Steps: #### Reproduction Steps:
Please include any steps to reproduce the issue, this the request that is causing the problem etc. Please include any steps to reproduce the issue, this the request that is causing the problem etc.

View file

@ -1,7 +1,7 @@
language: csharp language: csharp
solution: PlexRequests.sln solution: PlexRequests.sln
install: install:
- mono Tools/nuget.exe restore PlexRequests.sln - mono Tools/nuget.exe restore PlexRequests.sln
- nuget install NUnit.Runners -OutputDirectory testrunner - nuget install NUnit.Runners -OutputDirectory testrunner
script: script:
- xbuild /p:Configuration=Release PlexRequests.sln /p:TargetFrameworkVersion="v4.5" - xbuild /p:Configuration=Release PlexRequests.sln /p:TargetFrameworkVersion="v4.5"

View file

@ -1,40 +1,40 @@
#region Copyright #region Copyright
// /************************************************************************ // /************************************************************************
// Copyright (c) 2016 Jamie Rees // Copyright (c) 2016 Jamie Rees
// File: IApiRequest.cs // File: IApiRequest.cs
// Created By: Jamie Rees // Created By: Jamie Rees
// //
// Permission is hereby granted, free of charge, to any person obtaining // Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the // a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including // "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish, // without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to // distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to // permit persons to whom the Software is furnished to do so, subject to
// the following conditions: // the following conditions:
// //
// The above copyright notice and this permission notice shall be // The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software. // included in all copies or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/ // ************************************************************************/
#endregion #endregion
using System; using System;
using RestSharp; using RestSharp;
namespace PlexRequests.Api.Interfaces namespace PlexRequests.Api.Interfaces
{ {
public interface IApiRequest public interface IApiRequest
{ {
T Execute<T>(IRestRequest request, Uri baseUri) where T : new(); T Execute<T>(IRestRequest request, Uri baseUri) where T : new();
IRestResponse Execute(IRestRequest request, Uri baseUri); IRestResponse Execute(IRestRequest request, Uri baseUri);
T ExecuteXml<T>(IRestRequest request, Uri baseUri) where T : class; T ExecuteXml<T>(IRestRequest request, Uri baseUri) where T : class;
T ExecuteJson<T>(IRestRequest request, Uri baseUri) where T : new(); T ExecuteJson<T>(IRestRequest request, Uri baseUri) where T : new();
} }
} }

View file

@ -1,44 +1,44 @@
#region Copyright #region Copyright
// /************************************************************************ // /************************************************************************
// Copyright (c) 2016 Jamie Rees // Copyright (c) 2016 Jamie Rees
// File: IHeadphonesApi.cs // File: IHeadphonesApi.cs
// Created By: Jamie Rees // Created By: Jamie Rees
// //
// Permission is hereby granted, free of charge, to any person obtaining // Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the // a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including // "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish, // without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to // distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to // permit persons to whom the Software is furnished to do so, subject to
// the following conditions: // the following conditions:
// //
// The above copyright notice and this permission notice shall be // The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software. // included in all copies or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/ // ************************************************************************/
#endregion #endregion
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Threading.Tasks; using System.Threading.Tasks;
using PlexRequests.Api.Models.Music; using PlexRequests.Api.Models.Music;
namespace PlexRequests.Api.Interfaces namespace PlexRequests.Api.Interfaces
{ {
public interface IHeadphonesApi public interface IHeadphonesApi
{ {
Task<bool> AddAlbum(string apiKey, Uri baseUrl, string albumId); Task<bool> AddAlbum(string apiKey, Uri baseUrl, string albumId);
HeadphonesVersion GetVersion(string apiKey, Uri baseUrl); HeadphonesVersion GetVersion(string apiKey, Uri baseUrl);
Task<bool> AddArtist(string apiKey, Uri baseUrl, string artistId); Task<bool> AddArtist(string apiKey, Uri baseUrl, string artistId);
Task<bool> QueueAlbum(string apiKey, Uri baseUrl, string albumId); Task<bool> QueueAlbum(string apiKey, Uri baseUrl, string albumId);
Task<List<HeadphonesGetIndex>> GetIndex(string apiKey, Uri baseUrl); Task<List<HeadphonesGetIndex>> GetIndex(string apiKey, Uri baseUrl);
Task<bool> RefreshArtist(string apiKey, Uri baseUrl, string artistId); Task<bool> RefreshArtist(string apiKey, Uri baseUrl, string artistId);
} }
} }

View file

@ -1,45 +1,45 @@
#region Copyright #region Copyright
// /************************************************************************ // /************************************************************************
// Copyright (c) 2016 Jamie Rees // Copyright (c) 2016 Jamie Rees
// File: IPushbulletApi.cs // File: IPushbulletApi.cs
// Created By: Jamie Rees // Created By: Jamie Rees
// //
// Permission is hereby granted, free of charge, to any person obtaining // Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the // a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including // "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish, // without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to // distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to // permit persons to whom the Software is furnished to do so, subject to
// the following conditions: // the following conditions:
// //
// The above copyright notice and this permission notice shall be // The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software. // included in all copies or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/ // ************************************************************************/
#endregion #endregion
using System.Threading.Tasks; using System.Threading.Tasks;
using PlexRequests.Api.Models.Notifications; using PlexRequests.Api.Models.Notifications;
namespace PlexRequests.Api.Interfaces namespace PlexRequests.Api.Interfaces
{ {
public interface IPushbulletApi public interface IPushbulletApi
{ {
/// <summary> /// <summary>
/// Pushes the specified message. /// Pushes the specified message.
/// </summary> /// </summary>
/// <param name="accessToken">The access token.</param> /// <param name="accessToken">The access token.</param>
/// <param name="title">The title.</param> /// <param name="title">The title.</param>
/// <param name="message">The message.</param> /// <param name="message">The message.</param>
/// <param name="deviceIdentifier">The device identifier.</param> /// <param name="deviceIdentifier">The device identifier.</param>
/// <returns></returns> /// <returns></returns>
Task<PushbulletResponse> PushAsync(string accessToken, string title, string message, string deviceIdentifier = default(string)); Task<PushbulletResponse> PushAsync(string accessToken, string title, string message, string deviceIdentifier = default(string));
} }
} }

View file

@ -1,37 +1,37 @@
#region Copyright #region Copyright
// /************************************************************************ // /************************************************************************
// Copyright (c) 2016 Jamie Rees // Copyright (c) 2016 Jamie Rees
// File: IPushoverApi.cs // File: IPushoverApi.cs
// Created By: Jamie Rees // Created By: Jamie Rees
// //
// Permission is hereby granted, free of charge, to any person obtaining // Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the // a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including // "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish, // without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to // distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to // permit persons to whom the Software is furnished to do so, subject to
// the following conditions: // the following conditions:
// //
// The above copyright notice and this permission notice shall be // The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software. // included in all copies or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/ // ************************************************************************/
#endregion #endregion
using System.Threading.Tasks; using System.Threading.Tasks;
using PlexRequests.Api.Models.Notifications; using PlexRequests.Api.Models.Notifications;
namespace PlexRequests.Api.Interfaces namespace PlexRequests.Api.Interfaces
{ {
public interface IPushoverApi public interface IPushoverApi
{ {
Task<PushoverResponse> PushAsync(string accessToken, string message, string userToken); Task<PushoverResponse> PushAsync(string accessToken, string message, string userToken);
} }
} }

View file

@ -1,45 +1,45 @@
#region Copyright #region Copyright
// /************************************************************************ // /************************************************************************
// Copyright (c) 2016 Jamie Rees // Copyright (c) 2016 Jamie Rees
// File: ISickRageApi.cs // File: ISickRageApi.cs
// Created By: Jamie Rees // Created By: Jamie Rees
// //
// Permission is hereby granted, free of charge, to any person obtaining // Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the // a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including // "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish, // without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to // distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to // permit persons to whom the Software is furnished to do so, subject to
// the following conditions: // the following conditions:
// //
// The above copyright notice and this permission notice shall be // The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software. // included in all copies or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/ // ************************************************************************/
#endregion #endregion
using System; using System;
using System.Threading.Tasks; using System.Threading.Tasks;
using PlexRequests.Api.Models.SickRage; using PlexRequests.Api.Models.SickRage;
namespace PlexRequests.Api.Interfaces namespace PlexRequests.Api.Interfaces
{ {
public interface ISickRageApi public interface ISickRageApi
{ {
Task<SickRageTvAdd> AddSeries(int tvdbId, int seasoncount, int[] seasons, string quality, string apiKey, Task<SickRageTvAdd> AddSeries(int tvdbId, int seasoncount, int[] seasons, string quality, string apiKey,
Uri baseUrl); Uri baseUrl);
SickRagePing Ping(string apiKey, Uri baseUrl); SickRagePing Ping(string apiKey, Uri baseUrl);
Task<SickRageTvAdd> AddSeason(int tvdbId, int season, string apiKey, Uri baseUrl); Task<SickRageTvAdd> AddSeason(int tvdbId, int season, string apiKey, Uri baseUrl);
Task<SickrageShows> GetShows(string apiKey, Uri baseUrl); Task<SickrageShows> GetShows(string apiKey, Uri baseUrl);
} }
} }

View file

@ -1,78 +1,78 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup> <PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{95834072-A675-415D-AA8F-877C91623810}</ProjectGuid> <ProjectGuid>{95834072-A675-415D-AA8F-877C91623810}</ProjectGuid>
<OutputType>Library</OutputType> <OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder> <AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>PlexRequests.Api.Interfaces</RootNamespace> <RootNamespace>PlexRequests.Api.Interfaces</RootNamespace>
<AssemblyName>PlexRequests.Api.Interfaces</AssemblyName> <AssemblyName>PlexRequests.Api.Interfaces</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion> <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<TargetFrameworkProfile /> <TargetFrameworkProfile />
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType> <DebugType>full</DebugType>
<Optimize>false</Optimize> <Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath> <OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants> <DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType> <DebugType>pdbonly</DebugType>
<Optimize>true</Optimize> <Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath> <OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants> <DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="RestSharp, Version=105.2.3.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="RestSharp, Version=105.2.3.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\RestSharp.105.2.3\lib\net45\RestSharp.dll</HintPath> <HintPath>..\packages\RestSharp.105.2.3\lib\net45\RestSharp.dll</HintPath>
<Private>True</Private> <Private>True</Private>
</Reference> </Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" /> <Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" /> <Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" /> <Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" /> <Reference Include="System.Data" />
<Reference Include="System.Net.Http" /> <Reference Include="System.Net.Http" />
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="IApiRequest.cs" /> <Compile Include="IApiRequest.cs" />
<Compile Include="ICouchPotatoApi.cs" /> <Compile Include="ICouchPotatoApi.cs" />
<Compile Include="IHeadphonesApi.cs" /> <Compile Include="IHeadphonesApi.cs" />
<Compile Include="IMusicBrainzApi.cs" /> <Compile Include="IMusicBrainzApi.cs" />
<Compile Include="IPlexApi.cs" /> <Compile Include="IPlexApi.cs" />
<Compile Include="IPushbulletApi.cs" /> <Compile Include="IPushbulletApi.cs" />
<Compile Include="ISlackApi.cs" /> <Compile Include="ISlackApi.cs" />
<Compile Include="IPushoverApi.cs" /> <Compile Include="IPushoverApi.cs" />
<Compile Include="ISickRageApi.cs" /> <Compile Include="ISickRageApi.cs" />
<Compile Include="ISonarrApi.cs" /> <Compile Include="ISonarrApi.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\PlexRequests.Api.Models\PlexRequests.Api.Models.csproj"> <ProjectReference Include="..\PlexRequests.Api.Models\PlexRequests.Api.Models.csproj">
<Project>{CB37A5F8-6DFC-4554-99D3-A42B502E4591}</Project> <Project>{CB37A5F8-6DFC-4554-99D3-A42B502E4591}</Project>
<Name>PlexRequests.Api.Models</Name> <Name>PlexRequests.Api.Models</Name>
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="app.config" /> <None Include="app.config" />
<None Include="packages.config" /> <None Include="packages.config" />
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- 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. Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild"> <Target Name="BeforeBuild">
</Target> </Target>
<Target Name="AfterBuild"> <Target Name="AfterBuild">
</Target> </Target>
--> -->
</Project> </Project>

View file

@ -1,38 +1,38 @@
using System.Reflection; using System.Reflection;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following // General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information // set of attributes. Change these attribute values to modify the information
// associated with an assembly. // associated with an assembly.
[assembly: AssemblyTitle("PlexRequests.Api.Interfaces")] [assembly: AssemblyTitle("PlexRequests.Api.Interfaces")]
[assembly: AssemblyDescription("")] [assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")] [assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")] [assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("PlexRequests.Api.Interfaces")] [assembly: AssemblyProduct("PlexRequests.Api.Interfaces")]
[assembly: AssemblyCopyright("Copyright © 2016")] [assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")] [assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")] [assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible // Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from // to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type. // COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)] [assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM // The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("95834072-a675-415d-aa8f-877c91623810")] [assembly: Guid("95834072-a675-415d-aa8f-877c91623810")]
// Version information for an assembly consists of the following four values: // Version information for an assembly consists of the following four values:
// //
// Major Version // Major Version
// Minor Version // Minor Version
// Build Number // Build Number
// Revision // Revision
// //
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersionAttribute("1.0.0.0")] [assembly: AssemblyInformationalVersionAttribute("1.0.0.0")]

View file

@ -1,12 +1,12 @@
using System.Collections.Generic; using System.Collections.Generic;
namespace PlexRequests.Api.Models.Movie namespace PlexRequests.Api.Models.Movie
{ {
public class CouchPotatoMovies public class CouchPotatoMovies
{ {
public List<Movie> movies { get; set; } public List<Movie> movies { get; set; }
public int total { get; set; } public int total { get; set; }
public bool success { get; set; } public bool success { get; set; }
public bool empty { get; set; } public bool empty { get; set; }
} }
} }

View file

@ -1,58 +1,58 @@
#region Copyright #region Copyright
// /************************************************************************ // /************************************************************************
// Copyright (c) 2016 Jamie Rees // Copyright (c) 2016 Jamie Rees
// File: CouchPotatoProfiles.cs // File: CouchPotatoProfiles.cs
// Created By: Jamie Rees // Created By: Jamie Rees
// //
// Permission is hereby granted, free of charge, to any person obtaining // Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the // a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including // "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish, // without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to // distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to // permit persons to whom the Software is furnished to do so, subject to
// the following conditions: // the following conditions:
// //
// The above copyright notice and this permission notice shall be // The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software. // included in all copies or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/ // ************************************************************************/
#endregion #endregion
using System.Collections.Generic; using System.Collections.Generic;
using Newtonsoft.Json; using Newtonsoft.Json;
using Newtonsoft.Json.Serialization; using Newtonsoft.Json.Serialization;
namespace PlexRequests.Api.Models.Movie namespace PlexRequests.Api.Models.Movie
{ {
public class ProfileList public class ProfileList
{ {
public bool core { get; set; } public bool core { get; set; }
public bool hide { get; set; } public bool hide { get; set; }
public string _rev { get; set; } public string _rev { get; set; }
public List<bool> finish { get; set; } public List<bool> finish { get; set; }
public List<string> qualities { get; set; } public List<string> qualities { get; set; }
public string _id { get; set; } public string _id { get; set; }
public string _t { get; set; } public string _t { get; set; }
public string label { get; set; } public string label { get; set; }
public int minimum_score { get; set; } public int minimum_score { get; set; }
public List<int> stop_after { get; set; } public List<int> stop_after { get; set; }
public List<object> wait_for { get; set; } public List<object> wait_for { get; set; }
public int order { get; set; } public int order { get; set; }
[JsonProperty(PropertyName = "3d")] [JsonProperty(PropertyName = "3d")]
public List<object> threeD { get; set; } public List<object> threeD { get; set; }
} }
public class CouchPotatoProfiles public class CouchPotatoProfiles
{ {
public List<ProfileList> list { get; set; } public List<ProfileList> list { get; set; }
public bool success { get; set; } public bool success { get; set; }
} }
} }

View file

@ -1,13 +1,13 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace PlexRequests.Api.Models.Movie namespace PlexRequests.Api.Models.Movie
{ {
public class CouchPotatoStatus public class CouchPotatoStatus
{ {
public bool success { get; set; } public bool success { get; set; }
} }
} }

View file

@ -1,45 +1,45 @@
#region Copyright #region Copyright
// /************************************************************************ // /************************************************************************
// Copyright (c) 2016 Jamie Rees // Copyright (c) 2016 Jamie Rees
// File: HeadphonesAlbumSearchResult.cs // File: HeadphonesAlbumSearchResult.cs
// Created By: Jamie Rees // Created By: Jamie Rees
// //
// Permission is hereby granted, free of charge, to any person obtaining // Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the // a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including // "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish, // without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to // distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to // permit persons to whom the Software is furnished to do so, subject to
// the following conditions: // the following conditions:
// //
// The above copyright notice and this permission notice shall be // The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software. // included in all copies or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/ // ************************************************************************/
#endregion #endregion
namespace PlexRequests.Api.Models.Music namespace PlexRequests.Api.Models.Music
{ {
public class HeadphonesAlbumSearchResult public class HeadphonesAlbumSearchResult
{ {
public string rgid { get; set; } public string rgid { get; set; }
public string albumurl { get; set; } public string albumurl { get; set; }
public string tracks { get; set; } public string tracks { get; set; }
public string date { get; set; } public string date { get; set; }
public string id { get; set; } // Artist ID public string id { get; set; } // Artist ID
public string rgtype { get; set; } public string rgtype { get; set; }
public string title { get; set; } public string title { get; set; }
public string url { get; set; } public string url { get; set; }
public string country { get; set; } public string country { get; set; }
public string albumid { get; set; } // AlbumId public string albumid { get; set; } // AlbumId
public int score { get; set; } public int score { get; set; }
public string uniquename { get; set; } public string uniquename { get; set; }
public string formats { get; set; } public string formats { get; set; }
} }
} }

View file

@ -1,37 +1,37 @@
#region Copyright #region Copyright
// /************************************************************************ // /************************************************************************
// Copyright (c) 2016 Jamie Rees // Copyright (c) 2016 Jamie Rees
// File: HeadphonesSearchResult.cs // File: HeadphonesSearchResult.cs
// Created By: Jamie Rees // Created By: Jamie Rees
// //
// Permission is hereby granted, free of charge, to any person obtaining // Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the // a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including // "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish, // without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to // distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to // permit persons to whom the Software is furnished to do so, subject to
// the following conditions: // the following conditions:
// //
// The above copyright notice and this permission notice shall be // The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software. // included in all copies or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/ // ************************************************************************/
#endregion #endregion
namespace PlexRequests.Api.Models.Music namespace PlexRequests.Api.Models.Music
{ {
public class HeadphonesArtistSearchResult public class HeadphonesArtistSearchResult
{ {
public string url { get; set; } // MusicBrainz url public string url { get; set; } // MusicBrainz url
public int score { get; set; } // Search Match score? public int score { get; set; } // Search Match score?
public string name { get; set; } // Artist Name public string name { get; set; } // Artist Name
public string uniquename { get; set; } // Artist Unique Name public string uniquename { get; set; } // Artist Unique Name
public string id { get; set; } // Artist Unique ID for MusicBrainz public string id { get; set; } // Artist Unique ID for MusicBrainz
} }
} }

View file

@ -1,37 +1,37 @@
#region Copyright #region Copyright
// /************************************************************************ // /************************************************************************
// Copyright (c) 2016 Jamie Rees // Copyright (c) 2016 Jamie Rees
// File: HeadphonesVersion.cs // File: HeadphonesVersion.cs
// Created By: Jamie Rees // Created By: Jamie Rees
// //
// Permission is hereby granted, free of charge, to any person obtaining // Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the // a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including // "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish, // without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to // distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to // permit persons to whom the Software is furnished to do so, subject to
// the following conditions: // the following conditions:
// //
// The above copyright notice and this permission notice shall be // The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software. // included in all copies or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/ // ************************************************************************/
#endregion #endregion
namespace PlexRequests.Api.Models.Music namespace PlexRequests.Api.Models.Music
{ {
public class HeadphonesVersion public class HeadphonesVersion
{ {
public string install_type { get; set; } public string install_type { get; set; }
public object current_version { get; set; } public object current_version { get; set; }
public string git_path { get; set; } public string git_path { get; set; }
public string latest_version { get; set; } public string latest_version { get; set; }
public int commits_behind { get; set; } public int commits_behind { get; set; }
} }
} }

View file

@ -1,68 +1,68 @@
#region Copyright #region Copyright
// /************************************************************************ // /************************************************************************
// Copyright (c) 2016 Jamie Rees // Copyright (c) 2016 Jamie Rees
// File: MusicBrainzReleaseInfo.cs // File: MusicBrainzReleaseInfo.cs
// Created By: Jamie Rees // Created By: Jamie Rees
// //
// Permission is hereby granted, free of charge, to any person obtaining // Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the // a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including // "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish, // without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to // distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to // permit persons to whom the Software is furnished to do so, subject to
// the following conditions: // the following conditions:
// //
// The above copyright notice and this permission notice shall be // The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software. // included in all copies or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/ // ************************************************************************/
#endregion #endregion
using System.Collections.Generic; using System.Collections.Generic;
using Newtonsoft.Json; using Newtonsoft.Json;
namespace PlexRequests.Api.Models.Music namespace PlexRequests.Api.Models.Music
{ {
public class CoverArtArchive public class CoverArtArchive
{ {
public int count { get; set; } public int count { get; set; }
public bool back { get; set; } public bool back { get; set; }
public bool artwork { get; set; } public bool artwork { get; set; }
public bool front { get; set; } public bool front { get; set; }
public bool darkened { get; set; } public bool darkened { get; set; }
} }
public class MusicBrainzReleaseInfo public class MusicBrainzReleaseInfo
{ {
[JsonProperty(PropertyName = "artist-credit")] [JsonProperty(PropertyName = "artist-credit")]
public List<ArtistCredit> ArtistCredits { get; set; } public List<ArtistCredit> ArtistCredits { get; set; }
public string date { get; set; } public string date { get; set; }
public string status { get; set; } public string status { get; set; }
public string asin { get; set; } public string asin { get; set; }
public string title { get; set; } public string title { get; set; }
public string quality { get; set; } public string quality { get; set; }
public string country { get; set; } public string country { get; set; }
public string packaging { get; set; } public string packaging { get; set; }
[JsonProperty(PropertyName = "text-representation")] [JsonProperty(PropertyName = "text-representation")]
public TextRepresentation TextRepresentation { get; set; } public TextRepresentation TextRepresentation { get; set; }
[JsonProperty(PropertyName = "cover-art-archive")] [JsonProperty(PropertyName = "cover-art-archive")]
public CoverArtArchive CoverArtArchive { get; set; } public CoverArtArchive CoverArtArchive { get; set; }
public string barcode { get; set; } public string barcode { get; set; }
public string disambiguation { get; set; } public string disambiguation { get; set; }
[JsonProperty(PropertyName = "release-events")] [JsonProperty(PropertyName = "release-events")]
public List<ReleaseEvent> ReleaseEvents { get; set; } public List<ReleaseEvent> ReleaseEvents { get; set; }
public string id { get; set; } public string id { get; set; }
} }
} }

View file

@ -1,38 +1,38 @@
#region Copyright #region Copyright
// /************************************************************************ // /************************************************************************
// Copyright (c) 2016 Jamie Rees // Copyright (c) 2016 Jamie Rees
// File: PushbulletPush.cs // File: PushbulletPush.cs
// Created By: Jamie Rees // Created By: Jamie Rees
// //
// Permission is hereby granted, free of charge, to any person obtaining // Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the // a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including // "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish, // without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to // distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to // permit persons to whom the Software is furnished to do so, subject to
// the following conditions: // the following conditions:
// //
// The above copyright notice and this permission notice shall be // The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software. // included in all copies or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/ // ************************************************************************/
#endregion #endregion
using Newtonsoft.Json; using Newtonsoft.Json;
namespace PlexRequests.Api.Models.Notifications namespace PlexRequests.Api.Models.Notifications
{ {
public class PushbulletPush public class PushbulletPush
{ {
public string body { get; set; } public string body { get; set; }
public string title { get; set; } public string title { get; set; }
public string type { get; set; } public string type { get; set; }
public string device_iden { get; set; } public string device_iden { get; set; }
} }
} }

View file

@ -1,48 +1,48 @@
#region Copyright #region Copyright
// /************************************************************************ // /************************************************************************
// Copyright (c) 2016 Jamie Rees // Copyright (c) 2016 Jamie Rees
// File: PushbulletResponse.cs // File: PushbulletResponse.cs
// Created By: Jamie Rees // Created By: Jamie Rees
// //
// Permission is hereby granted, free of charge, to any person obtaining // Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the // a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including // "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish, // without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to // distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to // permit persons to whom the Software is furnished to do so, subject to
// the following conditions: // the following conditions:
// //
// The above copyright notice and this permission notice shall be // The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software. // included in all copies or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/ // ************************************************************************/
#endregion #endregion
namespace PlexRequests.Api.Models.Notifications namespace PlexRequests.Api.Models.Notifications
{ {
public class PushbulletResponse public class PushbulletResponse
{ {
public bool active { get; set; } public bool active { get; set; }
public string iden { get; set; } public string iden { get; set; }
public double created { get; set; } public double created { get; set; }
public double modified { get; set; } public double modified { get; set; }
public string type { get; set; } public string type { get; set; }
public bool dismissed { get; set; } public bool dismissed { get; set; }
public string direction { get; set; } public string direction { get; set; }
public string sender_iden { get; set; } public string sender_iden { get; set; }
public string sender_email { get; set; } public string sender_email { get; set; }
public string sender_email_normalized { get; set; } public string sender_email_normalized { get; set; }
public string sender_name { get; set; } public string sender_name { get; set; }
public string receiver_iden { get; set; } public string receiver_iden { get; set; }
public string receiver_email { get; set; } public string receiver_email { get; set; }
public string receiver_email_normalized { get; set; } public string receiver_email_normalized { get; set; }
public string title { get; set; } public string title { get; set; }
public string body { get; set; } public string body { get; set; }
} }
} }

View file

@ -1,34 +1,34 @@
#region Copyright #region Copyright
// /************************************************************************ // /************************************************************************
// Copyright (c) 2016 Jamie Rees // Copyright (c) 2016 Jamie Rees
// File: PushoverResponse.cs // File: PushoverResponse.cs
// Created By: Jamie Rees // Created By: Jamie Rees
// //
// Permission is hereby granted, free of charge, to any person obtaining // Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the // a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including // "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish, // without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to // distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to // permit persons to whom the Software is furnished to do so, subject to
// the following conditions: // the following conditions:
// //
// The above copyright notice and this permission notice shall be // The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software. // included in all copies or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/ // ************************************************************************/
#endregion #endregion
namespace PlexRequests.Api.Models.Notifications namespace PlexRequests.Api.Models.Notifications
{ {
public class PushoverResponse public class PushoverResponse
{ {
public int status { get; set; } public int status { get; set; }
public string request { get; set; } public string request { get; set; }
} }
} }

View file

@ -1,39 +1,39 @@
#region Copyright #region Copyright
// /************************************************************************ // /************************************************************************
// Copyright (c) 2016 Jamie Rees // Copyright (c) 2016 Jamie Rees
// File: PlexError.cs // File: PlexError.cs
// Created By: Jamie Rees // Created By: Jamie Rees
// //
// Permission is hereby granted, free of charge, to any person obtaining // Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the // a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including // "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish, // without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to // distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to // permit persons to whom the Software is furnished to do so, subject to
// the following conditions: // the following conditions:
// //
// The above copyright notice and this permission notice shall be // The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software. // included in all copies or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/ // ************************************************************************/
#endregion #endregion
using System.Xml.Serialization; using System.Xml.Serialization;
namespace PlexRequests.Api.Models.Plex namespace PlexRequests.Api.Models.Plex
{ {
[XmlRoot(ElementName = "errors")] [XmlRoot(ElementName = "errors")]
public class PlexError public class PlexError
{ {
[XmlElement(ElementName = "error")] [XmlElement(ElementName = "error")]
public string Error { get; set; } public string Error { get; set; }
} }
} }

View file

@ -1,22 +1,22 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Xml.Serialization; using System.Xml.Serialization;
namespace PlexRequests.Api.Models.Plex namespace PlexRequests.Api.Models.Plex
{ {
[XmlRoot(ElementName = "MediaContainer")] [XmlRoot(ElementName = "MediaContainer")]
public class PlexLibraries public class PlexLibraries
{ {
[XmlElement(ElementName = "Directory")] [XmlElement(ElementName = "Directory")]
public List<Directory> Directories { get; set; } public List<Directory> Directories { get; set; }
} }
[XmlRoot(ElementName = "Location")] [XmlRoot(ElementName = "Location")]
public partial class Location public partial class Location
{ {
[XmlElement(ElementName = "id")] [XmlElement(ElementName = "id")]
public int id { get; set; } public int id { get; set; }
[XmlElement(ElementName = "path")] [XmlElement(ElementName = "path")]
public string path { get; set; } public string path { get; set; }
} }
} }

View file

@ -1,91 +1,91 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Xml.Serialization; using System.Xml.Serialization;
namespace PlexRequests.Api.Models.Plex namespace PlexRequests.Api.Models.Plex
{ {
[XmlRoot(ElementName = "Directory")] [XmlRoot(ElementName = "Directory")]
public class Directory public class Directory
{ {
[XmlAttribute(AttributeName = "count")] [XmlAttribute(AttributeName = "count")]
public string Count { get; set; } public string Count { get; set; }
[XmlAttribute(AttributeName = "key")] [XmlAttribute(AttributeName = "key")]
public string Key { get; set; } public string Key { get; set; }
[XmlAttribute(AttributeName = "title")] [XmlAttribute(AttributeName = "title")]
public string Title { get; set; } public string Title { get; set; }
[XmlAttribute(AttributeName = "type")] [XmlAttribute(AttributeName = "type")]
public string type { get; set; } public string type { get; set; }
} }
[XmlRoot(ElementName = "MediaContainer")] [XmlRoot(ElementName = "MediaContainer")]
public class PlexStatus public class PlexStatus
{ {
[XmlElement(ElementName = "Directory")] [XmlElement(ElementName = "Directory")]
public List<Directory> Directory { get; set; } public List<Directory> Directory { get; set; }
[XmlAttribute(AttributeName = "size")] [XmlAttribute(AttributeName = "size")]
public string Size { get; set; } public string Size { get; set; }
[XmlAttribute(AttributeName = "allowCameraUpload")] [XmlAttribute(AttributeName = "allowCameraUpload")]
public string AllowCameraUpload { get; set; } public string AllowCameraUpload { get; set; }
[XmlAttribute(AttributeName = "allowChannelAccess")] [XmlAttribute(AttributeName = "allowChannelAccess")]
public string AllowChannelAccess { get; set; } public string AllowChannelAccess { get; set; }
[XmlAttribute(AttributeName = "allowMediaDeletion")] [XmlAttribute(AttributeName = "allowMediaDeletion")]
public string AllowMediaDeletion { get; set; } public string AllowMediaDeletion { get; set; }
[XmlAttribute(AttributeName = "allowSync")] [XmlAttribute(AttributeName = "allowSync")]
public string AllowSync { get; set; } public string AllowSync { get; set; }
[XmlAttribute(AttributeName = "backgroundProcessing")] [XmlAttribute(AttributeName = "backgroundProcessing")]
public string BackgroundProcessing { get; set; } public string BackgroundProcessing { get; set; }
[XmlAttribute(AttributeName = "certificate")] [XmlAttribute(AttributeName = "certificate")]
public string Certificate { get; set; } public string Certificate { get; set; }
[XmlAttribute(AttributeName = "companionProxy")] [XmlAttribute(AttributeName = "companionProxy")]
public string CompanionProxy { get; set; } public string CompanionProxy { get; set; }
[XmlAttribute(AttributeName = "friendlyName")] [XmlAttribute(AttributeName = "friendlyName")]
public string FriendlyName { get; set; } public string FriendlyName { get; set; }
[XmlAttribute(AttributeName = "machineIdentifier")] [XmlAttribute(AttributeName = "machineIdentifier")]
public string MachineIdentifier { get; set; } public string MachineIdentifier { get; set; }
[XmlAttribute(AttributeName = "multiuser")] [XmlAttribute(AttributeName = "multiuser")]
public string Multiuser { get; set; } public string Multiuser { get; set; }
[XmlAttribute(AttributeName = "myPlex")] [XmlAttribute(AttributeName = "myPlex")]
public string MyPlex { get; set; } public string MyPlex { get; set; }
[XmlAttribute(AttributeName = "myPlexMappingState")] [XmlAttribute(AttributeName = "myPlexMappingState")]
public string MyPlexMappingState { get; set; } public string MyPlexMappingState { get; set; }
[XmlAttribute(AttributeName = "myPlexSigninState")] [XmlAttribute(AttributeName = "myPlexSigninState")]
public string MyPlexSigninState { get; set; } public string MyPlexSigninState { get; set; }
[XmlAttribute(AttributeName = "myPlexSubscription")] [XmlAttribute(AttributeName = "myPlexSubscription")]
public string MyPlexSubscription { get; set; } public string MyPlexSubscription { get; set; }
[XmlAttribute(AttributeName = "myPlexUsername")] [XmlAttribute(AttributeName = "myPlexUsername")]
public string MyPlexUsername { get; set; } public string MyPlexUsername { get; set; }
[XmlAttribute(AttributeName = "platform")] [XmlAttribute(AttributeName = "platform")]
public string Platform { get; set; } public string Platform { get; set; }
[XmlAttribute(AttributeName = "platformVersion")] [XmlAttribute(AttributeName = "platformVersion")]
public string PlatformVersion { get; set; } public string PlatformVersion { get; set; }
[XmlAttribute(AttributeName = "requestParametersInCookie")] [XmlAttribute(AttributeName = "requestParametersInCookie")]
public string RequestParametersInCookie { get; set; } public string RequestParametersInCookie { get; set; }
[XmlAttribute(AttributeName = "sync")] [XmlAttribute(AttributeName = "sync")]
public string Sync { get; set; } public string Sync { get; set; }
[XmlAttribute(AttributeName = "transcoderActiveVideoSessions")] [XmlAttribute(AttributeName = "transcoderActiveVideoSessions")]
public string TranscoderActiveVideoSessions { get; set; } public string TranscoderActiveVideoSessions { get; set; }
[XmlAttribute(AttributeName = "transcoderAudio")] [XmlAttribute(AttributeName = "transcoderAudio")]
public string TranscoderAudio { get; set; } public string TranscoderAudio { get; set; }
[XmlAttribute(AttributeName = "transcoderLyrics")] [XmlAttribute(AttributeName = "transcoderLyrics")]
public string TranscoderLyrics { get; set; } public string TranscoderLyrics { get; set; }
[XmlAttribute(AttributeName = "transcoderPhoto")] [XmlAttribute(AttributeName = "transcoderPhoto")]
public string TranscoderPhoto { get; set; } public string TranscoderPhoto { get; set; }
[XmlAttribute(AttributeName = "transcoderSubtitles")] [XmlAttribute(AttributeName = "transcoderSubtitles")]
public string TranscoderSubtitles { get; set; } public string TranscoderSubtitles { get; set; }
[XmlAttribute(AttributeName = "transcoderVideo")] [XmlAttribute(AttributeName = "transcoderVideo")]
public string TranscoderVideo { get; set; } public string TranscoderVideo { get; set; }
[XmlAttribute(AttributeName = "transcoderVideoBitrates")] [XmlAttribute(AttributeName = "transcoderVideoBitrates")]
public string TranscoderVideoBitrates { get; set; } public string TranscoderVideoBitrates { get; set; }
[XmlAttribute(AttributeName = "transcoderVideoQualities")] [XmlAttribute(AttributeName = "transcoderVideoQualities")]
public string TranscoderVideoQualities { get; set; } public string TranscoderVideoQualities { get; set; }
[XmlAttribute(AttributeName = "transcoderVideoResolutions")] [XmlAttribute(AttributeName = "transcoderVideoResolutions")]
public string TranscoderVideoResolutions { get; set; } public string TranscoderVideoResolutions { get; set; }
[XmlAttribute(AttributeName = "updatedAt")] [XmlAttribute(AttributeName = "updatedAt")]
public string UpdatedAt { get; set; } public string UpdatedAt { get; set; }
[XmlAttribute(AttributeName = "version")] [XmlAttribute(AttributeName = "version")]
public string Version { get; set; } public string Version { get; set; }
} }
} }

View file

@ -1,40 +1,40 @@
#region Copyright #region Copyright
// /************************************************************************ // /************************************************************************
// Copyright (c) 2016 Jamie Rees // Copyright (c) 2016 Jamie Rees
// File: PlexUserRequest.cs // File: PlexUserRequest.cs
// Created By: Jamie Rees // Created By: Jamie Rees
// //
// Permission is hereby granted, free of charge, to any person obtaining // Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the // a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including // "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish, // without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to // distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to // permit persons to whom the Software is furnished to do so, subject to
// the following conditions: // the following conditions:
// //
// The above copyright notice and this permission notice shall be // The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software. // included in all copies or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/ // ************************************************************************/
#endregion #endregion
namespace PlexRequests.Api.Models.Plex namespace PlexRequests.Api.Models.Plex
{ {
public class PlexUserRequest public class PlexUserRequest
{ {
public UserRequest user { get; set; } public UserRequest user { get; set; }
} }
public class UserRequest public class UserRequest
{ {
public string login { get; set; } public string login { get; set; }
public string password { get; set; } public string password { get; set; }
} }
} }

View file

@ -1,38 +1,38 @@
using System.Reflection; using System.Reflection;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following // General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information // set of attributes. Change these attribute values to modify the information
// associated with an assembly. // associated with an assembly.
[assembly: AssemblyTitle("PlexRequests.Api.Models")] [assembly: AssemblyTitle("PlexRequests.Api.Models")]
[assembly: AssemblyDescription("")] [assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")] [assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")] [assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("PlexRequests.Api.Models")] [assembly: AssemblyProduct("PlexRequests.Api.Models")]
[assembly: AssemblyCopyright("Copyright © 2016")] [assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")] [assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")] [assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible // Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from // to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type. // COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)] [assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM // The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("cb37a5f8-6dfc-4554-99d3-a42b502e4591")] [assembly: Guid("cb37a5f8-6dfc-4554-99d3-a42b502e4591")]
// Version information for an assembly consists of the following four values: // Version information for an assembly consists of the following four values:
// //
// Major Version // Major Version
// Minor Version // Minor Version
// Build Number // Build Number
// Revision // Revision
// //
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersionAttribute("1.0.0.0")] [assembly: AssemblyInformationalVersionAttribute("1.0.0.0")]

View file

@ -1,37 +1,37 @@
#region Copyright #region Copyright
// /************************************************************************ // /************************************************************************
// Copyright (c) 2016 Jamie Rees // Copyright (c) 2016 Jamie Rees
// File: SickRagePing.cs // File: SickRagePing.cs
// Created By: Jamie Rees // Created By: Jamie Rees
// //
// Permission is hereby granted, free of charge, to any person obtaining // Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the // a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including // "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish, // without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to // distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to // permit persons to whom the Software is furnished to do so, subject to
// the following conditions: // the following conditions:
// //
// The above copyright notice and this permission notice shall be // The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software. // included in all copies or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/ // ************************************************************************/
#endregion #endregion
namespace PlexRequests.Api.Models.SickRage namespace PlexRequests.Api.Models.SickRage
{ {
public class SickRagePingData public class SickRagePingData
{ {
public int pid { get; set; } public int pid { get; set; }
} }
public class SickRagePing : SickRageBase<SickRagePingData> public class SickRagePing : SickRageBase<SickRagePingData>
{ {
} }
} }

View file

@ -5,7 +5,7 @@ namespace PlexRequests.Api.Models.SickRage
{ {
public class SickRageSeasonList : SickRageBase<object> public class SickRageSeasonList : SickRageBase<object>
{ {
[JsonIgnore] [JsonIgnore]
public int[] Data => JsonConvertHelper.ParseObjectToArray<int>(data); public int[] Data => JsonConvertHelper.ParseObjectToArray<int>(data);
} }
} }

View file

@ -1,82 +1,82 @@
#region Copyright #region Copyright
// /************************************************************************ // /************************************************************************
// Copyright (c) 2016 Jamie Rees // Copyright (c) 2016 Jamie Rees
// File: SickRageShowInformation.cs // File: SickRageShowInformation.cs
// Created By: Jamie Rees // Created By: Jamie Rees
// //
// Permission is hereby granted, free of charge, to any person obtaining // Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the // a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including // "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish, // without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to // distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to // permit persons to whom the Software is furnished to do so, subject to
// the following conditions: // the following conditions:
// //
// The above copyright notice and this permission notice shall be // The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software. // included in all copies or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/ // ************************************************************************/
#endregion #endregion
using System.Collections.Generic; using System.Collections.Generic;
namespace PlexRequests.Api.Models.SickRage namespace PlexRequests.Api.Models.SickRage
{ {
public class Cache public class Cache
{ {
public int banner { get; set; } public int banner { get; set; }
public int poster { get; set; } public int poster { get; set; }
} }
public class QualityDetails public class QualityDetails
{ {
public List<object> archive { get; set; } public List<object> archive { get; set; }
public List<string> initial { get; set; } public List<string> initial { get; set; }
} }
public class SeasonList public class SeasonList
{ {
} }
public class Data public class Data
{ {
public int air_by_date { get; set; } public int air_by_date { get; set; }
public string airs { get; set; } public string airs { get; set; }
public int anime { get; set; } public int anime { get; set; }
public int archive_firstmatch { get; set; } public int archive_firstmatch { get; set; }
public Cache cache { get; set; } public Cache cache { get; set; }
public int dvdorder { get; set; } public int dvdorder { get; set; }
public int flatten_folders { get; set; } public int flatten_folders { get; set; }
public List<string> genre { get; set; } public List<string> genre { get; set; }
public string imdbid { get; set; } public string imdbid { get; set; }
public int indexerid { get; set; } public int indexerid { get; set; }
public string language { get; set; } public string language { get; set; }
public string location { get; set; } public string location { get; set; }
public string network { get; set; } public string network { get; set; }
public string next_ep_airdate { get; set; } public string next_ep_airdate { get; set; }
public int paused { get; set; } public int paused { get; set; }
public string quality { get; set; } public string quality { get; set; }
public QualityDetails quality_details { get; set; } public QualityDetails quality_details { get; set; }
public List<object> rls_ignore_words { get; set; } public List<object> rls_ignore_words { get; set; }
public List<object> rls_require_words { get; set; } public List<object> rls_require_words { get; set; }
public int scene { get; set; } public int scene { get; set; }
public SeasonList season_list { get; set; } public SeasonList season_list { get; set; }
public string show_name { get; set; } public string show_name { get; set; }
public int sports { get; set; } public int sports { get; set; }
public string status { get; set; } public string status { get; set; }
public int subtitles { get; set; } public int subtitles { get; set; }
public int tvdbid { get; set; } public int tvdbid { get; set; }
} }
public class SickRageShowInformation : SickRageBase<Data> public class SickRageShowInformation : SickRageBase<Data>
{ {
} }
} }

View file

@ -1,35 +1,35 @@
#region Copyright #region Copyright
// /************************************************************************ // /************************************************************************
// Copyright (c) 2016 Jamie Rees // Copyright (c) 2016 Jamie Rees
// File: SickRageStatus.cs // File: SickRageStatus.cs
// Created By: Jamie Rees // Created By: Jamie Rees
// //
// Permission is hereby granted, free of charge, to any person obtaining // Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the // a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including // "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish, // without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to // distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to // permit persons to whom the Software is furnished to do so, subject to
// the following conditions: // the following conditions:
// //
// The above copyright notice and this permission notice shall be // The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software. // included in all copies or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/ // ************************************************************************/
#endregion #endregion
namespace PlexRequests.Api.Models.SickRage namespace PlexRequests.Api.Models.SickRage
{ {
public static class SickRageStatus public static class SickRageStatus
{ {
public const string Wanted = "wanted"; public const string Wanted = "wanted";
public const string Skipped = "skipped"; public const string Skipped = "skipped";
public const string Ignored = "Ignored"; public const string Ignored = "Ignored";
} }
} }

View file

@ -1,38 +1,38 @@
#region Copyright #region Copyright
// /************************************************************************ // /************************************************************************
// Copyright (c) 2016 Jamie Rees // Copyright (c) 2016 Jamie Rees
// File: SickRageTvAdd.cs // File: SickRageTvAdd.cs
// Created By: Jamie Rees // Created By: Jamie Rees
// //
// Permission is hereby granted, free of charge, to any person obtaining // Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the // a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including // "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish, // without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to // distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to // permit persons to whom the Software is furnished to do so, subject to
// the following conditions: // the following conditions:
// //
// The above copyright notice and this permission notice shall be // The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software. // included in all copies or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/ // ************************************************************************/
#endregion #endregion
namespace PlexRequests.Api.Models.SickRage namespace PlexRequests.Api.Models.SickRage
{ {
public class SickRageTvAddData public class SickRageTvAddData
{ {
public string name { get; set; } public string name { get; set; }
} }
public class SickRageTvAdd : SickRageBase<SickRageTvAddData> public class SickRageTvAdd : SickRageBase<SickRageTvAddData>
{ {
} }
} }

View file

@ -1,42 +1,42 @@
#region Copyright #region Copyright
// /************************************************************************ // /************************************************************************
// Copyright (c) 2016 Jamie Rees // Copyright (c) 2016 Jamie Rees
// File: SickrageShows.cs // File: SickrageShows.cs
// Created By: Jamie Rees // Created By: Jamie Rees
// //
// Permission is hereby granted, free of charge, to any person obtaining // Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the // a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including // "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish, // without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to // distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to // permit persons to whom the Software is furnished to do so, subject to
// the following conditions: // the following conditions:
// //
// The above copyright notice and this permission notice shall be // The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software. // included in all copies or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/ // ************************************************************************/
#endregion #endregion
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
namespace PlexRequests.Api.Models.SickRage namespace PlexRequests.Api.Models.SickRage
{ {
public class SickrageShows : SickRageBase<Dictionary<int, Item>> public class SickrageShows : SickRageBase<Dictionary<int, Item>>
{ {
} }
public class Item public class Item
{ {
public int tvdbid { get; set; } public int tvdbid { get; set; }
} }
} }

View file

@ -1,69 +1,69 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
namespace PlexRequests.Api.Models.Sonarr namespace PlexRequests.Api.Models.Sonarr
{ {
public class SonarrAllSeries public class SonarrAllSeries
{ {
public List<Series> list { get; set; } public List<Series> list { get; set; }
} }
public class Series public class Series
{ {
public string title { get; set; } public string title { get; set; }
public List<Alternatetitle> alternateTitles { get; set; } public List<Alternatetitle> alternateTitles { get; set; }
public string sortTitle { get; set; } public string sortTitle { get; set; }
public int seasonCount { get; set; } public int seasonCount { get; set; }
public int totalEpisodeCount { get; set; } public int totalEpisodeCount { get; set; }
public int episodeCount { get; set; } public int episodeCount { get; set; }
public int episodeFileCount { get; set; } public int episodeFileCount { get; set; }
public long sizeOnDisk { get; set; } public long sizeOnDisk { get; set; }
public string status { get; set; } public string status { get; set; }
public string overview { get; set; } public string overview { get; set; }
public DateTime previousAiring { get; set; } public DateTime previousAiring { get; set; }
public string network { get; set; } public string network { get; set; }
public List<Image> images { get; set; } public List<Image> images { get; set; }
public List<Season> seasons { get; set; } public List<Season> seasons { get; set; }
public int year { get; set; } public int year { get; set; }
public string path { get; set; } public string path { get; set; }
public int profileId { get; set; } public int profileId { get; set; }
public bool seasonFolder { get; set; } public bool seasonFolder { get; set; }
public bool monitored { get; set; } public bool monitored { get; set; }
public bool useSceneNumbering { get; set; } public bool useSceneNumbering { get; set; }
public int runtime { get; set; } public int runtime { get; set; }
public int tvdbId { get; set; } public int tvdbId { get; set; }
public int tvRageId { get; set; } public int tvRageId { get; set; }
public int tvMazeId { get; set; } public int tvMazeId { get; set; }
public DateTime firstAired { get; set; } public DateTime firstAired { get; set; }
public DateTime lastInfoSync { get; set; } public DateTime lastInfoSync { get; set; }
public string seriesType { get; set; } public string seriesType { get; set; }
public string cleanTitle { get; set; } public string cleanTitle { get; set; }
public string imdbId { get; set; } public string imdbId { get; set; }
public string titleSlug { get; set; } public string titleSlug { get; set; }
public string certification { get; set; } public string certification { get; set; }
public List<string> genres { get; set; } public List<string> genres { get; set; }
public List<object> tags { get; set; } public List<object> tags { get; set; }
public DateTime added { get; set; } public DateTime added { get; set; }
public Ratings ratings { get; set; } public Ratings ratings { get; set; }
public int qualityProfileId { get; set; } public int qualityProfileId { get; set; }
public int id { get; set; } public int id { get; set; }
} }
public class Ratings public class Ratings
{ {
public int votes { get; set; } public int votes { get; set; }
public float value { get; set; } public float value { get; set; }
} }
public class Alternatetitle public class Alternatetitle
{ {
public string title { get; set; } public string title { get; set; }
public int seasonNumber { get; set; } public int seasonNumber { get; set; }
} }
public class Image public class Image
{ {
public string coverType { get; set; } public string coverType { get; set; }
public string url { get; set; } public string url { get; set; }
} }
} }

View file

@ -1,57 +1,57 @@
#region Copyright #region Copyright
// /************************************************************************ // /************************************************************************
// Copyright (c) 2016 Jamie Rees // Copyright (c) 2016 Jamie Rees
// File: SonarrProfile.cs // File: SonarrProfile.cs
// Created By: Jamie Rees // Created By: Jamie Rees
// //
// Permission is hereby granted, free of charge, to any person obtaining // Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the // a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including // "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish, // without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to // distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to // permit persons to whom the Software is furnished to do so, subject to
// the following conditions: // the following conditions:
// //
// The above copyright notice and this permission notice shall be // The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software. // included in all copies or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/ // ************************************************************************/
#endregion #endregion
using System.Collections.Generic; using System.Collections.Generic;
namespace PlexRequests.Api.Models.Sonarr namespace PlexRequests.Api.Models.Sonarr
{ {
public class Cutoff public class Cutoff
{ {
public int id { get; set; } public int id { get; set; }
public string name { get; set; } public string name { get; set; }
} }
public class Quality public class Quality
{ {
public int id { get; set; } public int id { get; set; }
public string name { get; set; } public string name { get; set; }
} }
public class Item public class Item
{ {
public Quality quality { get; set; } public Quality quality { get; set; }
public bool allowed { get; set; } public bool allowed { get; set; }
} }
public class SonarrProfile public class SonarrProfile
{ {
public string name { get; set; } public string name { get; set; }
public Cutoff cutoff { get; set; } public Cutoff cutoff { get; set; }
public List<Item> items { get; set; } public List<Item> items { get; set; }
public int id { get; set; } public int id { get; set; }
} }
} }

View file

@ -1,51 +1,51 @@
#region Copyright #region Copyright
// /************************************************************************ // /************************************************************************
// Copyright (c) 2016 Jamie Rees // Copyright (c) 2016 Jamie Rees
// File: SystemStatus.cs // File: SystemStatus.cs
// Created By: Jamie Rees // Created By: Jamie Rees
// //
// Permission is hereby granted, free of charge, to any person obtaining // Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the // a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including // "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish, // without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to // distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to // permit persons to whom the Software is furnished to do so, subject to
// the following conditions: // the following conditions:
// //
// The above copyright notice and this permission notice shall be // The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software. // included in all copies or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/ // ************************************************************************/
#endregion #endregion
namespace PlexRequests.Api.Models.Sonarr namespace PlexRequests.Api.Models.Sonarr
{ {
public class SystemStatus public class SystemStatus
{ {
public string version { get; set; } public string version { get; set; }
public string buildTime { get; set; } public string buildTime { get; set; }
public bool isDebug { get; set; } public bool isDebug { get; set; }
public bool isProduction { get; set; } public bool isProduction { get; set; }
public bool isAdmin { get; set; } public bool isAdmin { get; set; }
public bool isUserInteractive { get; set; } public bool isUserInteractive { get; set; }
public string startupPath { get; set; } public string startupPath { get; set; }
public string appData { get; set; } public string appData { get; set; }
public string osVersion { get; set; } public string osVersion { get; set; }
public bool isMonoRuntime { get; set; } public bool isMonoRuntime { get; set; }
public bool isMono { get; set; } public bool isMono { get; set; }
public bool isLinux { get; set; } public bool isLinux { get; set; }
public bool isOsx { get; set; } public bool isOsx { get; set; }
public bool isWindows { get; set; } public bool isWindows { get; set; }
public string branch { get; set; } public string branch { get; set; }
public string authentication { get; set; } public string authentication { get; set; }
public string sqliteVersion { get; set; } public string sqliteVersion { get; set; }
public string urlBase { get; set; } public string urlBase { get; set; }
public string runtimeVersion { get; set; } public string runtimeVersion { get; set; }
} }
} }

View file

@ -1,33 +1,33 @@
#region Copyright #region Copyright
// /************************************************************************ // /************************************************************************
// Copyright (c) 2016 Jamie Rees // Copyright (c) 2016 Jamie Rees
// File: Authentication.cs // File: Authentication.cs
// Created By: Jamie Rees // Created By: Jamie Rees
// //
// Permission is hereby granted, free of charge, to any person obtaining // Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the // a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including // "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish, // without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to // distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to // permit persons to whom the Software is furnished to do so, subject to
// the following conditions: // the following conditions:
// //
// The above copyright notice and this permission notice shall be // The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software. // included in all copies or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/ // ************************************************************************/
#endregion #endregion
namespace PlexRequests.Api.Models.Tv namespace PlexRequests.Api.Models.Tv
{ {
public class Authentication public class Authentication
{ {
public string token { get; set; } public string token { get; set; }
} }
} }

View file

@ -1,68 +1,68 @@
#region Copyright #region Copyright
// /************************************************************************ // /************************************************************************
// Copyright (c) 2016 Jamie Rees // Copyright (c) 2016 Jamie Rees
// File: TvSearchResult.cs // File: TvSearchResult.cs
// Created By: Jamie Rees // Created By: Jamie Rees
// //
// Permission is hereby granted, free of charge, to any person obtaining // Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the // a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including // "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish, // without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to // distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to // permit persons to whom the Software is furnished to do so, subject to
// the following conditions: // the following conditions:
// //
// The above copyright notice and this permission notice shall be // The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software. // included in all copies or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/ // ************************************************************************/
#endregion #endregion
using System.Collections.Generic; using System.Collections.Generic;
namespace PlexRequests.Api.Models.Tv namespace PlexRequests.Api.Models.Tv
{ {
public class TvShowSearchResult public class TvShowSearchResult
{ {
public int id { get; set; } public int id { get; set; }
public int airedSeason { get; set; } public int airedSeason { get; set; }
public int airedEpisodeNumber { get; set; } public int airedEpisodeNumber { get; set; }
public string episodeName { get; set; } public string episodeName { get; set; }
public string firstAired { get; set; } public string firstAired { get; set; }
public string guestStars { get; set; } public string guestStars { get; set; }
public string director { get; set; } public string director { get; set; }
public List<string> writers { get; set; } public List<string> writers { get; set; }
public string overview { get; set; } public string overview { get; set; }
public string productionCode { get; set; } public string productionCode { get; set; }
public string showUrl { get; set; } public string showUrl { get; set; }
public int lastUpdated { get; set; } public int lastUpdated { get; set; }
public string dvdDiscid { get; set; } public string dvdDiscid { get; set; }
public int dvdSeason { get; set; } public int dvdSeason { get; set; }
public int dvdEpisodeNumber { get; set; } public int dvdEpisodeNumber { get; set; }
public int dvdChapter { get; set; } public int dvdChapter { get; set; }
public int absoluteNumber { get; set; } public int absoluteNumber { get; set; }
public string filename { get; set; } public string filename { get; set; }
public string seriesId { get; set; } public string seriesId { get; set; }
public string lastUpdatedBy { get; set; } public string lastUpdatedBy { get; set; }
public int airsAfterSeason { get; set; } public int airsAfterSeason { get; set; }
public int airsBeforeSeason { get; set; } public int airsBeforeSeason { get; set; }
public int airsBeforeEpisode { get; set; } public int airsBeforeEpisode { get; set; }
public string thumbAuthor { get; set; } public string thumbAuthor { get; set; }
public string thumbAdded { get; set; } public string thumbAdded { get; set; }
public string thumbWidth { get; set; } public string thumbWidth { get; set; }
public string thumbHeight { get; set; } public string thumbHeight { get; set; }
public string imdbId { get; set; } public string imdbId { get; set; }
public int siteRating { get; set; } public int siteRating { get; set; }
} }
public class TvSearchResult public class TvSearchResult
{ {
public List<TvShow> data { get; set; } public List<TvShow> data { get; set; }
} }
} }

View file

@ -1,61 +1,61 @@
#region Copyright #region Copyright
// /************************************************************************ // /************************************************************************
// Copyright (c) 2016 Jamie Rees // Copyright (c) 2016 Jamie Rees
// File: TvShow.cs // File: TvShow.cs
// Created By: Jamie Rees // Created By: Jamie Rees
// //
// Permission is hereby granted, free of charge, to any person obtaining // Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the // a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including // "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish, // without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to // distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to // permit persons to whom the Software is furnished to do so, subject to
// the following conditions: // the following conditions:
// //
// The above copyright notice and this permission notice shall be // The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software. // included in all copies or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/ // ************************************************************************/
#endregion #endregion
using System.Collections.Generic; using System.Collections.Generic;
namespace PlexRequests.Api.Models.Tv namespace PlexRequests.Api.Models.Tv
{ {
public class TvShow public class TvShow
{ {
public int id { get; set; } public int id { get; set; }
public string seriesName { get; set; } public string seriesName { get; set; }
public List<string> aliases { get; set; } public List<string> aliases { get; set; }
public string banner { get; set; } public string banner { get; set; }
public string seriesId { get; set; } public string seriesId { get; set; }
public string status { get; set; } public string status { get; set; }
public string firstAired { get; set; } public string firstAired { get; set; }
public string network { get; set; } public string network { get; set; }
public string networkId { get; set; } public string networkId { get; set; }
public string runtime { get; set; } public string runtime { get; set; }
public List<string> genre { get; set; } public List<string> genre { get; set; }
public string overview { get; set; } public string overview { get; set; }
public int lastUpdated { get; set; } public int lastUpdated { get; set; }
public string airsDayOfWeek { get; set; } public string airsDayOfWeek { get; set; }
public string airsTime { get; set; } public string airsTime { get; set; }
public string rating { get; set; } public string rating { get; set; }
public string imdbId { get; set; } public string imdbId { get; set; }
public string zap2itId { get; set; } public string zap2itId { get; set; }
public string added { get; set; } public string added { get; set; }
public int addedBy { get; set; } public int addedBy { get; set; }
public int siteRating { get; set; } public int siteRating { get; set; }
} }
public class TvShowInformation public class TvShowInformation
{ {
public TvShow data { get; set; } public TvShow data { get; set; }
} }
} }

View file

@ -1,54 +1,54 @@
#region Copyright #region Copyright
// /************************************************************************ // /************************************************************************
// Copyright (c) 2016 Jamie Rees // Copyright (c) 2016 Jamie Rees
// File: TvShowImages.cs // File: TvShowImages.cs
// Created By: Jamie Rees // Created By: Jamie Rees
// //
// Permission is hereby granted, free of charge, to any person obtaining // Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the // a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including // "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish, // without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to // distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to // permit persons to whom the Software is furnished to do so, subject to
// the following conditions: // the following conditions:
// //
// The above copyright notice and this permission notice shall be // The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software. // included in all copies or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/ // ************************************************************************/
#endregion #endregion
using System.Collections.Generic; using System.Collections.Generic;
namespace PlexRequests.Api.Models.Tv namespace PlexRequests.Api.Models.Tv
{ {
public class RatingsInfo public class RatingsInfo
{ {
public double average { get; set; } public double average { get; set; }
} }
public class Datum public class Datum
{ {
public int id { get; set; } public int id { get; set; }
public string keyType { get; set; } public string keyType { get; set; }
public string subKey { get; set; } public string subKey { get; set; }
public string fileName { get; set; } public string fileName { get; set; }
public string resolution { get; set; } public string resolution { get; set; }
public RatingsInfo ratingsInfo { get; set; } public RatingsInfo ratingsInfo { get; set; }
public string thumbnail { get; set; } public string thumbnail { get; set; }
} }
public class TvShowImages public class TvShowImages
{ {
public List<Datum> data { get; set; } public List<Datum> data { get; set; }
public object errors { get; set; } public object errors { get; set; }
} }
} }

View file

@ -1,204 +1,204 @@
#region Copyright #region Copyright
// /************************************************************************ // /************************************************************************
// Copyright (c) 2016 Jamie Rees // Copyright (c) 2016 Jamie Rees
// File: HeadphonesApi.cs // File: HeadphonesApi.cs
// Created By: Jamie Rees // Created By: Jamie Rees
// //
// Permission is hereby granted, free of charge, to any person obtaining // Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the // a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including // "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish, // without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to // distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to // permit persons to whom the Software is furnished to do so, subject to
// the following conditions: // the following conditions:
// //
// The above copyright notice and this permission notice shall be // The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software. // included in all copies or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/ // ************************************************************************/
#endregion #endregion
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Threading.Tasks; using System.Threading.Tasks;
using Newtonsoft.Json; using Newtonsoft.Json;
using NLog; using NLog;
using PlexRequests.Api.Interfaces; using PlexRequests.Api.Interfaces;
using PlexRequests.Api.Models.Music; using PlexRequests.Api.Models.Music;
using PlexRequests.Helpers; using PlexRequests.Helpers;
using RestSharp; using RestSharp;
namespace PlexRequests.Api namespace PlexRequests.Api
{ {
public class HeadphonesApi : IHeadphonesApi public class HeadphonesApi : IHeadphonesApi
{ {
public HeadphonesApi() public HeadphonesApi()
{ {
Api = new ApiRequest(); Api = new ApiRequest();
} }
private ApiRequest Api { get; } private ApiRequest Api { get; }
private static readonly Logger Log = LogManager.GetCurrentClassLogger(); private static readonly Logger Log = LogManager.GetCurrentClassLogger();
public async Task<bool> AddAlbum(string apiKey, Uri baseUrl, string albumId) public async Task<bool> AddAlbum(string apiKey, Uri baseUrl, string albumId)
{ {
Log.Trace("Adding album: {0}", albumId); Log.Trace("Adding album: {0}", albumId);
var request = new RestRequest var request = new RestRequest
{ {
Resource = "/api?cmd=addAlbum&id={albumId}", Resource = "/api?cmd=addAlbum&id={albumId}",
Method = Method.GET Method = Method.GET
}; };
request.AddQueryParameter("apikey", apiKey); request.AddQueryParameter("apikey", apiKey);
request.AddUrlSegment("albumId", albumId); request.AddUrlSegment("albumId", albumId);
try try
{ {
var result = await Task.Run(() => Api.Execute(request, baseUrl)).ConfigureAwait(false); var result = await Task.Run(() => Api.Execute(request, baseUrl)).ConfigureAwait(false);
Log.Trace("Add Album Result: {0}", result.DumpJson()); Log.Trace("Add Album Result: {0}", result.DumpJson());
var albumResult = result.Content.Equals("OK", StringComparison.CurrentCultureIgnoreCase); var albumResult = result.Content.Equals("OK", StringComparison.CurrentCultureIgnoreCase);
Log.Info("Album add result {0}", albumResult); Log.Info("Album add result {0}", albumResult);
return albumResult; return albumResult;
} }
catch (Exception jse) catch (Exception jse)
{ {
Log.Error(jse); Log.Error(jse);
return false; // If there is no matching result we do not get returned a JSON string, it just returns "false". return false; // If there is no matching result we do not get returned a JSON string, it just returns "false".
} }
} }
public async Task<List<HeadphonesGetIndex>> GetIndex(string apiKey, Uri baseUrl) public async Task<List<HeadphonesGetIndex>> GetIndex(string apiKey, Uri baseUrl)
{ {
var request = new RestRequest var request = new RestRequest
{ {
Resource = "/api", Resource = "/api",
Method = Method.GET Method = Method.GET
}; };
request.AddQueryParameter("apikey", apiKey); request.AddQueryParameter("apikey", apiKey);
request.AddQueryParameter("cmd", "getIndex"); request.AddQueryParameter("cmd", "getIndex");
try try
{ {
var result = await Task.Run(() => Api.ExecuteJson<List<HeadphonesGetIndex>>(request, baseUrl)).ConfigureAwait(false); var result = await Task.Run(() => Api.ExecuteJson<List<HeadphonesGetIndex>>(request, baseUrl)).ConfigureAwait(false);
return result; return result;
} }
catch (Exception jse) catch (Exception jse)
{ {
Log.Error(jse); Log.Error(jse);
return new List<HeadphonesGetIndex>(); return new List<HeadphonesGetIndex>();
} }
} }
public async Task<bool> AddArtist(string apiKey, Uri baseUrl, string artistId) public async Task<bool> AddArtist(string apiKey, Uri baseUrl, string artistId)
{ {
Log.Trace("Adding Artist: {0}", artistId); Log.Trace("Adding Artist: {0}", artistId);
var request = new RestRequest var request = new RestRequest
{ {
Resource = "/api", Resource = "/api",
Method = Method.GET Method = Method.GET
}; };
request.AddQueryParameter("apikey", apiKey); request.AddQueryParameter("apikey", apiKey);
request.AddQueryParameter("cmd", "addArtist"); request.AddQueryParameter("cmd", "addArtist");
request.AddQueryParameter("id", artistId); request.AddQueryParameter("id", artistId);
try try
{ {
var result = await Task.Run(() => Api.Execute(request, baseUrl)).ConfigureAwait(false); var result = await Task.Run(() => Api.Execute(request, baseUrl)).ConfigureAwait(false);
Log.Info("Add Artist Result: {0}", result.Content); Log.Info("Add Artist Result: {0}", result.Content);
Log.Trace("Add Artist Result: {0}", result.DumpJson()); Log.Trace("Add Artist Result: {0}", result.DumpJson());
return result.Content.Equals("OK", StringComparison.CurrentCultureIgnoreCase); return result.Content.Equals("OK", StringComparison.CurrentCultureIgnoreCase);
} }
catch (JsonSerializationException jse) catch (JsonSerializationException jse)
{ {
Log.Error(jse); Log.Error(jse);
return false; // If there is no matching result we do not get returned a JSON string, it just returns "false". return false; // If there is no matching result we do not get returned a JSON string, it just returns "false".
} }
} }
public async Task<bool> QueueAlbum(string apiKey, Uri baseUrl, string albumId) public async Task<bool> QueueAlbum(string apiKey, Uri baseUrl, string albumId)
{ {
Log.Trace("Queing album: {0}", albumId); Log.Trace("Queing album: {0}", albumId);
var request = new RestRequest var request = new RestRequest
{ {
Resource = "/api?cmd=queueAlbum&id={albumId}", Resource = "/api?cmd=queueAlbum&id={albumId}",
Method = Method.GET Method = Method.GET
}; };
request.AddQueryParameter("apikey", apiKey); request.AddQueryParameter("apikey", apiKey);
request.AddUrlSegment("albumId", albumId); request.AddUrlSegment("albumId", albumId);
try try
{ {
var result = await Task.Run(() => Api.Execute(request, baseUrl)).ConfigureAwait(false); var result = await Task.Run(() => Api.Execute(request, baseUrl)).ConfigureAwait(false);
Log.Info("Queue Result: {0}", result.Content); Log.Info("Queue Result: {0}", result.Content);
Log.Trace("Queue Result: {0}", result.DumpJson()); Log.Trace("Queue Result: {0}", result.DumpJson());
return result.Content.Equals("OK", StringComparison.CurrentCultureIgnoreCase); return result.Content.Equals("OK", StringComparison.CurrentCultureIgnoreCase);
} }
catch (JsonSerializationException jse) catch (JsonSerializationException jse)
{ {
Log.Error(jse); Log.Error(jse);
return false; // If there is no matching result we do not get returned a JSON string, it just returns "false". return false; // If there is no matching result we do not get returned a JSON string, it just returns "false".
} }
} }
public async Task<bool> RefreshArtist(string apiKey, Uri baseUrl, string artistId) public async Task<bool> RefreshArtist(string apiKey, Uri baseUrl, string artistId)
{ {
Log.Trace("Refreshing artist: {0}", artistId); Log.Trace("Refreshing artist: {0}", artistId);
var request = new RestRequest var request = new RestRequest
{ {
Resource = "/api", Resource = "/api",
Method = Method.GET Method = Method.GET
}; };
request.AddQueryParameter("apikey", apiKey); request.AddQueryParameter("apikey", apiKey);
request.AddQueryParameter("cmd", "queueAlbum"); request.AddQueryParameter("cmd", "queueAlbum");
request.AddQueryParameter("id", artistId); request.AddQueryParameter("id", artistId);
try try
{ {
var result = await Task.Run(() => Api.Execute(request, baseUrl)).ConfigureAwait(false); var result = await Task.Run(() => Api.Execute(request, baseUrl)).ConfigureAwait(false);
Log.Info("Artist refresh Result: {0}", result.Content); Log.Info("Artist refresh Result: {0}", result.Content);
Log.Trace("Artist refresh Result: {0}", result.DumpJson()); Log.Trace("Artist refresh Result: {0}", result.DumpJson());
return result.Content.Equals("OK", StringComparison.CurrentCultureIgnoreCase); return result.Content.Equals("OK", StringComparison.CurrentCultureIgnoreCase);
} }
catch (JsonSerializationException jse) catch (JsonSerializationException jse)
{ {
Log.Error(jse); Log.Error(jse);
return false; // If there is no matching result we do not get returned a JSON string, it just returns "false". return false; // If there is no matching result we do not get returned a JSON string, it just returns "false".
} }
} }
public HeadphonesVersion GetVersion(string apiKey, Uri baseUrl) public HeadphonesVersion GetVersion(string apiKey, Uri baseUrl)
{ {
var request = new RestRequest var request = new RestRequest
{ {
Resource = "/api", Resource = "/api",
Method = Method.GET Method = Method.GET
}; };
request.AddQueryParameter("apikey", apiKey); request.AddQueryParameter("apikey", apiKey);
request.AddQueryParameter("cmd", "getVersion"); request.AddQueryParameter("cmd", "getVersion");
try try
{ {
return Api.ExecuteJson<HeadphonesVersion>(request, baseUrl); return Api.ExecuteJson<HeadphonesVersion>(request, baseUrl);
} }
catch (JsonSerializationException jse) catch (JsonSerializationException jse)
{ {
Log.Error(jse); Log.Error(jse);
return new HeadphonesVersion(); // If there is no matching result we do not get returned a JSON string, it just returns "false". return new HeadphonesVersion(); // If there is no matching result we do not get returned a JSON string, it just returns "false".
} }
} }
} }
} }

View file

@ -1,36 +1,36 @@
#region Copyright #region Copyright
// /************************************************************************ // /************************************************************************
// Copyright (c) 2016 Jamie Rees // Copyright (c) 2016 Jamie Rees
// File: TvBase.cs // File: TvBase.cs
// Created By: Jamie Rees // Created By: Jamie Rees
// //
// Permission is hereby granted, free of charge, to any person obtaining // Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the // a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including // "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish, // without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to // distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to // permit persons to whom the Software is furnished to do so, subject to
// the following conditions: // the following conditions:
// //
// The above copyright notice and this permission notice shall be // The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software. // included in all copies or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/ // ************************************************************************/
#endregion #endregion
using PlexRequests.Helpers; using PlexRequests.Helpers;
namespace PlexRequests.Api namespace PlexRequests.Api
{ {
public abstract class MovieBase public abstract class MovieBase
{ {
private static readonly string Encrypted = "0T3QNSseexLO7n7UPiJvl70Y+KKnvbeTlsusl7Kwq0hPH0BHOuFNGwksNCjkwqWedyDdI/MJeUR4wtL4bIl0Z+//uHXEaYM/4H2pjeLbH5EWdUe5TTj1AhaIR5PQweamvcienRyFD/3YPCC/+qL5mHkKXBkPumMod3Zb/4yN0Ik="; private static readonly string Encrypted = "0T3QNSseexLO7n7UPiJvl70Y+KKnvbeTlsusl7Kwq0hPH0BHOuFNGwksNCjkwqWedyDdI/MJeUR4wtL4bIl0Z+//uHXEaYM/4H2pjeLbH5EWdUe5TTj1AhaIR5PQweamvcienRyFD/3YPCC/+qL5mHkKXBkPumMod3Zb/4yN0Ik=";
protected string ApiKey = StringCipher.Decrypt(Encrypted, "ApiKey"); protected string ApiKey = StringCipher.Decrypt(Encrypted, "ApiKey");
} }
} }

View file

@ -1,116 +1,116 @@
#region Copyright #region Copyright
// /************************************************************************ // /************************************************************************
// Copyright (c) 2016 Jamie Rees // Copyright (c) 2016 Jamie Rees
// File: MusicBrainzApi.cs // File: MusicBrainzApi.cs
// Created By: Jamie Rees // Created By: Jamie Rees
// //
// Permission is hereby granted, free of charge, to any person obtaining // Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the // a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including // "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish, // without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to // distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to // permit persons to whom the Software is furnished to do so, subject to
// the following conditions: // the following conditions:
// //
// The above copyright notice and this permission notice shall be // The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software. // included in all copies or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/ // ************************************************************************/
#endregion #endregion
using System; using System;
using Newtonsoft.Json; using Newtonsoft.Json;
using NLog; using NLog;
using PlexRequests.Api.Interfaces; using PlexRequests.Api.Interfaces;
using PlexRequests.Api.Models.Music; using PlexRequests.Api.Models.Music;
using RestSharp; using RestSharp;
namespace PlexRequests.Api namespace PlexRequests.Api
{ {
public class MusicBrainzApi : IMusicBrainzApi public class MusicBrainzApi : IMusicBrainzApi
{ {
public MusicBrainzApi() public MusicBrainzApi()
{ {
Api = new ApiRequest(); Api = new ApiRequest();
} }
private ApiRequest Api { get; } private ApiRequest Api { get; }
private static readonly Logger Log = LogManager.GetCurrentClassLogger(); private static readonly Logger Log = LogManager.GetCurrentClassLogger();
private readonly Uri BaseUri = new Uri("http://musicbrainz.org/ws/2/"); private readonly Uri BaseUri = new Uri("http://musicbrainz.org/ws/2/");
public MusicBrainzSearchResults SearchAlbum(string searchTerm) public MusicBrainzSearchResults SearchAlbum(string searchTerm)
{ {
Log.Trace("Searching for album: {0}", searchTerm); Log.Trace("Searching for album: {0}", searchTerm);
var request = new RestRequest var request = new RestRequest
{ {
Resource = "release/?query={searchTerm}&fmt=json", Resource = "release/?query={searchTerm}&fmt=json",
Method = Method.GET Method = Method.GET
}; };
request.AddUrlSegment("searchTerm", searchTerm); request.AddUrlSegment("searchTerm", searchTerm);
try try
{ {
return Api.ExecuteJson<MusicBrainzSearchResults>(request, BaseUri); return Api.ExecuteJson<MusicBrainzSearchResults>(request, BaseUri);
} }
catch (JsonSerializationException jse) catch (JsonSerializationException jse)
{ {
Log.Warn(jse); Log.Warn(jse);
return new MusicBrainzSearchResults(); // If there is no matching result we do not get returned a JSON string, it just returns "false". return new MusicBrainzSearchResults(); // If there is no matching result we do not get returned a JSON string, it just returns "false".
} }
} }
public MusicBrainzReleaseInfo GetAlbum(string releaseId) public MusicBrainzReleaseInfo GetAlbum(string releaseId)
{ {
Log.Trace("Getting album: {0}", releaseId); Log.Trace("Getting album: {0}", releaseId);
var request = new RestRequest var request = new RestRequest
{ {
Resource = "release/{albumId}", Resource = "release/{albumId}",
Method = Method.GET Method = Method.GET
}; };
request.AddUrlSegment("albumId", releaseId); request.AddUrlSegment("albumId", releaseId);
request.AddQueryParameter("fmt", "json"); request.AddQueryParameter("fmt", "json");
request.AddQueryParameter("inc", "artists"); request.AddQueryParameter("inc", "artists");
try try
{ {
return Api.ExecuteJson<MusicBrainzReleaseInfo>(request, BaseUri); return Api.ExecuteJson<MusicBrainzReleaseInfo>(request, BaseUri);
} }
catch (JsonSerializationException jse) catch (JsonSerializationException jse)
{ {
Log.Warn(jse); Log.Warn(jse);
return new MusicBrainzReleaseInfo(); // If there is no matching result we do not get returned a JSON string, it just returns "false". return new MusicBrainzReleaseInfo(); // If there is no matching result we do not get returned a JSON string, it just returns "false".
} }
} }
public MusicBrainzCoverArt GetCoverArt(string releaseId) public MusicBrainzCoverArt GetCoverArt(string releaseId)
{ {
Log.Trace("Getting cover art for release: {0}", releaseId); Log.Trace("Getting cover art for release: {0}", releaseId);
var request = new RestRequest var request = new RestRequest
{ {
Resource = "release/{releaseId}", Resource = "release/{releaseId}",
Method = Method.GET Method = Method.GET
}; };
request.AddUrlSegment("releaseId", releaseId); request.AddUrlSegment("releaseId", releaseId);
try try
{ {
return Api.Execute<MusicBrainzCoverArt>(request, new Uri("http://coverartarchive.org/")); return Api.Execute<MusicBrainzCoverArt>(request, new Uri("http://coverartarchive.org/"));
} }
catch (Exception e) catch (Exception e)
{ {
Log.Warn(e); Log.Warn(e);
return new MusicBrainzCoverArt(); // If there is no matching result we do not get returned a JSON string, it just returns "false". return new MusicBrainzCoverArt(); // If there is no matching result we do not get returned a JSON string, it just returns "false".
} }
} }
} }
} }

View file

@ -1,37 +1,37 @@
using System.Reflection; using System.Reflection;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following // General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information // set of attributes. Change these attribute values to modify the information
// associated with an assembly. // associated with an assembly.
[assembly: AssemblyTitle("PlexRequests.Api")] [assembly: AssemblyTitle("PlexRequests.Api")]
[assembly: AssemblyDescription("")] [assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")] [assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")] [assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("PlexRequests.Api")] [assembly: AssemblyProduct("PlexRequests.Api")]
[assembly: AssemblyCopyright("Copyright © 2016")] [assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")] [assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")] [assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible // Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from // to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type. // COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)] [assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM // The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("8cb8d235-2674-442d-9c6a-35fcaeeb160d")] [assembly: Guid("8cb8d235-2674-442d-9c6a-35fcaeeb160d")]
// Version information for an assembly consists of the following four values: // Version information for an assembly consists of the following four values:
// //
// Major Version // Major Version
// Minor Version // Minor Version
// Build Number // Build Number
// Revision // Revision
// //
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersionAttribute("1.0.0.0")] [assembly: AssemblyInformationalVersionAttribute("1.0.0.0")]

View file

@ -1,64 +1,64 @@
#region Copyright #region Copyright
// /************************************************************************ // /************************************************************************
// Copyright (c) 2016 Jamie Rees // Copyright (c) 2016 Jamie Rees
// File: PlexApi.cs // File: PlexApi.cs
// Created By: Jamie Rees // Created By: Jamie Rees
// //
// Permission is hereby granted, free of charge, to any person obtaining // Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the // a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including // "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish, // without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to // distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to // permit persons to whom the Software is furnished to do so, subject to
// the following conditions: // the following conditions:
// //
// The above copyright notice and this permission notice shall be // The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software. // included in all copies or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/ // ************************************************************************/
#endregion #endregion
using System; using System;
using System.Threading.Tasks; using System.Threading.Tasks;
using PlexRequests.Api.Interfaces; using PlexRequests.Api.Interfaces;
using PlexRequests.Api.Models.Notifications; using PlexRequests.Api.Models.Notifications;
using RestSharp; using RestSharp;
namespace PlexRequests.Api namespace PlexRequests.Api
{ {
public class PushbulletApi : IPushbulletApi public class PushbulletApi : IPushbulletApi
{ {
public async Task<PushbulletResponse> PushAsync(string accessToken, string title, string message, string deviceIdentifier = default(string)) public async Task<PushbulletResponse> PushAsync(string accessToken, string title, string message, string deviceIdentifier = default(string))
{ {
var request = new RestRequest var request = new RestRequest
{ {
Method = Method.POST, Method = Method.POST,
}; };
request.AddHeader("Access-Token", accessToken); request.AddHeader("Access-Token", accessToken);
request.AddHeader("Content-Type", "application/json"); request.AddHeader("Content-Type", "application/json");
var push = new PushbulletPush { title = title, body = message, type = "note"}; var push = new PushbulletPush { title = title, body = message, type = "note"};
if (!string.IsNullOrEmpty(deviceIdentifier)) if (!string.IsNullOrEmpty(deviceIdentifier))
{ {
push.device_iden = deviceIdentifier; push.device_iden = deviceIdentifier;
} }
request.AddJsonBody(push); request.AddJsonBody(push);
var api = new ApiRequest(); var api = new ApiRequest();
return await Task.Run(() => api.ExecuteJson<PushbulletResponse>(request, new Uri("https://api.pushbullet.com/v2/pushes"))); return await Task.Run(() => api.ExecuteJson<PushbulletResponse>(request, new Uri("https://api.pushbullet.com/v2/pushes")));
} }
} }
} }

View file

@ -1,57 +1,57 @@
#region Copyright #region Copyright
// /************************************************************************ // /************************************************************************
// Copyright (c) 2016 Jamie Rees // Copyright (c) 2016 Jamie Rees
// File: PlexApi.cs // File: PlexApi.cs
// Created By: Jamie Rees // Created By: Jamie Rees
// //
// Permission is hereby granted, free of charge, to any person obtaining // Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the // a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including // "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish, // without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to // distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to // permit persons to whom the Software is furnished to do so, subject to
// the following conditions: // the following conditions:
// //
// The above copyright notice and this permission notice shall be // The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software. // included in all copies or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/ // ************************************************************************/
#endregion #endregion
using System; using System;
using System.Threading.Tasks; using System.Threading.Tasks;
using PlexRequests.Api.Interfaces; using PlexRequests.Api.Interfaces;
using PlexRequests.Api.Models.Notifications; using PlexRequests.Api.Models.Notifications;
using RestSharp; using RestSharp;
namespace PlexRequests.Api namespace PlexRequests.Api
{ {
public class PushoverApi : IPushoverApi public class PushoverApi : IPushoverApi
{ {
public async Task<PushoverResponse> PushAsync(string accessToken, string message, string userToken) public async Task<PushoverResponse> PushAsync(string accessToken, string message, string userToken)
{ {
var request = new RestRequest var request = new RestRequest
{ {
Method = Method.POST, Method = Method.POST,
Resource = "messages.json?token={token}&user={user}&message={message}" Resource = "messages.json?token={token}&user={user}&message={message}"
}; };
request.AddUrlSegment("token", accessToken); request.AddUrlSegment("token", accessToken);
request.AddUrlSegment("message", message); request.AddUrlSegment("message", message);
request.AddUrlSegment("user", userToken); request.AddUrlSegment("user", userToken);
var api = new ApiRequest(); var api = new ApiRequest();
return await Task.Run(() => api.ExecuteJson<PushoverResponse>(request, new Uri("https://api.pushover.net/1"))); return await Task.Run(() => api.ExecuteJson<PushoverResponse>(request, new Uri("https://api.pushover.net/1")));
} }
} }
} }

View file

@ -1,144 +1,144 @@
#region Copyright #region Copyright
// /************************************************************************ // /************************************************************************
// Copyright (c) 2016 Jamie Rees // Copyright (c) 2016 Jamie Rees
// File: TheTvDbApi.cs // File: TheTvDbApi.cs
// Created By: Jamie Rees // Created By: Jamie Rees
// //
// Permission is hereby granted, free of charge, to any person obtaining // Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the // a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including // "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish, // without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to // distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to // permit persons to whom the Software is furnished to do so, subject to
// the following conditions: // the following conditions:
// //
// The above copyright notice and this permission notice shall be // The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software. // included in all copies or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/ // ************************************************************************/
#endregion #endregion
using System; using System;
using PlexRequests.Api.Models.Tv; using PlexRequests.Api.Models.Tv;
using RestSharp; using RestSharp;
namespace PlexRequests.Api namespace PlexRequests.Api
{ {
[Obsolete("Use TVMazeAPP")] [Obsolete("Use TVMazeAPP")]
public class TheTvDbApi : TvBase public class TheTvDbApi : TvBase
{ {
public TheTvDbApi() public TheTvDbApi()
{ {
Api = new ApiRequest(); Api = new ApiRequest();
} }
private ApiRequest Api { get; } private ApiRequest Api { get; }
/// <summary> /// <summary>
/// Authenticates against TheTVDB. /// Authenticates against TheTVDB.
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public string Authenticate() public string Authenticate()
{ {
var request = new RestRequest var request = new RestRequest
{ {
Method = Method.POST, Method = Method.POST,
Resource = "login", Resource = "login",
RequestFormat = DataFormat.Json, RequestFormat = DataFormat.Json,
}; };
var apiKey = new { apikey = ApiKey }; var apiKey = new { apikey = ApiKey };
request.AddBody(apiKey); request.AddBody(apiKey);
request.AddHeader("Content-Type", "application/json"); request.AddHeader("Content-Type", "application/json");
return Api.Execute<Authentication>(request, Url).token; return Api.Execute<Authentication>(request, Url).token;
} }
/// <summary> /// <summary>
/// Refreshes the token. /// Refreshes the token.
/// </summary> /// </summary>
/// <param name="oldToken">The old token.</param> /// <param name="oldToken">The old token.</param>
/// <returns></returns> /// <returns></returns>
public Authentication RefreshToken(string oldToken) public Authentication RefreshToken(string oldToken)
{ {
var request = new RestRequest var request = new RestRequest
{ {
Method = Method.POST, Method = Method.POST,
Resource = "refresh_token" Resource = "refresh_token"
}; };
request.AddHeader("Authorization", $"Bearer {oldToken}"); request.AddHeader("Authorization", $"Bearer {oldToken}");
request.AddHeader("Content-Type", "application/json"); request.AddHeader("Content-Type", "application/json");
return Api.Execute<Authentication>(request, Url); return Api.Execute<Authentication>(request, Url);
} }
/// <summary> /// <summary>
/// Searches for a tv series. /// Searches for a tv series.
/// </summary> /// </summary>
/// <param name="searchTerm">The search term.</param> /// <param name="searchTerm">The search term.</param>
/// <param name="token">The token.</param> /// <param name="token">The token.</param>
/// <returns></returns> /// <returns></returns>
public TvSearchResult SearchTv(string searchTerm, string token) public TvSearchResult SearchTv(string searchTerm, string token)
{ {
var request = new RestRequest var request = new RestRequest
{ {
Method = Method.GET, Method = Method.GET,
Resource = "search/series?name={searchTerm}" Resource = "search/series?name={searchTerm}"
}; };
request.AddUrlSegment("searchTerm", searchTerm); request.AddUrlSegment("searchTerm", searchTerm);
request.AddHeader("Authorization", $"Bearer {token}"); request.AddHeader("Authorization", $"Bearer {token}");
request.AddHeader("Content-Type", "application/json"); request.AddHeader("Content-Type", "application/json");
return Api.Execute<TvSearchResult>(request, Url); return Api.Execute<TvSearchResult>(request, Url);
} }
/// <summary> /// <summary>
/// Gets the tv images. /// Gets the tv images.
/// </summary> /// </summary>
/// <param name="seriesId">The series identifier.</param> /// <param name="seriesId">The series identifier.</param>
/// <param name="token">The token.</param> /// <param name="token">The token.</param>
/// <returns></returns> /// <returns></returns>
public TvShowImages GetTvImages(int seriesId, string token) public TvShowImages GetTvImages(int seriesId, string token)
{ {
var request = new RestRequest var request = new RestRequest
{ {
Method = Method.GET, Method = Method.GET,
Resource = "/series/{id}/images/query?keyType=poster" Resource = "/series/{id}/images/query?keyType=poster"
}; };
request.AddUrlSegment("id", seriesId.ToString()); request.AddUrlSegment("id", seriesId.ToString());
request.AddHeader("Authorization", $"Bearer {token}"); request.AddHeader("Authorization", $"Bearer {token}");
request.AddHeader("Content-Type", "application/json"); request.AddHeader("Content-Type", "application/json");
return Api.Execute<TvShowImages>(request, Url); return Api.Execute<TvShowImages>(request, Url);
} }
/// <summary> /// <summary>
/// Gets the information for a TV Series. /// Gets the information for a TV Series.
/// </summary> /// </summary>
/// <param name="tvdbId">The TVDB identifier.</param> /// <param name="tvdbId">The TVDB identifier.</param>
/// <param name="token">The token.</param> /// <param name="token">The token.</param>
/// <returns></returns> /// <returns></returns>
public TvShowInformation GetInformation(int tvdbId, string token) public TvShowInformation GetInformation(int tvdbId, string token)
{ {
var request = new RestRequest var request = new RestRequest
{ {
Method = Method.GET, Method = Method.GET,
Resource = "series/{id}" Resource = "series/{id}"
}; };
request.AddUrlSegment("id", tvdbId.ToString()); request.AddUrlSegment("id", tvdbId.ToString());
request.AddHeader("Authorization", $"Bearer {token}"); request.AddHeader("Authorization", $"Bearer {token}");
request.AddHeader("Content-Type", "application/json"); request.AddHeader("Content-Type", "application/json");
return Api.Execute<TvShowInformation>(request, Url); return Api.Execute<TvShowInformation>(request, Url);
} }
} }
} }

View file

@ -1,39 +1,39 @@
#region Copyright #region Copyright
// /************************************************************************ // /************************************************************************
// Copyright (c) 2016 Jamie Rees // Copyright (c) 2016 Jamie Rees
// File: MovieBase.cs // File: MovieBase.cs
// Created By: Jamie Rees // Created By: Jamie Rees
// //
// Permission is hereby granted, free of charge, to any person obtaining // Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the // a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including // "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish, // without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to // distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to // permit persons to whom the Software is furnished to do so, subject to
// the following conditions: // the following conditions:
// //
// The above copyright notice and this permission notice shall be // The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software. // included in all copies or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/ // ************************************************************************/
#endregion #endregion
using System; using System;
using PlexRequests.Helpers; using PlexRequests.Helpers;
namespace PlexRequests.Api namespace PlexRequests.Api
{ {
public abstract class TvBase public abstract class TvBase
{ {
private static readonly string Encrypted = "AVdhrVK6XX8anvrQgEyN/qNr9rk8ZPwy7/r1t5t5cKyUEzxcyk0L1v6dSxgE7hTCxvITUX2cWa6VlFMlTMgJWyuPZml7fN3csCHntgd/VGYro6VfNf24snZ/rQ3mf005"; private static readonly string Encrypted = "AVdhrVK6XX8anvrQgEyN/qNr9rk8ZPwy7/r1t5t5cKyUEzxcyk0L1v6dSxgE7hTCxvITUX2cWa6VlFMlTMgJWyuPZml7fN3csCHntgd/VGYro6VfNf24snZ/rQ3mf005";
protected string ApiKey = StringCipher.Decrypt(Encrypted, "ApiKey"); protected string ApiKey = StringCipher.Decrypt(Encrypted, "ApiKey");
protected Uri Url = new Uri("https://api-beta.thetvdb.com/"); protected Uri Url = new Uri("https://api-beta.thetvdb.com/");
} }
} }

View file

@ -1,33 +1,33 @@
#region Copyright #region Copyright
// /************************************************************************ // /************************************************************************
// Copyright (c) 2016 Jamie Rees // Copyright (c) 2016 Jamie Rees
// File: TvMazeBase.cs // File: TvMazeBase.cs
// Created By: Jamie Rees // Created By: Jamie Rees
// //
// Permission is hereby granted, free of charge, to any person obtaining // Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the // a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including // "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish, // without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to // distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to // permit persons to whom the Software is furnished to do so, subject to
// the following conditions: // the following conditions:
// //
// The above copyright notice and this permission notice shall be // The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software. // included in all copies or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/ // ************************************************************************/
#endregion #endregion
namespace PlexRequests.Api namespace PlexRequests.Api
{ {
public class TvMazeBase public class TvMazeBase
{ {
protected string Uri = "http://api.tvmaze.com"; protected string Uri = "http://api.tvmaze.com";
} }
} }

View file

@ -1,37 +1,37 @@
using System.Reflection; using System.Reflection;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following // General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information // set of attributes. Change these attribute values to modify the information
// associated with an assembly. // associated with an assembly.
[assembly: AssemblyTitle("PlexRequests.Core.Tests")] [assembly: AssemblyTitle("PlexRequests.Core.Tests")]
[assembly: AssemblyDescription("")] [assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")] [assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")] [assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("PlexRequests.Core.Tests")] [assembly: AssemblyProduct("PlexRequests.Core.Tests")]
[assembly: AssemblyCopyright("Copyright © 2016")] [assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")] [assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")] [assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible // Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from // to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type. // COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)] [assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM // The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("fcfecd5d-47f6-454d-8692-e27a921be655")] [assembly: Guid("fcfecd5d-47f6-454d-8692-e27a921be655")]
// Version information for an assembly consists of the following four values: // Version information for an assembly consists of the following four values:
// //
// Major Version // Major Version
// Minor Version // Minor Version
// Build Number // Build Number
// Revision // Revision
// //
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersionAttribute("1.0.0.0")] [assembly: AssemblyInformationalVersionAttribute("1.0.0.0")]

View file

@ -1,46 +1,46 @@
#region Copyright #region Copyright
// /************************************************************************ // /************************************************************************
// Copyright (c) 2016 Jamie Rees // Copyright (c) 2016 Jamie Rees
// File: AuthenticationSettingsTests.cs // File: AuthenticationSettingsTests.cs
// Created By: Jamie Rees // Created By: Jamie Rees
// //
// Permission is hereby granted, free of charge, to any person obtaining // Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the // a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including // "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish, // without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to // distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to // permit persons to whom the Software is furnished to do so, subject to
// the following conditions: // the following conditions:
// //
// The above copyright notice and this permission notice shall be // The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software. // included in all copies or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/ // ************************************************************************/
#endregion #endregion
using System; using System;
using NUnit.Framework; using NUnit.Framework;
namespace PlexRequests.Core.Tests namespace PlexRequests.Core.Tests
{ {
[TestFixture] [TestFixture]
public class StatusCheckerTests public class StatusCheckerTests
{ {
[Test] [Test]
[Ignore("API Limit")] [Ignore("API Limit")]
public void CheckStatusTest() public void CheckStatusTest()
{ {
var checker = new StatusChecker(); var checker = new StatusChecker();
var status = checker.GetStatus(); var status = checker.GetStatus();
Assert.That(status, Is.Not.Null); Assert.That(status, Is.Not.Null);
} }
} }
} }

View file

@ -1,57 +1,57 @@
#region Copyright #region Copyright
// /************************************************************************ // /************************************************************************
// Copyright (c) 2016 Jamie Rees // Copyright (c) 2016 Jamie Rees
// File: IRequestService.cs // File: IRequestService.cs
// Created By: Jamie Rees // Created By: Jamie Rees
// //
// Permission is hereby granted, free of charge, to any person obtaining // Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the // a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including // "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish, // without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to // distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to // permit persons to whom the Software is furnished to do so, subject to
// the following conditions: // the following conditions:
// //
// The above copyright notice and this permission notice shall be // The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software. // included in all copies or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/ // ************************************************************************/
#endregion #endregion
using System.Collections.Generic; using System.Collections.Generic;
using System.Threading.Tasks; using System.Threading.Tasks;
using PlexRequests.Store; using PlexRequests.Store;
namespace PlexRequests.Core namespace PlexRequests.Core
{ {
public interface IRequestService public interface IRequestService
{ {
long AddRequest(RequestedModel model); long AddRequest(RequestedModel model);
Task<int> AddRequestAsync(RequestedModel model); Task<int> AddRequestAsync(RequestedModel model);
RequestedModel CheckRequest(int providerId); RequestedModel CheckRequest(int providerId);
Task<RequestedModel> CheckRequestAsync(int providerId); Task<RequestedModel> CheckRequestAsync(int providerId);
RequestedModel CheckRequest(string musicId); RequestedModel CheckRequest(string musicId);
Task<RequestedModel> CheckRequestAsync(string musicId); Task<RequestedModel> CheckRequestAsync(string musicId);
void DeleteRequest(RequestedModel request); void DeleteRequest(RequestedModel request);
Task DeleteRequestAsync(RequestedModel request); Task DeleteRequestAsync(RequestedModel request);
bool UpdateRequest(RequestedModel model); bool UpdateRequest(RequestedModel model);
Task<bool> UpdateRequestAsync(RequestedModel model); Task<bool> UpdateRequestAsync(RequestedModel model);
RequestedModel Get(int id); RequestedModel Get(int id);
Task<RequestedModel> GetAsync(int id); Task<RequestedModel> GetAsync(int id);
IEnumerable<RequestedModel> GetAll(); IEnumerable<RequestedModel> GetAll();
Task<IEnumerable<RequestedModel>> GetAllAsync(); Task<IEnumerable<RequestedModel>> GetAllAsync();
bool BatchUpdate(IEnumerable<RequestedModel> model); bool BatchUpdate(IEnumerable<RequestedModel> model);
Task<bool> BatchUpdateAsync(IEnumerable<RequestedModel> model); Task<bool> BatchUpdateAsync(IEnumerable<RequestedModel> model);
bool BatchDelete(IEnumerable<RequestedModel> model); bool BatchDelete(IEnumerable<RequestedModel> model);
Task<bool> BatchDeleteAsync(IEnumerable<RequestedModel> model); Task<bool> BatchDeleteAsync(IEnumerable<RequestedModel> model);
} }
} }

View file

@ -1,41 +1,41 @@
#region Copyright #region Copyright
// /************************************************************************ // /************************************************************************
// Copyright (c) 2016 Jamie Rees // Copyright (c) 2016 Jamie Rees
// File: ISettingsService.cs // File: ISettingsService.cs
// Created By: Jamie Rees // Created By: Jamie Rees
// //
// Permission is hereby granted, free of charge, to any person obtaining // Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the // a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including // "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish, // without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to // distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to // permit persons to whom the Software is furnished to do so, subject to
// the following conditions: // the following conditions:
// //
// The above copyright notice and this permission notice shall be // The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software. // included in all copies or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/ // ************************************************************************/
#endregion #endregion
using System.Threading.Tasks; using System.Threading.Tasks;
namespace PlexRequests.Core namespace PlexRequests.Core
{ {
public interface ISettingsService<T> public interface ISettingsService<T>
{ {
T GetSettings(); T GetSettings();
Task<T> GetSettingsAsync(); Task<T> GetSettingsAsync();
bool SaveSettings(T model); bool SaveSettings(T model);
Task<bool> SaveSettingsAsync(T model); Task<bool> SaveSettingsAsync(T model);
bool Delete(T model); bool Delete(T model);
Task<bool> DeleteAsync(T model); Task<bool> DeleteAsync(T model);
} }
} }

View file

@ -1,38 +1,38 @@
#region Copyright #region Copyright
// /************************************************************************ // /************************************************************************
// Copyright (c) 2016 Jamie Rees // Copyright (c) 2016 Jamie Rees
// File: StatusModel.cs // File: StatusModel.cs
// Created By: Jamie Rees // Created By: Jamie Rees
// //
// Permission is hereby granted, free of charge, to any person obtaining // Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the // a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including // "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish, // without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to // distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to // permit persons to whom the Software is furnished to do so, subject to
// the following conditions: // the following conditions:
// //
// The above copyright notice and this permission notice shall be // The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software. // included in all copies or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/ // ************************************************************************/
#endregion #endregion
namespace PlexRequests.Core.Models namespace PlexRequests.Core.Models
{ {
public class StatusModel public class StatusModel
{ {
public string Version { get; set; } public string Version { get; set; }
public bool UpdateAvailable { get; set; } public bool UpdateAvailable { get; set; }
public string UpdateUri { get; set; } public string UpdateUri { get; set; }
public string DownloadUri { get; set; } public string DownloadUri { get; set; }
public string ReleaseNotes { get; set; } public string ReleaseNotes { get; set; }
public string ReleaseTitle { get; set; } public string ReleaseTitle { get; set; }
} }
} }

View file

@ -1,33 +1,33 @@
#region Copyright #region Copyright
// /************************************************************************ // /************************************************************************
// Copyright (c) 2016 Jamie Rees // Copyright (c) 2016 Jamie Rees
// File: Settings.cs // File: Settings.cs
// Created By: Jamie Rees // Created By: Jamie Rees
// //
// Permission is hereby granted, free of charge, to any person obtaining // Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the // a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including // "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish, // without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to // distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to // permit persons to whom the Software is furnished to do so, subject to
// the following conditions: // the following conditions:
// //
// The above copyright notice and this permission notice shall be // The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software. // included in all copies or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/ // ************************************************************************/
#endregion #endregion
namespace PlexRequests.Core.SettingModels namespace PlexRequests.Core.SettingModels
{ {
public class Settings public class Settings
{ {
public int Id { get; set; } public int Id { get; set; }
} }
} }

View file

@ -1,38 +1,38 @@
#region Copyright #region Copyright
// /************************************************************************ // /************************************************************************
// Copyright (c) 2016 Jamie Rees // Copyright (c) 2016 Jamie Rees
// File: UserIdentity.cs // File: UserIdentity.cs
// Created By: Jamie Rees // Created By: Jamie Rees
// //
// Permission is hereby granted, free of charge, to any person obtaining // Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the // a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including // "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish, // without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to // distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to // permit persons to whom the Software is furnished to do so, subject to
// the following conditions: // the following conditions:
// //
// The above copyright notice and this permission notice shall be // The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software. // included in all copies or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/ // ************************************************************************/
#endregion #endregion
using System.Collections.Generic; using System.Collections.Generic;
using Nancy.Security; using Nancy.Security;
namespace PlexRequests.Core namespace PlexRequests.Core
{ {
public class UserIdentity : IUserIdentity public class UserIdentity : IUserIdentity
{ {
public string UserName { get; set; } public string UserName { get; set; }
public IEnumerable<string> Claims { get; set; } public IEnumerable<string> Claims { get; set; }
} }
} }

View file

@ -1,41 +1,41 @@
#region Copyright #region Copyright
// /************************************************************************ // /************************************************************************
// Copyright (c) 2016 Jamie Rees // Copyright (c) 2016 Jamie Rees
// File: AssemblyHelperTests.cs // File: AssemblyHelperTests.cs
// Created By: Jamie Rees // Created By: Jamie Rees
// //
// Permission is hereby granted, free of charge, to any person obtaining // Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the // a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including // "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish, // without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to // distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to // permit persons to whom the Software is furnished to do so, subject to
// the following conditions: // the following conditions:
// //
// The above copyright notice and this permission notice shall be // The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software. // included in all copies or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/ // ************************************************************************/
#endregion #endregion
using NUnit.Framework; using NUnit.Framework;
namespace PlexRequests.Helpers.Tests namespace PlexRequests.Helpers.Tests
{ {
[TestFixture] [TestFixture]
public class AssemblyHelperTests public class AssemblyHelperTests
{ {
[Test] [Test]
public void GetReleaseVersionTest() public void GetReleaseVersionTest()
{ {
var result = AssemblyHelper.GetProductVersion(); var result = AssemblyHelper.GetProductVersion();
Assert.That(result, Is.Not.Null); Assert.That(result, Is.Not.Null);
} }
} }
} }

View file

@ -1,56 +1,56 @@
#region Copyright #region Copyright
// /************************************************************************ // /************************************************************************
// Copyright (c) 2016 Jamie Rees // Copyright (c) 2016 Jamie Rees
// File: HtmlRemoverTests.cs // File: HtmlRemoverTests.cs
// Created By: Jamie Rees // Created By: Jamie Rees
// //
// Permission is hereby granted, free of charge, to any person obtaining // Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the // a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including // "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish, // without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to // distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to // permit persons to whom the Software is furnished to do so, subject to
// the following conditions: // the following conditions:
// //
// The above copyright notice and this permission notice shall be // The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software. // included in all copies or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/ // ************************************************************************/
#endregion #endregion
using NUnit.Framework; using NUnit.Framework;
namespace PlexRequests.Helpers.Tests namespace PlexRequests.Helpers.Tests
{ {
[TestFixture] [TestFixture]
public class HtmlRemoverTests public class HtmlRemoverTests
{ {
[Test] [Test]
public void RemoveHtmlBasic() public void RemoveHtmlBasic()
{ {
var html = "this is <b>bold</b> <p>para</p> OK!"; var html = "this is <b>bold</b> <p>para</p> OK!";
var result = html.RemoveHtml(); var result = html.RemoveHtml();
Assert.That(result, Is.Not.Null); Assert.That(result, Is.Not.Null);
Assert.That(result, Is.EqualTo("this is bold para OK!")); Assert.That(result, Is.EqualTo("this is bold para OK!"));
} }
[Test] [Test]
public void RemoveHtmlMoreTags() public void RemoveHtmlMoreTags()
{ {
// Good 'ol Ali G ;) // Good 'ol Ali G ;)
var html = "<p><strong><em>\"Ali G: Rezurection\"</em></strong> includes every episode of <em>Da Ali G Show</em> with new, original introductions by star, creator/writer Sacha Baron Cohen, along with the BAFTA(R) Award-winning English episodes of <em>Da Ali G Show</em> which have never aired on American television and <em>The Best of Ali G</em>.</p>"; var html = "<p><strong><em>\"Ali G: Rezurection\"</em></strong> includes every episode of <em>Da Ali G Show</em> with new, original introductions by star, creator/writer Sacha Baron Cohen, along with the BAFTA(R) Award-winning English episodes of <em>Da Ali G Show</em> which have never aired on American television and <em>The Best of Ali G</em>.</p>";
var result = html.RemoveHtml(); var result = html.RemoveHtml();
Assert.That(result, Is.Not.Null); Assert.That(result, Is.Not.Null);
Assert.That(result, Is.EqualTo("\"Ali G: Rezurection\" includes every episode of Da Ali G Show with new, original introductions by star, creator/writer Sacha Baron Cohen, along with the BAFTA(R) Award-winning English episodes of Da Ali G Show which have never aired on American television and The Best of Ali G.")); Assert.That(result, Is.EqualTo("\"Ali G: Rezurection\" includes every episode of Da Ali G Show with new, original introductions by star, creator/writer Sacha Baron Cohen, along with the BAFTA(R) Award-winning English episodes of Da Ali G Show which have never aired on American television and The Best of Ali G."));
} }
} }
} }

View file

@ -1,49 +1,49 @@
#region Copyright #region Copyright
// /************************************************************************ // /************************************************************************
// Copyright (c) 2016 Jamie Rees // Copyright (c) 2016 Jamie Rees
// File: AssemblyHelperTests.cs // File: AssemblyHelperTests.cs
// Created By: Jamie Rees // Created By: Jamie Rees
// //
// Permission is hereby granted, free of charge, to any person obtaining // Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the // a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including // "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish, // without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to // distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to // permit persons to whom the Software is furnished to do so, subject to
// the following conditions: // the following conditions:
// //
// The above copyright notice and this permission notice shall be // The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software. // included in all copies or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/ // ************************************************************************/
#endregion #endregion
using NUnit.Framework; using NUnit.Framework;
namespace PlexRequests.Helpers.Tests namespace PlexRequests.Helpers.Tests
{ {
[TestFixture] [TestFixture]
public class PasswordHasherTests public class PasswordHasherTests
{ {
[Test] [Test]
public void TestHash() public void TestHash()
{ {
var password = "abcdef"; var password = "abcdef";
var salt = PasswordHasher.GenerateSalt(); var salt = PasswordHasher.GenerateSalt();
var hash = PasswordHasher.ComputeHash(password, salt); var hash = PasswordHasher.ComputeHash(password, salt);
Assert.That(hash, Is.Not.EqualTo(password)); Assert.That(hash, Is.Not.EqualTo(password));
var match = PasswordHasher.VerifyPassword(password, salt, hash); var match = PasswordHasher.VerifyPassword(password, salt, hash);
Assert.That(match, Is.True); Assert.That(match, Is.True);
} }
} }
} }

View file

@ -1,37 +1,37 @@
using System.Reflection; using System.Reflection;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following // General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information // set of attributes. Change these attribute values to modify the information
// associated with an assembly. // associated with an assembly.
[assembly: AssemblyTitle("PlexRequests.Helpers.Tests")] [assembly: AssemblyTitle("PlexRequests.Helpers.Tests")]
[assembly: AssemblyDescription("")] [assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")] [assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")] [assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("PlexRequests.Helpers.Tests")] [assembly: AssemblyProduct("PlexRequests.Helpers.Tests")]
[assembly: AssemblyCopyright("Copyright © 2016")] [assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")] [assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")] [assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible // Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from // to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type. // COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)] [assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM // The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("0e6395d3-b074-49e8-898d-0eb99e507e0e")] [assembly: Guid("0e6395d3-b074-49e8-898d-0eb99e507e0e")]
// Version information for an assembly consists of the following four values: // Version information for an assembly consists of the following four values:
// //
// Major Version // Major Version
// Minor Version // Minor Version
// Build Number // Build Number
// Revision // Revision
// //
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersionAttribute("1.0.0.0")] [assembly: AssemblyInformationalVersionAttribute("1.0.0.0")]

View file

@ -1,108 +1,108 @@
#region Copyright #region Copyright
// /************************************************************************ // /************************************************************************
// Copyright (c) 2016 Jamie Rees // Copyright (c) 2016 Jamie Rees
// File: UriHelperTests.cs // File: UriHelperTests.cs
// Created By: Jamie Rees // Created By: Jamie Rees
// //
// Permission is hereby granted, free of charge, to any person obtaining // Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the // a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including // "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish, // without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to // distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to // permit persons to whom the Software is furnished to do so, subject to
// the following conditions: // the following conditions:
// //
// The above copyright notice and this permission notice shall be // The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software. // included in all copies or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/ // ************************************************************************/
#endregion #endregion
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using NUnit.Framework; using NUnit.Framework;
namespace PlexRequests.Helpers.Tests namespace PlexRequests.Helpers.Tests
{ {
[TestFixture] [TestFixture]
public class UriHelperTests public class UriHelperTests
{ {
[TestCaseSource(nameof(UriData))] [TestCaseSource(nameof(UriData))]
public Uri CreateUri1(string uri) public Uri CreateUri1(string uri)
{ {
return uri.ReturnUri(); return uri.ReturnUri();
} }
[Test] [Test]
public void CreateUriWithSsl() public void CreateUriWithSsl()
{ {
var uri = "192.168.1.69"; var uri = "192.168.1.69";
var result = uri.ReturnUri(8080, true); var result = uri.ReturnUri(8080, true);
Assert.That(result, Is.EqualTo(new Uri("https://192.168.1.69:8080"))); Assert.That(result, Is.EqualTo(new Uri("https://192.168.1.69:8080")));
} }
[TestCaseSource(nameof(UriDataWithPort))] [TestCaseSource(nameof(UriDataWithPort))]
public Uri CreateUri2(string uri, int port) public Uri CreateUri2(string uri, int port)
{ {
return uri.ReturnUri(port); return uri.ReturnUri(port);
} }
[TestCaseSource(nameof(UriDataWithSubDir))] [TestCaseSource(nameof(UriDataWithSubDir))]
public Uri CreateUriWithSubDir(string uri, int port, bool ssl, string subDir) public Uri CreateUriWithSubDir(string uri, int port, bool ssl, string subDir)
{ {
return uri.ReturnUriWithSubDir(port, ssl, subDir); return uri.ReturnUriWithSubDir(port, ssl, subDir);
} }
private static IEnumerable<TestCaseData> UriData private static IEnumerable<TestCaseData> UriData
{ {
get get
{ {
yield return new TestCaseData("google.com").Returns(new Uri("http://google.com/")); yield return new TestCaseData("google.com").Returns(new Uri("http://google.com/"));
yield return new TestCaseData("http://google.com").Returns(new Uri("http://google.com/")); yield return new TestCaseData("http://google.com").Returns(new Uri("http://google.com/"));
yield return new TestCaseData("https://google.com").Returns(new Uri("https://google.com/")); yield return new TestCaseData("https://google.com").Returns(new Uri("https://google.com/"));
yield return new TestCaseData("192.168.1.1").Returns(new Uri("http://192.168.1.1")); yield return new TestCaseData("192.168.1.1").Returns(new Uri("http://192.168.1.1"));
yield return new TestCaseData("0.0.0.0:5533").Returns(new Uri("http://0.0.0.0:5533")); yield return new TestCaseData("0.0.0.0:5533").Returns(new Uri("http://0.0.0.0:5533"));
yield return new TestCaseData("www.google.com").Returns(new Uri("http://www.google.com/")); yield return new TestCaseData("www.google.com").Returns(new Uri("http://www.google.com/"));
yield return new TestCaseData("http://www.google.com/").Returns(new Uri("http://www.google.com/")); yield return new TestCaseData("http://www.google.com/").Returns(new Uri("http://www.google.com/"));
yield return new TestCaseData("https://www.google.com").Returns(new Uri("https://www.google.com/")); yield return new TestCaseData("https://www.google.com").Returns(new Uri("https://www.google.com/"));
yield return new TestCaseData("www.google.com:443").Returns(new Uri("http://www.google.com:443/")); yield return new TestCaseData("www.google.com:443").Returns(new Uri("http://www.google.com:443/"));
yield return new TestCaseData("https://www.google.com:443").Returns(new Uri("https://www.google.com/")); yield return new TestCaseData("https://www.google.com:443").Returns(new Uri("https://www.google.com/"));
yield return new TestCaseData("http://www.google.com:443/id=2").Returns(new Uri("http://www.google.com:443/id=2")); yield return new TestCaseData("http://www.google.com:443/id=2").Returns(new Uri("http://www.google.com:443/id=2"));
yield return new TestCaseData("www.google.com:4438/id=22").Returns(new Uri("http://www.google.com:4438/id=22")); yield return new TestCaseData("www.google.com:4438/id=22").Returns(new Uri("http://www.google.com:4438/id=22"));
} }
} }
private static IEnumerable<TestCaseData> UriDataWithPort private static IEnumerable<TestCaseData> UriDataWithPort
{ {
get get
{ {
yield return new TestCaseData("www.google.com", 80).Returns(new Uri("http://www.google.com:80/")); yield return new TestCaseData("www.google.com", 80).Returns(new Uri("http://www.google.com:80/"));
yield return new TestCaseData("www.google.com", 443).Returns(new Uri("http://www.google.com:443/")); yield return new TestCaseData("www.google.com", 443).Returns(new Uri("http://www.google.com:443/"));
yield return new TestCaseData("http://www.google.com", 443).Returns(new Uri("http://www.google.com:443/")); yield return new TestCaseData("http://www.google.com", 443).Returns(new Uri("http://www.google.com:443/"));
yield return new TestCaseData("https://www.google.com", 443).Returns(new Uri("https://www.google.com:443/")); yield return new TestCaseData("https://www.google.com", 443).Returns(new Uri("https://www.google.com:443/"));
yield return new TestCaseData("http://www.google.com/id=2", 443).Returns(new Uri("http://www.google.com:443/id=2")); yield return new TestCaseData("http://www.google.com/id=2", 443).Returns(new Uri("http://www.google.com:443/id=2"));
yield return new TestCaseData("https://www.google.com/id=2", 443).Returns(new Uri("https://www.google.com:443/id=2")); yield return new TestCaseData("https://www.google.com/id=2", 443).Returns(new Uri("https://www.google.com:443/id=2"));
} }
} }
private static IEnumerable<TestCaseData> UriDataWithSubDir private static IEnumerable<TestCaseData> UriDataWithSubDir
{ {
get get
{ {
yield return new TestCaseData("www.google.com", 80, false, "test").Returns(new Uri("http://www.google.com:80/test")); yield return new TestCaseData("www.google.com", 80, false, "test").Returns(new Uri("http://www.google.com:80/test"));
yield return new TestCaseData("www.google.com", 443, false, "test").Returns(new Uri("http://www.google.com:443/test")); yield return new TestCaseData("www.google.com", 443, false, "test").Returns(new Uri("http://www.google.com:443/test"));
yield return new TestCaseData("http://www.google.com", 443, true, "test").Returns(new Uri("https://www.google.com:443/test")); yield return new TestCaseData("http://www.google.com", 443, true, "test").Returns(new Uri("https://www.google.com:443/test"));
yield return new TestCaseData("https://www.google.com", 443, true, "test").Returns(new Uri("https://www.google.com:443/test")); yield return new TestCaseData("https://www.google.com", 443, true, "test").Returns(new Uri("https://www.google.com:443/test"));
} }
} }
} }
} }

View file

@ -1,49 +1,49 @@
#region Copyright #region Copyright
// /************************************************************************ // /************************************************************************
// Copyright (c) 2016 Jamie Rees // Copyright (c) 2016 Jamie Rees
// File: AssemblyHelper.cs // File: AssemblyHelper.cs
// Created By: Jamie Rees // Created By: Jamie Rees
// //
// Permission is hereby granted, free of charge, to any person obtaining // Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the // a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including // "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish, // without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to // distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to // permit persons to whom the Software is furnished to do so, subject to
// the following conditions: // the following conditions:
// //
// The above copyright notice and this permission notice shall be // The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software. // included in all copies or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/ // ************************************************************************/
#endregion #endregion
using System.Diagnostics; using System.Diagnostics;
using System.Reflection; using System.Reflection;
namespace PlexRequests.Helpers namespace PlexRequests.Helpers
{ {
public class AssemblyHelper public class AssemblyHelper
{ {
public static string GetAssemblyVersion() public static string GetAssemblyVersion()
{ {
var assembly = Assembly.GetExecutingAssembly(); var assembly = Assembly.GetExecutingAssembly();
var fvi = FileVersionInfo.GetVersionInfo(assembly.Location); var fvi = FileVersionInfo.GetVersionInfo(assembly.Location);
return fvi.FileVersion; return fvi.FileVersion;
} }
public static string GetProductVersion() public static string GetProductVersion()
{ {
var assembly = Assembly.GetExecutingAssembly(); var assembly = Assembly.GetExecutingAssembly();
var fvi = FileVersionInfo.GetVersionInfo(assembly.Location); var fvi = FileVersionInfo.GetVersionInfo(assembly.Location);
var retVersion = fvi.ProductVersion; var retVersion = fvi.ProductVersion;
return retVersion; return retVersion;
} }
} }
} }

View file

@ -1,54 +1,54 @@
#region Copyright #region Copyright
// /************************************************************************ // /************************************************************************
// Copyright (c) 2016 Jamie Rees // Copyright (c) 2016 Jamie Rees
// File: ByteConverterHelper.cs // File: ByteConverterHelper.cs
// Created By: Jamie Rees // Created By: Jamie Rees
// //
// Permission is hereby granted, free of charge, to any person obtaining // Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the // a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including // "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish, // without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to // distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to // permit persons to whom the Software is furnished to do so, subject to
// the following conditions: // the following conditions:
// //
// The above copyright notice and this permission notice shall be // The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software. // included in all copies or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/ // ************************************************************************/
#endregion #endregion
using System.Text; using System.Text;
using Newtonsoft.Json; using Newtonsoft.Json;
namespace PlexRequests.Helpers namespace PlexRequests.Helpers
{ {
public class ByteConverterHelper public class ByteConverterHelper
{ {
public static byte[] ReturnBytes(object obj) public static byte[] ReturnBytes(object obj)
{ {
var json = JsonConvert.SerializeObject(obj); var json = JsonConvert.SerializeObject(obj);
var bytes = Encoding.UTF8.GetBytes(json); var bytes = Encoding.UTF8.GetBytes(json);
return bytes; return bytes;
} }
public static T ReturnObject<T>(byte[] bytes) public static T ReturnObject<T>(byte[] bytes)
{ {
var json = Encoding.UTF8.GetString(bytes); var json = Encoding.UTF8.GetString(bytes);
var model = JsonConvert.DeserializeObject<T>(json); var model = JsonConvert.DeserializeObject<T>(json);
return model; return model;
} }
public static string ReturnFromBytes(byte[] bytes) public static string ReturnFromBytes(byte[] bytes)
{ {
return Encoding.UTF8.GetString(bytes); return Encoding.UTF8.GetString(bytes);
} }
} }
} }

View file

@ -1,48 +1,48 @@
#region Copyright #region Copyright
// /************************************************************************ // /************************************************************************
// Copyright (c) 2016 Jamie Rees // Copyright (c) 2016 Jamie Rees
// File: ApplicationSettingsException.cs // File: ApplicationSettingsException.cs
// Created By: Jamie Rees // Created By: Jamie Rees
// //
// Permission is hereby granted, free of charge, to any person obtaining // Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the // a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including // "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish, // without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to // distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to // permit persons to whom the Software is furnished to do so, subject to
// the following conditions: // the following conditions:
// //
// The above copyright notice and this permission notice shall be // The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software. // included in all copies or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/ // ************************************************************************/
#endregion #endregion
using System; using System;
namespace PlexRequests.Helpers.Exceptions namespace PlexRequests.Helpers.Exceptions
{ {
public class ApplicationSettingsException : Exception public class ApplicationSettingsException : Exception
{ {
public ApplicationSettingsException(string message) : base(message) public ApplicationSettingsException(string message) : base(message)
{ {
} }
public ApplicationSettingsException(string message, Exception innerException) : base(message, innerException) public ApplicationSettingsException(string message, Exception innerException) : base(message, innerException)
{ {
} }
public ApplicationSettingsException() public ApplicationSettingsException()
{ {
} }
} }
} }

View file

@ -1,45 +1,45 @@
#region Copyright #region Copyright
// /************************************************************************ // /************************************************************************
// Copyright (c) 2016 Jamie Rees // Copyright (c) 2016 Jamie Rees
// File: HtmlRemover.cs // File: HtmlRemover.cs
// Created By: Jamie Rees // Created By: Jamie Rees
// //
// Permission is hereby granted, free of charge, to any person obtaining // Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the // a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including // "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish, // without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to // distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to // permit persons to whom the Software is furnished to do so, subject to
// the following conditions: // the following conditions:
// //
// The above copyright notice and this permission notice shall be // The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software. // included in all copies or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/ // ************************************************************************/
#endregion #endregion
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
namespace PlexRequests.Helpers namespace PlexRequests.Helpers
{ {
public static class HtmlRemover public static class HtmlRemover
{ {
public static string RemoveHtml(this string value) public static string RemoveHtml(this string value)
{ {
if (string.IsNullOrEmpty(value)) if (string.IsNullOrEmpty(value))
{ {
return string.Empty; return string.Empty;
} }
var step1 = Regex.Replace(value, @"<[^>]+>|&nbsp;", "").Trim(); var step1 = Regex.Replace(value, @"<[^>]+>|&nbsp;", "").Trim();
var step2 = Regex.Replace(step1, @"\s{2,}", " "); var step2 = Regex.Replace(step1, @"\s{2,}", " ");
return step2; return step2;
} }
} }
} }

View file

@ -1,68 +1,68 @@
#region Copyright #region Copyright
// /************************************************************************ // /************************************************************************
// Copyright (c) 2016 Jamie Rees // Copyright (c) 2016 Jamie Rees
// File: ICacheProvider.cs // File: ICacheProvider.cs
// Created By: Jamie Rees // Created By: Jamie Rees
// //
// Permission is hereby granted, free of charge, to any person obtaining // Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the // a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including // "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish, // without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to // distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to // permit persons to whom the Software is furnished to do so, subject to
// the following conditions: // the following conditions:
// //
// The above copyright notice and this permission notice shall be // The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software. // included in all copies or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/ // ************************************************************************/
#endregion #endregion
using System; using System;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace PlexRequests.Helpers namespace PlexRequests.Helpers
{ {
public interface ICacheProvider public interface ICacheProvider
{ {
/// <summary> /// <summary>
/// Gets the item from the cache, if the item is not present /// Gets the item from the cache, if the item is not present
/// then we will get that item and store it in the cache. /// then we will get that item and store it in the cache.
/// </summary> /// </summary>
/// <typeparam name="T">Type to store in the cache</typeparam> /// <typeparam name="T">Type to store in the cache</typeparam>
/// <param name="key">The key</param> /// <param name="key">The key</param>
/// <param name="itemCallback">The item callback. This will be called if the item is not present in the cache. </param> /// <param name="itemCallback">The item callback. This will be called if the item is not present in the cache. </param>
/// <param name="cacheTime">The amount of time we want to cache the object</param> /// <param name="cacheTime">The amount of time we want to cache the object</param>
/// <returns><see cref="T"/></returns> /// <returns><see cref="T"/></returns>
T GetOrSet<T>(string key, Func<T> itemCallback, int cacheTime = 20) where T : class; T GetOrSet<T>(string key, Func<T> itemCallback, int cacheTime = 20) where T : class;
Task<T> GetOrSetAsync<T>(string key, Func<Task<T>> itemCallback, int cacheTime = 20) where T : class; Task<T> GetOrSetAsync<T>(string key, Func<Task<T>> itemCallback, int cacheTime = 20) where T : class;
/// <summary> /// <summary>
/// Gets the specified item from the cache. /// Gets the specified item from the cache.
/// </summary> /// </summary>
/// <typeparam name="T">Type to get from the cache</typeparam> /// <typeparam name="T">Type to get from the cache</typeparam>
/// <param name="key">The key.</param> /// <param name="key">The key.</param>
/// <returns><see cref="T"/></returns> /// <returns><see cref="T"/></returns>
T Get<T>(string key) where T : class; T Get<T>(string key) where T : class;
/// <summary> /// <summary>
/// Set/Store the specified object in the cache /// Set/Store the specified object in the cache
/// </summary> /// </summary>
/// <param name="key">The key.</param> /// <param name="key">The key.</param>
/// <param name="data">The object we want to store.</param> /// <param name="data">The object we want to store.</param>
/// <param name="cacheTime">The amount of time we want to cache the object.</param> /// <param name="cacheTime">The amount of time we want to cache the object.</param>
void Set(string key, object data, int cacheTime = 20); void Set(string key, object data, int cacheTime = 20);
/// <summary> /// <summary>
/// Removes the specified object from the cache. /// Removes the specified object from the cache.
/// </summary> /// </summary>
/// <param name="key">The key.</param> /// <param name="key">The key.</param>
void Remove(string key); void Remove(string key);
} }
} }

View file

@ -1,54 +1,54 @@
#region Copyright #region Copyright
// /************************************************************************ // /************************************************************************
// Copyright (c) 2016 Jamie Rees // Copyright (c) 2016 Jamie Rees
// File: JsonConvertHelper.cs // File: JsonConvertHelper.cs
// Created By: Jamie Rees // Created By: Jamie Rees
// //
// Permission is hereby granted, free of charge, to any person obtaining // Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the // a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including // "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish, // without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to // distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to // permit persons to whom the Software is furnished to do so, subject to
// the following conditions: // the following conditions:
// //
// The above copyright notice and this permission notice shall be // The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software. // included in all copies or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/ // ************************************************************************/
#endregion #endregion
using Newtonsoft.Json; using Newtonsoft.Json;
namespace PlexRequests.Helpers namespace PlexRequests.Helpers
{ {
public static class JsonConvertHelper public static class JsonConvertHelper
{ {
public static T[] ParseObjectToArray<T>(object ambiguousObject) public static T[] ParseObjectToArray<T>(object ambiguousObject)
{ {
var json = ambiguousObject.ToString(); var json = ambiguousObject.ToString();
if (string.IsNullOrWhiteSpace(json)) if (string.IsNullOrWhiteSpace(json))
{ {
return new T[0]; // Could return null here instead. return new T[0]; // Could return null here instead.
} }
if (json.TrimStart().StartsWith("[")) if (json.TrimStart().StartsWith("["))
{ {
return JsonConvert.DeserializeObject<T[]>(json); return JsonConvert.DeserializeObject<T[]>(json);
} }
if (json.TrimStart().Equals("{}")) if (json.TrimStart().Equals("{}"))
{ {
return new T[0]; return new T[0];
} }
return new T[1] { JsonConvert.DeserializeObject<T>(json) }; return new T[1] { JsonConvert.DeserializeObject<T>(json) };
} }
} }
} }

View file

@ -1,57 +1,57 @@
#region Copyright #region Copyright
// /************************************************************************ // /************************************************************************
// Copyright (c) 2016 Jamie Rees // Copyright (c) 2016 Jamie Rees
// File: ObjectCopier.cs // File: ObjectCopier.cs
// Created By: Jamie Rees // Created By: Jamie Rees
// //
// Permission is hereby granted, free of charge, to any person obtaining // Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the // a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including // "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish, // without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to // distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to // permit persons to whom the Software is furnished to do so, subject to
// the following conditions: // the following conditions:
// //
// The above copyright notice and this permission notice shall be // The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software. // included in all copies or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/ // ************************************************************************/
#endregion #endregion
using Newtonsoft.Json; using Newtonsoft.Json;
namespace PlexRequests.Helpers namespace PlexRequests.Helpers
{ {
/// <summary> /// <summary>
/// Provides a method for performing a deep copy of an object. /// Provides a method for performing a deep copy of an object.
/// Binary Serialization is used to perform the copy. /// Binary Serialization is used to perform the copy.
/// </summary> /// </summary>
public static class ObjectCopier public static class ObjectCopier
{ {
/// <summary> /// <summary>
/// <para>Initialize inner objects individually</para> /// <para>Initialize inner objects individually</para>
/// For example in default constructor some list property initialized with some values, /// For example in default constructor some list property initialized with some values,
/// but in 'source' these items are cleaned - /// but in 'source' these items are cleaned -
/// without <c>ObjectCreationHandling.Replace</c> default constructor values will be added to result /// without <c>ObjectCreationHandling.Replace</c> default constructor values will be added to result
/// </summary> /// </summary>
private static readonly JsonSerializerSettings Settings = new JsonSerializerSettings { ObjectCreationHandling = ObjectCreationHandling.Replace }; private static readonly JsonSerializerSettings Settings = new JsonSerializerSettings { ObjectCreationHandling = ObjectCreationHandling.Replace };
/// <summary> /// <summary>
/// Perform a deep Copy of the object, using Json as a serialisation method. /// Perform a deep Copy of the object, using Json as a serialisation method.
/// </summary> /// </summary>
/// <typeparam name="T">The type of object being copied.</typeparam> /// <typeparam name="T">The type of object being copied.</typeparam>
/// <param name="source">The object instance to copy.</param> /// <param name="source">The object instance to copy.</param>
/// <returns>The copied object.</returns> /// <returns>The copied object.</returns>
public static T CloneJson<T>(this T source) public static T CloneJson<T>(this T source)
{ {
// Don't serialize a null object, simply return the default for that object // Don't serialize a null object, simply return the default for that object
return ReferenceEquals(source, null) ? default(T) : JsonConvert.DeserializeObject<T>(JsonConvert.SerializeObject(source), Settings); return ReferenceEquals(source, null) ? default(T) : JsonConvert.DeserializeObject<T>(JsonConvert.SerializeObject(source), Settings);
} }
} }
} }

View file

@ -1,69 +1,69 @@
#region Copyright #region Copyright
// /************************************************************************ // /************************************************************************
// Copyright (c) 2016 Jamie Rees // Copyright (c) 2016 Jamie Rees
// File: PasswordHasher.cs // File: PasswordHasher.cs
// Created By: Jamie Rees // Created By: Jamie Rees
// //
// Permission is hereby granted, free of charge, to any person obtaining // Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the // a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including // "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish, // without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to // distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to // permit persons to whom the Software is furnished to do so, subject to
// the following conditions: // the following conditions:
// //
// The above copyright notice and this permission notice shall be // The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software. // included in all copies or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/ // ************************************************************************/
#endregion #endregion
using System.Collections.Generic; using System.Collections.Generic;
using System.Security.Cryptography; using System.Security.Cryptography;
namespace PlexRequests.Helpers namespace PlexRequests.Helpers
{ {
public static class PasswordHasher public static class PasswordHasher
{ {
// 24 = 192 bits // 24 = 192 bits
private const int SaltByteSize = 24; private const int SaltByteSize = 24;
private const int HashByteSize = 24; private const int HashByteSize = 24;
private const int HasingIterationsCount = 10101; private const int HasingIterationsCount = 10101;
public static byte[] ComputeHash(string password, byte[] salt, int iterations = HasingIterationsCount, int hashByteSize = HashByteSize) public static byte[] ComputeHash(string password, byte[] salt, int iterations = HasingIterationsCount, int hashByteSize = HashByteSize)
{ {
var hashGenerator = new Rfc2898DeriveBytes(password, salt) { IterationCount = iterations }; var hashGenerator = new Rfc2898DeriveBytes(password, salt) { IterationCount = iterations };
return hashGenerator.GetBytes(hashByteSize); return hashGenerator.GetBytes(hashByteSize);
} }
public static byte[] GenerateSalt(int saltByteSize = SaltByteSize) public static byte[] GenerateSalt(int saltByteSize = SaltByteSize)
{ {
var saltGenerator = new RNGCryptoServiceProvider(); var saltGenerator = new RNGCryptoServiceProvider();
var salt = new byte[saltByteSize]; var salt = new byte[saltByteSize];
saltGenerator.GetBytes(salt); saltGenerator.GetBytes(salt);
return salt; return salt;
} }
public static bool VerifyPassword(string password, byte[] passwordSalt, byte[] passwordHash) public static bool VerifyPassword(string password, byte[] passwordSalt, byte[] passwordHash)
{ {
var computedHash = ComputeHash(password, passwordSalt); var computedHash = ComputeHash(password, passwordSalt);
return AreHashesEqual(computedHash, passwordHash); return AreHashesEqual(computedHash, passwordHash);
} }
//Length constant verification - prevents timing attack //Length constant verification - prevents timing attack
private static bool AreHashesEqual(IReadOnlyList<byte> firstHash, IReadOnlyList<byte> secondHash) private static bool AreHashesEqual(IReadOnlyList<byte> firstHash, IReadOnlyList<byte> secondHash)
{ {
var minHashLength = firstHash.Count <= secondHash.Count ? firstHash.Count : secondHash.Count; var minHashLength = firstHash.Count <= secondHash.Count ? firstHash.Count : secondHash.Count;
var xor = firstHash.Count ^ secondHash.Count; var xor = firstHash.Count ^ secondHash.Count;
for (var i = 0; i < minHashLength; i++) for (var i = 0; i < minHashLength; i++)
xor |= firstHash[i] ^ secondHash[i]; xor |= firstHash[i] ^ secondHash[i];
return 0 == xor; return 0 == xor;
} }
} }
} }

View file

@ -1,45 +1,45 @@
#region Copyright #region Copyright
// /************************************************************************ // /************************************************************************
// Copyright (c) 2016 Jamie Rees // Copyright (c) 2016 Jamie Rees
// File: SerializerSettings.cs // File: SerializerSettings.cs
// Created By: Jamie Rees // Created By: Jamie Rees
// //
// Permission is hereby granted, free of charge, to any person obtaining // Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the // a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including // "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish, // without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to // distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to // permit persons to whom the Software is furnished to do so, subject to
// the following conditions: // the following conditions:
// //
// The above copyright notice and this permission notice shall be // The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software. // included in all copies or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/ // ************************************************************************/
#endregion #endregion
using System.Runtime.Serialization.Formatters; using System.Runtime.Serialization.Formatters;
using Newtonsoft.Json; using Newtonsoft.Json;
namespace PlexRequests.Helpers namespace PlexRequests.Helpers
{ {
public static class SerializerSettings public static class SerializerSettings
{ {
public static readonly JsonSerializerSettings Settings = new JsonSerializerSettings public static readonly JsonSerializerSettings Settings = new JsonSerializerSettings
{ {
Formatting = Formatting.None, Formatting = Formatting.None,
TypeNameHandling = TypeNameHandling.Objects, TypeNameHandling = TypeNameHandling.Objects,
TypeNameAssemblyFormat = FormatterAssemblyStyle.Simple, TypeNameAssemblyFormat = FormatterAssemblyStyle.Simple,
NullValueHandling = NullValueHandling.Ignore NullValueHandling = NullValueHandling.Ignore
}; };
} }
} }

View file

@ -1,145 +1,145 @@
#region Copyright #region Copyright
// /************************************************************************ // /************************************************************************
// Copyright (c) 2016 Jamie Rees // Copyright (c) 2016 Jamie Rees
// File: StringCipher.cs // File: StringCipher.cs
// Created By: Jamie Rees // Created By: Jamie Rees
// //
// Permission is hereby granted, free of charge, to any person obtaining // Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the // a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including // "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish, // without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to // distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to // permit persons to whom the Software is furnished to do so, subject to
// the following conditions: // the following conditions:
// //
// The above copyright notice and this permission notice shall be // The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software. // included in all copies or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/ // ************************************************************************/
#endregion #endregion
using System; using System;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Security.Cryptography; using System.Security.Cryptography;
using System.Text; using System.Text;
namespace PlexRequests.Helpers namespace PlexRequests.Helpers
{ {
public class StringCipher public class StringCipher
{ {
// This constant determines the number of iterations for the password bytes generation function. // This constant determines the number of iterations for the password bytes generation function.
private const int DerivationIterations = 1000; private const int DerivationIterations = 1000;
// This constant is used to determine the keysize of the encryption algorithm in bits. // This constant is used to determine the keysize of the encryption algorithm in bits.
// We divide this by 8 within the code below to get the equivalent number of bytes. // We divide this by 8 within the code below to get the equivalent number of bytes.
private const int Keysize = 256; private const int Keysize = 256;
/// <summary> /// <summary>
/// Decrypts the specified cipher text. /// Decrypts the specified cipher text.
/// </summary> /// </summary>
/// <param name="cipherText">The cipher text.</param> /// <param name="cipherText">The cipher text.</param>
/// <param name="passPhrase">The pass phrase.</param> /// <param name="passPhrase">The pass phrase.</param>
/// <returns></returns> /// <returns></returns>
public static string Decrypt(string cipherText, string passPhrase) public static string Decrypt(string cipherText, string passPhrase)
{ {
// Get the complete stream of bytes that represent: // Get the complete stream of bytes that represent:
// [32 bytes of Salt] + [32 bytes of IV] + [n bytes of CipherText] // [32 bytes of Salt] + [32 bytes of IV] + [n bytes of CipherText]
var cipherTextBytesWithSaltAndIv = Convert.FromBase64String(cipherText); var cipherTextBytesWithSaltAndIv = Convert.FromBase64String(cipherText);
// Get the saltbytes by extracting the first 32 bytes from the supplied cipherText bytes. // Get the saltbytes by extracting the first 32 bytes from the supplied cipherText bytes.
var saltStringBytes = cipherTextBytesWithSaltAndIv.Take(Keysize / 8).ToArray(); var saltStringBytes = cipherTextBytesWithSaltAndIv.Take(Keysize / 8).ToArray();
// Get the IV bytes by extracting the next 32 bytes from the supplied cipherText bytes. // Get the IV bytes by extracting the next 32 bytes from the supplied cipherText bytes.
var ivStringBytes = cipherTextBytesWithSaltAndIv.Skip(Keysize / 8).Take(Keysize / 8).ToArray(); var ivStringBytes = cipherTextBytesWithSaltAndIv.Skip(Keysize / 8).Take(Keysize / 8).ToArray();
// Get the actual cipher text bytes by removing the first 64 bytes from the cipherText string. // Get the actual cipher text bytes by removing the first 64 bytes from the cipherText string.
var cipherTextBytes = cipherTextBytesWithSaltAndIv.Skip((Keysize / 8) * 2).Take(cipherTextBytesWithSaltAndIv.Length - ((Keysize / 8) * 2)).ToArray(); var cipherTextBytes = cipherTextBytesWithSaltAndIv.Skip((Keysize / 8) * 2).Take(cipherTextBytesWithSaltAndIv.Length - ((Keysize / 8) * 2)).ToArray();
using (var password = new Rfc2898DeriveBytes(passPhrase, saltStringBytes, DerivationIterations)) using (var password = new Rfc2898DeriveBytes(passPhrase, saltStringBytes, DerivationIterations))
{ {
var keyBytes = password.GetBytes(Keysize / 8); var keyBytes = password.GetBytes(Keysize / 8);
using (var symmetricKey = new RijndaelManaged()) using (var symmetricKey = new RijndaelManaged())
{ {
symmetricKey.BlockSize = 256; symmetricKey.BlockSize = 256;
symmetricKey.Mode = CipherMode.CBC; symmetricKey.Mode = CipherMode.CBC;
symmetricKey.Padding = PaddingMode.PKCS7; symmetricKey.Padding = PaddingMode.PKCS7;
using (var decryptor = symmetricKey.CreateDecryptor(keyBytes, ivStringBytes)) using (var decryptor = symmetricKey.CreateDecryptor(keyBytes, ivStringBytes))
{ {
using (var memoryStream = new MemoryStream(cipherTextBytes)) using (var memoryStream = new MemoryStream(cipherTextBytes))
{ {
using (var cryptoStream = new CryptoStream(memoryStream, decryptor, CryptoStreamMode.Read)) using (var cryptoStream = new CryptoStream(memoryStream, decryptor, CryptoStreamMode.Read))
{ {
var plainTextBytes = new byte[cipherTextBytes.Length]; var plainTextBytes = new byte[cipherTextBytes.Length];
var decryptedByteCount = cryptoStream.Read(plainTextBytes, 0, plainTextBytes.Length); var decryptedByteCount = cryptoStream.Read(plainTextBytes, 0, plainTextBytes.Length);
memoryStream.Close(); memoryStream.Close();
cryptoStream.Close(); cryptoStream.Close();
return Encoding.UTF8.GetString(plainTextBytes, 0, decryptedByteCount); return Encoding.UTF8.GetString(plainTextBytes, 0, decryptedByteCount);
} }
} }
} }
} }
} }
} }
/// <summary> /// <summary>
/// Encrypts the specified plain text. /// Encrypts the specified plain text.
/// </summary> /// </summary>
/// <param name="plainText">The plain text.</param> /// <param name="plainText">The plain text.</param>
/// <param name="passPhrase">The pass phrase.</param> /// <param name="passPhrase">The pass phrase.</param>
/// <returns></returns> /// <returns></returns>
public static string Encrypt(string plainText, string passPhrase) public static string Encrypt(string plainText, string passPhrase)
{ {
// Salt and IV is randomly generated each time, but is preprended to encrypted cipher text // Salt and IV is randomly generated each time, but is preprended to encrypted cipher text
// so that the same Salt and IV values can be used when decrypting. // so that the same Salt and IV values can be used when decrypting.
var saltStringBytes = Generate256BitsOfRandomEntropy(); var saltStringBytes = Generate256BitsOfRandomEntropy();
var ivStringBytes = Generate256BitsOfRandomEntropy(); var ivStringBytes = Generate256BitsOfRandomEntropy();
var plainTextBytes = Encoding.UTF8.GetBytes(plainText); var plainTextBytes = Encoding.UTF8.GetBytes(plainText);
using (var password = new Rfc2898DeriveBytes(passPhrase, saltStringBytes, DerivationIterations)) using (var password = new Rfc2898DeriveBytes(passPhrase, saltStringBytes, DerivationIterations))
{ {
var keyBytes = password.GetBytes(Keysize / 8); var keyBytes = password.GetBytes(Keysize / 8);
using (var symmetricKey = new RijndaelManaged()) using (var symmetricKey = new RijndaelManaged())
{ {
symmetricKey.BlockSize = 256; symmetricKey.BlockSize = 256;
symmetricKey.Mode = CipherMode.CBC; symmetricKey.Mode = CipherMode.CBC;
symmetricKey.Padding = PaddingMode.PKCS7; symmetricKey.Padding = PaddingMode.PKCS7;
using (var encryptor = symmetricKey.CreateEncryptor(keyBytes, ivStringBytes)) using (var encryptor = symmetricKey.CreateEncryptor(keyBytes, ivStringBytes))
{ {
using (var memoryStream = new MemoryStream()) using (var memoryStream = new MemoryStream())
{ {
using (var cryptoStream = new CryptoStream(memoryStream, encryptor, CryptoStreamMode.Write)) using (var cryptoStream = new CryptoStream(memoryStream, encryptor, CryptoStreamMode.Write))
{ {
cryptoStream.Write(plainTextBytes, 0, plainTextBytes.Length); cryptoStream.Write(plainTextBytes, 0, plainTextBytes.Length);
cryptoStream.FlushFinalBlock(); cryptoStream.FlushFinalBlock();
// Create the final bytes as a concatenation of the random salt bytes, the random iv bytes and the cipher bytes. // Create the final bytes as a concatenation of the random salt bytes, the random iv bytes and the cipher bytes.
var cipherTextBytes = saltStringBytes; var cipherTextBytes = saltStringBytes;
cipherTextBytes = cipherTextBytes.Concat(ivStringBytes).ToArray(); cipherTextBytes = cipherTextBytes.Concat(ivStringBytes).ToArray();
cipherTextBytes = cipherTextBytes.Concat(memoryStream.ToArray()).ToArray(); cipherTextBytes = cipherTextBytes.Concat(memoryStream.ToArray()).ToArray();
memoryStream.Close(); memoryStream.Close();
cryptoStream.Close(); cryptoStream.Close();
return Convert.ToBase64String(cipherTextBytes); return Convert.ToBase64String(cipherTextBytes);
} }
} }
} }
} }
} }
} }
/// <summary> /// <summary>
/// Generate256s the bits of random entropy. /// Generate256s the bits of random entropy.
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
private static byte[] Generate256BitsOfRandomEntropy() private static byte[] Generate256BitsOfRandomEntropy()
{ {
var randomBytes = new byte[32]; // 32 Bytes will give us 256 bits. var randomBytes = new byte[32]; // 32 Bytes will give us 256 bits.
using (var rngCsp = new RNGCryptoServiceProvider()) using (var rngCsp = new RNGCryptoServiceProvider())
{ {
// Fill the array with cryptographically secure random bytes. // Fill the array with cryptographically secure random bytes.
rngCsp.GetBytes(randomBytes); rngCsp.GetBytes(randomBytes);
} }
return randomBytes; return randomBytes;
} }
} }
} }

View file

@ -1,116 +1,116 @@
using System; using System;
using PlexRequests.Helpers.Exceptions; using PlexRequests.Helpers.Exceptions;
namespace PlexRequests.Helpers namespace PlexRequests.Helpers
{ {
public static class UriHelper public static class UriHelper
{ {
public static Uri ReturnUri(this string val) public static Uri ReturnUri(this string val)
{ {
if (val == null) if (val == null)
{ {
throw new ApplicationSettingsException("The URI is null, please check your settings to make sure you have configured the applications correctly."); throw new ApplicationSettingsException("The URI is null, please check your settings to make sure you have configured the applications correctly.");
} }
try try
{ {
var uri = new UriBuilder(); var uri = new UriBuilder();
if (val.StartsWith("http://", StringComparison.Ordinal)) if (val.StartsWith("http://", StringComparison.Ordinal))
{ {
uri = new UriBuilder(val); uri = new UriBuilder(val);
} }
else if (val.StartsWith("https://", StringComparison.Ordinal)) else if (val.StartsWith("https://", StringComparison.Ordinal))
{ {
uri = new UriBuilder(val); uri = new UriBuilder(val);
} }
else if (val.Contains(":")) else if (val.Contains(":"))
{ {
var split = val.Split(':', '/'); var split = val.Split(':', '/');
int port; int port;
int.TryParse(split[1], out port); int.TryParse(split[1], out port);
uri = split.Length == 3 uri = split.Length == 3
? new UriBuilder(Uri.UriSchemeHttp, split[0], port, "/" + split[2]) ? new UriBuilder(Uri.UriSchemeHttp, split[0], port, "/" + split[2])
: new UriBuilder(Uri.UriSchemeHttp, split[0], port); : new UriBuilder(Uri.UriSchemeHttp, split[0], port);
} }
else else
{ {
uri = new UriBuilder(Uri.UriSchemeHttp, val); uri = new UriBuilder(Uri.UriSchemeHttp, val);
} }
return uri.Uri; return uri.Uri;
} }
catch (Exception exception) catch (Exception exception)
{ {
throw new Exception(exception.Message, exception); throw new Exception(exception.Message, exception);
} }
} }
/// <summary> /// <summary>
/// Returns the URI. /// Returns the URI.
/// </summary> /// </summary>
/// <param name="val">The value.</param> /// <param name="val">The value.</param>
/// <param name="port">The port.</param> /// <param name="port">The port.</param>
/// <param name="ssl">if set to <c>true</c> [SSL].</param> /// <param name="ssl">if set to <c>true</c> [SSL].</param>
/// <param name="subdir">The subdir.</param> /// <param name="subdir">The subdir.</param>
/// <returns></returns> /// <returns></returns>
/// <exception cref="ApplicationSettingsException">The URI is null, please check your settings to make sure you have configured the applications correctly.</exception> /// <exception cref="ApplicationSettingsException">The URI is null, please check your settings to make sure you have configured the applications correctly.</exception>
/// <exception cref="System.Exception"></exception> /// <exception cref="System.Exception"></exception>
public static Uri ReturnUri(this string val, int port, bool ssl = default(bool)) public static Uri ReturnUri(this string val, int port, bool ssl = default(bool))
{ {
if (val == null) if (val == null)
{ {
throw new ApplicationSettingsException("The URI is null, please check your settings to make sure you have configured the applications correctly."); throw new ApplicationSettingsException("The URI is null, please check your settings to make sure you have configured the applications correctly.");
} }
try try
{ {
var uri = new UriBuilder(); var uri = new UriBuilder();
if (val.StartsWith("http://", StringComparison.Ordinal)) if (val.StartsWith("http://", StringComparison.Ordinal))
{ {
var split = val.Split('/'); var split = val.Split('/');
uri = split.Length >= 4 ? new UriBuilder(Uri.UriSchemeHttp, split[2], port, "/" + split[3]) : new UriBuilder(new Uri($"{val}:{port}")); uri = split.Length >= 4 ? new UriBuilder(Uri.UriSchemeHttp, split[2], port, "/" + split[3]) : new UriBuilder(new Uri($"{val}:{port}"));
} }
else if (val.StartsWith("https://", StringComparison.Ordinal)) else if (val.StartsWith("https://", StringComparison.Ordinal))
{ {
var split = val.Split('/'); var split = val.Split('/');
uri = split.Length >= 4 uri = split.Length >= 4
? new UriBuilder(Uri.UriSchemeHttps, split[2], port, "/" + split[3]) ? new UriBuilder(Uri.UriSchemeHttps, split[2], port, "/" + split[3])
: new UriBuilder(Uri.UriSchemeHttps, split[2], port); : new UriBuilder(Uri.UriSchemeHttps, split[2], port);
} }
else if(ssl) else if(ssl)
{ {
uri = new UriBuilder(Uri.UriSchemeHttps, val, port); uri = new UriBuilder(Uri.UriSchemeHttps, val, port);
} }
else else
{ {
uri = new UriBuilder(Uri.UriSchemeHttp, val, port); uri = new UriBuilder(Uri.UriSchemeHttp, val, port);
} }
return uri.Uri; return uri.Uri;
} }
catch (Exception exception) catch (Exception exception)
{ {
throw new Exception(exception.Message, exception); throw new Exception(exception.Message, exception);
} }
} }
public static Uri ReturnUriWithSubDir(this string val, int port, bool ssl, string subDir) public static Uri ReturnUriWithSubDir(this string val, int port, bool ssl, string subDir)
{ {
var uriBuilder = new UriBuilder(val); var uriBuilder = new UriBuilder(val);
if (ssl) if (ssl)
{ {
uriBuilder.Scheme = Uri.UriSchemeHttps; uriBuilder.Scheme = Uri.UriSchemeHttps;
} }
if (!string.IsNullOrEmpty(subDir)) if (!string.IsNullOrEmpty(subDir))
{ {
uriBuilder.Path = subDir; uriBuilder.Path = subDir;
} }
uriBuilder.Port = port; uriBuilder.Port = port;
return uriBuilder.Uri; return uriBuilder.Uri;
} }
} }
} }

View file

@ -1,37 +1,37 @@
using System.Reflection; using System.Reflection;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following // General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information // set of attributes. Change these attribute values to modify the information
// associated with an assembly. // associated with an assembly.
[assembly: AssemblyTitle("PlexRequests.Services.Tests")] [assembly: AssemblyTitle("PlexRequests.Services.Tests")]
[assembly: AssemblyDescription("")] [assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")] [assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")] [assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("PlexRequests.Services.Tests")] [assembly: AssemblyProduct("PlexRequests.Services.Tests")]
[assembly: AssemblyCopyright("Copyright © 2016")] [assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")] [assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")] [assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible // Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from // to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type. // COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)] [assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM // The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("eaadb4ac-064f-4d3a-aff9-64a33131a9a7")] [assembly: Guid("eaadb4ac-064f-4d3a-aff9-64a33131a9a7")]
// Version information for an assembly consists of the following four values: // Version information for an assembly consists of the following four values:
// //
// Major Version // Major Version
// Minor Version // Minor Version
// Build Number // Build Number
// Revision // Revision
// //
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersionAttribute("1.0.0.0")] [assembly: AssemblyInformationalVersionAttribute("1.0.0.0")]

View file

@ -1,8 +1,8 @@
namespace PlexRequests.Services.Interfaces namespace PlexRequests.Services.Interfaces
{ {
public interface ICouchPotatoCacher public interface ICouchPotatoCacher
{ {
void Queued(); void Queued();
int[] QueuedIds(); int[] QueuedIds();
} }
} }

View file

@ -1,35 +1,35 @@
#region Copyright #region Copyright
// /************************************************************************ // /************************************************************************
// Copyright (c) 2016 Jamie Rees // Copyright (c) 2016 Jamie Rees
// File: IIntervals.cs // File: IIntervals.cs
// Created By: Jamie Rees // Created By: Jamie Rees
// //
// Permission is hereby granted, free of charge, to any person obtaining // Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the // a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including // "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish, // without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to // distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to // permit persons to whom the Software is furnished to do so, subject to
// the following conditions: // the following conditions:
// //
// The above copyright notice and this permission notice shall be // The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software. // included in all copies or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/ // ************************************************************************/
#endregion #endregion
using System; using System;
namespace PlexRequests.Services.Interfaces namespace PlexRequests.Services.Interfaces
{ {
public interface IIntervals public interface IIntervals
{ {
TimeSpan Notification { get; } // notification interval for high load TimeSpan Notification { get; } // notification interval for high load
} }
} }

View file

@ -1,47 +1,47 @@
#region Copyright #region Copyright
// /************************************************************************ // /************************************************************************
// Copyright (c) 2016 Jamie Rees // Copyright (c) 2016 Jamie Rees
// File: INotification.cs // File: INotification.cs
// Created By: Jamie Rees // Created By: Jamie Rees
// //
// Permission is hereby granted, free of charge, to any person obtaining // Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the // a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including // "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish, // without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to // distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to // permit persons to whom the Software is furnished to do so, subject to
// the following conditions: // the following conditions:
// //
// The above copyright notice and this permission notice shall be // The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software. // included in all copies or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/ // ************************************************************************/
#endregion #endregion
using System.Threading.Tasks; using System.Threading.Tasks;
using PlexRequests.Services.Notification; using PlexRequests.Services.Notification;
using PlexRequests.Core.SettingModels; using PlexRequests.Core.SettingModels;
namespace PlexRequests.Services.Interfaces namespace PlexRequests.Services.Interfaces
{ {
public interface INotification public interface INotification
{ {
string NotificationName { get; } string NotificationName { get; }
Task NotifyAsync(NotificationModel model); Task NotifyAsync(NotificationModel model);
/// <summary> /// <summary>
/// Sends a notification to the user, this is usually for testing the settings. /// Sends a notification to the user, this is usually for testing the settings.
/// </summary> /// </summary>
/// <param name="model">The model.</param> /// <param name="model">The model.</param>
/// <param name="settings">The settings.</param> /// <param name="settings">The settings.</param>
/// <returns></returns> /// <returns></returns>
Task NotifyAsync(NotificationModel model, Settings settings); Task NotifyAsync(NotificationModel model, Settings settings);
} }
} }

View file

@ -1,53 +1,53 @@
#region Copyright #region Copyright
// /************************************************************************ // /************************************************************************
// Copyright (c) 2016 Jamie Rees // Copyright (c) 2016 Jamie Rees
// File: INotificationService.cs // File: INotificationService.cs
// Created By: Jamie Rees // Created By: Jamie Rees
// //
// Permission is hereby granted, free of charge, to any person obtaining // Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the // a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including // "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish, // without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to // distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to // permit persons to whom the Software is furnished to do so, subject to
// the following conditions: // the following conditions:
// //
// The above copyright notice and this permission notice shall be // The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software. // included in all copies or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/ // ************************************************************************/
#endregion #endregion
using System.Threading.Tasks; using System.Threading.Tasks;
using PlexRequests.Services.Notification; using PlexRequests.Services.Notification;
using PlexRequests.Core.SettingModels; using PlexRequests.Core.SettingModels;
namespace PlexRequests.Services.Interfaces namespace PlexRequests.Services.Interfaces
{ {
public interface INotificationService public interface INotificationService
{ {
/// <summary> /// <summary>
/// Sends a notification to the user. This one is used in normal notification scenarios /// Sends a notification to the user. This one is used in normal notification scenarios
/// </summary> /// </summary>
/// <param name="model">The model.</param> /// <param name="model">The model.</param>
/// <returns></returns> /// <returns></returns>
Task Publish(NotificationModel model); Task Publish(NotificationModel model);
/// <summary> /// <summary>
/// Sends a notification to the user, this is usually for testing the settings. /// Sends a notification to the user, this is usually for testing the settings.
/// </summary> /// </summary>
/// <param name="model">The model.</param> /// <param name="model">The model.</param>
/// <param name="settings">The settings.</param> /// <param name="settings">The settings.</param>
/// <returns></returns> /// <returns></returns>
Task Publish(NotificationModel model, Settings settings); Task Publish(NotificationModel model, Settings settings);
void Subscribe(INotification notification); void Subscribe(INotification notification);
void UnSubscribe(INotification notification); void UnSubscribe(INotification notification);
} }
} }

View file

@ -1,104 +1,104 @@
#region Copyright #region Copyright
// /************************************************************************ // /************************************************************************
// Copyright (c) 2016 Jamie Rees // Copyright (c) 2016 Jamie Rees
// File: NotificationService.cs // File: NotificationService.cs
// Created By: Jamie Rees // Created By: Jamie Rees
// //
// Permission is hereby granted, free of charge, to any person obtaining // Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the // a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including // "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish, // without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to // distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to // permit persons to whom the Software is furnished to do so, subject to
// the following conditions: // the following conditions:
// //
// The above copyright notice and this permission notice shall be // The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software. // included in all copies or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/ // ************************************************************************/
#endregion #endregion
using System; using System;
using System.Collections.Concurrent; using System.Collections.Concurrent;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using NLog; using NLog;
using PlexRequests.Services.Interfaces; using PlexRequests.Services.Interfaces;
using PlexRequests.Core.SettingModels; using PlexRequests.Core.SettingModels;
namespace PlexRequests.Services.Notification namespace PlexRequests.Services.Notification
{ {
public class NotificationService : INotificationService public class NotificationService : INotificationService
{ {
private static Logger Log = LogManager.GetCurrentClassLogger(); private static Logger Log = LogManager.GetCurrentClassLogger();
public ConcurrentDictionary<string, INotification> Observers { get; } = new ConcurrentDictionary<string, INotification>(); public ConcurrentDictionary<string, INotification> Observers { get; } = new ConcurrentDictionary<string, INotification>();
/// <summary> /// <summary>
/// Sends a notification to the user. This one is used in normal notification scenarios /// Sends a notification to the user. This one is used in normal notification scenarios
/// </summary> /// </summary>
/// <param name="model">The model.</param> /// <param name="model">The model.</param>
/// <returns></returns> /// <returns></returns>
public async Task Publish(NotificationModel model) public async Task Publish(NotificationModel model)
{ {
var notificationTasks = Observers.Values.Select(notification => NotifyAsync(notification, model)); var notificationTasks = Observers.Values.Select(notification => NotifyAsync(notification, model));
await Task.WhenAll(notificationTasks).ConfigureAwait(false); await Task.WhenAll(notificationTasks).ConfigureAwait(false);
} }
/// <summary> /// <summary>
/// Sends a notification to the user, this is usually for testing the settings. /// Sends a notification to the user, this is usually for testing the settings.
/// </summary> /// </summary>
/// <param name="model">The model.</param> /// <param name="model">The model.</param>
/// <param name="settings">The settings.</param> /// <param name="settings">The settings.</param>
/// <returns></returns> /// <returns></returns>
public async Task Publish(NotificationModel model, Settings settings) public async Task Publish(NotificationModel model, Settings settings)
{ {
var notificationTasks = Observers.Values.Select(notification => NotifyAsync(notification, model, settings)); var notificationTasks = Observers.Values.Select(notification => NotifyAsync(notification, model, settings));
await Task.WhenAll(notificationTasks).ConfigureAwait(false); await Task.WhenAll(notificationTasks).ConfigureAwait(false);
} }
public void Subscribe(INotification notification) public void Subscribe(INotification notification)
{ {
Observers.TryAdd(notification.NotificationName, notification); Observers.TryAdd(notification.NotificationName, notification);
} }
public void UnSubscribe(INotification notification) public void UnSubscribe(INotification notification)
{ {
Observers.TryRemove(notification.NotificationName, out notification); Observers.TryRemove(notification.NotificationName, out notification);
} }
private async Task NotifyAsync(INotification notification, NotificationModel model) private async Task NotifyAsync(INotification notification, NotificationModel model)
{ {
try try
{ {
await notification.NotifyAsync(model).ConfigureAwait(false); await notification.NotifyAsync(model).ConfigureAwait(false);
} }
catch (Exception ex) catch (Exception ex)
{ {
Log.Error(ex, $"Notification '{notification.NotificationName}' failed with exception"); Log.Error(ex, $"Notification '{notification.NotificationName}' failed with exception");
} }
} }
private async Task NotifyAsync(INotification notification, NotificationModel model, Settings settings) private async Task NotifyAsync(INotification notification, NotificationModel model, Settings settings)
{ {
try try
{ {
await notification.NotifyAsync(model, settings).ConfigureAwait(false); await notification.NotifyAsync(model, settings).ConfigureAwait(false);
} }
catch (Exception ex) catch (Exception ex)
{ {
Log.Error(ex, $"Notification '{notification.NotificationName}' failed with exception"); Log.Error(ex, $"Notification '{notification.NotificationName}' failed with exception");
} }
} }
} }
} }

View file

@ -1,37 +1,37 @@
using System.Reflection; using System.Reflection;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following // General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information // set of attributes. Change these attribute values to modify the information
// associated with an assembly. // associated with an assembly.
[assembly: AssemblyTitle("PlexRequests.Services")] [assembly: AssemblyTitle("PlexRequests.Services")]
[assembly: AssemblyDescription("")] [assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")] [assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")] [assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("PlexRequests.Services")] [assembly: AssemblyProduct("PlexRequests.Services")]
[assembly: AssemblyCopyright("Copyright © 2016")] [assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")] [assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")] [assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible // Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from // to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type. // COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)] [assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM // The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("566efa49-68f8-4716-9693-a6b3f2624dea")] [assembly: Guid("566efa49-68f8-4716-9693-a6b3f2624dea")]
// Version information for an assembly consists of the following four values: // Version information for an assembly consists of the following four values:
// //
// Major Version // Major Version
// Minor Version // Minor Version
// Build Number // Build Number
// Revision // Revision
// //
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersionAttribute("1.0.0.0")] [assembly: AssemblyInformationalVersionAttribute("1.0.0.0")]

View file

@ -1,102 +1,102 @@
#region Copyright #region Copyright
// *********************************************************************** // ***********************************************************************
// Copyright (c) 2016 Jamie Rees // Copyright (c) 2016 Jamie Rees
// File: DbConfiguration.cs // File: DbConfiguration.cs
// Created By: Jamie Rees // Created By: Jamie Rees
// //
// Permission is hereby granted, free of charge, to any person obtaining // Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the // a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including // "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish, // without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to // distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to // permit persons to whom the Software is furnished to do so, subject to
// the following conditions: // the following conditions:
// //
// The above copyright notice and this permission notice shall be // The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software. // included in all copies or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// *********************************************************************** // ***********************************************************************
using System.Globalization; using System.Globalization;
#endregion #endregion
using System; using System;
using System.Data; using System.Data;
using System.IO; using System.IO;
using System.Windows.Forms; using System.Windows.Forms;
using Mono.Data.Sqlite; using Mono.Data.Sqlite;
using NLog; using NLog;
namespace PlexRequests.Store namespace PlexRequests.Store
{ {
public class DbConfiguration : ISqliteConfiguration public class DbConfiguration : ISqliteConfiguration
{ {
private static Logger Log = LogManager.GetCurrentClassLogger(); private static Logger Log = LogManager.GetCurrentClassLogger();
public DbConfiguration(SqliteFactory provider) public DbConfiguration(SqliteFactory provider)
{ {
Factory = provider; Factory = provider;
} }
private SqliteFactory Factory { get; } private SqliteFactory Factory { get; }
public string CurrentPath =>Path.Combine(Path.GetDirectoryName(Application.ExecutablePath) ?? string.Empty, DbFile); public string CurrentPath =>Path.Combine(Path.GetDirectoryName(Application.ExecutablePath) ?? string.Empty, DbFile);
public virtual bool CheckDb() public virtual bool CheckDb()
{ {
Log.Trace("Checking DB"); Log.Trace("Checking DB");
Console.WriteLine("Location of the database: {0}",CurrentPath); Console.WriteLine("Location of the database: {0}",CurrentPath);
if (!File.Exists(CurrentPath)) if (!File.Exists(CurrentPath))
{ {
Log.Trace("DB doesn't exist, creating a new one"); Log.Trace("DB doesn't exist, creating a new one");
CreateDatabase(); CreateDatabase();
return true; return true;
} }
return false; return false;
} }
public const string DbFile = "PlexRequests.sqlite"; public const string DbFile = "PlexRequests.sqlite";
/// <summary> /// <summary>
/// Gets the database connection. /// Gets the database connection.
/// </summary> /// </summary>
/// <returns><see cref="IDbConnection"/></returns> /// <returns><see cref="IDbConnection"/></returns>
/// <exception cref="System.Exception">Factory returned null</exception> /// <exception cref="System.Exception">Factory returned null</exception>
public virtual IDbConnection DbConnection() public virtual IDbConnection DbConnection()
{ {
var fact = Factory.CreateConnection(); var fact = Factory.CreateConnection();
if (fact == null) if (fact == null)
{ {
throw new SqliteException("Factory returned null"); throw new SqliteException("Factory returned null");
} }
fact.ConnectionString = "Data Source=" + CurrentPath; fact.ConnectionString = "Data Source=" + CurrentPath;
return fact; return fact;
} }
/// <summary> /// <summary>
/// Create the database file. /// Create the database file.
/// </summary> /// </summary>
public virtual void CreateDatabase() public virtual void CreateDatabase()
{ {
try try
{ {
using (File.Create(CurrentPath)) using (File.Create(CurrentPath))
{ {
} }
} }
catch (Exception e) catch (Exception e)
{ {
Log.Error(e); Log.Error(e);
} }
} }
} }
} }

View file

@ -1,36 +1,36 @@
#region Copyright #region Copyright
// /************************************************************************ // /************************************************************************
// Copyright (c) 2016 Jamie Rees // Copyright (c) 2016 Jamie Rees
// File: Entity.cs // File: Entity.cs
// Created By: Jamie Rees // Created By: Jamie Rees
// //
// Permission is hereby granted, free of charge, to any person obtaining // Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the // a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including // "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish, // without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to // distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to // permit persons to whom the Software is furnished to do so, subject to
// the following conditions: // the following conditions:
// //
// The above copyright notice and this permission notice shall be // The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software. // included in all copies or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/ // ************************************************************************/
#endregion #endregion
using Dapper.Contrib.Extensions; using Dapper.Contrib.Extensions;
namespace PlexRequests.Store namespace PlexRequests.Store
{ {
public class Entity public class Entity
{ {
[Key] [Key]
public int Id { get; set; } public int Id { get; set; }
} }
} }

View file

@ -1,53 +1,53 @@
#region Copyright #region Copyright
// *********************************************************************** // ***********************************************************************
// Copyright (c) 2016 Jamie Rees // Copyright (c) 2016 Jamie Rees
// File: ISqliteConfiguration.cs // File: ISqliteConfiguration.cs
// Created By: Jamie Rees // Created By: Jamie Rees
// //
// Permission is hereby granted, free of charge, to any person obtaining // Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the // a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including // "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish, // without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to // distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to // permit persons to whom the Software is furnished to do so, subject to
// the following conditions: // the following conditions:
// //
// The above copyright notice and this permission notice shall be // The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software. // included in all copies or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// *********************************************************************** // ***********************************************************************
#endregion #endregion
using System.Data; using System.Data;
namespace PlexRequests.Store namespace PlexRequests.Store
{ {
public interface ISqliteConfiguration public interface ISqliteConfiguration
{ {
/// <summary> /// <summary>
/// Checks the database. /// Checks the database.
/// </summary> /// </summary>
bool CheckDb(); bool CheckDb();
/// <summary> /// <summary>
/// Returns the database connection. /// Returns the database connection.
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
IDbConnection DbConnection(); IDbConnection DbConnection();
/// <summary> /// <summary>
/// Creates the database. /// Creates the database.
/// </summary> /// </summary>
void CreateDatabase(); void CreateDatabase();
string CurrentPath { get; } string CurrentPath { get; }
} }
} }

View file

@ -1,39 +1,39 @@
#region Copyright #region Copyright
// /************************************************************************ // /************************************************************************
// Copyright (c) 2016 Jamie Rees // Copyright (c) 2016 Jamie Rees
// File: GlobalSettings.cs // File: GlobalSettings.cs
// Created By: Jamie Rees // Created By: Jamie Rees
// //
// Permission is hereby granted, free of charge, to any person obtaining // Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the // a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including // "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish, // without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to // distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to // permit persons to whom the Software is furnished to do so, subject to
// the following conditions: // the following conditions:
// //
// The above copyright notice and this permission notice shall be // The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software. // included in all copies or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/ // ************************************************************************/
#endregion #endregion
using Dapper.Contrib.Extensions; using Dapper.Contrib.Extensions;
namespace PlexRequests.Store.Models namespace PlexRequests.Store.Models
{ {
[Table("GlobalSettings")] [Table("GlobalSettings")]
public class GlobalSettings : Entity public class GlobalSettings : Entity
{ {
public string Content { get; set; } public string Content { get; set; }
public string SettingsName { get; set; } public string SettingsName { get; set; }
} }
} }

View file

@ -1,47 +1,47 @@
#region Copyright #region Copyright
// /************************************************************************ // /************************************************************************
// Copyright (c) 2016 Jamie Rees // Copyright (c) 2016 Jamie Rees
// File: LogEntity.cs // File: LogEntity.cs
// Created By: Jamie Rees // Created By: Jamie Rees
// //
// Permission is hereby granted, free of charge, to any person obtaining // Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the // a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including // "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish, // without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to // distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to // permit persons to whom the Software is furnished to do so, subject to
// the following conditions: // the following conditions:
// //
// The above copyright notice and this permission notice shall be // The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software. // included in all copies or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/ // ************************************************************************/
#endregion #endregion
using System; using System;
using Dapper.Contrib.Extensions; using Dapper.Contrib.Extensions;
using Newtonsoft.Json; using Newtonsoft.Json;
namespace PlexRequests.Store.Models namespace PlexRequests.Store.Models
{ {
[Table("Logs")] [Table("Logs")]
public class LogEntity : Entity public class LogEntity : Entity
{ {
public DateTime Date { get; set; } public DateTime Date { get; set; }
public string Level { get; set; } public string Level { get; set; }
public string Logger { get; set; } public string Logger { get; set; }
public string Message { get; set; } public string Message { get; set; }
public string Callsite { get; set; } public string Callsite { get; set; }
public string Exception { get; set; } public string Exception { get; set; }
[JsonIgnore] [JsonIgnore]
public string DateString { get; set; } public string DateString { get; set; }
} }
} }

View file

@ -1,39 +1,39 @@
#region Copyright #region Copyright
// /************************************************************************ // /************************************************************************
// Copyright (c) 2016 Jamie Rees // Copyright (c) 2016 Jamie Rees
// File: RequestBlobs.cs // File: RequestBlobs.cs
// Created By: Jamie Rees // Created By: Jamie Rees
// //
// Permission is hereby granted, free of charge, to any person obtaining // Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the // a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including // "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish, // without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to // distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to // permit persons to whom the Software is furnished to do so, subject to
// the following conditions: // the following conditions:
// //
// The above copyright notice and this permission notice shall be // The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software. // included in all copies or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/ // ************************************************************************/
#endregion #endregion
using Dapper.Contrib.Extensions; using Dapper.Contrib.Extensions;
namespace PlexRequests.Store.Models namespace PlexRequests.Store.Models
{ {
[Table("RequestBlobs")] [Table("RequestBlobs")]
public class RequestBlobs : Entity public class RequestBlobs : Entity
{ {
public int ProviderId { get; set; } public int ProviderId { get; set; }
public byte[] Content { get; set; } public byte[] Content { get; set; }
public RequestType Type { get; set; } public RequestType Type { get; set; }
public string MusicId { get; set; } public string MusicId { get; set; }
} }
} }

View file

@ -1,37 +1,37 @@
using System.Reflection; using System.Reflection;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following // General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information // set of attributes. Change these attribute values to modify the information
// associated with an assembly. // associated with an assembly.
[assembly: AssemblyTitle("PlexRequests.Store")] [assembly: AssemblyTitle("PlexRequests.Store")]
[assembly: AssemblyDescription("")] [assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")] [assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")] [assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("PlexRequests.Store")] [assembly: AssemblyProduct("PlexRequests.Store")]
[assembly: AssemblyCopyright("Copyright © 2016")] [assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")] [assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")] [assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible // Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from // to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type. // COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)] [assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM // The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("92433867-2b7b-477b-a566-96c382427525")] [assembly: Guid("92433867-2b7b-477b-a566-96c382427525")]
// Version information for an assembly consists of the following four values: // Version information for an assembly consists of the following four values:
// //
// Major Version // Major Version
// Minor Version // Minor Version
// Build Number // Build Number
// Revision // Revision
// //
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersionAttribute("1.0.0.0")] [assembly: AssemblyInformationalVersionAttribute("1.0.0.0")]

View file

@ -1,77 +1,77 @@
#region Copyright #region Copyright
// /************************************************************************ // /************************************************************************
// Copyright (c) 2016 Jamie Rees // Copyright (c) 2016 Jamie Rees
// File: ISettingsRepository.cs // File: ISettingsRepository.cs
// Created By: Jamie Rees // Created By: Jamie Rees
// //
// Permission is hereby granted, free of charge, to any person obtaining // Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the // a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including // "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish, // without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to // distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to // permit persons to whom the Software is furnished to do so, subject to
// the following conditions: // the following conditions:
// //
// The above copyright notice and this permission notice shall be // The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software. // included in all copies or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/ // ************************************************************************/
#endregion #endregion
using System.Collections.Generic; using System.Collections.Generic;
using System.Threading.Tasks; using System.Threading.Tasks;
using PlexRequests.Store.Models; using PlexRequests.Store.Models;
namespace PlexRequests.Store.Repository namespace PlexRequests.Store.Repository
{ {
public interface IRequestRepository public interface IRequestRepository
{ {
/// <summary> /// <summary>
/// Inserts the specified entity. /// Inserts the specified entity.
/// </summary> /// </summary>
/// <param name="entity">The entity.</param> /// <param name="entity">The entity.</param>
long Insert(RequestBlobs entity); long Insert(RequestBlobs entity);
Task<int> InsertAsync(RequestBlobs entity); Task<int> InsertAsync(RequestBlobs entity);
/// <summary> /// <summary>
/// Gets all. /// Gets all.
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
IEnumerable<RequestBlobs> GetAll(); IEnumerable<RequestBlobs> GetAll();
Task<IEnumerable<RequestBlobs>> GetAllAsync(); Task<IEnumerable<RequestBlobs>> GetAllAsync();
RequestBlobs Get(int id); RequestBlobs Get(int id);
Task<RequestBlobs> GetAsync(int id); Task<RequestBlobs> GetAsync(int id);
/// <summary> /// <summary>
/// Deletes the specified entity. /// Deletes the specified entity.
/// </summary> /// </summary>
/// <param name="entity">The entity.</param> /// <param name="entity">The entity.</param>
/// <returns></returns> /// <returns></returns>
bool Delete(RequestBlobs entity); bool Delete(RequestBlobs entity);
Task<bool> DeleteAsync(RequestBlobs entity); Task<bool> DeleteAsync(RequestBlobs entity);
bool DeleteAll(IEnumerable<RequestBlobs> entity); bool DeleteAll(IEnumerable<RequestBlobs> entity);
Task<bool> DeleteAllAsync(IEnumerable<RequestBlobs> entity); Task<bool> DeleteAllAsync(IEnumerable<RequestBlobs> entity);
/// <summary> /// <summary>
/// Updates the specified entity. /// Updates the specified entity.
/// </summary> /// </summary>
/// <param name="entity">The entity.</param> /// <param name="entity">The entity.</param>
/// <returns></returns> /// <returns></returns>
bool Update(RequestBlobs entity); bool Update(RequestBlobs entity);
Task<bool> UpdateAsync(RequestBlobs entity); Task<bool> UpdateAsync(RequestBlobs entity);
bool UpdateAll(IEnumerable<RequestBlobs> entity); bool UpdateAll(IEnumerable<RequestBlobs> entity);
Task<bool> UpdateAllAsync(IEnumerable<RequestBlobs> entity); Task<bool> UpdateAllAsync(IEnumerable<RequestBlobs> entity);
} }
} }

View file

@ -1,75 +1,75 @@
#region Copyright #region Copyright
// /************************************************************************ // /************************************************************************
// Copyright (c) 2016 Jamie Rees // Copyright (c) 2016 Jamie Rees
// File: ISettingsRepository.cs // File: ISettingsRepository.cs
// Created By: Jamie Rees // Created By: Jamie Rees
// //
// Permission is hereby granted, free of charge, to any person obtaining // Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the // a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including // "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish, // without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to // distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to // permit persons to whom the Software is furnished to do so, subject to
// the following conditions: // the following conditions:
// //
// The above copyright notice and this permission notice shall be // The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software. // included in all copies or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/ // ************************************************************************/
#endregion #endregion
using System.Collections.Generic; using System.Collections.Generic;
using System.Threading.Tasks; using System.Threading.Tasks;
using PlexRequests.Store.Models; using PlexRequests.Store.Models;
namespace PlexRequests.Store.Repository namespace PlexRequests.Store.Repository
{ {
public interface ISettingsRepository public interface ISettingsRepository
{ {
/// <summary> /// <summary>
/// Inserts the specified entity. /// Inserts the specified entity.
/// </summary> /// </summary>
/// <param name="entity">The entity.</param> /// <param name="entity">The entity.</param>
long Insert(GlobalSettings entity); long Insert(GlobalSettings entity);
Task<int> InsertAsync(GlobalSettings entity); Task<int> InsertAsync(GlobalSettings entity);
/// <summary> /// <summary>
/// Gets all. /// Gets all.
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
IEnumerable<GlobalSettings> GetAll(); IEnumerable<GlobalSettings> GetAll();
Task<IEnumerable<GlobalSettings>> GetAllAsync(); Task<IEnumerable<GlobalSettings>> GetAllAsync();
/// <summary> /// <summary>
/// Gets the specified identifier. /// Gets the specified identifier.
/// </summary> /// </summary>
/// <param name="settingsName">Name of the settings.</param> /// <param name="settingsName">Name of the settings.</param>
/// <returns></returns> /// <returns></returns>
GlobalSettings Get(string settingsName); GlobalSettings Get(string settingsName);
Task<GlobalSettings> GetAsync(string settingsName); Task<GlobalSettings> GetAsync(string settingsName);
/// <summary> /// <summary>
/// Deletes the specified entity. /// Deletes the specified entity.
/// </summary> /// </summary>
/// <param name="entity">The entity.</param> /// <param name="entity">The entity.</param>
/// <returns></returns> /// <returns></returns>
Task<bool> DeleteAsync(GlobalSettings entity); Task<bool> DeleteAsync(GlobalSettings entity);
bool Delete(GlobalSettings entity); bool Delete(GlobalSettings entity);
/// <summary> /// <summary>
/// Updates the specified entity. /// Updates the specified entity.
/// </summary> /// </summary>
/// <param name="entity">The entity.</param> /// <param name="entity">The entity.</param>
/// <returns></returns> /// <returns></returns>
Task<bool> UpdateAsync(GlobalSettings entity); Task<bool> UpdateAsync(GlobalSettings entity);
bool Update(GlobalSettings entity); bool Update(GlobalSettings entity);
} }
} }

View file

@ -1,91 +1,91 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by a tool. // This code was generated by a tool.
// Runtime Version:4.0.30319.42000 // Runtime Version:4.0.30319.42000
// //
// Changes to this file may cause incorrect behavior and will be lost if // Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated. // the code is regenerated.
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
namespace PlexRequests.Store { namespace PlexRequests.Store {
using System; using System;
/// <summary> /// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc. /// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary> /// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder // This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio. // class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen // To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project. // with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Sql { internal class Sql {
private static global::System.Resources.ResourceManager resourceMan; private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture; private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Sql() { internal Sql() {
} }
/// <summary> /// <summary>
/// Returns the cached ResourceManager instance used by this class. /// Returns the cached ResourceManager instance used by this class.
/// </summary> /// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager { internal static global::System.Resources.ResourceManager ResourceManager {
get { get {
if (object.ReferenceEquals(resourceMan, null)) { if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("PlexRequests.Store.Sql", typeof(Sql).Assembly); global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("PlexRequests.Store.Sql", typeof(Sql).Assembly);
resourceMan = temp; resourceMan = temp;
} }
return resourceMan; return resourceMan;
} }
} }
/// <summary> /// <summary>
/// Overrides the current thread's CurrentUICulture property for all /// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class. /// resource lookups using this strongly typed resource class.
/// </summary> /// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture { internal static global::System.Globalization.CultureInfo Culture {
get { get {
return resourceCulture; return resourceCulture;
} }
set { set {
resourceCulture = value; resourceCulture = value;
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to --Any DB changes need to be made in this file. /// Looks up a localized string similar to --Any DB changes need to be made in this file.
/// ///
///CREATE TABLE IF NOT EXISTS User ///CREATE TABLE IF NOT EXISTS User
///( ///(
/// Id INTEGER PRIMARY KEY AUTOINCREMENT, /// Id INTEGER PRIMARY KEY AUTOINCREMENT,
/// User varchar(50) NOT NULL , /// User varchar(50) NOT NULL ,
/// UserName varchar(50) NOT NULL, /// UserName varchar(50) NOT NULL,
/// Password varchar(100) NOT NULL /// Password varchar(100) NOT NULL
///); ///);
/// ///
///CREATE TABLE IF NOT EXISTS Settings ///CREATE TABLE IF NOT EXISTS Settings
///( ///(
/// Id INTEGER PRIMARY KEY AUTOINCREMENT, /// Id INTEGER PRIMARY KEY AUTOINCREMENT,
/// Port INTEGER NOT NULL, /// Port INTEGER NOT NULL,
/// UserAuthentication INTEGER NOT NULL, /// UserAuthentication INTEGER NOT NULL,
/// PlexAuthToken varchar(50) /// PlexAuthToken varchar(50)
///); ///);
/// ///
///CREATE TABLE IF NOT EXISTS Requested ///CREATE TABLE IF NOT EXISTS Requested
///( [rest of string was truncated]&quot;;. ///( [rest of string was truncated]&quot;;.
/// </summary> /// </summary>
internal static string SqlTables { internal static string SqlTables {
get { get {
return ResourceManager.GetString("SqlTables", resourceCulture); return ResourceManager.GetString("SqlTables", resourceCulture);
} }
} }
} }
} }

View file

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

View file

@ -1,39 +1,39 @@
#region Copyright #region Copyright
// /************************************************************************ // /************************************************************************
// Copyright (c) 2016 Jamie Rees // Copyright (c) 2016 Jamie Rees
// File: UserEntity.cs // File: UserEntity.cs
// Created By: Jamie Rees // Created By: Jamie Rees
// //
// Permission is hereby granted, free of charge, to any person obtaining // Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the // a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including // "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish, // without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to // distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to // permit persons to whom the Software is furnished to do so, subject to
// the following conditions: // the following conditions:
// //
// The above copyright notice and this permission notice shall be // The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software. // included in all copies or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/ // ************************************************************************/
#endregion #endregion
using Dapper.Contrib.Extensions; using Dapper.Contrib.Extensions;
namespace PlexRequests.Store namespace PlexRequests.Store
{ {
public class UserEntity public class UserEntity
{ {
[Key] [Key]
public int Id { get; set; } public int Id { get; set; }
public string UserName { get; set; } public string UserName { get; set; }
public string UserGuid { get; set; } public string UserGuid { get; set; }
} }
} }

View file

@ -1,45 +1,45 @@
#region Copyright #region Copyright
// /************************************************************************ // /************************************************************************
// Copyright (c) 2016 Jamie Rees // Copyright (c) 2016 Jamie Rees
// File: BootstrapperExtensions.cs // File: BootstrapperExtensions.cs
// Created By: Jamie Rees // Created By: Jamie Rees
// //
// Permission is hereby granted, free of charge, to any person obtaining // Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the // a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including // "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish, // without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to // distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to // permit persons to whom the Software is furnished to do so, subject to
// the following conditions: // the following conditions:
// //
// The above copyright notice and this permission notice shall be // The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software. // included in all copies or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/ // ************************************************************************/
#endregion #endregion
using System.Collections.Generic; using System.Collections.Generic;
using Nancy.Bootstrapper; using Nancy.Bootstrapper;
using Nancy.Session; using Nancy.Session;
namespace PlexRequests.UI.Tests namespace PlexRequests.UI.Tests
{ {
public static class BootstrapperExtensions public static class BootstrapperExtensions
{ {
public static void WithSession(this IPipelines pipeline, IDictionary<string, object> session) public static void WithSession(this IPipelines pipeline, IDictionary<string, object> session)
{ {
pipeline.BeforeRequest.AddItemToEndOfPipeline(ctx => pipeline.BeforeRequest.AddItemToEndOfPipeline(ctx =>
{ {
ctx.Request.Session = new Session(session); ctx.Request.Session = new Session(session);
return null; return null;
}); });
} }
} }
} }

View file

@ -1,36 +1,36 @@
using System.Reflection; using System.Reflection;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following // General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information // set of attributes. Change these attribute values to modify the information
// associated with an assembly. // associated with an assembly.
[assembly: AssemblyTitle("PlexRequests.UI.Tests")] [assembly: AssemblyTitle("PlexRequests.UI.Tests")]
[assembly: AssemblyDescription("")] [assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")] [assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")] [assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("PlexRequests.UI.Tests")] [assembly: AssemblyProduct("PlexRequests.UI.Tests")]
[assembly: AssemblyCopyright("Copyright © 2016")] [assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")] [assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")] [assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible // Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from // to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type. // COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)] [assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM // The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("a930e2cf-79e2-45f9-b06a-9a719a254ce4")] [assembly: Guid("a930e2cf-79e2-45f9-b06a-9a719a254ce4")]
// Version information for an assembly consists of the following four values: // Version information for an assembly consists of the following four values:
// //
// Major Version // Major Version
// Minor Version // Minor Version
// Build Number // Build Number
// Revision // Revision
// //
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]

View file

@ -1,64 +1,64 @@
#region Copyright #region Copyright
// /************************************************************************ // /************************************************************************
// Copyright (c) 2016 Jamie Rees // Copyright (c) 2016 Jamie Rees
// File: TestRootPathProvider.cs // File: TestRootPathProvider.cs
// Created By: Jamie Rees // Created By: Jamie Rees
// //
// Permission is hereby granted, free of charge, to any person obtaining // Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the // a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including // "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish, // without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to // distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to // permit persons to whom the Software is furnished to do so, subject to
// the following conditions: // the following conditions:
// //
// The above copyright notice and this permission notice shall be // The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software. // included in all copies or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/ // ************************************************************************/
#endregion #endregion
using System; using System;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using Nancy; using Nancy;
namespace PlexRequests.UI.Tests namespace PlexRequests.UI.Tests
{ {
public class TestRootPathProvider : IRootPathProvider public class TestRootPathProvider : IRootPathProvider
{ {
private static string _CachedRootPath; private static string _CachedRootPath;
public string GetRootPath() public string GetRootPath()
{ {
if (!string.IsNullOrEmpty(_CachedRootPath)) if (!string.IsNullOrEmpty(_CachedRootPath))
return _CachedRootPath; return _CachedRootPath;
var currentDirectory = new DirectoryInfo(Environment.CurrentDirectory); var currentDirectory = new DirectoryInfo(Environment.CurrentDirectory);
bool rootPathFound = false; bool rootPathFound = false;
while (!rootPathFound) while (!rootPathFound)
{ {
var directoriesContainingViewFolder = currentDirectory.GetDirectories( var directoriesContainingViewFolder = currentDirectory.GetDirectories(
"Views", SearchOption.AllDirectories); "Views", SearchOption.AllDirectories);
if (directoriesContainingViewFolder.Any()) if (directoriesContainingViewFolder.Any())
{ {
_CachedRootPath = directoriesContainingViewFolder.First().FullName; _CachedRootPath = directoriesContainingViewFolder.First().FullName;
rootPathFound = true; rootPathFound = true;
} }
currentDirectory = currentDirectory.Parent; currentDirectory = currentDirectory.Parent;
} }
return _CachedRootPath; return _CachedRootPath;
} }
} }
} }

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1,24 +1,24 @@
$primary-colour: rgb(255, 164, 0); $primary-colour: rgb(255, 164, 0);
.pace { .pace {
-webkit-pointer-events: none; -webkit-pointer-events: none;
pointer-events: none; pointer-events: none;
-webkit-user-select: none; -webkit-user-select: none;
-moz-user-select: none; -moz-user-select: none;
user-select: none; user-select: none;
} }
.pace-inactive { .pace-inactive {
display: none; display: none;
} }
.pace .pace-progress { .pace .pace-progress {
background: $primary-colour; background: $primary-colour;
position: fixed; position: fixed;
z-index: 2000; z-index: 2000;
top: 0; top: 0;
right: 100%; right: 100%;
width: 100%; width: 100%;
height: 2px; height: 2px;
} }

View file

@ -1,176 +1,176 @@
#region Copyright #region Copyright
// /************************************************************************ // /************************************************************************
// Copyright (c) 2016 Jamie Rees // Copyright (c) 2016 Jamie Rees
// File: HeadphonesSender.cs // File: HeadphonesSender.cs
// Created By: Jamie Rees // Created By: Jamie Rees
// //
// Permission is hereby granted, free of charge, to any person obtaining // Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the // a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including // "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish, // without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to // distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to // permit persons to whom the Software is furnished to do so, subject to
// the following conditions: // the following conditions:
// //
// The above copyright notice and this permission notice shall be // The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software. // included in all copies or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/ // ************************************************************************/
#endregion #endregion
using System.Linq; using System.Linq;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using NLog; using NLog;
using PlexRequests.Api.Interfaces; using PlexRequests.Api.Interfaces;
using PlexRequests.Core; using PlexRequests.Core;
using PlexRequests.Core.SettingModels; using PlexRequests.Core.SettingModels;
using PlexRequests.Store; using PlexRequests.Store;
namespace PlexRequests.UI.Helpers namespace PlexRequests.UI.Helpers
{ {
public class HeadphonesSender public class HeadphonesSender
{ {
public HeadphonesSender(IHeadphonesApi api, HeadphonesSettings settings, IRequestService request) public HeadphonesSender(IHeadphonesApi api, HeadphonesSettings settings, IRequestService request)
{ {
Api = api; Api = api;
Settings = settings; Settings = settings;
RequestService = request; RequestService = request;
} }
private int WaitTime => 2000; private int WaitTime => 2000;
private int CounterMax => 60; private int CounterMax => 60;
private static readonly Logger Log = LogManager.GetCurrentClassLogger(); private static readonly Logger Log = LogManager.GetCurrentClassLogger();
private IHeadphonesApi Api { get; } private IHeadphonesApi Api { get; }
private IRequestService RequestService { get; } private IRequestService RequestService { get; }
private HeadphonesSettings Settings { get; } private HeadphonesSettings Settings { get; }
public async Task<bool> AddAlbum(RequestedModel request) public async Task<bool> AddAlbum(RequestedModel request)
{ {
var addArtistResult = await AddArtist(request); var addArtistResult = await AddArtist(request);
if (!addArtistResult) if (!addArtistResult)
{ {
return false; return false;
} }
// Artist is now active // Artist is now active
// Add album // Add album
var albumResult = await Api.AddAlbum(Settings.ApiKey, Settings.FullUri, request.MusicBrainzId); var albumResult = await Api.AddAlbum(Settings.ApiKey, Settings.FullUri, request.MusicBrainzId);
if (!albumResult) if (!albumResult)
{ {
Log.Error("Couldn't add the album to headphones"); Log.Error("Couldn't add the album to headphones");
} }
// Set the status to wanted and search // Set the status to wanted and search
var status = await SetAlbumStatus(request); var status = await SetAlbumStatus(request);
if (!status) if (!status)
{ {
return false; return false;
} }
// Approve it // Approve it
request.Approved = true; request.Approved = true;
// Update the record // Update the record
var updated = RequestService.UpdateRequest(request); var updated = RequestService.UpdateRequest(request);
return updated; return updated;
} }
private async Task<bool> AddArtist(RequestedModel request) private async Task<bool> AddArtist(RequestedModel request)
{ {
var index = await Api.GetIndex(Settings.ApiKey, Settings.FullUri); var index = await Api.GetIndex(Settings.ApiKey, Settings.FullUri);
var artistExists = index.Any(x => x.ArtistID == request.ArtistId); var artistExists = index.Any(x => x.ArtistID == request.ArtistId);
if (!artistExists) if (!artistExists)
{ {
var artistAdd = Api.AddArtist(Settings.ApiKey, Settings.FullUri, request.ArtistId); var artistAdd = Api.AddArtist(Settings.ApiKey, Settings.FullUri, request.ArtistId);
Log.Info("Artist add result : {0}", artistAdd); Log.Info("Artist add result : {0}", artistAdd);
} }
var counter = 0; var counter = 0;
while (index.All(x => x.ArtistID != request.ArtistId)) while (index.All(x => x.ArtistID != request.ArtistId))
{ {
Thread.Sleep(WaitTime); Thread.Sleep(WaitTime);
counter++; counter++;
Log.Trace("Artist is still not present in the index. Counter = {0}", counter); Log.Trace("Artist is still not present in the index. Counter = {0}", counter);
index = await Api.GetIndex(Settings.ApiKey, Settings.FullUri); index = await Api.GetIndex(Settings.ApiKey, Settings.FullUri);
if (counter > CounterMax) if (counter > CounterMax)
{ {
Log.Trace("Artist is still not present in the index. Counter = {0}. Returning false", counter); Log.Trace("Artist is still not present in the index. Counter = {0}. Returning false", counter);
Log.Warn("We have tried adding the artist but it seems they are still not in headphones."); Log.Warn("We have tried adding the artist but it seems they are still not in headphones.");
return false; return false;
} }
} }
counter = 0; counter = 0;
var artistStatus = index.Where(x => x.ArtistID == request.ArtistId).Select(x => x.Status).FirstOrDefault(); var artistStatus = index.Where(x => x.ArtistID == request.ArtistId).Select(x => x.Status).FirstOrDefault();
while (artistStatus != "Active") while (artistStatus != "Active")
{ {
Thread.Sleep(WaitTime); Thread.Sleep(WaitTime);
counter++; counter++;
Log.Trace("Artist status {1}. Counter = {0}", counter, artistStatus); Log.Trace("Artist status {1}. Counter = {0}", counter, artistStatus);
index = await Api.GetIndex(Settings.ApiKey, Settings.FullUri); index = await Api.GetIndex(Settings.ApiKey, Settings.FullUri);
artistStatus = index.Where(x => x.ArtistID == request.ArtistId).Select(x => x.Status).FirstOrDefault(); artistStatus = index.Where(x => x.ArtistID == request.ArtistId).Select(x => x.Status).FirstOrDefault();
if (counter > CounterMax) if (counter > CounterMax)
{ {
Log.Trace("Artist status is still not active. Counter = {0}. Returning false", counter); Log.Trace("Artist status is still not active. Counter = {0}. Returning false", counter);
Log.Warn("The artist status is still not Active. We have waited long enough, seems to be a big delay in headphones."); Log.Warn("The artist status is still not Active. We have waited long enough, seems to be a big delay in headphones.");
return false; return false;
} }
} }
var addedArtist = index.FirstOrDefault(x => x.ArtistID == request.ArtistId); var addedArtist = index.FirstOrDefault(x => x.ArtistID == request.ArtistId);
var artistName = addedArtist?.ArtistName ?? string.Empty; var artistName = addedArtist?.ArtistName ?? string.Empty;
counter = 0; counter = 0;
while (artistName.Contains("Fetch failed")) while (artistName.Contains("Fetch failed"))
{ {
Thread.Sleep(WaitTime); Thread.Sleep(WaitTime);
await Api.RefreshArtist(Settings.ApiKey, Settings.FullUri, request.ArtistId); await Api.RefreshArtist(Settings.ApiKey, Settings.FullUri, request.ArtistId);
index = await Api.GetIndex(Settings.ApiKey, Settings.FullUri); index = await Api.GetIndex(Settings.ApiKey, Settings.FullUri);
artistName = index?.FirstOrDefault(x => x.ArtistID == request.ArtistId)?.ArtistName ?? string.Empty; artistName = index?.FirstOrDefault(x => x.ArtistID == request.ArtistId)?.ArtistName ?? string.Empty;
counter++; counter++;
if (counter > CounterMax) if (counter > CounterMax)
{ {
Log.Trace("Artist fetch has failed. Counter = {0}. Returning false", counter); Log.Trace("Artist fetch has failed. Counter = {0}. Returning false", counter);
Log.Warn("Artist in headphones fetch has failed, we have tried refreshing the artist but no luck."); Log.Warn("Artist in headphones fetch has failed, we have tried refreshing the artist but no luck.");
return false; return false;
} }
} }
return true; return true;
} }
private async Task<bool> SetAlbumStatus(RequestedModel request) private async Task<bool> SetAlbumStatus(RequestedModel request)
{ {
var counter = 0; var counter = 0;
var setStatus = await Api.QueueAlbum(Settings.ApiKey, Settings.FullUri, request.MusicBrainzId); var setStatus = await Api.QueueAlbum(Settings.ApiKey, Settings.FullUri, request.MusicBrainzId);
while (!setStatus) while (!setStatus)
{ {
Thread.Sleep(WaitTime); Thread.Sleep(WaitTime);
counter++; counter++;
Log.Trace("Setting Album status. Counter = {0}", counter); Log.Trace("Setting Album status. Counter = {0}", counter);
setStatus = await Api.QueueAlbum(Settings.ApiKey, Settings.FullUri, request.MusicBrainzId); setStatus = await Api.QueueAlbum(Settings.ApiKey, Settings.FullUri, request.MusicBrainzId);
if (counter > CounterMax) if (counter > CounterMax)
{ {
Log.Trace("Album status is still not active. Counter = {0}. Returning false", counter); Log.Trace("Album status is still not active. Counter = {0}. Returning false", counter);
Log.Warn("We tried to se the status for the album but headphones didn't want to snatch it."); Log.Warn("We tried to se the status for the album but headphones didn't want to snatch it.");
return false; return false;
} }
} }
return true; return true;
} }
} }
} }

View file

@ -1,4 +1,5 @@
#region Copyright #region Copyright
// /************************************************************************ // /************************************************************************
// Copyright (c) 2016 Jamie Rees // Copyright (c) 2016 Jamie Rees
// File: Scheduler.cs // File: Scheduler.cs
@ -23,18 +24,17 @@
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/ // ************************************************************************/
#endregion #endregion
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using NLog; using NLog;
using PlexRequests.Core; using PlexRequests.Core;
using PlexRequests.Core.SettingModels; using PlexRequests.Core.SettingModels;
using PlexRequests.Services.Jobs; using PlexRequests.Services.Jobs;
using PlexRequests.UI.Helpers; using PlexRequests.UI.Helpers;
using Quartz; using Quartz;
using Quartz.Impl; using Quartz.Impl;
@ -61,20 +61,17 @@ namespace PlexRequests.UI.Jobs
var jobList = new List<IJobDetail> var jobList = new List<IJobDetail>
{ {
JobBuilder.Create<PlexAvailabilityChecker>().WithIdentity("PlexAvailabilityChecker", "Plex").Build(), JobBuilder.Create<PlexAvailabilityChecker>().WithIdentity("PlexAvailabilityChecker", "Plex").Build(),
JobBuilder.Create<PlexEpisodeCacher>().WithIdentity("PlexEpisodeCacher", "Cache").Build(), JobBuilder.Create<PlexEpisodeCacher>().WithIdentity("PlexEpisodeCacher", "Cache").Build(),
JobBuilder.Create<SickRageCacher>().WithIdentity("SickRageCacher", "Cache").Build(), JobBuilder.Create<SickRageCacher>().WithIdentity("SickRageCacher", "Cache").Build(),
JobBuilder.Create<SonarrCacher>().WithIdentity("SonarrCacher", "Cache").Build(), JobBuilder.Create<SonarrCacher>().WithIdentity("SonarrCacher", "Cache").Build(),
JobBuilder.Create<CouchPotatoCacher>().WithIdentity("CouchPotatoCacher", "Cache").Build(), JobBuilder.Create<CouchPotatoCacher>().WithIdentity("CouchPotatoCacher", "Cache").Build(),
JobBuilder.Create<StoreBackup>().WithIdentity("StoreBackup", "Database").Build(), JobBuilder.Create<StoreBackup>().WithIdentity("StoreBackup", "Database").Build(),
JobBuilder.Create<StoreCleanup>().WithIdentity("StoreCleanup", "Database").Build(), JobBuilder.Create<StoreCleanup>().WithIdentity("StoreCleanup", "Database").Build(),
JobBuilder.Create<UserRequestLimitResetter>().WithIdentity("UserRequestLimiter", "Request").Build(), JobBuilder.Create<UserRequestLimitResetter>().WithIdentity("UserRequestLimiter", "Request").Build(),
JobBuilder.Create<RecentlyAdded>().WithIdentity("RecentlyAddedModel", "Email").Build()
}; };
if (!string.IsNullOrEmpty(s.RecentlyAddedCron))
{
jobList.Add(JobBuilder.Create<RecentlyAdded>().WithIdentity("RecentlyAddedModel", "Email").Build());
}
jobs.AddRange(jobList); jobs.AddRange(jobList);
@ -115,6 +112,47 @@ namespace PlexRequests.UI.Jobs
var settingsService = Service.Resolve<ISettingsService<ScheduledJobsSettings>>(); var settingsService = Service.Resolve<ISettingsService<ScheduledJobsSettings>>();
var s = settingsService.GetSettings(); var s = settingsService.GetSettings();
if (s.CouchPotatoCacher == 0)
{
s.CouchPotatoCacher = 60;
}
if (s.PlexAvailabilityChecker == 0)
{
s.PlexAvailabilityChecker = 60;
}
if (s.PlexEpisodeCacher == 0)
{
s.PlexEpisodeCacher = 11;
}
if (string.IsNullOrEmpty(s.RecentlyAddedCron))
{
var cron =
(Quartz.Impl.Triggers.CronTriggerImpl)
CronScheduleBuilder.WeeklyOnDayAndHourAndMinute(DayOfWeek.Friday, 7, 0).Build();
s.RecentlyAddedCron = cron.CronExpressionString; // Weekly CRON at 7 am on Mondays
}
if (s.SickRageCacher == 0)
{
s.SickRageCacher = 60;
}
if (s.SonarrCacher == 0)
{
s.SonarrCacher = 60;
}
if (s.StoreBackup == 0)
{
s.StoreBackup = 24;
}
if (s.StoreCleanup == 0)
{
s.StoreCleanup = 24;
}
if (s.UserRequestLimitResetter == 0)
{
s.UserRequestLimitResetter = 12;
}
var triggers = new List<ITrigger>(); var triggers = new List<ITrigger>();
var plexAvailabilityChecker = var plexAvailabilityChecker =
@ -175,22 +213,15 @@ namespace PlexRequests.UI.Jobs
.Build(); .Build();
var cronJob = string.IsNullOrEmpty(s.RecentlyAddedCron); var rencentlyAdded =
if (!cronJob) TriggerBuilder.Create()
{ .WithIdentity("RecentlyAddedModel", "Email")
var rencentlyAdded = .StartNow()
TriggerBuilder.Create() .WithCronSchedule(s.RecentlyAddedCron)
.WithIdentity("RecentlyAddedModel", "Email") .WithSimpleSchedule(x => x.WithIntervalInHours(2).RepeatForever())
.StartNow() .Build();
.WithCronSchedule(s.RecentlyAddedCron)
.WithSimpleSchedule(x => x.WithIntervalInHours(2).RepeatForever())
.Build();
triggers.Add(rencentlyAdded);
}
triggers.Add(rencentlyAdded);
triggers.Add(plexAvailabilityChecker); triggers.Add(plexAvailabilityChecker);
triggers.Add(srCacher); triggers.Add(srCacher);
triggers.Add(sonarrCacher); triggers.Add(sonarrCacher);

View file

@ -1,36 +1,36 @@
#region Copyright #region Copyright
// /************************************************************************ // /************************************************************************
// Copyright (c) 2016 Jamie Rees // Copyright (c) 2016 Jamie Rees
// File: DatatablesModel.cs // File: DatatablesModel.cs
// Created By: Jamie Rees // Created By: Jamie Rees
// //
// Permission is hereby granted, free of charge, to any person obtaining // Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the // a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including // "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish, // without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to // distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to // permit persons to whom the Software is furnished to do so, subject to
// the following conditions: // the following conditions:
// //
// The above copyright notice and this permission notice shall be // The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software. // included in all copies or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/ // ************************************************************************/
#endregion #endregion
using System.Collections.Generic; using System.Collections.Generic;
namespace PlexRequests.UI.Models namespace PlexRequests.UI.Models
{ {
public class DatatablesModel<T> public class DatatablesModel<T>
{ {
public List<T> Data { get; set; } public List<T> Data { get; set; }
} }
} }

View file

@ -1,34 +1,34 @@
#region Copyright #region Copyright
// /************************************************************************ // /************************************************************************
// Copyright (c) 2016 Jamie Rees // Copyright (c) 2016 Jamie Rees
// File: JsonResponseModel.cs // File: JsonResponseModel.cs
// Created By: Jamie Rees // Created By: Jamie Rees
// //
// Permission is hereby granted, free of charge, to any person obtaining // Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the // a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including // "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish, // without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to // distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to // permit persons to whom the Software is furnished to do so, subject to
// the following conditions: // the following conditions:
// //
// The above copyright notice and this permission notice shall be // The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software. // included in all copies or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/ // ************************************************************************/
#endregion #endregion
namespace PlexRequests.UI.Models namespace PlexRequests.UI.Models
{ {
public class JsonResponseModel public class JsonResponseModel
{ {
public bool Result { get; set; } public bool Result { get; set; }
public string Message { get; set; } public string Message { get; set; }
} }
} }

View file

@ -1,35 +1,35 @@
#region Copyright #region Copyright
// /************************************************************************ // /************************************************************************
// Copyright (c) 2016 Jamie Rees // Copyright (c) 2016 Jamie Rees
// File: PlexType.cs // File: PlexType.cs
// Created By: Jamie Rees // Created By: Jamie Rees
// //
// Permission is hereby granted, free of charge, to any person obtaining // Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the // a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including // "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish, // without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to // distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to // permit persons to whom the Software is furnished to do so, subject to
// the following conditions: // the following conditions:
// //
// The above copyright notice and this permission notice shall be // The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software. // included in all copies or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/ // ************************************************************************/
#endregion #endregion
namespace PlexRequests.UI.Models namespace PlexRequests.UI.Models
{ {
public enum MovieSearchType public enum MovieSearchType
{ {
Upcoming, Upcoming,
CurrentlyPlaying, CurrentlyPlaying,
Search Search
} }
} }

Some files were not shown because too many files have changed in this diff Show more