CodingStyle: Adding last \n at end of file

This commit is contained in:
Zoe Roux 2021-09-05 10:52:20 +02:00
parent 62eec91e6e
commit fd122592f4
117 changed files with 166 additions and 159 deletions

View File

@ -1,7 +1,7 @@
root = true
[*]
charset = us-ascii
charset = utf-8
end_of_line = lf
trim_trailing_whitespace = true
insert_final_newline = true

View File

@ -248,6 +248,7 @@ namespace Kyoo.Abstractions.Controllers
/// </summary>
/// <param name="id">The ID of the resource</param>
/// <exception cref="ItemNotFoundException">If the item is not found</exception>
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
Task Delete(int id);
/// <summary>
@ -255,6 +256,7 @@ namespace Kyoo.Abstractions.Controllers
/// </summary>
/// <param name="slug">The slug of the resource</param>
/// <exception cref="ItemNotFoundException">If the item is not found</exception>
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
Task Delete(string slug);
/// <summary>
@ -262,6 +264,7 @@ namespace Kyoo.Abstractions.Controllers
/// </summary>
/// <param name="obj">The resource to delete</param>
/// <exception cref="ItemNotFoundException">If the item is not found</exception>
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
Task Delete([NotNull] T obj);
/// <summary>
@ -269,6 +272,7 @@ namespace Kyoo.Abstractions.Controllers
/// </summary>
/// <param name="where">A predicate to filter resources to delete. Every resource that match this will be deleted.</param>
/// <exception cref="ItemNotFoundException">If the item is not found</exception>
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
Task DeleteAll([NotNull] Expression<Func<T, bool>> where);
}
@ -284,6 +288,7 @@ namespace Kyoo.Abstractions.Controllers
/// <param name="showID">The ID of the show</param>
/// <param name="libraryID">The ID of the library (optional)</param>
/// <param name="collectionID">The ID of the collection (optional)</param>
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
Task AddShowLink(int showID, int? libraryID, int? collectionID);
/// <summary>
@ -624,7 +629,8 @@ namespace Kyoo.Abstractions.Controllers
Task<ICollection<MetadataID>> GetMetadataID<T>([Optional] Expression<Func<MetadataID, bool>> where,
Expression<Func<MetadataID, object>> sort,
Pagination limit = default
) where T : class, IMetadata
)
where T : class, IMetadata
=> GetMetadataID<T>(where, new Sort<MetadataID>(sort), limit);
}

View File

