mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-21 05:43:19 -07:00
moved everything up a directory
This commit is contained in:
parent
448cd8d92e
commit
9a78f790a6
76 changed files with 0 additions and 0 deletions
41
RequestPlex.Api/ApiRequest.cs
Normal file
41
RequestPlex.Api/ApiRequest.cs
Normal file
|
@ -0,0 +1,41 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using RequestPlex.Api.Interfaces;
|
||||
|
||||
using RestSharp;
|
||||
|
||||
namespace RequestPlex.Api
|
||||
{
|
||||
public class ApiRequest : IApiRequest
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// An API request handler
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of class you want to deserialize</typeparam>
|
||||
/// <param name="request">The request.</param>
|
||||
/// <param name="baseUri">The base URI.</param>
|
||||
/// <returns>The type of class you want to deserialize</returns>
|
||||
public T Execute<T>(IRestRequest request, Uri baseUri) where T : new()
|
||||
{
|
||||
var client = new RestClient { BaseUrl = baseUri };
|
||||
|
||||
var response = client.Execute<T>(request);
|
||||
|
||||
if (response.ErrorException != null)
|
||||
{
|
||||
|
||||
|
||||
var message = "Error retrieving response. Check inner details for more info.";
|
||||
throw new ApplicationException(message, response.ErrorException);
|
||||
}
|
||||
|
||||
return response.Data;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
34
RequestPlex.Api/Models/MovieSearch.cs
Normal file
34
RequestPlex.Api/Models/MovieSearch.cs
Normal file
|
@ -0,0 +1,34 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace RequestPlex.Api.Models
|
||||
{
|
||||
public class MovieResult
|
||||
{
|
||||
public bool adult { get; set; }
|
||||
public string backdrop_path { get; set; }
|
||||
public List<object> genre_ids { get; set; }
|
||||
public int id { get; set; }
|
||||
public string original_language { get; set; }
|
||||
public string original_title { get; set; }
|
||||
public string overview { get; set; }
|
||||
public string release_date { get; set; }
|
||||
public string poster_path { get; set; }
|
||||
public double popularity { get; set; }
|
||||
public string title { get; set; }
|
||||
public bool video { get; set; }
|
||||
public double vote_average { get; set; }
|
||||
public int vote_count { get; set; }
|
||||
}
|
||||
|
||||
public class MovieSearch
|
||||
{
|
||||
public int page { get; set; }
|
||||
public List<MovieResult> results { get; set; }
|
||||
public int total_pages { get; set; }
|
||||
public int total_results { get; set; }
|
||||
}
|
||||
}
|
14
RequestPlex.Api/MovieBase.cs
Normal file
14
RequestPlex.Api/MovieBase.cs
Normal file
|
@ -0,0 +1,14 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace RequestPlex.Api
|
||||
{
|
||||
public abstract class MovieBase
|
||||
{
|
||||
protected string ApiKey = "b8eabaf5608b88d0298aa189dd90bf00";
|
||||
protected string Url = "http://api.themoviedb.org/3";
|
||||
}
|
||||
}
|
36
RequestPlex.Api/Properties/AssemblyInfo.cs
Normal file
36
RequestPlex.Api/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("RequestPlex.Api")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("RequestPlex.Api")]
|
||||
[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("8cb8d235-2674-442d-9c6a-35fcaeeb160d")]
|
||||
|
||||
// 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")]
|
79
RequestPlex.Api/RequestPlex.Api.csproj
Normal file
79
RequestPlex.Api/RequestPlex.Api.csproj
Normal file
|
@ -0,0 +1,79 @@
|
|||
<?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>{8CB8D235-2674-442D-9C6A-35FCAEEB160D}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>RequestPlex.Api</RootNamespace>
|
||||
<AssemblyName>RequestPlex.Api</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="Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="RestSharp, Version=105.2.3.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\RestSharp.105.2.3\lib\net452\RestSharp.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<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="TMDbLib, Version=0.9.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\TMDbLib.0.9.0.0-alpha\lib\net45\TMDbLib.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="ApiRequest.cs" />
|
||||
<Compile Include="Models\MovieSearch.cs" />
|
||||
<Compile Include="TheMovieDbApi.cs" />
|
||||
<Compile Include="MovieBase.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\RequestPlex.Api.Interfaces\RequestPlex.Api.Interfaces.csproj">
|
||||
<Project>{95834072-A675-415D-AA8F-877C91623810}</Project>
|
||||
<Name>RequestPlex.Api.Interfaces</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<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>
|
43
RequestPlex.Api/TheMovieDbApi.cs
Normal file
43
RequestPlex.Api/TheMovieDbApi.cs
Normal file
|
@ -0,0 +1,43 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using TMDbLib.Client;
|
||||
using TMDbLib.Objects.General;
|
||||
using TMDbLib.Objects.Movies;
|
||||
using TMDbLib.Objects.Search;
|
||||
|
||||
namespace RequestPlex.Api
|
||||
{
|
||||
public class TheMovieDbApi : MovieBase
|
||||
{
|
||||
public TheMovieDbApi()
|
||||
{
|
||||
Client = new TMDbClient(ApiKey);
|
||||
}
|
||||
|
||||
public TMDbClient Client { get; set; }
|
||||
public async Task<List<SearchMovie>> SearchMovie(string searchTerm)
|
||||
{
|
||||
var results = await Client.SearchMovie(searchTerm);
|
||||
return results.Results;
|
||||
}
|
||||
|
||||
public async Task<List<SearchTv>> SearchTv(string searchTerm)
|
||||
{
|
||||
|
||||
var results = await Client.SearchTvShow(searchTerm);
|
||||
return results.Results;
|
||||
}
|
||||
|
||||
public async Task<List<MovieResult>> GetCurrentPlayingMovies()
|
||||
{
|
||||
var movies = await Client.GetMovieList(MovieListType.NowPlaying);
|
||||
return movies.Results;
|
||||
}
|
||||
public async Task<List<MovieResult>> GetUpcomingMovies()
|
||||
{
|
||||
var movies = await Client.GetMovieList(MovieListType.Upcoming);
|
||||
return movies.Results;
|
||||
}
|
||||
}
|
||||
}
|
6
RequestPlex.Api/packages.config
Normal file
6
RequestPlex.Api/packages.config
Normal file
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Newtonsoft.Json" version="7.0.1" targetFramework="net452" />
|
||||
<package id="RestSharp" version="105.2.3" targetFramework="net452" />
|
||||
<package id="TMDbLib" version="0.9.0.0-alpha" targetFramework="net452" />
|
||||
</packages>
|
Loading…
Add table
Add a link
Reference in a new issue