From 61812075139ee5d7162b072ec0f248268f9f6eb3 Mon Sep 17 00:00:00 2001 From: purple_emily Date: Mon, 1 Apr 2024 23:08:32 +0100 Subject: [PATCH] Fix incorrect file index stored (#197) * Fix incorrect file index stored * Update `rank-torrent-name` to latest version * Knight Crawler version update --- deployment/docker/docker-compose.yaml | 14 +++++++------- .../Features/Worker/DebridMetaToTorrentMeta.cs | 6 ++++-- src/debrid-collector/requirements.txt | 2 +- src/producer/src/requirements.txt | 2 +- src/qbit-collector/requirements.txt | 2 +- 5 files changed, 14 insertions(+), 12 deletions(-) diff --git a/deployment/docker/docker-compose.yaml b/deployment/docker/docker-compose.yaml index 419b77a5..4a724287 100644 --- a/deployment/docker/docker-compose.yaml +++ b/deployment/docker/docker-compose.yaml @@ -94,7 +94,7 @@ services: condition: service_healthy env_file: stack.env hostname: knightcrawler-addon - image: gabisonfire/knightcrawler-addon:2.0.18 + image: gabisonfire/knightcrawler-addon:2.0.19 labels: logging: promtail networks: @@ -117,7 +117,7 @@ services: redis: condition: service_healthy env_file: stack.env - image: gabisonfire/knightcrawler-consumer:2.0.18 + image: gabisonfire/knightcrawler-consumer:2.0.19 labels: logging: promtail networks: @@ -138,7 +138,7 @@ services: redis: condition: service_healthy env_file: stack.env - image: gabisonfire/knightcrawler-debrid-collector:2.0.18 + image: gabisonfire/knightcrawler-debrid-collector:2.0.19 labels: logging: promtail networks: @@ -152,7 +152,7 @@ services: migrator: condition: service_completed_successfully env_file: stack.env - image: gabisonfire/knightcrawler-metadata:2.0.18 + image: gabisonfire/knightcrawler-metadata:2.0.19 networks: - knightcrawler-network restart: "no" @@ -163,7 +163,7 @@ services: postgres: condition: service_healthy env_file: stack.env - image: gabisonfire/knightcrawler-migrator:2.0.18 + image: gabisonfire/knightcrawler-migrator:2.0.19 networks: - knightcrawler-network restart: "no" @@ -182,7 +182,7 @@ services: redis: condition: service_healthy env_file: stack.env - image: gabisonfire/knightcrawler-producer:2.0.18 + image: gabisonfire/knightcrawler-producer:2.0.19 labels: logging: promtail networks: @@ -207,7 +207,7 @@ services: deploy: replicas: ${QBIT_REPLICAS:-0} env_file: stack.env - image: gabisonfire/knightcrawler-qbit-collector:2.0.18 + image: gabisonfire/knightcrawler-qbit-collector:2.0.19 labels: logging: promtail networks: diff --git a/src/debrid-collector/Features/Worker/DebridMetaToTorrentMeta.cs b/src/debrid-collector/Features/Worker/DebridMetaToTorrentMeta.cs index db83e2c7..ca2a5aca 100644 --- a/src/debrid-collector/Features/Worker/DebridMetaToTorrentMeta.cs +++ b/src/debrid-collector/Features/Worker/DebridMetaToTorrentMeta.cs @@ -16,13 +16,14 @@ public static IReadOnlyList MapMetadataToFilesCollection( foreach (var metadataEntry in Metadata.Where(m => Filetypes.VideoFileExtensions.Any(ext => m.Value.Filename.EndsWith(ext)))) { var validFileIndex = int.TryParse(metadataEntry.Key, out var fileIndex); + var fileIndexMinusOne = Math.Max(0, fileIndex - 1); var file = new TorrentFile { ImdbId = ImdbId, KitsuId = 0, InfoHash = torrent.InfoHash, - FileIndex = validFileIndex ? fileIndex : 0, + FileIndex = validFileIndex ? fileIndexMinusOne : 0, Title = metadataEntry.Value.Filename, Size = metadataEntry.Value.Filesize.GetValueOrDefault(), }; @@ -66,13 +67,14 @@ public static async Task> MapMetadataToSubtitlesColl foreach (var metadataEntry in Metadata.Where(m => Filetypes.SubtitleFileExtensions.Any(ext => m.Value.Filename.EndsWith(ext)))) { var validFileIndex = int.TryParse(metadataEntry.Key, out var fileIndex); + var fileIndexMinusOne = Math.Max(0, fileIndex - 1); var fileId = torrentFiles.FirstOrDefault( t => Path.GetFileNameWithoutExtension(t.Title) == Path.GetFileNameWithoutExtension(metadataEntry.Value.Filename))?.Id ?? 0; var file = new SubtitleFile { InfoHash = InfoHash, - FileIndex = validFileIndex ? fileIndex : 0, + FileIndex = validFileIndex ? fileIndexMinusOne : 0, FileId = fileId, Title = metadataEntry.Value.Filename, }; diff --git a/src/debrid-collector/requirements.txt b/src/debrid-collector/requirements.txt index aaa299ec..5a9e8ab2 100644 --- a/src/debrid-collector/requirements.txt +++ b/src/debrid-collector/requirements.txt @@ -1 +1 @@ -rank-torrent-name==0.2.5 \ No newline at end of file +rank-torrent-name==0.2.11 \ No newline at end of file diff --git a/src/producer/src/requirements.txt b/src/producer/src/requirements.txt index 1f2a3a6e..efc5d160 100644 --- a/src/producer/src/requirements.txt +++ b/src/producer/src/requirements.txt @@ -1 +1 @@ -rank-torrent-name==0.2.5 \ No newline at end of file +rank-torrent-name==0.2.11 \ No newline at end of file diff --git a/src/qbit-collector/requirements.txt b/src/qbit-collector/requirements.txt index aaa299ec..5a9e8ab2 100644 --- a/src/qbit-collector/requirements.txt +++ b/src/qbit-collector/requirements.txt @@ -1 +1 @@ -rank-torrent-name==0.2.5 \ No newline at end of file +rank-torrent-name==0.2.11 \ No newline at end of file