@ -9,6 +9,43 @@ using Kyoo.Abstractions.Models.Exceptions;
namespace Kyoo.Abstractions.Controllers
{
/// <summary>
/// A common interface that tasks should implement.
/// </summary>
public interface ITask
{
/// <summary>
/// The list of parameters
/// </summary>
/// <returns>
/// All parameters that this task as. Every one of them will be given to the run function with a value.
/// </returns>
public TaskParameters GetParameters();
/// <summary>
/// Start this task.
/// </summary>
/// <param name="arguments">
/// The list of parameters.
/// </param>
/// <param name="progress">
/// The progress reporter. Used to inform the sender the percentage of completion of this task
/// .</param>
/// <param name="cancellationToken">A token to request the task's cancellation.
/// If this task is not cancelled quickly, it might be killed by the runner.
/// </param>
/// <exception cref="TaskFailedException">
/// An exception meaning that the task has failed for handled reasons like invalid arguments,
/// invalid environment, missing plugins or failures not related to a default in the code.
/// This exception allow the task to display a failure message to the end user while others exceptions
/// will be displayed as unhandled exceptions and display a stack trace.
/// </exception>
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
public Task Run([NotNull] TaskParameters arguments,
[NotNull] IProgress<float> progress,
CancellationToken cancellationToken);
}
/// <summary>
/// A single task parameter. This struct contains metadata to display and utility functions to get them in the task.
/// </summary>
@ -43,7 +80,7 @@ namespace Kyoo.Abstractions.Controllers
/// <summary>
/// The value of the parameter.
/// </summary>
private object Value { get; init; }
private object _Value { get; init; }
/// <summary>
/// Create a new task parameter.
@ -93,7 +130,7 @@ namespace Kyoo.Abstractions.Controllers
{
Name = name,
Type = typeof(T),
Value = value
_Value = value
};
}
@ -104,7 +141,7 @@ namespace Kyoo.Abstractions.Controllers
/// <returns>A new parameter's value for this current parameter</returns>
public TaskParameter CreateValue(object value)
{
return this with { Value = value };
return this with { _Value = value };
}
/// <summary>
@ -115,9 +152,9 @@ namespace Kyoo.Abstractions.Controllers
public T As<T>()
{
if (typeof(T) == typeof(object))
return (T)Value;
return (T)_Value;
if (Value is IResource resource)
if (_Value is IResource resource)
{
if (typeof(T) == typeof(string))
return (T)(object)resource.Slug;
@ -125,7 +162,7 @@ namespace Kyoo.Abstractions.Controllers
return (T)(object)resource.ID;
}
return (T)Convert.ChangeType(Value, typeof(T));
return (T)Convert.ChangeType(_Value, typeof(T));
}
}
@ -146,7 +183,7 @@ namespace Kyoo.Abstractions.Controllers
public TaskParameters() { }
/// <summary>
/// Create a <see cref="TaskParameters"/> with an initial parameters content
/// Create a <see cref="TaskParameters"/> with an initial parameters content.
/// </summary>
/// <param name="parameters">The list of parameters</param>
public TaskParameters(IEnumerable<TaskParameter> parameters)
@ -154,40 +191,4 @@ namespace Kyoo.Abstractions.Controllers
AddRange(parameters);
}
}
/// <summary>
/// A common interface that tasks should implement.
/// </summary>
public interface ITask
{
/// <summary>
/// The list of parameters
/// </summary>
/// <returns>
/// All parameters that this task as. Every one of them will be given to the run function with a value.
/// </returns>
public TaskParameters GetParameters();
/// <summary>
/// Start this task.
/// </summary>
/// <param name="arguments">
/// The list of parameters.
/// </param>
/// <param name="progress">
/// The progress reporter. Used to inform the sender the percentage of completion of this task
/// .</param>
/// <param name="cancellationToken">A token to request the task's cancellation.
/// If this task is not cancelled quickly, it might be killed by the runner.
/// </param>
/// <exception cref="TaskFailedException">
/// An exception meaning that the task has failed for handled reasons like invalid arguments,
/// invalid environment, missing plugins or failures not related to a default in the code.
/// This exception allow the task to display a failure message to the end user while others exceptions
/// will be displayed as unhandled exceptions and display a stack trace.
/// </exception>
public Task Run([NotNull] TaskParameters arguments,
[NotNull] IProgress<float> progress,
CancellationToken cancellationToken);
}
}

View File

@ -79,4 +79,4 @@ namespace Kyoo.Abstractions.Controllers
/// <returns>A list of every tasks that this instance know.</returns>
ICollection<TaskMetadataAttribute> GetAllTasks();
}
}
}

View File

@ -217,4 +217,4 @@ namespace Kyoo.Abstractions.Controllers
);
}
}
}
}

View File

@ -14,4 +14,4 @@ namespace Kyoo.Abstractions.Models
/// </summary>
public T Value { get; set; }
}
}
}

View File

@ -7,4 +7,4 @@ namespace Kyoo.Abstractions.Models.Attributes
/// </summary>
[AttributeUsage(AttributeTargets.Property)]
public class ComputedAttribute : NotMergeableAttribute { }
}
}

View File

@ -49,4 +49,4 @@ namespace Kyoo.Abstractions.Models.Attributes
StripScheme = (bool)metadata[nameof(StripScheme)];
}
}
}
}

View File

@ -19,4 +19,4 @@ namespace Kyoo.Abstractions.Models.Attributes
/// <param name="merged">The object that has been merged with this.</param>
void OnMerge(object merged);
}
}
}

View File

@ -34,4 +34,4 @@ namespace Kyoo.Abstractions.Models.Attributes
RelationID = relationID;
}
}
}
}

View File

@ -42,4 +42,4 @@ namespace Kyoo.Abstractions.Models.Attributes
Format = format;
}
}
}
}

View File

@ -73,4 +73,4 @@ namespace Kyoo.Abstractions.Models.Attributes
IsHidden = (bool)metadata[nameof(IsHidden)];
}
}
}
}

