diff --git a/back/src/Kyoo.Core/Controllers/ThumbnailsManager.cs b/back/src/Kyoo.Core/Controllers/ThumbnailsManager.cs index d11fd898..3c276145 100644 --- a/back/src/Kyoo.Core/Controllers/ThumbnailsManager.cs +++ b/back/src/Kyoo.Core/Controllers/ThumbnailsManager.cs @@ -77,18 +77,18 @@ namespace Kyoo.Core.Controllers using SKCodec codec = SKCodec.Create(reader); SKImageInfo info = codec.Info; info.ColorType = SKColorType.Rgba8888; - SKBitmap bitmap = SKBitmap.Decode(codec, info); + using SKBitmap original = SKBitmap.Decode(codec, info); - bitmap.Resize(new SKSizeI(bitmap.Width, bitmap.Height), SKFilterQuality.High); - await _WriteTo(bitmap, $"{localPath}.{ImageQuality.High.ToString().ToLowerInvariant()}.jpg"); + using SKBitmap high = original.Resize(new SKSizeI(original.Width, original.Height), SKFilterQuality.High); + await _WriteTo(high, $"{localPath}.{ImageQuality.High.ToString().ToLowerInvariant()}.jpg"); - bitmap.Resize(new SKSizeI((int)(bitmap.Width / 1.5), (int)(bitmap.Height / 1.5)), SKFilterQuality.Medium); - await _WriteTo(bitmap, $"{localPath}.{ImageQuality.Medium.ToString().ToLowerInvariant()}.jpg"); + using SKBitmap medium = high.Resize(new SKSizeI((int)(high.Width / 1.5), (int)(high.Height / 1.5)), SKFilterQuality.Medium); + await _WriteTo(medium, $"{localPath}.{ImageQuality.Medium.ToString().ToLowerInvariant()}.jpg"); - bitmap.Resize(new SKSizeI(bitmap.Width / 2, bitmap.Height / 2), SKFilterQuality.Low); - await _WriteTo(bitmap, $"{localPath}.{ImageQuality.Low.ToString().ToLowerInvariant()}.jpg"); + using SKBitmap low = medium.Resize(new SKSizeI(medium.Width / 2, medium.Height / 2), SKFilterQuality.Low); + await _WriteTo(low, $"{localPath}.{ImageQuality.Low.ToString().ToLowerInvariant()}.jpg"); - image.Blurhash = Blurhasher.Encode(bitmap, 4, 3); + image.Blurhash = Blurhasher.Encode(low, 4, 3); } catch (Exception ex) { diff --git a/back/src/Kyoo.Postgresql/Migrations/20230806025743_items.cs b/back/src/Kyoo.Postgresql/Migrations/20230806025743_items.cs index 85b812ff..278b0179 100644 --- a/back/src/Kyoo.Postgresql/Migrations/20230806025743_items.cs +++ b/back/src/Kyoo.Postgresql/Migrations/20230806025743_items.cs @@ -39,14 +39,14 @@ namespace Kyoo.Postgresql.Migrations FROM shows AS s UNION ALL SELECT - m.id, m.slug, m.name, m.tagline, m.aliases, m.overview, m.tags, m.genres, m.status, + -m.id, m.slug, m.name, m.tagline, m.aliases, m.overview, m.tags, m.genres, m.status, m.air_date as start_air, m.air_date as end_air, m.poster_source, m.poster_blurhash, m.thumbnail_source, m.thumbnail_blurhash, m.logo_source, m.logo_blurhash, m.trailer, m.external_id, m.air_date, m.path, 'movie'::item_kind AS kind FROM movies AS m UNION ALL SELECT - c.id, c.slug, c.name, NULL as tagline, NULL as alises, c.overview, NULL AS tags, NULL AS genres, 'unknown'::status AS status, + c.id + 10000 AS id, c.slug, c.name, NULL as tagline, NULL as alises, c.overview, NULL AS tags, NULL AS genres, 'unknown'::status AS status, NULL AS start_air, NULL AS end_air, c.poster_source, c.poster_blurhash, c.thumbnail_source, c.thumbnail_blurhash, c.logo_source, c.logo_blurhash, NULL as trailer, c.external_id, NULL AS air_date, NULL as path, 'collection'::item_kind AS kind