1
0
mirror of https://github.com/Radarr/Radarr.git synced 2026-03-31 18:36:15 -04:00

Compare commits

..

1 Commits

Author SHA1 Message Date
Qstick
dec77f63e7 Speed up collections load by 50% 2022-11-23 21:03:52 -06:00
7 changed files with 99 additions and 76 deletions

View File

@@ -17,12 +17,12 @@ namespace NzbDrone.Core.ImportLists.Plex
{
var pageableRequests = new ImportListPageableRequestChain();
pageableRequests.Add(GetSeriesRequest());
pageableRequests.Add(GetMoviesRequest());
return pageableRequests;
}
private IEnumerable<ImportListRequest> GetSeriesRequest()
private IEnumerable<ImportListRequest> GetMoviesRequest()
{
var request = new ImportListRequest(_plexTvService.GetWatchlist(Settings.AccessToken));

View File

@@ -1,9 +1,9 @@
{
"EditDelayProfile": "Upravit profil zpoždění",
"AcceptConfirmationModal": "Přijměte potvrzovací modální okno",
"AcceptConfirmationModal": "Přijměte potvrzení Modal",
"Automatic": "Automatický",
"CertificateValidation": "Ověření certifikátu",
"CertificateValidationHelpText": "Změňte přísnost ověřování certifikátů HTTPS. Neměňte, pokud nerozumíte rizikům.",
"CertificateValidationHelpText": "Změňte, jak přísné je ověření certifikace HTTPS",
"Cast": "Obsazení",
"CheckDownloadClientForDetails": "zkontrolujte stahování klienta pro více informací",
"CheckForFinishedDownloadsInterval": "Zkontrolujte interval dokončených stahování",
@@ -137,7 +137,7 @@
"Ungroup": "Oddělit skupinu",
"Unlimited": "Neomezený",
"UnsavedChanges": "Neuložené změny",
"UpdateMechanismHelpText": "Použijte vestavěný aktualizační program Radarr nebo skript",
"UpdateMechanismHelpText": "Použijte vestavěný aktualizátor Radarr nebo skript",
"UpgradeUntilQuality": "Upgradujte až do kvality",
"UseHardlinksInsteadOfCopy": "Místo kopírování použijte pevné odkazy",
"UsenetDelayTime": "Usenet Zpoždění: {0}",
@@ -157,12 +157,12 @@
"Announced": "Oznámeno",
"AvailabilityDelayHelpText": "Množství času před nebo po dostupném datu pro vyhledání filmu",
"ImportExistingMovies": "Importovat existující filmy",
"AddedToDownloadQueue": "Přidáno do fronty ke stažení",
"AddedToDownloadQueue": "Přidáno do stažené fronty",
"AddNotification": "Přidat oznámení",
"Add": "Přidat",
"AddCustomFormat": "Přidat vlastní formát",
"AddDelayProfile": "Přidat profil zpoždění",
"AddDownloadClient": "Přidat klienta pro stahování",
"AddDownloadClient": "Přidat staženého klienta",
"AddRootFolder": "Přidat kořenovou složku",
"Always": "Vždy",
"AnalyticsEnabledHelpText": "Odesílejte anonymní informace o použití a chybách na servery Radarru. To zahrnuje informace o vašem prohlížeči, které stránky Radarr WebUI používáte, hlášení chyb a také verzi operačního systému a běhového prostředí. Tyto informace použijeme k upřednostnění funkcí a oprav chyb.",
@@ -677,7 +677,7 @@
"IMDb": "IMDb",
"ImportCustomFormat": "Importujte vlastní formát",
"ImportedTo": "Importováno do",
"ImportRootPath": "Nasměrujte Radarr na složku obsahující všechny vaše filmy, ne na konkrétní film. Např. {0} a ne {1}. Kromě toho musí být každý film ve vlastní složce v rámci kořenové složky nebo knihovny.",
"ImportRootPath": "Namiřte Radarr na složku obsahující všechny vaše filmy, nikoli konkrétní film. např. {0} a ne {1}. Každý film musí být navíc ve své vlastní složce v kořenové složce / složce knihovny.",
"ImportTipsMessage": "Několik tipů, jak zajistit bezproblémový import:",
"InCinemasDate": "V kinech",
"InCinemasMsg": "Film je v kinech",
@@ -687,13 +687,13 @@
"IncludeUnmonitored": "Zahrnout Nesledováno",
"ImportMovies": "Importovat filmy",
"IndexerPriority": "Priorita indexování",
"IndexerPriorityHelpText": "Priorita indexovacího modulu od 1 (nejvyšší) do 50 (nejnižší). Výchozí: 25. Používá se při získávání verzí jako rozhodující prvek pro jinak stejné verze, Radarr bude stále používat všechny povolené indexovací moduly pro Synchronizaci RSS a vyhledávání",
"IndexerPriorityHelpText": "Priorita indexování od 1 (nejvyšší) do 50 (nejnižší). Výchozí: 25.",
"IndexerRssHealthCheckNoAvailableIndexers": "Všechny indexery podporující rss jsou dočasně nedostupné kvůli nedávným chybám indexeru",
"IndexerRssHealthCheckNoIndexers": "Nejsou k dispozici žádné indexery se zapnutou synchronizací RSS, Radarr nové verze automaticky nezachytí",
"Indexers": "Indexery",
"IndexerSearchCheckNoAutomaticMessage": "Nejsou k dispozici žádné indexery se zapnutým automatickým vyhledáváním, Radarr neposkytne žádné automatické výsledky hledání",
"IndexerSearchCheckNoAvailableIndexersMessage": "Všechny indexery podporující vyhledávání jsou dočasně nedostupné kvůli nedávným chybám indexeru",
"IndexerSearchCheckNoInteractiveMessage": "Při povoleném interaktivním vyhledávání, nejsou dostupné žádné indexovací moduly, Radarr neposkytne žádné interaktivní výsledky hledání",
"IndexerSearchCheckNoInteractiveMessage": "Pokud je povoleno interaktivní vyhledávání, nejsou k dispozici žádné indexery, Radarr neposkytne žádné interaktivní výsledky hledání",
"IndexerSettings": "Nastavení indexeru",
"IndexerStatusCheckSingleClientMessage": "Indexery nedostupné z důvodu selhání: {0}",
"InstallLatest": "Nainstalujte nejnovější",
@@ -1061,6 +1061,6 @@
"AllCollectionsHiddenDueToFilter": "Všechny filmy jsou skryty kvůli použitému filtru.",
"Collections": "Sbírka",
"MonitorMovies": "Monitorujte film",
"NoCollections": "Nebyly nalezeny žádné kolekce, pro začátek budete chtít přidat nový film nebo importovat některé stávající",
"NoCollections": "Nebyly nalezeny žádné filmy. Chcete-li začít, budete chtít přidat nový film nebo importovat některé stávající.",
"RssSyncHelpText": "Interval v minutách. Nastavením na nulu deaktivujete (tím se zastaví veškeré automatické uvolnění uvolnění)"
}

View File

@@ -333,13 +333,13 @@
"Branch": "Git-Branch",
"BypassProxyForLocalAddresses": "Proxy für lokale Adressen umgehen",
"CertificateValidation": "Zertifikat Validierung",
"CertificateValidationHelpText": "Ändere wie streng die Validierung der HTTPS-Zertifizierung ist. Ändern Sie nicht wenn Ihnen die Risiken nicht bewusst sind.",
"CertificateValidationHelpText": "Ändere wie streng die Validierung der HTTPS-Zertifizierung ist. Nicht anpassen, außer du kennst das Risiko.",
"CertificationCountry": "Zertifizierungs Land",
"ChangeFileDate": "Erstelldatum der Datei anpassen",
"ChangeHasNotBeenSavedYet": "Änderung wurde noch nicht gespeichert",
"CheckForFinishedDownloadsInterval": "Intervall zum prüfen von fertigen Downloads",
"CleanLibraryLevel": "Mediathek aufräumen",
"ClickToChangeLanguage": "Sprache ändern",
"ClickToChangeLanguage": "Sprache ändern ...",
"ClickToChangeQuality": "Hier klicken um die Qualität zu ändern",
"ClientPriority": "Priorität",
"CloneFormatTag": "Format Tag kopieren",
@@ -516,7 +516,7 @@
"ShowTitleHelpText": "Filmtitel unter dem Plakat anzeigen",
"ShowUnknownMovieItems": "Unzugeordente Filmeinträge anzeigen",
"SkipFreeSpaceCheck": "Pürfung des freien Speichers überspringen",
"SkipFreeSpaceCheckWhenImportingHelpText": "Aktiviere diese Option, wenn es Radarr nicht möglich ist, den freien Speicherplatz des Stammverzeichnisses für Filme zu erkennen",
"SkipFreeSpaceCheckWhenImportingHelpText": "Aktiviere diese Option, wenn es nicht möglich ist, den freien Speicherplatz des Stammverzeichnisses für Filme zu erkennen",
"SorryThatMovieCannotBeFound": "Schade, dieser Film kann nicht gefunden werden.",
"SourcePath": "Quellpfad",
"SourceRelativePath": "Relativer Quellpfad",
@@ -531,7 +531,7 @@
"TestAllIndexers": "Alle testen",
"TestAllLists": "Alle testen",
"TimeFormat": "Zeitformat",
"UpdateMechanismHelpText": "Benutze Radarr's Build-In Updater oder ein Script",
"UpdateMechanismHelpText": "Benutze den Build-In Updater oder ein Script",
"UpdateScriptPathHelpText": "Pfad zu einem benutzerdefinierten Skript, das ein extrahiertes Update-Paket übernimmt und den Rest des Update-Prozesses abwickelt",
"UpgradeAllowedHelpText": "Wenn deaktiviert wird die Qualität nicht verbessert",
"Uptime": "Laufzeit",
@@ -1063,7 +1063,7 @@
"ImportListMissingRoot": "Fehlendes Stammverzeichnis für Importlist(en): {0}",
"BypassDelayIfHighestQualityHelpText": "Verzögerung ignorieren wenn das Release die höchste aktivierte Qualität des Qualitätsprofils mit dem bevorzugtem Protokoll ist",
"BypassDelayIfHighestQuality": "Ignoriere wenn höchste Qualität",
"TaskUserAgentTooltip": "UserAgent von der App welche die API aufgerufen hat",
"TaskUserAgentTooltip": "UserAgent von der App die die API aufgerufen hat",
"Letterboxd": "Letterboxd",
"From": "von",
"NotificationTriggersHelpText": "Auslöser für diese Benachrichtigung auswählen",
@@ -1146,12 +1146,5 @@
"TotalMovies": "Filme insgesamt",
"ApplicationURL": "Anwendungs-URL",
"ApplicationUrlHelpText": "Die externe URL der Anwendung inklusive http(s)://, Port und URL-Basis",
"PreferredProtocol": "Bevorzugtes Protokoll",
"AreYouSureYouWantToResetQualityDefinitions": "Sicher, dass die Qualitätsdefinitionen zurückgesetzt werden sollen?",
"ResetDefinitions": "Definitionen zurücksetzen",
"ResetQualityDefinitions": "Qualitätsdefinitionen zurücksetzen",
"SettingsThemeHelpText": "Anwendungsdesign ändern, inspiriert von Theme.Park",
"ResetTitles": "Titel zurücksetzen",
"ResetTitlesHelpText": "Definitionstitel und Werte zurücksetzen",
"SettingsTheme": "Design"
"PreferredProtocol": "Bevorzugtes Protokoll"
}