View File

@ -92,4 +92,4 @@ namespace Kyoo.Abstractions.Models
return new(path, null);
}
}
}
}

View File

@ -33,4 +33,4 @@ namespace Kyoo.Abstractions.Models.Exceptions
: base(info, context)
{ }
}
}
}

View File

@ -42,4 +42,4 @@ namespace Kyoo.Abstractions.Models.Exceptions
: base(info, context)
{ }
}
}
}

View File

@ -141,4 +141,4 @@ namespace Kyoo.Abstractions.Models
Type = ItemType.Collection
};
}
}
}

View File

@ -42,4 +42,4 @@ namespace Kyoo.Abstractions.Models
get { return x => new { First = x.ResourceID, Second = x.ProviderID }; }
}
}
}
}

View File

@ -76,4 +76,4 @@ namespace Kyoo.Abstractions.Models
First = new Uri(url + query.ToQueryString());
}
}
}
}

View File

@ -54,4 +54,4 @@ namespace Kyoo.Abstractions.Models
/// </summary>
public string Role { get; set; }
}
}
}

View File

@ -77,4 +77,4 @@ namespace Kyoo.Abstractions.Models
return true;
}
}
}
}

View File

@ -26,4 +26,4 @@ namespace Kyoo.Abstractions.Models
/// </remarks>
public string Slug { get; }
}
}
}

View File

@ -46,4 +46,4 @@ namespace Kyoo.Abstractions.Models
/// </summary>
public const int Trailer = 3;
}
}
}

View File

@ -61,4 +61,4 @@ namespace Kyoo.Abstractions.Models
};
}
}
}
}

View File

@ -77,4 +77,4 @@ namespace Kyoo.Abstractions.Models
/// </summary>
public int WatchedPercentage { get; set; }
}
}
}

View File

@ -83,4 +83,4 @@ namespace Kyoo.Abstractions
return configuration["basics:publicUrl"]?.TrimEnd('/') ?? "http://localhost:5000";
}
}
}
}

View File

@ -276,4 +276,4 @@ namespace Kyoo.Utils
yield return ret;
}
}
}
}

View File

@ -88,4 +88,4 @@ namespace Kyoo.Utils
return action.Method;
}
}
}
}

View File

@ -66,4 +66,4 @@ namespace Kyoo.Utils
return value ?? Task.FromResult<T>(default);
}
}
}
}

View File

@ -117,4 +117,4 @@ namespace Kyoo.Authentication
return certificate;
}
}
}
}

View File

@ -51,4 +51,4 @@ namespace Kyoo.Authentication
return hash.SequenceEqual(validHash.Skip(16));
}
}
}
}

View File

@ -51,4 +51,4 @@ namespace Kyoo.Authentication
return user.Claims.FirstOrDefault(x => x.Type == "permissions")?.Value.Split(',');
}
}
}
}

View File

@ -25,4 +25,4 @@ namespace Kyoo.Authentication.Models.DTO
/// </summary>
public IFormFile Picture { get; set; }
}
}
}

View File

@ -25,4 +25,4 @@ namespace Kyoo.Authentication.Models.DTO
/// </summary>
public string ReturnURL { get; set; }
}
}
}

View File

@ -15,4 +15,4 @@ namespace Kyoo.Authentication.Models.DTO
/// </summary>
public bool StayLoggedIn { get; set; }
}
}
}

View File

@ -44,4 +44,4 @@ namespace Kyoo.Authentication.Models.DTO
};
}
}
}
}

View File

@ -100,4 +100,4 @@ namespace Kyoo.Authentication
};
}
}
}
}

View File

@ -25,4 +25,4 @@ namespace Kyoo.Authentication.Models
/// </summary>
public string ProfilePicturePath { get; set; }
}
}
}

View File

@ -25,4 +25,4 @@ namespace Kyoo.Authentication.Models
/// </summary>
public string Password { get; set; }
}
}
}

View File

@ -20,4 +20,4 @@ namespace Kyoo.Authentication.Models
/// </summary>
public string[] NewUser { get; set; }
}
}
}

View File

@ -223,4 +223,4 @@ namespace Kyoo.Authentication.Views
return _options.Value.Permissions.Default ?? Array.Empty<string>();
}
}
}
}

