-
-
Notifications
You must be signed in to change notification settings - Fork 397
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #470 from tidusjar/dev
Dev 1.9
- Loading branch information
Showing
265 changed files
with
24,710 additions
and
13,471 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -236,3 +236,4 @@ _Pvt_Extensions | |
.fake/ | ||
*.ncrunchproject | ||
*.ncrunchsolution | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
#region Copyright | ||
// /************************************************************************ | ||
// Copyright (c) 2016 Jamie Rees | ||
// File: DatabaseConfiguration.cs | ||
// Created By: Jamie Rees | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining | ||
// a copy of this software and associated documentation files (the | ||
// "Software"), to deal in the Software without restriction, including | ||
// without limitation the rights to use, copy, modify, merge, publish, | ||
// distribute, sublicense, and/or sell copies of the Software, and to | ||
// permit persons to whom the Software is furnished to do so, subject to | ||
// the following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be | ||
// included in all copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | ||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | ||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
// ************************************************************************/ | ||
#endregion | ||
using Mono.Data.Sqlite; | ||
|
||
using PlexRequests.Core; | ||
using PlexRequests.Core.SettingModels; | ||
using PlexRequests.Helpers; | ||
using PlexRequests.Store; | ||
using PlexRequests.Store.Repository; | ||
|
||
namespace PlexRequestes.Automation.Helpers | ||
{ | ||
public static class DatabaseConfiguration | ||
{ | ||
private static SettingsJsonRepository _jsonRepository = new SettingsJsonRepository(new DbConfiguration(new SqliteFactory()), new MemoryCacheProvider()); | ||
|
||
public static void ResetDatabase() | ||
{ | ||
var defaultSettings = new PlexRequestSettings | ||
{ | ||
RequireTvShowApproval = true, | ||
RequireMovieApproval = true, | ||
SearchForMovies = true, | ||
SearchForTvShows = true, | ||
BaseUrl = string.Empty, | ||
CollectAnalyticData = true, | ||
}; | ||
UpdateSettings(defaultSettings); | ||
|
||
LandingPageSettings lp = null; | ||
PlexSettings plexSettings = null; | ||
SonarrSettings sonarr = null; | ||
CouchPotatoSettings cp = null; | ||
SickRageSettings sr = null; | ||
UpdateSettings(lp); | ||
UpdateSettings(plexSettings); | ||
UpdateSettings(sonarr); | ||
UpdateSettings(cp); | ||
UpdateSettings(sr); | ||
|
||
|
||
} | ||
|
||
|
||
public static void UpdateSettings<T>(T settings) where T : Settings, new() | ||
{ | ||
var service = new SettingsServiceV2<T>(_jsonRepository); | ||
if (settings == null) | ||
{ | ||
var existing = service.GetSettings(); | ||
service.Delete(existing); | ||
return; | ||
} | ||
service.SaveSettings(settings); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
using System; | ||
|
||
using OpenQA.Selenium; | ||
|
||
namespace PlexRequestes.Automation.Helpers | ||
{ | ||
public static class DriverHelpers | ||
{ | ||
public static bool Exists(this IWebElement element, bool preformAStringEmptyCheck) | ||
{ | ||
try | ||
{ | ||
var text = element.Text; | ||
if (preformAStringEmptyCheck) | ||
{ | ||
if (string.IsNullOrEmpty(text)) | ||
{ | ||
return false; | ||
} | ||
} | ||
} | ||
catch (NoSuchElementException) | ||
{ | ||
return false; | ||
} | ||
|
||
return true; | ||
} | ||
|
||
public static bool Exists(this IWebDriver driver, By locator, bool preformAStringEmptyCheck) | ||
{ | ||
try | ||
{ | ||
var element = driver.FindElement(locator); | ||
var text = element.Text; | ||
if (preformAStringEmptyCheck) | ||
{ | ||
if (string.IsNullOrEmpty(text)) | ||
{ | ||
return false; | ||
} | ||
} | ||
} | ||
catch (NoSuchElementException) | ||
{ | ||
return false; | ||
} | ||
|
||
return true; | ||
} | ||
|
||
/// <summary> | ||
/// The exists. | ||
/// </summary> | ||
/// <param name="element">The element.</param> | ||
/// <returns> | ||
/// The <see cref="bool" />. | ||
/// </returns> | ||
public static bool Exists(this IWebElement element) | ||
{ | ||
try | ||
{ | ||
var text = element.Text; | ||
if (string.IsNullOrEmpty(text)) | ||
{ | ||
return false; | ||
} | ||
} | ||
catch (Exception) | ||
{ | ||
return false; | ||
} | ||
|
||
return true; | ||
} | ||
} | ||
} |
89 changes: 89 additions & 0 deletions
89
PlexRequestes.Automation.Helpers/PlexRequestes.Automation.Helpers.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="14.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')" /> | ||
<PropertyGroup> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
<ProjectGuid>{DC8BACEF-C284-4A8F-A9AA-7F49EFABA288}</ProjectGuid> | ||
<OutputType>Library</OutputType> | ||
<AppDesignerFolder>Properties</AppDesignerFolder> | ||
<RootNamespace>PlexRequestes.Automation.Helpers</RootNamespace> | ||
<AssemblyName>PlexRequestes.Automation.Helpers</AssemblyName> | ||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion> | ||
<FileAlignment>512</FileAlignment> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
<DebugSymbols>true</DebugSymbols> | ||
<DebugType>full</DebugType> | ||
<Optimize>false</Optimize> | ||
<OutputPath>bin\Debug\</OutputPath> | ||
<DefineConstants>DEBUG;TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
<DebugType>pdbonly</DebugType> | ||
<Optimize>true</Optimize> | ||
<OutputPath>bin\Release\</OutputPath> | ||
<DefineConstants>TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Reference Include="CommandLine, Version=1.9.71.2, Culture=neutral, PublicKeyToken=de6f01bd326f8c32, processorArchitecture=MSIL"> | ||
<HintPath>..\packages\CommandLineParser.1.9.71\lib\net45\CommandLine.dll</HintPath> | ||
<Private>True</Private> | ||
</Reference> | ||
<Reference Include="Mono.Data.Sqlite"> | ||
<HintPath>..\Assemblies\Mono.Data.Sqlite.dll</HintPath> | ||
</Reference> | ||
<Reference Include="System" /> | ||
<Reference Include="System.Core" /> | ||
<Reference Include="System.Drawing" /> | ||
<Reference Include="System.Xml.Linq" /> | ||
<Reference Include="System.Data.DataSetExtensions" /> | ||
<Reference Include="Microsoft.CSharp" /> | ||
<Reference Include="System.Data" /> | ||
<Reference Include="System.Net.Http" /> | ||
<Reference Include="System.Xml" /> | ||
<Reference Include="WebDriver, Version=2.53.1.0, Culture=neutral, processorArchitecture=MSIL"> | ||
<HintPath>..\packages\Selenium.WebDriver.2.53.1\lib\net40\WebDriver.dll</HintPath> | ||
<Private>True</Private> | ||
</Reference> | ||
<Reference Include="WebDriver.Support, Version=2.53.1.0, Culture=neutral, processorArchitecture=MSIL"> | ||
<HintPath>..\packages\Selenium.Support.2.53.1\lib\net40\WebDriver.Support.dll</HintPath> | ||
<Private>True</Private> | ||
</Reference> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="DatabaseConfiguration.cs" /> | ||
<Compile Include="DriverHelpers.cs" /> | ||
<Compile Include="Properties\AssemblyInfo.cs" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="app.config" /> | ||
<None Include="packages.config" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="..\PlexRequests.Core\PlexRequests.Core.csproj"> | ||
<Project>{dd7dc444-d3bf-4027-8ab9-efc71f5ec581}</Project> | ||
<Name>PlexRequests.Core</Name> | ||
</ProjectReference> | ||
<ProjectReference Include="..\PlexRequests.Helpers\PlexRequests.Helpers.csproj"> | ||
<Project>{1252336D-42A3-482A-804C-836E60173DFA}</Project> | ||
<Name>PlexRequests.Helpers</Name> | ||
</ProjectReference> | ||
<ProjectReference Include="..\PlexRequests.Store\PlexRequests.Store.csproj"> | ||
<Project>{92433867-2b7b-477b-a566-96c382427525}</Project> | ||
<Name>PlexRequests.Store</Name> | ||
</ProjectReference> | ||
</ItemGroup> | ||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | ||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. | ||
Other similar extension points exist, see Microsoft.Common.targets. | ||
<Target Name="BeforeBuild"> | ||
</Target> | ||
<Target Name="AfterBuild"> | ||
</Target> | ||
--> | ||
</Project> |
36 changes: 36 additions & 0 deletions
36
PlexRequestes.Automation.Helpers/Properties/AssemblyInfo.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using System.Reflection; | ||
using System.Runtime.CompilerServices; | ||
using System.Runtime.InteropServices; | ||
|
||
// General Information about an assembly is controlled through the following | ||
// set of attributes. Change these attribute values to modify the information | ||
// associated with an assembly. | ||
[assembly: AssemblyTitle("PlexRequestes.Automation.Helpers")] | ||
[assembly: AssemblyDescription("")] | ||
[assembly: AssemblyConfiguration("")] | ||
[assembly: AssemblyCompany("")] | ||
[assembly: AssemblyProduct("PlexRequestes.Automation.Helpers")] | ||
[assembly: AssemblyCopyright("Copyright © 2016")] | ||
[assembly: AssemblyTrademark("")] | ||
[assembly: AssemblyCulture("")] | ||
|
||
// 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 | ||
// COM, set the ComVisible attribute to true on that type. | ||
[assembly: ComVisible(false)] | ||
|
||
// The following GUID is for the ID of the typelib if this project is exposed to COM | ||
[assembly: Guid("dc8bacef-c284-4a8f-a9aa-7f49efaba288")] | ||
|
||
// Version information for an assembly consists of the following four values: | ||
// | ||
// Major Version | ||
// Minor Version | ||
// Build Number | ||
// Revision | ||
// | ||
// You can specify all the values or you can default the Build and Revision Numbers | ||
// by using the '*' as shown below: | ||
// [assembly: AssemblyVersion("1.0.*")] | ||
[assembly: AssemblyVersion("1.0.0.0")] | ||
[assembly: AssemblyFileVersion("1.0.0.0")] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<configuration> | ||
<runtime> | ||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> | ||
<dependentAssembly> | ||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" /> | ||
<bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0" /> | ||
</dependentAssembly> | ||
</assemblyBinding> | ||
</runtime> | ||
</configuration> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<packages> | ||
<package id="CommandLineParser" version="1.9.71" targetFramework="net452" /> | ||
<package id="Selenium.Support" version="2.53.1" targetFramework="net452" /> | ||
<package id="Selenium.WebDriver" version="2.53.1" targetFramework="net452" /> | ||
</packages> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,43 @@ | ||
#region Copyright | ||
// /************************************************************************ | ||
// Copyright (c) 2016 Jamie Rees | ||
// File: ICouchPotatoApi.cs | ||
// Created By: Jamie Rees | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining | ||
// a copy of this software and associated documentation files (the | ||
// "Software"), to deal in the Software without restriction, including | ||
// without limitation the rights to use, copy, modify, merge, publish, | ||
// distribute, sublicense, and/or sell copies of the Software, and to | ||
// permit persons to whom the Software is furnished to do so, subject to | ||
// the following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be | ||
// included in all copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | ||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | ||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
// ************************************************************************/ | ||
#endregion | ||
|
||
using System; | ||
|
||
using PlexRequests.Api.Models.Movie; | ||
|
||
namespace PlexRequests.Api.Interfaces | ||
{ | ||
public interface ICouchPotatoApi | ||
{ | ||
bool AddMovie(string imdbid, string apiKey, string title, Uri baseUrl, string profileID = default(string)); | ||
CouchPotatoStatus GetStatus(Uri url, string apiKey); | ||
CouchPotatoProfiles GetProfiles(Uri url, string apiKey); | ||
CouchPotatoMovies GetMovies(Uri baseUrl, string apiKey, string[] status); | ||
} | ||
#region Copyright | ||
// /************************************************************************ | ||
// Copyright (c) 2016 Jamie Rees | ||
// File: ICouchPotatoApi.cs | ||
// Created By: Jamie Rees | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining | ||
// a copy of this software and associated documentation files (the | ||
// "Software"), to deal in the Software without restriction, including | ||
// without limitation the rights to use, copy, modify, merge, publish, | ||
// distribute, sublicense, and/or sell copies of the Software, and to | ||
// permit persons to whom the Software is furnished to do so, subject to | ||
// the following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be | ||
// included in all copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | ||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | ||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
// ************************************************************************/ | ||
#endregion | ||
|
||
using System; | ||
|
||
using PlexRequests.Api.Models.Movie; | ||
|
||
namespace PlexRequests.Api.Interfaces | ||
{ | ||
public interface ICouchPotatoApi | ||
{ | ||
bool AddMovie(string imdbid, string apiKey, string title, Uri baseUrl, string profileID = default(string)); | ||
CouchPotatoStatus GetStatus(Uri url, string apiKey); | ||
CouchPotatoProfiles GetProfiles(Uri url, string apiKey); | ||
CouchPotatoMovies GetMovies(Uri baseUrl, string apiKey, string[] status); | ||
|
||
CoucPotatoApiKey GetApiKey(Uri baseUrl, string username, string password); | ||
} | ||
} |
Oops, something went wrong.