mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-05-24 02:02:36 -04:00
Stylcop: Adding a stylecop analyser and trying to configure it
This commit is contained in:
parent
38472a7431
commit
8ff2fe3965
17
Directory.Build.props
Normal file
17
Directory.Build.props
Normal file
@ -0,0 +1,17 @@
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<IsWindows Condition="$([MSBuild]::IsOSPlatform('Windows'))">true</IsWindows>
|
||||
<IsOSX Condition="$([MSBuild]::IsOSPlatform('OSX'))">true</IsOSX>
|
||||
<IsLinux Condition="$([MSBuild]::IsOSPlatform('Linux'))">true</IsLinux>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.354" />
|
||||
<None Include="$(MSBuildThisFileDirectory)stylecop.json" Link="stylecop.json" Visible="false" />
|
||||
<None Include="$(MSBuildThisFileDirectory).editorconfig" Link="stylecop.json" Visible="false" />
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<CodeAnalysisRuleSet>$(MSBuildThisFileDirectory)Kyoo.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
</Project>
|
@ -16,9 +16,9 @@
|
||||
void Restart();
|
||||
|
||||
/// <summary>
|
||||
/// Get the data directory
|
||||
/// Get the data directory.
|
||||
/// </summary>
|
||||
/// <returns>Retrieve the data directory where runtime data should be stored</returns>
|
||||
/// <returns>Retrieve the data directory where runtime data should be stored.</returns>
|
||||
string GetDataDirectory();
|
||||
|
||||
/// <summary>
|
||||
@ -28,4 +28,4 @@
|
||||
/// <returns>The configuration file name.</returns>
|
||||
string GetConfigFile();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -14,12 +14,12 @@ namespace Kyoo.Abstractions.Controllers
|
||||
public interface IConfigurationManager
|
||||
{
|
||||
/// <summary>
|
||||
/// Add an editable configuration to the editable configuration list
|
||||
/// Add an editable configuration to the editable configuration list.
|
||||
/// </summary>
|
||||
/// <param name="path">The root path of the editable configuration. It should not be a nested type.</param>
|
||||
/// <typeparam name="T">The type of the configuration</typeparam>
|
||||
/// <typeparam name="T">The type of the configuration.</typeparam>
|
||||
void AddTyped<T>(string path);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Add an editable configuration to the editable configuration list.
|
||||
/// WARNING: this method allow you to add an unmanaged type. This type won't be editable. This can be used
|
||||
@ -36,32 +36,33 @@ namespace Kyoo.Abstractions.Controllers
|
||||
/// <param name="path">The root path of the editable configuration. It should not be a nested type.</param>
|
||||
/// <param name="type">The type of the configuration or null.</param>
|
||||
void Register(string path, [CanBeNull] Type type);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Get the value of a setting using it's path.
|
||||
/// </summary>
|
||||
/// <param name="path">The path of the resource (can be separated by ':' or '__')</param>
|
||||
/// <param name="path">The path of the resource (can be separated by ':' or '__').</param>
|
||||
/// <exception cref="ItemNotFoundException">No setting found at the given path.</exception>
|
||||
/// <returns>The value of the settings (if it's a strongly typed one, the given type is instantiated</returns>
|
||||
/// <returns>The value of the settings (if it's a strongly typed one, the given type is instantiated.</returns>
|
||||
object GetValue(string path);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Get the value of a setting using it's path.
|
||||
/// If your don't need a strongly typed value, see <see cref="GetValue"/>.
|
||||
/// </summary>
|
||||
/// <param name="path">The path of the resource (can be separated by ':' or '__')</param>
|
||||
/// <param name="path">The path of the resource (can be separated by ':' or '__').</param>
|
||||
/// <typeparam name="T">A type to strongly type your option.</typeparam>
|
||||
/// <exception cref="InvalidCastException">If your type is not the same as the registered type</exception>
|
||||
/// <exception cref="InvalidCastException">If your type is not the same as the registered type.</exception>
|
||||
/// <exception cref="ItemNotFoundException">No setting found at the given path.</exception>
|
||||
/// <returns>The value of the settings (if it's a strongly typed one, the given type is instantiated</returns>
|
||||
/// <returns>The value of the settings (if it's a strongly typed one, the given type is instantiated.</returns>
|
||||
T GetValue<T>(string path);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Edit the value of a setting using it's path. Save it to the json file.
|
||||
/// </summary>
|
||||
/// <param name="path">The path of the resource (can be separated by ':' or '__')</param>
|
||||
/// <param name="value">The new value of the resource</param>
|
||||
/// <param name="path">The path of the resource (can be separated by ':' or '__').</param>
|
||||
/// <param name="value">The new value of the resource.</param>
|
||||
/// <exception cref="ItemNotFoundException">No setting found at the given path.</exception>
|
||||
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
|
||||
Task EditValue(string path, object value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,8 @@ using Microsoft.AspNetCore.Mvc;
|
||||
namespace Kyoo.Abstractions.Controllers
|
||||
{
|
||||
/// <summary>
|
||||
/// A service to abstract the file system to allow custom file systems (like distant file systems or external providers)
|
||||
/// A service to abstract the file system to allow custom file systems
|
||||
/// (like distant file systems or external providers).
|
||||
/// </summary>
|
||||
public interface IFileSystem
|
||||
{
|
||||
@ -16,10 +17,10 @@ namespace Kyoo.Abstractions.Controllers
|
||||
|
||||
/// <summary>
|
||||
/// Used for http queries returning a file. This should be used to return local files
|
||||
/// or proxy them from a distant server
|
||||
/// or proxy them from a distant server.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// If no file exists at the given path or if the path is null, a NotFoundResult is returned
|
||||
/// If no file exists at the given path or if the path is null, a NotFoundResult is returned
|
||||
/// to handle it gracefully.
|
||||
/// </remarks>
|
||||
/// <param name="path">The path of the file.</param>
|
||||
@ -42,7 +43,7 @@ namespace Kyoo.Abstractions.Controllers
|
||||
/// <exception cref="FileNotFoundException">If the file could not be found.</exception>
|
||||
/// <returns>A reader to read the file.</returns>
|
||||
public Task<Stream> GetReader([NotNull] string path);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Read a file present at <paramref name="path"/>. The reader can be used in an arbitrary context.
|
||||
/// To return files from an http endpoint, use <see cref="FileResult"/>.
|
||||
@ -80,7 +81,7 @@ namespace Kyoo.Abstractions.Controllers
|
||||
/// <param name="path">The path of the directory</param>
|
||||
/// <param name="options">Should the search be recursive or not.</param>
|
||||
/// <returns>A list of files's path.</returns>
|
||||
public Task<ICollection<string>> ListFiles([NotNull] string path,
|
||||
public Task<ICollection<string>> ListFiles([NotNull] string path,
|
||||
SearchOption options = SearchOption.TopDirectoryOnly);
|
||||
|
||||
/// <summary>
|
||||
@ -100,4 +101,4 @@ namespace Kyoo.Abstractions.Controllers
|
||||
/// <returns>The extra directory of the resource.</returns>
|
||||
public Task<string> GetExtraDirectory<T>([NotNull] T resource);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ namespace Kyoo.Abstractions.Controllers
|
||||
/// If no metadata could be parsed for a type, null can be returned.
|
||||
/// </returns>
|
||||
Task<(Collection, Show, Season, Episode)> Identify(string path);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Identify an external subtitle or track file from it's path and return the parsed metadata.
|
||||
/// </summary>
|
||||
@ -34,4 +34,4 @@ namespace Kyoo.Abstractions.Controllers
|
||||
/// </returns>
|
||||
Task<Track> IdentifyTrack(string path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
using Kyoo.Abstractions.Models;
|
||||
using System.Threading.Tasks;
|
||||
using Kyoo.Abstractions.Models;
|
||||
|
||||
namespace Kyoo.Abstractions.Controllers
|
||||
{
|
||||
|
@ -15,18 +15,18 @@ namespace Kyoo.Abstractions.Models.Exceptions
|
||||
/// </summary>
|
||||
public IdentificationFailedException()
|
||||
: base("An identification failed.")
|
||||
{}
|
||||
|
||||
{ }
|
||||
|
||||
/// <summary>
|
||||
/// Create a new <see cref="IdentificationFailedException"/> with a custom message.
|
||||
/// </summary>
|
||||
/// <param name="message">The message to use.</param>
|
||||
public IdentificationFailedException(string message)
|
||||
: base(message)
|
||||
{}
|
||||
|
||||
{ }
|
||||
|
||||
/// <summary>
|
||||
/// The serialization constructor
|
||||
/// The serialization constructor
|
||||
/// </summary>
|
||||
/// <param name="info">Serialization infos</param>
|
||||
/// <param name="context">The serialization context</param>
|
||||
@ -34,4 +34,4 @@ namespace Kyoo.Abstractions.Models.Exceptions
|
||||
: base(info, context)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ namespace Kyoo.Abstractions.Models.Exceptions
|
||||
/// <summary>
|
||||
/// Create a default <see cref="ItemNotFoundException"/> with no message.
|
||||
/// </summary>
|
||||
public ItemNotFoundException() {}
|
||||
public ItemNotFoundException() { }
|
||||
|
||||
/// <summary>
|
||||
/// Create a new <see cref="ItemNotFoundException"/> with a message
|
||||
@ -21,9 +21,9 @@ namespace Kyoo.Abstractions.Models.Exceptions
|
||||
public ItemNotFoundException(string message)
|
||||
: base(message)
|
||||
{ }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// The serialization constructor
|
||||
/// The serialization constructor
|
||||
/// </summary>
|
||||
/// <param name="info">Serialization infos</param>
|
||||
/// <param name="context">The serialization context</param>
|
||||
@ -31,4 +31,4 @@ namespace Kyoo.Abstractions.Models.Exceptions
|
||||
: base(info, context)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9,12 +9,6 @@
|
||||
<RepositoryUrl>https://github.com/AnonymusRaccoon/Kyoo</RepositoryUrl>
|
||||
<LangVersion>default</LangVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<IsWindows Condition="$([MSBuild]::IsOSPlatform('Windows'))">true</IsWindows>
|
||||
<IsOSX Condition="$([MSBuild]::IsOSPlatform('OSX'))">true</IsOSX>
|
||||
<IsLinux Condition="$([MSBuild]::IsOSPlatform('Linux'))">true</IsLinux>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<TranscoderBinary Condition="$(IsWindows) == true">transcoder.dll</TranscoderBinary>
|
||||
@ -58,14 +52,14 @@
|
||||
</Exec>
|
||||
<Error Condition="'$(ErrorCode)' != '0'" Text="An environement capable of building the transcoder was not found. Appropriate tools are not installed, not available in the $PATH or not correctly configured. To fix this you can ether:
 - Fix your tools
 - Skip the transcoder via the '-p:SkipTranscoder=true'
 - Download an already built transcoder and put it in ./Kyoo.Transcoder/build" />
|
||||
</Target>
|
||||
|
||||
|
||||
<ItemGroup Condition="'$(SkipTranscoder)' != 'true'">
|
||||
<None Include="$(TranscoderRoot)/build/$(TranscoderBinary)">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<Visible>false</Visible>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="../LICENSE" CopyToOutputDirectory="Always" Visible="false" />
|
||||
<Content Include="settings.json" CopyToOutputDirectory="PreserveNewest" />
|
||||
|
@ -1,12 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Threading.Tasks;
|
||||
using Kyoo.Abstractions.Controllers;
|
||||
using Kyoo.Abstractions.Models;
|
||||
using Kyoo.Abstractions.Models.Permissions;
|
||||
using Kyoo.Core.Models.Options;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
namespace Kyoo.Core.Api
|
||||
@ -33,11 +33,11 @@ namespace Kyoo.Core.Api
|
||||
ActionResult<Library> result = await base.Create(resource);
|
||||
if (result.Value != null)
|
||||
_taskManager.StartTask("scan",
|
||||
new Progress<float>(),
|
||||
new Progress<float>(),
|
||||
new Dictionary<string, object> {{"slug", result.Value.Slug}});
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
[HttpGet("{id:int}/show")]
|
||||
[HttpGet("{id:int}/shows")]
|
||||
[PartialPermission(Kind.Read)]
|
||||
@ -89,7 +89,7 @@ namespace Kyoo.Core.Api
|
||||
return BadRequest(new {Error = ex.Message});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[HttpGet("{id:int}/collection")]
|
||||
[HttpGet("{id:int}/collections")]
|
||||
[PartialPermission(Kind.Read)]
|
||||
@ -141,7 +141,7 @@ namespace Kyoo.Core.Api
|
||||
return BadRequest(new {Error = ex.Message});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[HttpGet("{id:int}/item")]
|
||||
[HttpGet("{id:int}/items")]
|
||||
[PartialPermission(Kind.Read)]
|
||||
@ -167,7 +167,7 @@ namespace Kyoo.Core.Api
|
||||
return BadRequest(new {Error = ex.Message});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[HttpGet("{slug}/item")]
|
||||
[HttpGet("{slug}/items")]
|
||||
[PartialPermission(Kind.Read)]
|
||||
@ -194,4 +194,4 @@ namespace Kyoo.Core.Api
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,12 +1,8 @@
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<IsWindows Condition="$([MSBuild]::IsOSPlatform('Windows'))">true</IsWindows>
|
||||
</PropertyGroup>
|
||||
|
||||
<Import Project="Kyoo.Host.WindowsTrait.target" Condition="$(IsWindows) == true" />
|
||||
<Import Project="Kyoo.Host.WindowsTrait.linux.target" Condition="$(IsWindows) != true" />
|
||||
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="*.target" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
</Project>
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -5,8 +5,8 @@ using TMDbLib.Objects.General;
|
||||
using TMDbLib.Objects.People;
|
||||
using TMDbLib.Objects.Search;
|
||||
using Images = Kyoo.Abstractions.Models.Images;
|
||||
using TvCast = TMDbLib.Objects.TvShows.Cast;
|
||||
using MovieCast = TMDbLib.Objects.Movies.Cast;
|
||||
using TvCast = TMDbLib.Objects.TvShows.Cast;
|
||||
|
||||
namespace Kyoo.TheMovieDb
|
||||
{
|
||||
@ -31,8 +31,8 @@ namespace Kyoo.TheMovieDb
|
||||
Name = cast.Name,
|
||||
Images = new Dictionary<int, string>
|
||||
{
|
||||
[Images.Poster] = cast.ProfilePath != null
|
||||
? $"https://image.tmdb.org/t/p/original{cast.ProfilePath}"
|
||||
[Images.Poster] = cast.ProfilePath != null
|
||||
? $"https://image.tmdb.org/t/p/original{cast.ProfilePath}"
|
||||
: null
|
||||
},
|
||||
ExternalIDs = new[]
|
||||
@ -49,7 +49,7 @@ namespace Kyoo.TheMovieDb
|
||||
Role = cast.Character
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Convert a <see cref="TvCast"/> to a <see cref="PeopleRole"/>.
|
||||
/// </summary>
|
||||
@ -66,8 +66,8 @@ namespace Kyoo.TheMovieDb
|
||||
Name = cast.Name,
|
||||
Images = new Dictionary<int, string>
|
||||
{
|
||||
[Images.Poster] = cast.ProfilePath != null
|
||||
? $"https://image.tmdb.org/t/p/original{cast.ProfilePath}"
|
||||
[Images.Poster] = cast.ProfilePath != null
|
||||
? $"https://image.tmdb.org/t/p/original{cast.ProfilePath}"
|
||||
: null
|
||||
},
|
||||
ExternalIDs = new[]
|
||||
@ -84,7 +84,7 @@ namespace Kyoo.TheMovieDb
|
||||
Role = cast.Character
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Convert a <see cref="Crew"/> to a <see cref="PeopleRole"/>.
|
||||
/// </summary>
|
||||
@ -101,8 +101,8 @@ namespace Kyoo.TheMovieDb
|
||||
Name = crew.Name,
|
||||
Images = new Dictionary<int, string>
|
||||
{
|
||||
[Images.Poster] = crew.ProfilePath != null
|
||||
? $"https://image.tmdb.org/t/p/original{crew.ProfilePath}"
|
||||
[Images.Poster] = crew.ProfilePath != null
|
||||
? $"https://image.tmdb.org/t/p/original{crew.ProfilePath}"
|
||||
: null
|
||||
},
|
||||
ExternalIDs = new[]
|
||||
@ -119,7 +119,7 @@ namespace Kyoo.TheMovieDb
|
||||
Role = crew.Job
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Convert a <see cref="Person"/> to a <see cref="People"/>.
|
||||
/// </summary>
|
||||
@ -134,8 +134,8 @@ namespace Kyoo.TheMovieDb
|
||||
Name = person.Name,
|
||||
Images = new Dictionary<int, string>
|
||||
{
|
||||
[Images.Poster] = person.ProfilePath != null
|
||||
? $"https://image.tmdb.org/t/p/original{person.ProfilePath}"
|
||||
[Images.Poster] = person.ProfilePath != null
|
||||
? $"https://image.tmdb.org/t/p/original{person.ProfilePath}"
|
||||
: null
|
||||
},
|
||||
ExternalIDs = new[]
|
||||
@ -149,7 +149,7 @@ namespace Kyoo.TheMovieDb
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Convert a <see cref="SearchPerson"/> to a <see cref="People"/>.
|
||||
/// </summary>
|
||||
@ -164,8 +164,8 @@ namespace Kyoo.TheMovieDb
|
||||
Name = person.Name,
|
||||
Images = new Dictionary<int, string>
|
||||
{
|
||||
[Images.Poster] = person.ProfilePath != null
|
||||
? $"https://image.tmdb.org/t/p/original{person.ProfilePath}"
|
||||
[Images.Poster] = person.ProfilePath != null
|
||||
? $"https://image.tmdb.org/t/p/original{person.ProfilePath}"
|
||||
: null
|
||||
},
|
||||
ExternalIDs = new[]
|
||||
@ -180,4 +180,4 @@ namespace Kyoo.TheMovieDb
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ namespace Kyoo.TheMovieDb
|
||||
.Select(x => x.ToPeople(provider))
|
||||
.Concat(tv.Credits.Crew.Select(x => x.ToPeople(provider)))
|
||||
.ToArray(),
|
||||
ExternalIDs = new []
|
||||
ExternalIDs = new[]
|
||||
{
|
||||
new MetadataID
|
||||
{
|
||||
@ -60,7 +60,7 @@ namespace Kyoo.TheMovieDb
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Convert a <see cref="SearchTv"/> to a <see cref="Show"/>.
|
||||
/// </summary>
|
||||
@ -75,7 +75,7 @@ namespace Kyoo.TheMovieDb
|
||||
Title = tv.Name,
|
||||
Overview = tv.Overview,
|
||||
StartAir = tv.FirstAirDate,
|
||||
Images = new Dictionary<int, string>
|
||||
Images = new Dictionary<int, string>
|
||||
{
|
||||
[Images.Poster] = tv.PosterPath != null
|
||||
? $"https://image.tmdb.org/t/p/original{tv.PosterPath}"
|
||||
@ -84,7 +84,7 @@ namespace Kyoo.TheMovieDb
|
||||
? $"https://image.tmdb.org/t/p/original{tv.BackdropPath}"
|
||||
: null,
|
||||
},
|
||||
ExternalIDs = new []
|
||||
ExternalIDs = new[]
|
||||
{
|
||||
new MetadataID
|
||||
{
|
||||
@ -96,4 +96,4 @@ namespace Kyoo.TheMovieDb
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ namespace Kyoo.TheMovieDb
|
||||
{
|
||||
Slug = Utility.ToSlug(company.Name),
|
||||
Name = company.Name,
|
||||
ExternalIDs = new []
|
||||
ExternalIDs = new[]
|
||||
{
|
||||
new MetadataID
|
||||
{
|
||||
@ -58,4 +58,4 @@ namespace Kyoo.TheMovieDb
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -14,24 +14,6 @@ namespace Kyoo.TheMovieDb
|
||||
/// </summary>
|
||||
public class PluginTmdb : IPlugin
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public string Slug => "the-moviedb";
|
||||
|
||||
/// <inheritdoc />
|
||||
public string Name => "TheMovieDb";
|
||||
|
||||
/// <inheritdoc />
|
||||
public string Description => "A metadata provider for TheMovieDB.";
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool Enabled => !string.IsNullOrEmpty(_configuration.GetValue<string>("the-moviedb:apikey"));
|
||||
|
||||
/// <inheritdoc />
|
||||
public Dictionary<string, Type> Configuration => new()
|
||||
{
|
||||
{ TheMovieDbOptions.Path, typeof(TheMovieDbOptions) }
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// The configuration used to check if the api key is present or not.
|
||||
/// </summary>
|
||||
@ -46,14 +28,34 @@ namespace Kyoo.TheMovieDb
|
||||
{
|
||||
_configuration = configuration;
|
||||
if (!Enabled)
|
||||
{
|
||||
logger.LogWarning("No API key configured for TheMovieDB provider. " +
|
||||
"To enable TheMovieDB, specify one in the setting the-moviedb:APIKEY ");
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public string Slug => "the-moviedb";
|
||||
|
||||
/// <inheritdoc />
|
||||
public string Name => "TheMovieDb";
|
||||
|
||||
/// <inheritdoc />
|
||||
public string Description => "A metadata provider for TheMovieDB.";
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool Enabled => !string.IsNullOrEmpty(_configuration.GetValue<string>("the-moviedb:apikey"));
|
||||
|
||||
/// <inheritdoc />
|
||||
public Dictionary<string, Type> Configuration => new()
|
||||
{
|
||||
{ TheMovieDbOptions.Path, typeof(TheMovieDbOptions) }
|
||||
};
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Configure(ContainerBuilder builder)
|
||||
{
|
||||
builder.RegisterProvider<TheMovieDbProvider>();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -11,8 +11,8 @@ namespace Kyoo.TheMovieDb.Models
|
||||
public const string Path = "the-moviedb";
|
||||
|
||||
/// <summary>
|
||||
/// The api key of TheMovieDb.
|
||||
/// The api key of TheMovieDb.
|
||||
/// </summary>
|
||||
public string ApiKey { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ namespace Kyoo.TheTvdb
|
||||
public static class Convertors
|
||||
{
|
||||
/// <summary>
|
||||
/// Convert the string representation of the status in the tvdb API to a Kyoo's <see cref="Status"/> enum.
|
||||
/// Convert the string representation of the status in the tvdb API to a Kyoo's <see cref="Status"/> enum.
|
||||
/// </summary>
|
||||
/// <param name="status">The string representing the status.</param>
|
||||
/// <returns>A kyoo <see cref="Status"/> value or null.</returns>
|
||||
@ -40,9 +40,9 @@ namespace Kyoo.TheTvdb
|
||||
? parsed
|
||||
: null;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Convert a series search to a show.
|
||||
/// Convert a series search to a show.
|
||||
/// </summary>
|
||||
/// <param name="result">The search result</param>
|
||||
/// <param name="provider">The provider representing the tvdb inside kyoo</param>
|
||||
@ -60,7 +60,7 @@ namespace Kyoo.TheTvdb
|
||||
Images = new Dictionary<int, string>
|
||||
{
|
||||
[Images.Poster] = !string.IsNullOrEmpty(result.Poster)
|
||||
? $"https://www.thetvdb.com{result.Poster}"
|
||||
? $"https://www.thetvdb.com{result.Poster}"
|
||||
: null,
|
||||
},
|
||||
ExternalIDs = new[]
|
||||
@ -74,7 +74,7 @@ namespace Kyoo.TheTvdb
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Convert a tvdb series to a kyoo show.
|
||||
/// </summary>
|
||||
@ -94,10 +94,10 @@ namespace Kyoo.TheTvdb
|
||||
Images = new Dictionary<int, string>
|
||||
{
|
||||
[Images.Poster] = !string.IsNullOrEmpty(series.Poster)
|
||||
? $"https://www.thetvdb.com/banners/{series.Poster}"
|
||||
? $"https://www.thetvdb.com/banners/{series.Poster}"
|
||||
: null,
|
||||
[Images.Thumbnail] = !string.IsNullOrEmpty(series.FanArt)
|
||||
? $"https://www.thetvdb.com/banners/{series.FanArt}"
|
||||
? $"https://www.thetvdb.com/banners/{series.FanArt}"
|
||||
: null
|
||||
},
|
||||
Genres = series.Genre.Select(y => new Genre(y)).ToList(),
|
||||
@ -112,7 +112,7 @@ namespace Kyoo.TheTvdb
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Convert a tvdb actor to a kyoo <see cref="PeopleRole"/>.
|
||||
/// </summary>
|
||||
@ -126,10 +126,10 @@ namespace Kyoo.TheTvdb
|
||||
{
|
||||
Slug = Utility.ToSlug(actor.Name),
|
||||
Name = actor.Name,
|
||||
Images = new Dictionary<int, string>
|
||||
Images = new Dictionary<int, string>
|
||||
{
|
||||
[Images.Poster] = !string.IsNullOrEmpty(actor.Image)
|
||||
? $"https://www.thetvdb.com/banners/{actor.Image}"
|
||||
[Images.Poster] = !string.IsNullOrEmpty(actor.Image)
|
||||
? $"https://www.thetvdb.com/banners/{actor.Image}"
|
||||
: null
|
||||
}
|
||||
},
|
||||
@ -155,8 +155,8 @@ namespace Kyoo.TheTvdb
|
||||
Overview = episode.Overview,
|
||||
Images = new Dictionary<int, string>
|
||||
{
|
||||
[Images.Thumbnail] = !string.IsNullOrEmpty(episode.Filename)
|
||||
? $"https://www.thetvdb.com/banners/{episode.Filename}"
|
||||
[Images.Thumbnail] = !string.IsNullOrEmpty(episode.Filename)
|
||||
? $"https://www.thetvdb.com/banners/{episode.Filename}"
|
||||
: null
|
||||
},
|
||||
ExternalIDs = new[]
|
||||
@ -171,4 +171,4 @@ namespace Kyoo.TheTvdb
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
26
Kyoo.ruleset
Normal file
26
Kyoo.ruleset
Normal file
@ -0,0 +1,26 @@
|
||||
<RuleSet Name="Kyoo" ToolsVersion="10.0">
|
||||
<Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.CSharp.MaintainabilityRules">
|
||||
<Rule Id="SA1413" Action="None" /> <!-- UseTrailingCommasInMultiLineInitializers -->
|
||||
<Rule Id="SA1414" Action="None" /> <!-- UseTrailingCommasInMultiLineInitializers -->
|
||||
</Rules>
|
||||
<Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.CSharp.NamingRules">
|
||||
<Rule Id="SA1309" Action="None" /> <!-- FieldNamesMustNotBeginWithUnderscore -->
|
||||
<Rule Id="SX1309" Action="Warning" /> <!-- FieldNamesMustBeginWithUnderscore -->
|
||||
</Rules>
|
||||
<Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.CSharp.ReadabilityRules">
|
||||
<Rule Id="SA1101" Action="None" /> <!-- PrefixLocalCallsWithThis -->
|
||||
<Rule Id="SX1101" Action="Warning" /> <!-- DoNotPrefixLocalMembersWithThis -->
|
||||
</Rules>
|
||||
<Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.CSharp.SpacingRules">
|
||||
<Rule Id="SA1502" Action="None"/> <!-- DocumentationLinesMustBeginWithSingleSpace -->
|
||||
</Rules>
|
||||
<Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.CSharp.DocumentationRules">
|
||||
<Rule Id="SA1642" Action="None" /> <!-- ConstructorSummaryDocumentationMustBeginWithStandardText -->
|
||||
<Rule Id="SA1643" Action="None" /> <!-- DestructorSummaryDocumentationMustBeginWithStandardText -->
|
||||
<Rule Id="SA1623" Action="None" /> <!-- PropertySummaryDocumentationMustMatchAccessors -->
|
||||
|
||||
|
||||
|
||||
<Rule Id="SA1633" Action="None" /> <!-- FileMustHaveHeader TODO remove this, this is only temporary -->
|
||||
</Rules>
|
||||
</RuleSet>
|
6
stylecop.json
Normal file
6
stylecop.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"$schema": "https://raw.githubusercontent.com/DotNetAnalyzers/StyleCopAnalyzers/master/StyleCop.Analyzers/StyleCop.Analyzers/Settings/stylecop.schema.json",
|
||||
"settings": {
|
||||
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user