View File

@@ -1146,12 +1146,5 @@
"TotalMovies": "Összes film",
"ApplicationUrlHelpText": "Az alkalmazás külső URL-címe, beleértve a \"http(s)://\"-t, a \"Portot\" és az \"URL-alapot\" is",
"ApplicationURL": "Alkalmazás URL-je",
"PreferredProtocol": "Preferált protokoll",
"AreYouSureYouWantToResetQualityDefinitions": "Biztos visszaállítod a minőségi definíciókat?",
"SettingsTheme": "Téma",
"SettingsThemeHelpText": "Kezelőfelület témájának módosítása, a Theme.Park jóvoltából",
"ResetDefinitions": "Definíciók visszaállítása",
"ResetQualityDefinitions": "Állítsd vissza a minőségi meghatározásokat",
"ResetTitles": "Címek visszaállítása",
"ResetTitlesHelpText": "A definíciócímek és értékek visszaállítása"
"PreferredProtocol": "Preferált protokoll"
}

View File

@@ -1146,12 +1146,5 @@
"TotalMovies": "Total de Filmes",
"ApplicationURL": "URL da Aplicação",
"ApplicationUrlHelpText": "O URL externa deste aplicativo, incluindo http(s)://, porta e base de URL",
"PreferredProtocol": "Protocolo Preferido",
"SettingsThemeHelpText": "Alterar o tema da interface do usuário do aplicativo, inspirado no Theme.Park",
"ResetDefinitions": "Redefinir definições",
"ResetQualityDefinitions": "Redefinir Definições de Qualidade",
"ResetTitles": "Redefinir Títulos",
"ResetTitlesHelpText": "Redefinir títulos de definição, bem como valores",
"SettingsTheme": "Tema",
"AreYouSureYouWantToResetQualityDefinitions": "Tem certeza de que deseja redefinir as definições de qualidade?"
"PreferredProtocol": "Protocolo Preferido"
}

