mirror of
				https://github.com/zoriya/Kyoo.git
				synced 2025-11-03 19:17:16 -05:00 
			
		
		
		
	Cleanups
This commit is contained in:
		
							parent
							
								
									da0c1087e9
								
							
						
					
					
						commit
						edf2941e01
					
				@ -1,7 +1,7 @@
 | 
				
			|||||||
# Useful config options
 | 
					# Useful config options
 | 
				
			||||||
LIBRARY_ROOT=/video
 | 
					LIBRARY_ROOT=/video
 | 
				
			||||||
TVDB__APIKEY=
 | 
					TVDB__APIKEY=
 | 
				
			||||||
THEMOVIEDB__APIKEY=
 | 
					THEMOVIEDB_APIKEY=
 | 
				
			||||||
PUBLIC_BACK_URL=http://localhost:5000
 | 
					PUBLIC_BACK_URL=http://localhost:5000
 | 
				
			||||||
AUTHENTICATION_SECRET=
 | 
					AUTHENTICATION_SECRET=
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -98,6 +98,7 @@ namespace Kyoo.Core.Controllers
 | 
				
			|||||||
						?? await _providers.CreateIfNotExists(x)
 | 
											?? await _providers.CreateIfNotExists(x)
 | 
				
			||||||
					)
 | 
										)
 | 
				
			||||||
					.ToListAsync();
 | 
										.ToListAsync();
 | 
				
			||||||
 | 
									_database.AttachRange(resource.Providers);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -21,7 +21,6 @@ using System.Collections.Generic;
 | 
				
			|||||||
using Autofac;
 | 
					using Autofac;
 | 
				
			||||||
using Kyoo.Abstractions;
 | 
					using Kyoo.Abstractions;
 | 
				
			||||||
using Kyoo.Abstractions.Controllers;
 | 
					using Kyoo.Abstractions.Controllers;
 | 
				
			||||||
using Kyoo.TheMovieDb.Models;
 | 
					 | 
				
			||||||
using Microsoft.Extensions.Configuration;
 | 
					using Microsoft.Extensions.Configuration;
 | 
				
			||||||
using Microsoft.Extensions.Logging;
 | 
					using Microsoft.Extensions.Logging;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -62,13 +61,10 @@ namespace Kyoo.TheMovieDb
 | 
				
			|||||||
		public string Description => "A metadata provider for TheMovieDB.";
 | 
							public string Description => "A metadata provider for TheMovieDB.";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		/// <inheritdoc />
 | 
							/// <inheritdoc />
 | 
				
			||||||
		public bool Enabled => !string.IsNullOrEmpty(_configuration.GetValue<string>("themoviedb:apikey"));
 | 
							public bool Enabled => !string.IsNullOrEmpty(_configuration.GetValue<string>("THEMOVIEDB_APIKEY"));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		/// <inheritdoc />
 | 
							/// <inheritdoc />
 | 
				
			||||||
		public Dictionary<string, Type> Configuration => new()
 | 
							public Dictionary<string, Type> Configuration => new();
 | 
				
			||||||
		{
 | 
					 | 
				
			||||||
			{ TheMovieDbOptions.Path, typeof(TheMovieDbOptions) }
 | 
					 | 
				
			||||||
		};
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
		/// <inheritdoc />
 | 
							/// <inheritdoc />
 | 
				
			||||||
		public void Configure(ContainerBuilder builder)
 | 
							public void Configure(ContainerBuilder builder)
 | 
				
			||||||
 | 
				
			|||||||
@ -1,36 +0,0 @@
 | 
				
			|||||||
// Kyoo - A portable and vast media library solution.
 | 
					 | 
				
			||||||
// Copyright (c) Kyoo.
 | 
					 | 
				
			||||||
//
 | 
					 | 
				
			||||||
// See AUTHORS.md and LICENSE file in the project root for full license information.
 | 
					 | 
				
			||||||
//
 | 
					 | 
				
			||||||
// Kyoo is free software: you can redistribute it and/or modify
 | 
					 | 
				
			||||||
// it under the terms of the GNU General Public License as published by
 | 
					 | 
				
			||||||
