mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-15 01:32:55 -07:00
First pass at the plex update service
This commit is contained in:
parent
f2819664e7
commit
7636409790
25 changed files with 661 additions and 16 deletions
|
@ -38,5 +38,6 @@ namespace PlexRequests.Core
|
||||||
void UpdateRequest(int originalId, RequestedModel model);
|
void UpdateRequest(int originalId, RequestedModel model);
|
||||||
RequestedModel Get(int id);
|
RequestedModel Get(int id);
|
||||||
IEnumerable<RequestedModel> GetAll();
|
IEnumerable<RequestedModel> GetAll();
|
||||||
|
bool BatchUpdate(List<RequestedModel> model);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -62,6 +62,16 @@ namespace PlexRequests.Core
|
||||||
Repo.Update(model);
|
Repo.Update(model);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Updates all the entities. NOTE: we need to Id to be the original entity
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="model">The model.</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public bool BatchUpdate(List<RequestedModel> model)
|
||||||
|
{
|
||||||
|
return Repo.UpdateAll(model);
|
||||||
|
}
|
||||||
|
|
||||||
public RequestedModel Get(int id)
|
public RequestedModel Get(int id)
|
||||||
{
|
{
|
||||||
return Repo.Get(id);
|
return Repo.Get(id);
|
||||||
|
|
73
PlexRequests.Services/AvailabilityUpdateService.cs
Normal file
73
PlexRequests.Services/AvailabilityUpdateService.cs
Normal file
|
@ -0,0 +1,73 @@
|
||||||
|
#region Copyright
|
||||||
|
// /************************************************************************
|
||||||
|
// Copyright (c) 2016 Jamie Rees
|
||||||
|
// File: AvailabilityUpdateService.cs
|
||||||
|
// Created By: Jamie Rees
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
// a copy of this software and associated documentation files (the
|
||||||
|
// "Software"), to deal in the Software without restriction, including
|
||||||
|
// without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
// permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
// the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be
|
||||||
|
// included in all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||||
|
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||||
|
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
|
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
// ************************************************************************/
|
||||||
|
#endregion
|
||||||
|
using System;
|
||||||
|
using System.Reactive.Linq;
|
||||||
|
using System.Runtime.Remoting.Messaging;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Web.Hosting;
|
||||||
|
|
||||||
|
using FluentScheduler;
|
||||||
|
|
||||||
|
using NLog;
|
||||||
|
|
||||||
|
using PlexRequests.Services.Interfaces;
|
||||||
|
|
||||||
|
namespace PlexRequests.Services
|
||||||
|
{
|
||||||
|
public class AvailabilityUpdateService : ITask, IRegisteredObject
|
||||||
|
{
|
||||||
|
public AvailabilityUpdateService(IConfigurationReader reader, IAvailabilityChecker checker)
|
||||||
|
{
|
||||||
|
ConfigurationReader = reader;
|
||||||
|
Checker = checker;
|
||||||
|
HostingEnvironment.RegisterObject(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Logger Log = LogManager.GetCurrentClassLogger();
|
||||||
|
|
||||||
|
private IConfigurationReader ConfigurationReader { get; }
|
||||||
|
private IAvailabilityChecker Checker { get; }
|
||||||
|
private IDisposable UpdateSubscription { get; set; }
|
||||||
|
|
||||||
|
public void Start(Configuration c)
|
||||||
|
{
|
||||||
|
UpdateSubscription?.Dispose();
|
||||||
|
|
||||||
|
UpdateSubscription = Observable.Interval(c.Intervals.Measurement).Subscribe(Checker.CheckAndUpdateAll);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Execute()
|
||||||
|
{
|
||||||
|
Start(ConfigurationReader.Read());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Stop(bool immediate)
|
||||||
|
{
|
||||||
|
throw new System.NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
40
PlexRequests.Services/Configuration.cs
Normal file
40
PlexRequests.Services/Configuration.cs
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
#region Copyright
|
||||||
|
// /************************************************************************
|
||||||
|
// Copyright (c) 2016 Jamie Rees
|
||||||
|
// File: Congifuration.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 PlexRequests.Services.Interfaces;
|
||||||
|
|
||||||
|
namespace PlexRequests.Services
|
||||||
|
{
|
||||||
|
public class Configuration
|
||||||
|
{
|
||||||
|
public Configuration(IIntervals intervals)
|
||||||
|
{
|
||||||
|
Intervals = intervals;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IIntervals Intervals { get; set; }
|
||||||
|
}
|
||||||
|
}
|
38
PlexRequests.Services/ConfigurationReader.cs
Normal file
38
PlexRequests.Services/ConfigurationReader.cs
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
#region Copyright
|
||||||
|
// /************************************************************************
|
||||||
|
// Copyright (c) 2016 Jamie Rees
|
||||||
|
// File: ConfigurationReader.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 PlexRequests.Services.Interfaces;
|
||||||
|
|
||||||
|
namespace PlexRequests.Services
|
||||||
|
{
|
||||||
|
public class ConfigurationReader : IConfigurationReader
|
||||||
|
{
|
||||||
|
public Configuration Read()
|
||||||
|
{
|
||||||
|
return new Configuration(new UpdateInterval());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
33
PlexRequests.Services/Interfaces/IAvailabilityChecker.cs
Normal file
33
PlexRequests.Services/Interfaces/IAvailabilityChecker.cs
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
#region Copyright
|
||||||
|
// /************************************************************************
|
||||||
|
// Copyright (c) 2016 Jamie Rees
|
||||||
|
// File: IAvailabilityChecker.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
|
||||||
|
namespace PlexRequests.Services.Interfaces
|
||||||
|
{
|
||||||
|
public interface IAvailabilityChecker
|
||||||
|
{
|
||||||
|
void CheckAndUpdateAll(long check);
|
||||||
|
}
|
||||||
|
}
|
33
PlexRequests.Services/Interfaces/IConfigurationReader.cs
Normal file
33
PlexRequests.Services/Interfaces/IConfigurationReader.cs
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
#region Copyright
|
||||||
|
// /************************************************************************
|
||||||
|
// Copyright (c) 2016 Jamie Rees
|
||||||
|
// File: IConfigurationReader.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
|
||||||
|
namespace PlexRequests.Services.Interfaces
|
||||||
|
{
|
||||||
|
public interface IConfigurationReader
|
||||||
|
{
|
||||||
|
Configuration Read();
|
||||||
|
}
|
||||||
|
}
|
37
PlexRequests.Services/Interfaces/IIntervals.cs
Normal file
37
PlexRequests.Services/Interfaces/IIntervals.cs
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
#region Copyright
|
||||||
|
// /************************************************************************
|
||||||
|
// Copyright (c) 2016 Jamie Rees
|
||||||
|
// File: IIntervals.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;
|
||||||
|
|
||||||
|
namespace PlexRequests.Services.Interfaces
|
||||||
|
{
|
||||||
|
public interface IIntervals
|
||||||
|
{
|
||||||
|
TimeSpan CriticalNotification { get; } // notification interval for critical load
|
||||||
|
TimeSpan Measurement { get; } // how often to measure
|
||||||
|
TimeSpan Notification { get; } // notification interval for high load
|
||||||
|
}
|
||||||
|
}
|
73
PlexRequests.Services/PlexAvailabilityChecker.cs
Normal file
73
PlexRequests.Services/PlexAvailabilityChecker.cs
Normal file
|
@ -0,0 +1,73 @@
|
||||||
|
#region Copyright
|
||||||
|
// /************************************************************************
|
||||||
|
// Copyright (c) 2016 Jamie Rees
|
||||||
|
// File: PlexAvailabilityChecker.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.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
|
using PlexRequests.Api;
|
||||||
|
using PlexRequests.Core;
|
||||||
|
using PlexRequests.Core.SettingModels;
|
||||||
|
using PlexRequests.Services.Interfaces;
|
||||||
|
using PlexRequests.Store;
|
||||||
|
|
||||||
|
namespace PlexRequests.Services
|
||||||
|
{
|
||||||
|
public class PlexAvailabilityChecker : IAvailabilityChecker
|
||||||
|
{
|
||||||
|
public PlexAvailabilityChecker(ISettingsService<PlexSettings> plexSettings, ISettingsService<AuthenticationSettings> auth, IRequestService request)
|
||||||
|
{
|
||||||
|
Plex = plexSettings;
|
||||||
|
Auth = auth;
|
||||||
|
RequestService = request;
|
||||||
|
}
|
||||||
|
|
||||||
|
private ISettingsService<PlexSettings> Plex { get; }
|
||||||
|
private ISettingsService<AuthenticationSettings> Auth { get; }
|
||||||
|
private IRequestService RequestService { get; }
|
||||||
|
|
||||||
|
|
||||||
|
public void CheckAndUpdateAll(long check)
|
||||||
|
{
|
||||||
|
var plexSettings = Plex.GetSettings();
|
||||||
|
var authSettings = Auth.GetSettings();
|
||||||
|
var requests = RequestService.GetAll();
|
||||||
|
var api = new PlexApi();
|
||||||
|
|
||||||
|
var modifiedModel = new List<RequestedModel>();
|
||||||
|
foreach (var r in requests)
|
||||||
|
{
|
||||||
|
var results = api.SearchContent(authSettings.PlexAuthToken, r.Title, plexSettings.FullUri);
|
||||||
|
var result = results.Video.FirstOrDefault(x => x.Title == r.Title);
|
||||||
|
var originalRequest = RequestService.Get(r.Id);
|
||||||
|
|
||||||
|
originalRequest.Available = result != null;
|
||||||
|
modifiedModel.Add(originalRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
RequestService.BatchUpdate(modifiedModel);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
105
PlexRequests.Services/PlexRequests.Services.csproj
Normal file
105
PlexRequests.Services/PlexRequests.Services.csproj
Normal file
|
@ -0,0 +1,105 @@
|
||||||
|
<?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>{566EFA49-68F8-4716-9693-A6B3F2624DEA}</ProjectGuid>
|
||||||
|
<OutputType>Library</OutputType>
|
||||||
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
|
<RootNamespace>PlexRequests.Services</RootNamespace>
|
||||||
|
<AssemblyName>PlexRequests.Services</AssemblyName>
|
||||||
|
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
|
||||||
|
<FileAlignment>512</FileAlignment>
|
||||||
|
<TargetFrameworkProfile />
|
||||||
|
</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="FluentScheduler, Version=3.1.46.0, Culture=neutral, PublicKeyToken=b76503528a14ebd1, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\FluentScheduler.3.1.46\lib\net40\FluentScheduler.dll</HintPath>
|
||||||
|
<Private>True</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Microsoft.Build.Framework" />
|
||||||
|
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\NLog.4.2.3\lib\net45\NLog.dll</HintPath>
|
||||||
|
<Private>True</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.Core" />
|
||||||
|
<Reference Include="System.Reactive.Core, Version=2.2.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Rx-Core.2.2.5\lib\net45\System.Reactive.Core.dll</HintPath>
|
||||||
|
<Private>True</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Reactive.Interfaces, Version=2.2.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Rx-Interfaces.2.2.5\lib\net45\System.Reactive.Interfaces.dll</HintPath>
|
||||||
|
<Private>True</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Reactive.Linq, Version=2.2.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Rx-Linq.2.2.5\lib\net45\System.Reactive.Linq.dll</HintPath>
|
||||||
|
<Private>True</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Reactive.PlatformServices, Version=2.2.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Rx-PlatformServices.2.2.5\lib\net45\System.Reactive.PlatformServices.dll</HintPath>
|
||||||
|
<Private>True</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Web" />
|
||||||
|
<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" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="AvailabilityUpdateService.cs" />
|
||||||
|
<Compile Include="Configuration.cs" />
|
||||||
|
<Compile Include="ConfigurationReader.cs" />
|
||||||
|
<Compile Include="Interfaces\IAvailabilityChecker.cs" />
|
||||||
|
<Compile Include="Interfaces\IConfigurationReader.cs" />
|
||||||
|
<Compile Include="Interfaces\IIntervals.cs" />
|
||||||
|
<Compile Include="PlexAvailabilityChecker.cs" />
|
||||||
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
<Compile Include="UpdateInterval.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="packages.config" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\PlexRequests.Api\PlexRequests.Api.csproj">
|
||||||
|
<Project>{8cb8d235-2674-442d-9c6a-35fcaeeb160d}</Project>
|
||||||
|
<Name>PlexRequests.Api</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\PlexRequests.Core\PlexRequests.Core.csproj">
|
||||||
|
<Project>{dd7dc444-d3bf-4027-8ab9-efc71f5ec581}</Project>
|
||||||
|
<Name>PlexRequests.Core</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
PlexRequests.Services/Properties/AssemblyInfo.cs
Normal file
36
PlexRequests.Services/Properties/AssemblyInfo.cs
Normal file
|
@ -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("PlexRequests.Services")]
|
||||||
|
[assembly: AssemblyDescription("")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("")]
|
||||||
|
[assembly: AssemblyProduct("PlexRequests.Services")]
|
||||||
|
[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("566efa49-68f8-4716-9693-a6b3f2624dea")]
|
||||||
|
|
||||||
|
// 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")]
|
40
PlexRequests.Services/UpdateInterval.cs
Normal file
40
PlexRequests.Services/UpdateInterval.cs
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
#region Copyright
|
||||||
|
// /************************************************************************
|
||||||
|
// Copyright (c) 2016 Jamie Rees
|
||||||
|
// File: UpdateInterval.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.Services.Interfaces;
|
||||||
|
|
||||||
|
namespace PlexRequests.Services
|
||||||
|
{
|
||||||
|
public class UpdateInterval : IIntervals
|
||||||
|
{
|
||||||
|
public TimeSpan Measurement => TimeSpan.FromSeconds(1);
|
||||||
|
public TimeSpan CriticalNotification { get; }
|
||||||
|
public TimeSpan Notification => TimeSpan.FromMinutes(2);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
10
PlexRequests.Services/packages.config
Normal file
10
PlexRequests.Services/packages.config
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<packages>
|
||||||
|
<package id="FluentScheduler" version="3.1.46" targetFramework="net452" />
|
||||||
|
<package id="NLog" version="4.2.3" targetFramework="net452" />
|
||||||
|
<package id="Rx-Core" version="2.2.5" targetFramework="net452" />
|
||||||
|
<package id="Rx-Interfaces" version="2.2.5" targetFramework="net452" />
|
||||||
|
<package id="Rx-Linq" version="2.2.5" targetFramework="net452" />
|
||||||
|
<package id="Rx-Main" version="2.2.5" targetFramework="net452" />
|
||||||
|
<package id="Rx-PlatformServices" version="2.2.5" targetFramework="net452" />
|
||||||
|
</packages>
|
|
@ -26,6 +26,7 @@
|
||||||
#endregion
|
#endregion
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
using Dapper.Contrib.Extensions;
|
using Dapper.Contrib.Extensions;
|
||||||
|
|
||||||
|
@ -89,5 +90,19 @@ namespace PlexRequests.Store
|
||||||
return db.Update(entity);
|
return db.Update(entity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool UpdateAll(IEnumerable<T> entity)
|
||||||
|
{
|
||||||
|
var result = new HashSet<bool>();
|
||||||
|
using (var db = Config.DbConnection())
|
||||||
|
{
|
||||||
|
db.Open();
|
||||||
|
foreach (var e in entity)
|
||||||
|
{
|
||||||
|
result.Add(db.Update(e));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result.All(x => true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,5 +61,12 @@ namespace PlexRequests.Store
|
||||||
/// <param name="entity">The entity.</param>
|
/// <param name="entity">The entity.</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
bool Update(T entity);
|
bool Update(T entity);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Updates all.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="entity">The entity.</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
bool UpdateAll(IEnumerable<T> entity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,6 +92,11 @@ namespace PlexRequests.Store
|
||||||
return db.Update(entity);
|
return db.Update(entity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool UpdateAll(IEnumerable<T> entity)
|
||||||
|
{
|
||||||
|
throw new NotSupportedException();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,10 @@
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Reference Include="FluentScheduler, Version=3.1.46.0, Culture=neutral, PublicKeyToken=b76503528a14ebd1, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\FluentScheduler.3.1.46\lib\net40\FluentScheduler.dll</HintPath>
|
||||||
|
<Private>True</Private>
|
||||||
|
</Reference>
|
||||||
<Reference Include="Moq, Version=4.2.1510.2205, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
|
<Reference Include="Moq, Version=4.2.1510.2205, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\Moq.4.2.1510.2205\lib\net40\Moq.dll</HintPath>
|
<HintPath>..\packages\Moq.4.2.1510.2205\lib\net40\Moq.dll</HintPath>
|
||||||
<Private>True</Private>
|
<Private>True</Private>
|
||||||
|
@ -49,6 +53,7 @@
|
||||||
<Private>True</Private>
|
<Private>True</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.Web" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Choose>
|
<Choose>
|
||||||
<When Condition="('$(VisualStudioVersion)' == '10.0' or '$(VisualStudioVersion)' == '') and '$(TargetFrameworkVersion)' == 'v3.5'">
|
<When Condition="('$(VisualStudioVersion)' == '10.0' or '$(VisualStudioVersion)' == '') and '$(TargetFrameworkVersion)' == 'v3.5'">
|
||||||
|
@ -60,10 +65,22 @@
|
||||||
</Choose>
|
</Choose>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
<Compile Include="TaskFactoryTests.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<None Include="app.config" />
|
||||||
<None Include="packages.config" />
|
<None Include="packages.config" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\PlexRequests.Services\PlexRequests.Services.csproj">
|
||||||
|
<Project>{566EFA49-68F8-4716-9693-A6B3F2624DEA}</Project>
|
||||||
|
<Name>PlexRequests.Services</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\PlexRequests.UI\PlexRequests.UI.csproj">
|
||||||
|
<Project>{68F5F5F3-B8BB-4911-875F-6F00AAE04EA6}</Project>
|
||||||
|
<Name>PlexRequests.UI</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemGroup>
|
||||||
<Choose>
|
<Choose>
|
||||||
<When Condition="'$(VisualStudioVersion)' == '10.0' And '$(IsCodedUITest)' == 'True'">
|
<When Condition="'$(VisualStudioVersion)' == '10.0' And '$(IsCodedUITest)' == 'True'">
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
46
PlexRequests.UI.Tests/TaskFactoryTests.cs
Normal file
46
PlexRequests.UI.Tests/TaskFactoryTests.cs
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
#region Copyright
|
||||||
|
// /************************************************************************
|
||||||
|
// Copyright (c) 2016 Jamie Rees
|
||||||
|
// File: TaskFactoryTests.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 NUnit.Framework;
|
||||||
|
|
||||||
|
using PlexRequests.Services;
|
||||||
|
using PlexRequests.UI.Jobs;
|
||||||
|
|
||||||
|
namespace PlexRequests.UI.Tests
|
||||||
|
{
|
||||||
|
[TestFixture]
|
||||||
|
public class TaskFactoryTests
|
||||||
|
{
|
||||||
|
[Test]
|
||||||
|
public void GetTaskInstanceTest()
|
||||||
|
{
|
||||||
|
var fact = new PlexTaskFactory();
|
||||||
|
var result = fact.GetTaskInstance<AvailabilityUpdateService>();
|
||||||
|
|
||||||
|
Assert.That(result, Is.Not.Null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
11
PlexRequests.UI.Tests/app.config
Normal file
11
PlexRequests.UI.Tests/app.config
Normal file
|
@ -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-8.0.0.0" newVersion="8.0.0.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
</assemblyBinding>
|
||||||
|
</runtime>
|
||||||
|
</configuration>
|
|
@ -1,6 +1,7 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<packages>
|
<packages>
|
||||||
<package id="AutoFixture" version="3.40.0" targetFramework="net452" />
|
<package id="AutoFixture" version="3.40.0" targetFramework="net452" />
|
||||||
|
<package id="FluentScheduler" version="3.1.46" targetFramework="net46" />
|
||||||
<package id="Moq" version="4.2.1510.2205" targetFramework="net452" />
|
<package id="Moq" version="4.2.1510.2205" targetFramework="net452" />
|
||||||
<package id="NUnit" version="3.0.1" targetFramework="net452" />
|
<package id="NUnit" version="3.0.1" targetFramework="net452" />
|
||||||
</packages>
|
</packages>
|
|
@ -39,9 +39,14 @@ using Nancy.TinyIoc;
|
||||||
using PlexRequests.Core;
|
using PlexRequests.Core;
|
||||||
using PlexRequests.Core.SettingModels;
|
using PlexRequests.Core.SettingModels;
|
||||||
using PlexRequests.Helpers;
|
using PlexRequests.Helpers;
|
||||||
|
using PlexRequests.Services;
|
||||||
|
using PlexRequests.Services.Interfaces;
|
||||||
using PlexRequests.Store;
|
using PlexRequests.Store;
|
||||||
using PlexRequests.Store.Repository;
|
using PlexRequests.Store.Repository;
|
||||||
using PlexRequests.UI.Jobs;
|
using PlexRequests.UI.Jobs;
|
||||||
|
|
||||||
|
using IAvailabilityChecker = PlexRequests.UI.Jobs.IAvailabilityChecker;
|
||||||
|
using PlexAvailabilityChecker = PlexRequests.UI.Jobs.PlexAvailabilityChecker;
|
||||||
using TaskFactory = FluentScheduler.TaskFactory;
|
using TaskFactory = FluentScheduler.TaskFactory;
|
||||||
|
|
||||||
namespace PlexRequests.UI
|
namespace PlexRequests.UI
|
||||||
|
@ -69,12 +74,16 @@ namespace PlexRequests.UI
|
||||||
container.Register<IAvailabilityChecker, PlexAvailabilityChecker>();
|
container.Register<IAvailabilityChecker, PlexAvailabilityChecker>();
|
||||||
container.Register<IRequestService, RequestService>();
|
container.Register<IRequestService, RequestService>();
|
||||||
|
|
||||||
|
container.Register<IAvailabilityChecker, PlexAvailabilityChecker>();
|
||||||
|
container.Register<IConfigurationReader, ConfigurationReader>();
|
||||||
|
container.Register<IIntervals, UpdateInterval>();
|
||||||
|
|
||||||
base.ConfigureRequestContainer(container, context);
|
base.ConfigureRequestContainer(container, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void ApplicationStartup(TinyIoCContainer container, IPipelines pipelines)
|
protected override void ApplicationStartup(TinyIoCContainer container, IPipelines pipelines)
|
||||||
{
|
{
|
||||||
TaskManager.TaskFactory = new Jobs.TaskFactory();
|
TaskManager.TaskFactory = new Jobs.PlexTaskFactory();
|
||||||
TaskManager.Initialize(new PlexRegistry());
|
TaskManager.Initialize(new PlexRegistry());
|
||||||
|
|
||||||
CookieBasedSessions.Enable(pipelines, CryptographyConfiguration.Default);
|
CookieBasedSessions.Enable(pipelines, CryptographyConfiguration.Default);
|
||||||
|
|
|
@ -27,13 +27,15 @@
|
||||||
|
|
||||||
using FluentScheduler;
|
using FluentScheduler;
|
||||||
|
|
||||||
|
using PlexRequests.Services;
|
||||||
|
|
||||||
namespace PlexRequests.UI.Jobs
|
namespace PlexRequests.UI.Jobs
|
||||||
{
|
{
|
||||||
public class PlexRegistry : Registry
|
public class PlexRegistry : Registry
|
||||||
{
|
{
|
||||||
public PlexRegistry()
|
public PlexRegistry()
|
||||||
{
|
{
|
||||||
Schedule<PlexAvailabilityChecker>().ToRunNow();
|
Schedule<AvailabilityUpdateService>().ToRunNow();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,13 +1,19 @@
|
||||||
using FluentScheduler;
|
using FluentScheduler;
|
||||||
using Nancy.TinyIoc;
|
using Nancy.TinyIoc;
|
||||||
|
|
||||||
|
using PlexRequests.Services;
|
||||||
|
|
||||||
namespace PlexRequests.UI.Jobs
|
namespace PlexRequests.UI.Jobs
|
||||||
{
|
{
|
||||||
public class TaskFactory : ITaskFactory
|
public class PlexTaskFactory : ITaskFactory
|
||||||
{
|
{
|
||||||
public ITask GetTaskInstance<T>() where T : ITask
|
public ITask GetTaskInstance<T>() where T : ITask
|
||||||
{
|
{
|
||||||
|
//typeof(AvailabilityUpdateService);
|
||||||
var container = TinyIoCContainer.Current;
|
var container = TinyIoCContainer.Current;
|
||||||
|
|
||||||
|
var a= container.ResolveAll(typeof(T));
|
||||||
|
|
||||||
object outT;
|
object outT;
|
||||||
container.TryResolve(typeof(T), out outT);
|
container.TryResolve(typeof(T), out outT);
|
||||||
|
|
|
@ -164,7 +164,7 @@
|
||||||
<Compile Include="Jobs\IAvailabilityChecker.cs" />
|
<Compile Include="Jobs\IAvailabilityChecker.cs" />
|
||||||
<Compile Include="Jobs\PlexAvailabilityChecker.cs" />
|
<Compile Include="Jobs\PlexAvailabilityChecker.cs" />
|
||||||
<Compile Include="Jobs\PlexRegistry.cs" />
|
<Compile Include="Jobs\PlexRegistry.cs" />
|
||||||
<Compile Include="Jobs\TaskFactory.cs" />
|
<Compile Include="Jobs\PlexTaskFactory.cs" />
|
||||||
<Compile Include="Models\PlexAuth.cs" />
|
<Compile Include="Models\PlexAuth.cs" />
|
||||||
<Compile Include="Models\RequestViewModel.cs" />
|
<Compile Include="Models\RequestViewModel.cs" />
|
||||||
<Compile Include="Models\SearchTvShowViewModel.cs" />
|
<Compile Include="Models\SearchTvShowViewModel.cs" />
|
||||||
|
@ -297,6 +297,10 @@
|
||||||
<Project>{1252336D-42A3-482A-804C-836E60173DFA}</Project>
|
<Project>{1252336D-42A3-482A-804C-836E60173DFA}</Project>
|
||||||
<Name>PlexRequests.Helpers</Name>
|
<Name>PlexRequests.Helpers</Name>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\PlexRequests.Services\PlexRequests.Services.csproj">
|
||||||
|
<Project>{566EFA49-68F8-4716-9693-A6B3F2624DEA}</Project>
|
||||||
|
<Name>PlexRequests.Services</Name>
|
||||||
|
</ProjectReference>
|
||||||
<ProjectReference Include="..\PlexRequests.Store\PlexRequests.Store.csproj">
|
<ProjectReference Include="..\PlexRequests.Store\PlexRequests.Store.csproj">
|
||||||
<Project>{92433867-2B7B-477B-A566-96C382427525}</Project>
|
<Project>{92433867-2B7B-477B-A566-96C382427525}</Project>
|
||||||
<Name>PlexRequests.Store</Name>
|
<Name>PlexRequests.Store</Name>
|
||||||
|
|
|
@ -27,9 +27,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PlexRequests.UI.Tests", "Pl
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PlexRequests.Core.Tests", "PlexRequests.Core.Tests\PlexRequests.Core.Tests.csproj", "{FCFECD5D-47F6-454D-8692-E27A921BE655}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PlexRequests.Core.Tests", "PlexRequests.Core.Tests\PlexRequests.Core.Tests.csproj", "{FCFECD5D-47F6-454D-8692-E27A921BE655}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PlexRequests.Helpers.Tests", "PlexRequests.Helpers.Tests\PlexRequests.Helpers.Tests.csproj", "{0E6395D3-B074-49E8-898D-0EB99E507E0E}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PlexRequests.Services", "PlexRequests.Services\PlexRequests.Services.csproj", "{566EFA49-68F8-4716-9693-A6B3F2624DEA}"
|
||||||
EndProject
|
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{EC46BEB4-AEC4-42AE-B1D5-6B32FEA8154A}"
|
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
@ -69,17 +67,12 @@ Global
|
||||||
{FCFECD5D-47F6-454D-8692-E27A921BE655}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{FCFECD5D-47F6-454D-8692-E27A921BE655}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{FCFECD5D-47F6-454D-8692-E27A921BE655}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{FCFECD5D-47F6-454D-8692-E27A921BE655}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{FCFECD5D-47F6-454D-8692-E27A921BE655}.Release|Any CPU.Build.0 = Release|Any CPU
|
{FCFECD5D-47F6-454D-8692-E27A921BE655}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{0E6395D3-B074-49E8-898D-0EB99E507E0E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{566EFA49-68F8-4716-9693-A6B3F2624DEA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{0E6395D3-B074-49E8-898D-0EB99E507E0E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{566EFA49-68F8-4716-9693-A6B3F2624DEA}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{0E6395D3-B074-49E8-898D-0EB99E507E0E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{566EFA49-68F8-4716-9693-A6B3F2624DEA}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{0E6395D3-B074-49E8-898D-0EB99E507E0E}.Release|Any CPU.Build.0 = Release|Any CPU
|
{566EFA49-68F8-4716-9693-A6B3F2624DEA}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(NestedProjects) = preSolution
|
|
||||||
{A930E2CF-79E2-45F9-B06A-9A719A254CE4} = {EC46BEB4-AEC4-42AE-B1D5-6B32FEA8154A}
|
|
||||||
{FCFECD5D-47F6-454D-8692-E27A921BE655} = {EC46BEB4-AEC4-42AE-B1D5-6B32FEA8154A}
|
|
||||||
{0E6395D3-B074-49E8-898D-0EB99E507E0E} = {EC46BEB4-AEC4-42AE-B1D5-6B32FEA8154A}
|
|
||||||
EndGlobalSection
|
|
||||||
EndGlobal
|
EndGlobal
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue