From 206c6ed3805e4920d5d592a4d20c257a1edda014 Mon Sep 17 00:00:00 2001 From: Zoe Roux Date: Mon, 26 Feb 2024 23:16:02 +0100 Subject: [PATCH 1/4] Add COMPOSE_PROFILES note on installing.md --- INSTALLING.md | 2 ++ front/packages/models/src/login.ts | 1 + 2 files changed, 3 insertions(+) diff --git a/INSTALLING.md b/INSTALLING.md index 00c28d077..bc802aa5b 100644 --- a/INSTALLING.md +++ b/INSTALLING.md @@ -81,6 +81,7 @@ Kyoo will default to use your primary card (located at `/dev/dri/renderD128`). I can use the `GOTRANSCODER_VAAPI_RENDERER` env-var to specify `/dev/dri/renderD129` or another one. Then you can simply run kyoo using `docker compose --profile vaapi up -d` (notice the `--profile vaapi` added) +You can also add `COMPOSE_PROFILES=vaapi` to your `.env` instead of adding the `--profile` flag. ## Nvidia @@ -93,6 +94,7 @@ To test if everything works, you can run `sudo docker run --rm --gpus all ubuntu you might need to add `--runtime nvidia` like so: `sudo docker run --rm --runtime=nvidia --gpus all ubuntu nvidia-smi` After that, you can now use `docker compose --profile nvidia up -d` to start kyoo with nvidia hardware acceleration (notice the `--profile nvidia` added). +You can also add `COMPOSE_PROFILES=nvidia` to your `.env` instead of adding the `--profile` flag. Note that most nvidia cards have an artificial limit on the number of encodes. You can confirm your card limit [here](https://developer.nvidia.com/video-encode-and-decode-gpu-support-matrix-new). This limit can also be removed by applying an [unofficial patch](https://github.com/keylase/nvidia-patch) to you driver. diff --git a/front/packages/models/src/login.ts b/front/packages/models/src/login.ts index 2875a4f4f..6ae89d6eb 100644 --- a/front/packages/models/src/login.ts +++ b/front/packages/models/src/login.ts @@ -78,6 +78,7 @@ export const getTokenWJ = async (account?: Account | null): ReturnType Date: Mon, 26 Feb 2024 23:40:03 +0100 Subject: [PATCH 2/4] Run monitor before scan --- scanner/scanner/__init__.py | 8 +++++--- scanner/scanner/scanner.py | 1 + 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/scanner/scanner/__init__.py b/scanner/scanner/__init__.py index 6e3a7dd2a..587f10862 100644 --- a/scanner/scanner/__init__.py +++ b/scanner/scanner/__init__.py @@ -1,4 +1,5 @@ async def main(): + import asyncio import os import logging import sys @@ -38,8 +39,9 @@ async def main(): ) as client: try: scanner = Scanner(client, languages=languages.split(","), api_key=api_key) - await scanner.scan(path) - logging.info("Scan finished. Starting to monitor...") - await monitor(path, scanner) + await asyncio.gather( + monitor(path, scanner), + scanner.scan(path), + ) except ProviderError as e: logging.error(e) diff --git a/scanner/scanner/scanner.py b/scanner/scanner/scanner.py index 337da4876..e0784a773 100644 --- a/scanner/scanner/scanner.py +++ b/scanner/scanner/scanner.py @@ -54,6 +54,7 @@ async def scan(self, path: str): # We batch videos by 20 because too mutch at once kinda DDOS everything. for group in batch(iter(videos), 20): await asyncio.gather(*map(self.identify, group)) + logging.info("Scan finished.") async def get_registered_paths(self) -> List[str]: paths = None From 5b6a927af54848bdb4c07165151c2863ab8fac0c Mon Sep 17 00:00:00 2001 From: Zoe Roux Date: Tue, 27 Feb 2024 00:06:37 +0100 Subject: [PATCH 3/4] Fix movies sort by start/end air date on items routes --- back/src/Kyoo.Abstractions/Models/Resources/Movie.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/back/src/Kyoo.Abstractions/Models/Resources/Movie.cs b/back/src/Kyoo.Abstractions/Models/Resources/Movie.cs index d3ccf7c49..bdab427e5 100644 --- a/back/src/Kyoo.Abstractions/Models/Resources/Movie.cs +++ b/back/src/Kyoo.Abstractions/Models/Resources/Movie.cs @@ -19,6 +19,7 @@ using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using EntityFrameworkCore.Projectables; using Kyoo.Abstractions.Controllers; @@ -118,6 +119,14 @@ public class Movie /// public Image? Logo { get; set; } + [SerializeIgnore] + [Column("air_date")] + public DateTime? StartAir => AirDate; + + [SerializeIgnore] + [Column("air_date")] + public DateTime? EndAir => AirDate; + /// /// A video of a few minutes that tease the content. /// From 1835f5046c78a92057a113e3b336353dd9bc46b6 Mon Sep 17 00:00:00 2001 From: Zoe Roux Date: Tue, 27 Feb 2024 00:23:44 +0100 Subject: [PATCH 4/4] Add support for tmdb continuous (absolute) ordering when using normal ordering (ex: One piece) --- .../providers/implementations/themoviedatabase.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/scanner/providers/implementations/themoviedatabase.py b/scanner/providers/implementations/themoviedatabase.py index ab3c6cae8..27d33bd98 100644 --- a/scanner/providers/implementations/themoviedatabase.py +++ b/scanner/providers/implementations/themoviedatabase.py @@ -655,7 +655,7 @@ async def get_absolute_number(self, show_id: str, season: int, episode_nbr: int) ) + episode_nbr ) - return next( + absolute = next( ( # The + 1 is to go from 0based index to 1based absolute number i + 1 @@ -664,6 +664,18 @@ async def get_absolute_number(self, show_id: str, season: int, episode_nbr: int) ), None, ) + if absolute is not None: + return absolute + # assume we use tmdb weird absolute by default (for example, One Piece S21E800, the first + # episode of S21 si not reset to 0 but keep increasing so it can be 800 + start = next( + (x["episode_number"] for x in absgrp if x["season_number"] == season), None + ) + if start is None or start <= episode_nbr: + return None + # add back the continuous number (imagine the user has one piece S21e31 + # but tmdb registered it as S21E831 since S21's first ep is 800 + return await self.get_absolute_number(show_id, season, episode_nbr + start) async def identify_collection(self, provider_id: str) -> Collection: languages = self.get_languages()