// the Free Software Foundation, either version 3 of the License, or
 | 
					 | 
				
			||||||
// any later version.
 | 
					 | 
				
			||||||
//
 | 
					 | 
				
			||||||
// Kyoo is distributed in the hope that it will be useful,
 | 
					 | 
				
			||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
					 | 
				
			||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 | 
					 | 
				
			||||||
// GNU General Public License for more details.
 | 
					 | 
				
			||||||
//
 | 
					 | 
				
			||||||
// You should have received a copy of the GNU General Public License
 | 
					 | 
				
			||||||
// along with Kyoo. If not, see <https://www.gnu.org/licenses/>.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
namespace Kyoo.TheMovieDb.Models
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	/// <summary>
 | 
					 | 
				
			||||||
	/// The option containing the api key for TheMovieDb.
 | 
					 | 
				
			||||||
	/// </summary>
 | 
					 | 
				
			||||||
	public class TheMovieDbOptions
 | 
					 | 
				
			||||||
	{
 | 
					 | 
				
			||||||
		/// <summary>
 | 
					 | 
				
			||||||
		/// The path to get this option from the root configuration.
 | 
					 | 
				
			||||||
		/// </summary>
 | 
					 | 
				
			||||||
		public const string Path = "themoviedb";
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		/// <summary>
 | 
					 | 
				
			||||||
		/// The api key of TheMovieDb.
 | 
					 | 
				
			||||||
		/// </summary>
 | 
					 | 
				
			||||||
		public string ApiKey { get; set; }
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@ -22,9 +22,8 @@ using System.Linq;
 | 
				
			|||||||
using System.Threading.Tasks;
 | 
					using System.Threading.Tasks;
 | 
				
			||||||
using Kyoo.Abstractions.Controllers;
 | 
					using Kyoo.Abstractions.Controllers;
 | 
				
			||||||
using Kyoo.Abstractions.Models;
 | 
					using Kyoo.Abstractions.Models;
 | 
				
			||||||
using Kyoo.TheMovieDb.Models;
 | 
					using Microsoft.Extensions.Configuration;
 | 
				
			||||||
using Microsoft.Extensions.Logging;
 | 
					using Microsoft.Extensions.Logging;
 | 
				
			||||||
using Microsoft.Extensions.Options;
 | 
					 | 
				
			||||||
using TMDbLib.Client;
 | 
					using TMDbLib.Client;
 | 
				
			||||||
using TMDbLib.Objects.Movies;
 | 
					using TMDbLib.Objects.Movies;
 | 
				
			||||||
using TMDbLib.Objects.Search;
 | 
					using TMDbLib.Objects.Search;
 | 
				
			||||||
@ -40,7 +39,7 @@ namespace Kyoo.TheMovieDb
 | 
				
			|||||||
		/// <summary>
 | 
							/// <summary>
 | 
				
			||||||
		/// The API key used to authenticate with TheMovieDb API.
 | 
							/// The API key used to authenticate with TheMovieDb API.
 | 
				
			||||||
		/// </summary>
 | 
							/// </summary>
 | 
				
			||||||
		private readonly IOptions<TheMovieDbOptions> _apiKey;
 | 
							private readonly string _apiKey;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		/// <summary>
 | 
							/// <summary>
 | 
				
			||||||
		/// The logger to use in ase of issue.
 | 
							/// The logger to use in ase of issue.
 | 
				
			||||||
@ -62,11 +61,11 @@ namespace Kyoo.TheMovieDb
 | 
				
			|||||||
		/// <summary>
 | 
							/// <summary>
 | 
				
			||||||
		/// Create a new <see cref="TheMovieDbProvider"/> using the given api key.
 | 
							/// Create a new <see cref="TheMovieDbProvider"/> using the given api key.
 | 
				
			||||||
		/// </summary>
 | 
							/// </summary>
 | 
				
			||||||
		/// <param name="apiKey">The api key.</param>
 | 
							/// <param name="config">The api key.</param>
 | 
				
			||||||
		/// <param name="logger">The logger to use in case of issue.</param>
 | 
							/// <param name="logger">The logger to use in case of issue.</param>
 | 
				
			||||||
		public TheMovieDbProvider(IOptions<TheMovieDbOptions> apiKey, ILogger<TheMovieDbProvider> logger)
 | 
							public TheMovieDbProvider(IConfiguration config, ILogger<TheMovieDbProvider> logger)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			_apiKey = apiKey;
 | 
								_apiKey = config.GetValue<string>("THEMOVIEDB_APIKEY");
 | 
				
			||||||
			_logger = logger;
 | 
								_logger = logger;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -100,7 +99,7 @@ namespace Kyoo.TheMovieDb
 | 
				
			|||||||
					return found;
 | 
										return found;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			TMDbClient client = new(_apiKey.Value.ApiKey);
 | 
								TMDbClient client = new(_apiKey);
 | 
				
			||||||
			return (await client.GetCollectionAsync(id)).ToCollection(Provider);
 | 
								return (await client.GetCollectionAsync(id)).ToCollection(Provider);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -119,7 +118,7 @@ namespace Kyoo.TheMovieDb
 | 
				
			|||||||
					return found;
 | 
										return found;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			TMDbClient client = new(_apiKey.Value.ApiKey);
 | 
								TMDbClient client = new(_apiKey);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if (show.IsMovie)
 | 
								if (show.IsMovie)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
@ -150,7 +149,7 @@ namespace Kyoo.TheMovieDb
 | 
				
			|||||||
			if (!season.Show.TryGetID(Provider.Slug, out int id))
 | 
								if (!season.Show.TryGetID(Provider.Slug, out int id))
 | 
				
			||||||
				return null;
 | 
									return null;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			TMDbClient client = new(_apiKey.Value.ApiKey);
 | 
								TMDbClient client = new(_apiKey);
 | 
				
			||||||
			return (await client.GetTvSeasonAsync(id, season.SeasonNumber))
 | 
								return (await client.GetTvSeasonAsync(id, season.SeasonNumber))
 | 
				
			||||||
				.ToSeason(id, Provider);
 | 
									.ToSeason(id, Provider);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@ -173,7 +172,7 @@ namespace Kyoo.TheMovieDb
 | 
				
			|||||||
				|| episode.SeasonNumber == null || episode.EpisodeNumber == null)
 | 
									|| episode.SeasonNumber == null || episode.EpisodeNumber == null)
 | 
				
			||||||
				return null;
 | 
									return null;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			TMDbClient client = new(_apiKey.Value.ApiKey);
 | 
								TMDbClient client = new(_apiKey);
 | 
				
			||||||
			return (await client.GetTvEpisodeAsync(id, episode.SeasonNumber.Value, episode.EpisodeNumber.Value))
 | 
								return (await client.GetTvEpisodeAsync(id, episode.SeasonNumber.Value, episode.EpisodeNumber.Value))
 | 
				
			||||||
				?.ToEpisode(id, Provider);
 | 
									?.ToEpisode(id, Provider);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@ -192,7 +191,7 @@ namespace Kyoo.TheMovieDb
 | 
				
			|||||||
					return found;
 | 
										return found;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			TMDbClient client = new(_apiKey.Value.ApiKey);
 | 
								TMDbClient client = new(_apiKey);
 | 
				
			||||||
			return (await client.GetPersonAsync(id)).ToPeople(Provider);
 | 
								return (await client.GetPersonAsync(id)).ToPeople(Provider);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -210,7 +209,7 @@ namespace Kyoo.TheMovieDb
 | 
				
			|||||||
					return found;
 | 
										return found;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			TMDbClient client = new(_apiKey.Value.ApiKey);
 | 
								TMDbClient client = new(_apiKey);
 | 
				
			||||||
			return (await client.GetCompanyAsync(id)).ToStudio(Provider);
 | 
								return (await client.GetCompanyAsync(id)).ToStudio(Provider);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -236,7 +235,7 @@ namespace Kyoo.TheMovieDb
 | 
				
			|||||||
		/// <returns>A list of collections containing metadata from TheMovieDb</returns>
 | 
							/// <returns>A list of collections containing metadata from TheMovieDb</returns>
 | 
				
			||||||
		private async Task<ICollection<Collection>> _SearchCollections(string query)
 | 
							private async Task<ICollection<Collection>> _SearchCollections(string query)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			TMDbClient client = new(_apiKey.Value.ApiKey);
 | 
								TMDbClient client = new(_apiKey);
 | 
				
			||||||
			return (await client.SearchCollectionAsync(query))
 | 
								return (await client.SearchCollectionAsync(query))
 | 
				
			||||||
				.Results
 | 
									.Results
 | 
				
			||||||
				.Select(x => x.ToCollection(Provider))
 | 
									.Select(x => x.ToCollection(Provider))
 | 
				
			||||||