View File

@@ -45,39 +45,7 @@ namespace NzbDrone.Core.Movies
public List<MovieMetadata> GetMoviesWithCollections()
{
var movieDictionary = new Dictionary<int, MovieMetadata>();
var builder = new SqlBuilder(_database.DatabaseType)
.LeftJoin<MovieMetadata, MovieTranslation>((mm, t) => mm.Id == t.MovieMetadataId)
.Where<MovieMetadata>(x => x.CollectionTmdbId > 0);
_ = _database.QueryJoined<MovieMetadata, MovieTranslation>(
builder,
(metadata, translation) =>
{
MovieMetadata movieEntry;
if (!movieDictionary.TryGetValue(metadata.Id, out movieEntry))
{
movieEntry = metadata;
movieDictionary.Add(movieEntry.Id, movieEntry);
}
if (translation != null)
{
movieEntry.Translations.Add(translation);
}
else
{
// Add a translation to avoid filename builder making another call thinking translations are not loaded
// Optimize this later by pulling translations with metadata always
movieEntry.Translations.Add(new MovieTranslation { Title = movieEntry.Title, Language = Language.English });
}
return movieEntry;
});
return movieDictionary.Values.ToList();
return Query(x => x.CollectionTmdbId > 0);
}
public List<MovieMetadata> GetMoviesByCollectionTmdbId(int collectionId)