View File

@ -197,4 +197,4 @@ namespace Kyoo.Core.Controllers
return await CreateDirectory(path);
}
}
}
}

View File

@ -135,4 +135,4 @@ namespace Kyoo.Core.Controllers
throw new NotImplementedException();
}
}
}
}

View File

@ -138,4 +138,4 @@ namespace Kyoo.Core.Controllers
});
}
}
}
}

View File

@ -174,4 +174,4 @@ namespace Kyoo.Core.Controllers
}
}
}
}
}

View File

@ -140,4 +140,4 @@ namespace Kyoo.Core.Controllers
});
}
}
}
}

View File

@ -103,4 +103,4 @@ namespace Kyoo.Core.Controllers
await _database.SaveChangesAsync();
}
}
}
}

View File

@ -62,4 +62,4 @@ namespace Kyoo.Core.Controllers
await _database.SaveChangesAsync();
}
}
}
}

View File

@ -152,4 +152,4 @@ namespace Kyoo.Core.Controllers
return items;
}
}
}
}

View File

@ -103,4 +103,4 @@ namespace Kyoo.Core.Controllers
await _database.SaveChangesAsync();
}
}
}
}

View File

@ -313,4 +313,4 @@ namespace Kyoo.Core.Controllers
await Delete(resource);
}
}
}
}

View File

@ -209,4 +209,4 @@ namespace Kyoo.Core.Controllers
return roles;
}
}
}
}

View File

@ -78,4 +78,4 @@ namespace Kyoo.Core.Controllers
limit);
}
}
}
}

View File

@ -196,4 +196,4 @@ namespace Kyoo.Core.Controllers
await _database.SaveChangesAsync();
}
}
}
}

View File

@ -97,4 +97,4 @@ namespace Kyoo.Core.Controllers
await _database.SaveChangesAsync();
}
}
}
}

View File

@ -62,4 +62,4 @@ namespace Kyoo.Core.Controllers
await _database.SaveChangesAsync();
}
}
}
}

View File

@ -321,4 +321,4 @@ namespace Kyoo.Core.Controllers
return _tasks.Select(x => x.Metadata).ToArray();
}
}
}
}

View File

@ -156,4 +156,4 @@ namespace Kyoo.Core
SA.New<IApplicationBuilder>(app => app.UseEndpoints(x => x.MapControllers()), SA.Endpoint)
};
}
}
}

View File

@ -23,4 +23,4 @@ namespace Kyoo.Core
return JsonConvert.DeserializeObject<T>(content);
}
}
}
}

View File

@ -68,4 +68,4 @@ namespace Kyoo.Core.Models.Watch
return SubtitleExtensions.ContainsKey(Path.GetExtension(filePath));
}
}
}
}

View File

@ -55,4 +55,4 @@ namespace Kyoo.Core.Models.Options
/// </summary>
public string MetadataPath { get; set; } = "metadata/";
}
}
}

View File

@ -20,4 +20,4 @@ namespace Kyoo.Core.Models.Options
/// </summary>
public string[] SubtitleRegex { get; set; }
}
}
}

View File

@ -25,4 +25,4 @@ namespace Kyoo.Core.Models.Options
[UsedImplicitly]
public Dictionary<string, TimeSpan> Scheduled { get; set; } = new();
}
}
}

View File

@ -64,4 +64,4 @@ namespace Kyoo.Core.Models.Watch
};
}
}
}
}

View File

@ -117,4 +117,4 @@
// return null;
// }
// }
// }
// }

View File

@ -82,4 +82,4 @@ namespace Kyoo.Core.Tasks
progress.Report(100);
}
}
}
}

View File

@ -75,4 +75,4 @@ namespace Kyoo.Core.Tasks
progress.Report(100);
}
}
}
}

View File

@ -60,4 +60,4 @@ namespace Kyoo.Core.Tasks
return Task.CompletedTask;
}
}
}
}

View File

@ -124,4 +124,4 @@
// return null;
// }
// }
// }
// }

View File

@ -191,4 +191,4 @@ namespace Kyoo.Core.Tasks
return await _libraryManager.CreateIfNotExists(item);
}
}
}
}

View File

@ -81,4 +81,4 @@ namespace Kyoo.Core.Tasks
}
}
}
}
}