@ -251,7 +250,7 @@ namespace Kyoo.TheMovieDb
 | 
				
			|||||||
		/// <returns>A list of shows containing metadata from TheMovieDb</returns>
 | 
							/// <returns>A list of shows containing metadata from TheMovieDb</returns>
 | 
				
			||||||
		private async Task<ICollection<Show>> _SearchShows(string query, int? year = null)
 | 
							private async Task<ICollection<Show>> _SearchShows(string query, int? year = null)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			TMDbClient client = new(_apiKey.Value.ApiKey);
 | 
								TMDbClient client = new(_apiKey);
 | 
				
			||||||
			return (await client.SearchMultiAsync(query, year: year ?? 0))
 | 
								return (await client.SearchMultiAsync(query, year: year ?? 0))
 | 
				
			||||||
				.Results
 | 
									.Results
 | 
				
			||||||
				.Select(x =>
 | 
									.Select(x =>
 | 
				
			||||||
@ -274,7 +273,7 @@ namespace Kyoo.TheMovieDb
 | 
				
			|||||||
		/// <returns>A list of people containing metadata from TheMovieDb</returns>
 | 
							/// <returns>A list of people containing metadata from TheMovieDb</returns>
 | 
				
			||||||
		private async Task<ICollection<People>> _SearchPeople(string query)
 | 
							private async Task<ICollection<People>> _SearchPeople(string query)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			TMDbClient client = new(_apiKey.Value.ApiKey);
 | 
								TMDbClient client = new(_apiKey);
 | 
				
			||||||
			return (await client.SearchPersonAsync(query))
 | 
								return (await client.SearchPersonAsync(query))
 | 
				
			||||||
				.Results
 | 
									.Results
 | 
				
			||||||
				.Select(x => x.ToPeople(Provider))
 | 
									.Select(x => x.ToPeople(Provider))
 | 
				
			||||||
@ -288,7 +287,7 @@ namespace Kyoo.TheMovieDb
 | 
				
			|||||||
		/// <returns>A list of studios containing metadata from TheMovieDb</returns>
 | 
							/// <returns>A list of studios containing metadata from TheMovieDb</returns>
 | 
				
			||||||
		private async Task<ICollection<Studio>> _SearchStudios(string query)
 | 
							private async Task<ICollection<Studio>> _SearchStudios(string query)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			TMDbClient client = new(_apiKey.Value.ApiKey);
 | 
								TMDbClient client = new(_apiKey);
 | 
				
			||||||
			return (await client.SearchCompanyAsync(query))
 | 
								return (await client.SearchCompanyAsync(query))
 | 
				
			||||||
				.Results
 | 
									.Results
 | 
				
			||||||
				.Select(x => x.ToStudio(Provider))
 | 
									.Select(x => x.ToStudio(Provider))
 | 
				
			||||||
 | 
				
			|||||||
@ -15,7 +15,7 @@ services:
 | 
				
			|||||||
    volumes:
 | 
					    volumes:
 | 
				
			||||||
      - ./back:/app
 | 
					      - ./back:/app
 | 
				
			||||||
      - /app/out/
 | 
					      - /app/out/
 | 
				
			||||||
      - kyoo:/var/lib/kyoo
 | 
					      - kyoo:/kyoo
 | 
				
			||||||
      - ./video:/video
 | 
					      - ./video:/video
 | 
				
			||||||
  front:
 | 
					  front:
 | 
				
			||||||
    build:
 | 
					    build:
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user