Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Fazzani committed Dec 27, 2024
1 parent b9571f6 commit 3453684
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 32 deletions.
18 changes: 7 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,8 @@
<p align="center">
Automatically categorize your requested movies and TV shows from your watching providers.
<br />
<a href="https://github.com/Fazzani/Proxarr"><strong>Explore the docs »</strong></a>
<br />
<br />
<a href="https://github.com/Fazzani/Proxarr">View Demo</a>
·
<a href="https://github.com/Fazzani/Proxarr/issues/new?labels=bug&template=bug-report---.md">Report Bug</a>
·
·
<a href="https://github.com/Fazzani/Proxarr/issues/new?labels=enhancement&template=feature-request---.md">Request Feature</a>
</p>
</div>
Expand Down Expand Up @@ -74,7 +69,8 @@ It uses TMDB to find out which streaming services are available in the selected
1. Clone the repo
```sh
git clone https://github.com/Fazzani/Proxarr.git
```
```

2. Update your [config.yml](./src/Proxarr.Api/config.yml) with your API keys according to your setup
```yaml
AppConfiguration:
Expand Down Expand Up @@ -109,9 +105,9 @@ docker compose -f docker-compose.yml up -d

### Watching providers configuration

[TMDB API to get available regions](https://developer.themoviedb.org/reference/watch-providers-available-regions)
[TMDB API to get available movie providers by region](https://developer.themoviedb.org/reference/watch-providers-movie-list)
[TMDB API to get available tv providers by region](https://developer.themoviedb.org/reference/watch-providers-tv-list)
- [TMDB API to get available regions](https://developer.themoviedb.org/reference/watch-providers-available-regions)
- [TMDB API to get available movie providers by region](https://developer.themoviedb.org/reference/watch-providers-movie-list)
- [TMDB API to get available tv providers by region](https://developer.themoviedb.org/reference/watch-providers-tv-list)

<!-- ROADMAP -->
## Roadmap
Expand Down Expand Up @@ -181,4 +177,4 @@ Project Link: [https://github.com/Fazzani/Proxarr](https://github.com/Fazzani/Pr
[license-url]: https://github.com/Fazzani/Proxarr/blob/master/LICENSE.txt
[linkedin-shield]: https://img.shields.io/badge/-LinkedIn-black.svg?style=for-the-badge&logo=linkedin&colorB=555
[linkedin-url]: https://www.linkedin.com/in/heni-fazzani
[arr-api-key]: images/arr_api_key.png
[arr-api-key]: images/arr_api_key.png
2 changes: 1 addition & 1 deletion src/Proxarr.Api/AppConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{
public sealed class AppConfiguration
{
public const string SectionName = nameof(AppConfiguration);
public const string SECTION_NAME = nameof(AppConfiguration);

public string LOG_FOLDER { get; set; }

Expand Down
1 change: 1 addition & 0 deletions src/Proxarr.Api/Configuration/ClientConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
{
public sealed class ClientConfiguration
{
public const string SECTION_NAME = $"{AppConfiguration.SECTION_NAME}:Clients";
public required string ApiKey { get; set; }
public required string BaseUrl { get; set; }
}
Expand Down
9 changes: 5 additions & 4 deletions src/Proxarr.Api/Core/ApiKeyDelegatingHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ namespace Proxarr.Api.Core
{
public class ApiKeyDelegatingHandler : DelegatingHandler
{
private const string API_KEY_HEADER_NAME = "X-API-KEY";

private readonly IConfiguration _configuration;
private const string apiKeyHeaderName = "X-API-KEY";

public ApiKeyDelegatingHandler(IConfiguration configuration)
{
Expand All @@ -14,15 +15,15 @@ public ApiKeyDelegatingHandler(IConfiguration configuration)

protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
{
if (!request.Headers.Contains(apiKeyHeaderName) && request.RequestUri != null)
if (!request.Headers.Contains(API_KEY_HEADER_NAME) && request.RequestUri != null)
{
var key = $"{request.RequestUri.Scheme}://{request.RequestUri.Host}";
var clients = _configuration.GetSection("Clients").Get<List<ClientConfiguration>>();
var clients = _configuration.GetSection(ClientConfiguration.SECTION_NAME).Get<List<ClientConfiguration>>();
var clientConfig = clients?.FirstOrDefault(x => x.BaseUrl.Equals(key, StringComparison.OrdinalIgnoreCase));

if (clientConfig != null)
{
request.Headers.Add(apiKeyHeaderName, clientConfig.ApiKey);
request.Headers.Add(API_KEY_HEADER_NAME, clientConfig.ApiKey);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/Proxarr.Api/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
builder.Services.AddOpenApi();

builder.Services.AddSingleton(x => new TMDbClient(builder.Configuration.GetValue<string>("AppConfiguration:TMDB_API_KEY")));
builder.Services.Configure<AppConfiguration>(builder.Configuration.GetSection(AppConfiguration.SectionName));
builder.Services.Configure<AppConfiguration>(builder.Configuration.GetSection(AppConfiguration.SECTION_NAME));
builder.Services.AddTransient<ApiKeyDelegatingHandler>();
builder.Services.AddScoped<IRadarrService, RadarrService>();
builder.Services.AddScoped<ISonarrService, SonarrService>();
Expand Down
13 changes: 7 additions & 6 deletions src/Proxarr.Api/Proxarr.Api.http
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Content-Type: application/json
Accept: application/json
{
"movie": {
"id": 72,
"id": 75,
"title": "Carry-On",
"year": 2024,
"releaseDate": "9999-12-31",
Expand All @@ -19,22 +19,23 @@ Accept: application/json
"overview": "An airport security officer races to outsmart a mysterious traveler forcing him to let a dangerous item slip onto a Christmas Eve flight.",
"genres": [
"Action",
"Mystery",
"Thriller"
],
"images": [
{
"coverType": "poster",
"url": "/MediaCover/72/poster.jpg",
"url": "/MediaCover/75/poster.jpg",
"remoteUrl": "https://image.tmdb.org/t/p/original/sjMN7DRi4sGiledsmllEw5HJjPy.jpg"
},
{
"coverType": "fanart",
"url": "/MediaCover/72/fanart.jpg",
"url": "/MediaCover/75/fanart.jpg",
"remoteUrl": "https://image.tmdb.org/t/p/original/rhc8Mtuo3Kh8CndnlmTNMF8o9pU.jpg"
}
],
"tags": [],
"tags": [
"1 - heni"
],
"originalLanguage": {
"id": 1,
"name": "English"
Expand All @@ -43,7 +44,7 @@ Accept: application/json
"addMethod": "manual",
"eventType": "MovieAdded",
"instanceName": "Radarr",
"applicationUrl": "{{Radarr.ApplicationUrl}}"
"applicationUrl": "https://radarr.synker.ovh"
}

### Movie qualify endpoint TEST
Expand Down
13 changes: 4 additions & 9 deletions src/Proxarr.Api/config.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
---
Logging:
LogLevel:
Default: "Information"
Microsoft.AspNetCore: Information
Serilog:
Using:
- Serilog.Sinks.Console
Expand All @@ -23,15 +19,14 @@ Serilog:
Args:
path: "%LOG_FOLDER%/Serilog.log"
rollingInterval: Day
outputTemplate: "[{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} {CorrelationId} {Level:u3}]
{Username} {Message:lj}{NewLine}{Exception}"
outputTemplate: "[{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} {CorrelationId} {Level:u3}] {Username} {Message:lj}{NewLine}{Exception}"
AllowedHosts: "*"
AppConfiguration:
TMDB_API_KEY: "38e2583fc9244b03ad8a59e5cba5f3f8"
TMDB_API_KEY: 38e2583fc9244b03ad8a59e5cba5f3f8
TAG_NAME: "q"
WATCH_PROVIDERS: "FR:Netflix,US:Amazon Prime Video"
Clients:
- ApiKey: "9b2ee4ab385446dda9a4c50de8401536"
- ApiKey: 9b2ee4ab385446dda9a4c50de8401536
BaseUrl: "https://radarr.synker.ovh"
- ApiKey: "f085b5c7ddd94bcf9056bf1e5a03a4be"
- ApiKey: f085b5c7ddd94bcf9056bf1e5a03a4be
BaseUrl: "https://sonarr.synker.ovh"

0 comments on commit 3453684

Please sign in to comment.