View File

@ -180,4 +180,4 @@ namespace Kyoo.Core.Api
}
}
}
}
}

View File

@ -77,4 +77,4 @@ namespace Kyoo.Core.Api
}
}
}
}
}

View File

@ -77,4 +77,4 @@ namespace Kyoo.Core.Api
}
}
}
}
}

View File

@ -134,4 +134,4 @@ namespace Kyoo.Core.Api
return ret;
}
}
}
}

View File

@ -203,4 +203,4 @@ namespace Kyoo.Core.Api
return Ok();
}
}
}
}

View File

@ -153,4 +153,4 @@ namespace Kyoo.Core.Api
// Values are ignored and should not be editable, except if the internal value is set.
}
}
}
}

View File

@ -105,4 +105,4 @@ namespace Kyoo.Core.Api
}
}
}
}
}

View File

@ -56,4 +56,4 @@ namespace Kyoo.Core.Api
}
}
}
}
}

View File

@ -105,4 +105,4 @@ namespace Kyoo.Core.Api
return _files.FileResult(await _thumbs.GetImagePath(people, Images.Poster));
}
}
}
}

View File

@ -47,4 +47,4 @@ namespace Kyoo.Core.Api
return _files.FileResult(await _thumbnails.GetImagePath(provider, Images.Logo));
}
}
}
}

View File

@ -86,4 +86,4 @@ namespace Kyoo.Core.Api
return _libraryManager.Search<Studio>(query);
}
}
}
}

View File

@ -77,4 +77,4 @@ namespace Kyoo.Core.Api
}
}
}
}
}

View File

@ -52,4 +52,4 @@ namespace Kyoo.Core.Api
}
}
}
}
}

View File

@ -33,4 +33,4 @@ namespace Kyoo.Database
return config.GetValue<string>("database:enabled");
}
}
}
}

View File

@ -180,4 +180,4 @@ namespace Kyoo.Postgresql.Migrations
migrationBuilder.Sql(@"DROP VIEW library_items;");
}
}
}
}

View File

@ -166,4 +166,4 @@ namespace Kyoo.Postgresql
return Expression.Lambda<Func<T, bool>>(call, query.Parameters);
}
}
}
}

View File

@ -74,4 +74,4 @@ namespace Kyoo.Postgresql
conn.ReloadTypes();
}
}
}
}

View File

@ -182,4 +182,4 @@ namespace Kyoo.SqLite.Migrations
migrationBuilder.Sql("DROP TRIGGER ShowSlugUpdate;");
}
}
}
}

View File

@ -69,4 +69,4 @@ namespace Kyoo.SqLite
context.Database.Migrate();
}
}
}
}

View File

@ -77,4 +77,4 @@ namespace Kyoo.TheMovieDb
};
}
}
}
}

View File

@ -44,4 +44,4 @@ namespace Kyoo.TheMovieDb
};
}
}
}
}

View File

@ -99,4 +99,4 @@ namespace Kyoo.TheMovieDb
};
}
}
}
}

View File

@ -42,4 +42,4 @@ namespace Kyoo.TheMovieDb
};
}
}
}
}

View File

@ -58,4 +58,4 @@ namespace Kyoo.TheTvdb
builder.RegisterProvider<ProviderTvdb>();
}
}
}
}

View File

@ -144,4 +144,4 @@ namespace Kyoo.TheTvdb
}
}
}
}
}

View File

@ -15,4 +15,4 @@ namespace Kyoo.TheTvdb.Models
/// </summary>
public string ApiKey { get; set; }
}
}
}

View File

@ -74,4 +74,4 @@ namespace Kyoo.Tests
await Context.DisposeAsync();
}
}
}
}

View File

@ -190,4 +190,4 @@ namespace Kyoo.Tests
Assert.Equal(0, await _repository.GetCount());
}
}
}
}

View File

@ -196,4 +196,4 @@ namespace Kyoo.Tests.Database
KAssert.DeepEqual(value, ret.First());
}
}
}
}

View File

@ -323,4 +323,4 @@ namespace Kyoo.Tests.Database
KAssert.DeepEqual(value, ret.First());
}
}
}
}

Some files were not shown because too many files have changed in this diff Show More