Format code

This commit is contained in:
Zoe Roux 2024-02-19 16:57:35 +01:00
parent 8269d80620
commit a3172c7918
8 changed files with 14 additions and 19 deletions

View File

@ -269,11 +269,7 @@ namespace Kyoo.Abstractions.Models
/// Links to watch this episode. /// Links to watch this episode.
/// </summary> /// </summary>
public VideoLinks Links => public VideoLinks Links =>
new() new() { Direct = $"/episode/{Slug}/direct", Hls = $"/episode/{Slug}/master.m3u8", };
{
Direct = $"/episode/{Slug}/direct",
Hls = $"/episode/{Slug}/master.m3u8",
};
/// <summary> /// <summary>
/// Get the slug of an episode. /// Get the slug of an episode.

View File

@ -153,11 +153,7 @@ namespace Kyoo.Abstractions.Models
/// Links to watch this movie. /// Links to watch this movie.
/// </summary> /// </summary>
public VideoLinks Links => public VideoLinks Links =>
new() new() { Direct = $"/movie/{Slug}/direct", Hls = $"/movie/{Slug}/master.m3u8", };
{
Direct = $"/movie/{Slug}/direct",
Hls = $"/movie/{Slug}/master.m3u8",
};
[SerializeIgnore] [SerializeIgnore]
public ICollection<MovieWatchStatus>? Watched { get; set; } public ICollection<MovieWatchStatus>? Watched { get; set; }

View File

@ -68,7 +68,8 @@ public class WatchStatusRepository : IWatchStatusRepository
DatabaseContext db = scope.ServiceProvider.GetRequiredService<DatabaseContext>(); DatabaseContext db = scope.ServiceProvider.GetRequiredService<DatabaseContext>();
WatchStatusRepository repo = WatchStatusRepository repo =
scope.ServiceProvider.GetRequiredService<WatchStatusRepository>(); scope.ServiceProvider.GetRequiredService<WatchStatusRepository>();
List<Guid> users = await db.ShowWatchStatus.IgnoreQueryFilters() List<Guid> users = await db
.ShowWatchStatus.IgnoreQueryFilters()
.Where(x => x.ShowId == ep.ShowId && x.Status == WatchStatus.Completed) .Where(x => x.ShowId == ep.ShowId && x.Status == WatchStatus.Completed)
.Select(x => x.UserId) .Select(x => x.UserId)
.ToListAsync(); .ToListAsync();

View File

@ -110,7 +110,8 @@ namespace Kyoo.Core
options.SuppressMapClientErrors = true; options.SuppressMapClientErrors = true;
options.InvalidModelStateResponseFactory = ctx => options.InvalidModelStateResponseFactory = ctx =>
{ {
string[] errors = ctx.ModelState.SelectMany(x => x.Value!.Errors) string[] errors = ctx
.ModelState.SelectMany(x => x.Value!.Errors)
.Select(x => x.ErrorMessage) .Select(x => x.ErrorMessage)
.ToArray(); .ToArray();
return new BadRequestObjectResult(new RequestError(errors)); return new BadRequestObjectResult(new RequestError(errors));

View File

@ -111,7 +111,6 @@ public abstract class TranscoderApi<T>(IRepository<T> repository, IThumbnailsMan
await _Proxy($"/{quality}/{segment}", await GetPath(identifier)); await _Proxy($"/{quality}/{segment}", await GetPath(identifier));
} }
[HttpGet("{identifier:id}/audio/{audio}/index.m3u8")] [HttpGet("{identifier:id}/audio/{audio}/index.m3u8")]
[PartialPermission(Kind.Play)] [PartialPermission(Kind.Play)]
public async Task GetAudioIndex(Identifier identifier, string audio) public async Task GetAudioIndex(Identifier identifier, string audio)

View File

@ -46,7 +46,9 @@ namespace Kyoo.Postgresql.Migrations
); );
// language=PostgreSQL // language=PostgreSQL
migrationBuilder.Sql("update users set permissions = ARRAY_APPEND(permissions, 'overall.play');"); migrationBuilder.Sql(
"update users set permissions = ARRAY_APPEND(permissions, 'overall.play');"
);
} }
/// <inheritdoc /> /// <inheritdoc />

View File

@ -19,16 +19,16 @@ type FileStream struct {
Keyframes []float64 Keyframes []float64
CanTransmux bool CanTransmux bool
Info *MediaInfo Info *MediaInfo
videos CMap[Quality, *VideoStream] videos CMap[Quality, *VideoStream]
audios CMap[int32, *AudioStream] audios CMap[int32, *AudioStream]
} }
func NewFileStream(path string, sha string, route string) *FileStream { func NewFileStream(path string, sha string, route string) *FileStream {
ret := &FileStream{ ret := &FileStream{
Path: path, Path: path,
Out: fmt.Sprintf("%s/%s", Settings.Outpath, sha), Out: fmt.Sprintf("%s/%s", Settings.Outpath, sha),
videos: NewCMap[Quality, *VideoStream](), videos: NewCMap[Quality, *VideoStream](),
audios: NewCMap[int32, *AudioStream](), audios: NewCMap[int32, *AudioStream](),
} }
ret.ready.Add(1) ret.ready.Add(1)

View File

@ -181,7 +181,7 @@ func GetInfo(path string, sha string, route string) (*MediaInfo, error) {
ret, _ := infos.GetOrCreate(sha, func() *MediaInfo { ret, _ := infos.GetOrCreate(sha, func() *MediaInfo {
readyChan := make(chan struct{}) readyChan := make(chan struct{})
mi := &MediaInfo{ mi := &MediaInfo{
Sha: sha, Sha: sha,
ready: readyChan, ready: readyChan,
} }
go func() { go func() {