View File

@@ -2,13 +2,16 @@ using System.Collections.Generic;
using System.Linq;
using Microsoft.AspNetCore.Mvc;
using NzbDrone.Common.Extensions;
using NzbDrone.Core.Configuration;
using NzbDrone.Core.Datastore.Events;
using NzbDrone.Core.Languages;
using NzbDrone.Core.Messaging.Commands;
using NzbDrone.Core.Messaging.Events;
using NzbDrone.Core.Movies;
using NzbDrone.Core.Movies.Collections;
using NzbDrone.Core.Movies.Commands;
using NzbDrone.Core.Movies.Events;
using NzbDrone.Core.Movies.Translations;
using NzbDrone.Core.Organizer;
using NzbDrone.SignalR;
using Radarr.Http;
@@ -26,6 +29,8 @@ namespace Radarr.Api.V3.Collections
private readonly IMovieCollectionService _collectionService;
private readonly IMovieService _movieService;
private readonly IMovieMetadataService _movieMetadataService;
private readonly IMovieTranslationService _movieTranslationService;
private readonly IConfigService _configService;
private readonly IBuildFileNames _fileNameBuilder;
private readonly INamingConfigService _namingService;
private readonly IManageCommandQueue _commandQueueManager;
@@ -34,6 +39,8 @@ namespace Radarr.Api.V3.Collections
IMovieCollectionService collectionService,
IMovieService movieService,
IMovieMetadataService movieMetadataService,
IMovieTranslationService movieTranslationService,
IConfigService configService,
IBuildFileNames fileNameBuilder,
INamingConfigService namingService,
IManageCommandQueue commandQueueManager)
@@ -42,6 +49,8 @@ namespace Radarr.Api.V3.Collections
_collectionService = collectionService;
_movieService = movieService;
_movieMetadataService = movieMetadataService;
_movieTranslationService = movieTranslationService;
_configService = configService;
_fileNameBuilder = fileNameBuilder;
_namingService = namingService;
_commandQueueManager = commandQueueManager;
@@ -132,16 +141,29 @@ namespace Radarr.Api.V3.Collections
private IEnumerable<CollectionResource> MapToResource(List<MovieCollection> collections)
{
var configLanguage = (Language)_configService.MovieInfoLanguage;
// Avoid calling for naming spec on every movie in filenamebuilder
var namingConfig = _namingService.GetConfig();
var collectionMovies = _movieMetadataService.GetMoviesWithCollections();
var allCollectionMovies = _movieMetadataService.GetMoviesWithCollections()
.GroupBy(x => x.CollectionTmdbId)
.ToDictionary(x => x.Key, x => (IEnumerable<MovieMetadata>)x);
var translations = _movieTranslationService.GetAllTranslationsForLanguage(configLanguage);
var tdict = translations.ToDictionary(x => x.MovieMetadataId);
foreach (var collection in collections)
{
var resource = collection.ToResource();
foreach (var movie in collectionMovies.Where(m => m.CollectionTmdbId == collection.TmdbId))
allCollectionMovies.TryGetValue(collection.TmdbId, out var collectionMovies);
foreach (var movie in collectionMovies)
{
var translation = GetTranslationFromDict(tdict, movie, configLanguage);
movie.Translations.Add(translation);
var movieResource = movie.ToResource();
movieResource.Folder = _fileNameBuilder.GetMovieFolder(new Movie { MovieMetadata = movie }, namingConfig);
@@ -155,11 +177,17 @@ namespace Radarr.Api.V3.Collections
private CollectionResource MapToResource(MovieCollection collection)
{
var resource = collection.ToResource();
var namingConfig = _namingService.GetConfig();
foreach (var movie in _movieMetadataService.GetMoviesByCollectionTmdbId(collection.TmdbId))
{
var translations = _movieTranslationService.GetAllTranslationsForMovieMetadata(movie.Id);
var translation = GetMovieTranslation(translations, movie, (Language)_configService.MovieInfoLanguage);
movie.Translations.Add(translation);
var movieResource = movie.ToResource();
movieResource.Folder = _fileNameBuilder.GetMovieFolder(new Movie { MovieMetadata = movie });
movieResource.Folder = _fileNameBuilder.GetMovieFolder(new Movie { MovieMetadata = movie }, namingConfig);
resource.Movies.Add(movieResource);
}
@@ -167,6 +195,54 @@ namespace Radarr.Api.V3.Collections
return resource;
}
private MovieTranslation GetMovieTranslation(List<MovieTranslation> translations, MovieMetadata movie, Language configLanguage)
{
if (configLanguage == Language.Original)
{
return new MovieTranslation
{
Title = movie.OriginalTitle,
Overview = movie.Overview
};
}
var translation = translations.FirstOrDefault(t => t.Language == configLanguage && t.MovieMetadataId == movie.Id);
if (translation == null)
{
translation = new MovieTranslation
{
Title = movie.Title,
Language = Language.English
};
}
return translation;
}
private MovieTranslation GetTranslationFromDict(Dictionary<int, MovieTranslation> translations, MovieMetadata movie, Language configLanguage)
{
if (configLanguage == Language.Original)
{
return new MovieTranslation
{
Title = movie.OriginalTitle,
Overview = movie.Overview
};
}
if (!translations.TryGetValue(movie.Id, out var translation))
{
translation = new MovieTranslation
{
Title = movie.Title,
Language = Language.English
};
}
return translation;
}
[NonAction]
public void Handle(CollectionAddedEvent message)
{