From a1a53dbb5e017bbeb9b636aea302fd31b2df598b Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Tue, 25 Jun 2024 15:51:20 -0700 Subject: [PATCH] New: Improve UI status when downloads cannot be imported automatically (cherry picked from commit 6d5ff9c4d6993d16848980aea499a45b1b51d95c) --- .../src/Activity/Queue/QueueStatusCell.js | 36 ++++++++++++------- .../HistoryEventTypeFilterBuilderRowValue.tsx | 2 +- frontend/src/Store/Actions/historyActions.js | 2 +- .../ImportFixture.cs | 2 +- .../Download/CompletedDownloadService.cs | 19 ++++++---- .../TrackedDownloads/TrackedDownload.cs | 1 + src/NzbDrone.Core/Localization/Core/de.json | 2 +- src/NzbDrone.Core/Localization/Core/el.json | 2 +- src/NzbDrone.Core/Localization/Core/en.json | 12 ++++++- src/NzbDrone.Core/Localization/Core/es.json | 2 +- src/NzbDrone.Core/Localization/Core/fi.json | 2 +- src/NzbDrone.Core/Localization/Core/fr.json | 2 +- src/NzbDrone.Core/Localization/Core/hu.json | 2 +- .../Localization/Core/pt_BR.json | 2 +- .../Localization/Core/zh_CN.json | 2 +- 15 files changed, 60 insertions(+), 30 deletions(-) diff --git a/frontend/src/Activity/Queue/QueueStatusCell.js b/frontend/src/Activity/Queue/QueueStatusCell.js index 6d5caf6f9..d4dcdfeee 100644 --- a/frontend/src/Activity/Queue/QueueStatusCell.js +++ b/frontend/src/Activity/Queue/QueueStatusCell.js @@ -57,30 +57,40 @@ function QueueStatusCell(props) { if (status === 'paused') { iconName = icons.PAUSED; - title = 'Paused'; + title = translate('Paused'); } if (status === 'queued') { iconName = icons.QUEUED; - title = 'Queued'; + title = translate('Queued'); } if (status === 'completed') { iconName = icons.DOWNLOADED; - title = 'Downloaded'; + title = translate('Downloaded'); + + if (trackedDownloadState === 'importBlocked') { + title += ` - ${translate('UnableToImportAutomatically')}`; + iconKind = kinds.WARNING; + } + + if (trackedDownloadState === 'importFailed') { + title += ` - ${translate('ImportFailed', { sourceTitle })}`; + iconKind = kinds.WARNING; + } if (trackedDownloadState === 'importPending') { - title += ' - Waiting to Import'; + title += ` - ${translate('WaitingToImport')}`; iconKind = kinds.PURPLE; } if (trackedDownloadState === 'importing') { - title += ' - Importing'; + title += ` - ${translate('Importing')}`; iconKind = kinds.PURPLE; } if (trackedDownloadState === 'failedPending') { - title += ' - Waiting to Process'; + title += ` - ${translate('WaitingToProcess')}`; iconKind = kinds.DANGER; } } @@ -91,36 +101,38 @@ function QueueStatusCell(props) { if (status === 'delay') { iconName = icons.PENDING; - title = 'Pending'; + title = translate('Pending'); } if (status === 'downloadClientUnavailable') { iconName = icons.PENDING; iconKind = kinds.WARNING; - title = 'Pending - Download client is unavailable'; + title = translate('PendingDownloadClientUnavailable'); } if (status === 'failed') { iconName = icons.DOWNLOADING; iconKind = kinds.DANGER; - title = 'Download failed'; + title = translate('DownloadFailed'); } if (status === 'warning') { iconName = icons.DOWNLOADING; iconKind = kinds.WARNING; - title = `Download warning: ${errorMessage || 'check download client for more details'}`; + const warningMessage = + errorMessage || translate('CheckDownloadClientForDetails'); + title = translate('DownloadWarning', { warningMessage }); } if (hasError) { if (status === 'completed') { iconName = icons.DOWNLOAD; iconKind = kinds.DANGER; - title = `Import failed: ${sourceTitle}`; + title = translate('ImportFailed', { sourceTitle }); } else { iconName = icons.DOWNLOADING; iconKind = kinds.DANGER; - title = 'Download failed'; + title = translate('DownloadFailed'); } } diff --git a/frontend/src/Components/Filter/Builder/HistoryEventTypeFilterBuilderRowValue.tsx b/frontend/src/Components/Filter/Builder/HistoryEventTypeFilterBuilderRowValue.tsx index 45e6fc756..1b3b369be 100644 --- a/frontend/src/Components/Filter/Builder/HistoryEventTypeFilterBuilderRowValue.tsx +++ b/frontend/src/Components/Filter/Builder/HistoryEventTypeFilterBuilderRowValue.tsx @@ -25,7 +25,7 @@ const EVENT_TYPE_OPTIONS = [ { id: 7, get name() { - return translate('ImportFailed'); + return translate('ImportCompleteFailed'); }, }, { diff --git a/frontend/src/Store/Actions/historyActions.js b/frontend/src/Store/Actions/historyActions.js index 225698229..9d16d29c4 100644 --- a/frontend/src/Store/Actions/historyActions.js +++ b/frontend/src/Store/Actions/historyActions.js @@ -150,7 +150,7 @@ export const defaultState = { }, { key: 'importFailed', - label: () => translate('ImportFailed'), + label: () => translate('ImportCompleteFailed'), filters: [ { key: 'eventType', diff --git a/src/NzbDrone.Core.Test/Download/CompletedDownloadServiceTests/ImportFixture.cs b/src/NzbDrone.Core.Test/Download/CompletedDownloadServiceTests/ImportFixture.cs index 9719b7f1f..ee0651ea3 100644 --- a/src/NzbDrone.Core.Test/Download/CompletedDownloadServiceTests/ImportFixture.cs +++ b/src/NzbDrone.Core.Test/Download/CompletedDownloadServiceTests/ImportFixture.cs @@ -395,7 +395,7 @@ namespace NzbDrone.Core.Test.Download.CompletedDownloadServiceTests Mocker.GetMock() .Verify(v => v.PublishEvent(It.IsAny()), Times.Never()); - _trackedDownload.State.Should().Be(TrackedDownloadState.ImportFailed); + _trackedDownload.State.Should().Be(TrackedDownloadState.ImportBlocked); } private void AssertImported() diff --git a/src/NzbDrone.Core/Download/CompletedDownloadService.cs b/src/NzbDrone.Core/Download/CompletedDownloadService.cs index 9ac8e13e9..b5010b8f8 100644 --- a/src/NzbDrone.Core/Download/CompletedDownloadService.cs +++ b/src/NzbDrone.Core/Download/CompletedDownloadService.cs @@ -63,8 +63,8 @@ namespace NzbDrone.Core.Download SetImportItem(trackedDownload); - // Only process tracked downloads that are still downloading - if (trackedDownload.State != TrackedDownloadState.Downloading) + // Only process tracked downloads that are still downloading or have been blocked for importing due to an issue with matching + if (trackedDownload.State != TrackedDownloadState.Downloading && trackedDownload.State != TrackedDownloadState.ImportBlocked) { return; } @@ -93,7 +93,9 @@ namespace NzbDrone.Core.Download if (artist == null) { - trackedDownload.Warn("Artist name mismatch, automatic import is not possible."); + trackedDownload.Warn("Artist name mismatch, automatic import is not possible. Check the download troubleshooting entry on the wiki for common causes."); + SetStateToImportBlocked(trackedDownload); + return; } } @@ -113,6 +115,8 @@ namespace NzbDrone.Core.Download if (trackedDownload.RemoteAlbum == null) { trackedDownload.Warn("Unable to parse download, automatic import is not possible."); + SetStateToImportBlocked(trackedDownload); + return; } @@ -169,9 +173,7 @@ namespace NzbDrone.Core.Download if (statusMessages.Any()) { trackedDownload.Warn(statusMessages.ToArray()); - - // Mark as failed to prevent further attempts at processing - trackedDownload.State = TrackedDownloadState.ImportFailed; + SetStateToImportBlocked(trackedDownload); } } @@ -237,6 +239,11 @@ namespace NzbDrone.Core.Download return false; } + private void SetStateToImportBlocked(TrackedDownload trackedDownload) + { + trackedDownload.State = TrackedDownloadState.ImportBlocked; + } + private void SetImportItem(TrackedDownload trackedDownload) { trackedDownload.ImportItem = _provideImportItemService.ProvideImportItem(trackedDownload.DownloadItem, trackedDownload.ImportItem); diff --git a/src/NzbDrone.Core/Download/TrackedDownloads/TrackedDownload.cs b/src/NzbDrone.Core/Download/TrackedDownloads/TrackedDownload.cs index d4b4cfe20..af1f85abf 100644 --- a/src/NzbDrone.Core/Download/TrackedDownloads/TrackedDownload.cs +++ b/src/NzbDrone.Core/Download/TrackedDownloads/TrackedDownload.cs @@ -41,6 +41,7 @@ namespace NzbDrone.Core.Download.TrackedDownloads Downloading, DownloadFailed, DownloadFailedPending, + ImportBlocked, ImportPending, Importing, ImportFailed, diff --git a/src/NzbDrone.Core/Localization/Core/de.json b/src/NzbDrone.Core/Localization/Core/de.json index 17b53fad5..6ce2aa25f 100644 --- a/src/NzbDrone.Core/Localization/Core/de.json +++ b/src/NzbDrone.Core/Localization/Core/de.json @@ -782,7 +782,7 @@ "DownloadImported": "Importiere herunterladen", "EditMetadata": "Metadaten bearbeiten", "ForNewImportsOnly": "Nur für neue Imports", - "ImportFailed": "Import fehlgeschlagen", + "ImportCompleteFailed": "Import fehlgeschlagen", "EndedOnly": "Nur beendete", "MassAlbumsCutoffUnmetWarning": "Bist du dir sicher, dass du nach allen '{0}' Alben suchen willst deren Schwelle nicht erreicht worden ist?", "SearchForAllMissingAlbumsConfirmationCount": "Bist du sicher, dass du nach allen {totalRecords} fehlenden Alben suchen möchtest?", diff --git a/src/NzbDrone.Core/Localization/Core/el.json b/src/NzbDrone.Core/Localization/Core/el.json index 47363001b..1ba176c58 100644 --- a/src/NzbDrone.Core/Localization/Core/el.json +++ b/src/NzbDrone.Core/Localization/Core/el.json @@ -751,7 +751,7 @@ "GoToArtistListing": "Μεταβείτε στη λίστα καλλιτεχνών", "HideAlbums": "Απόκρυψη άλμπουμ", "HideTracks": "Απόκρυψη κομματιών", - "ImportFailed": "Η εισαγωγή απέτυχε", + "ImportCompleteFailed": "Η εισαγωγή απέτυχε", "ImportFailures": "Αστοχίες εισαγωγής", "ImportLists": "Λίστες εισαγωγής", "ImportListSpecificSettings": "Εισαγωγή ειδικών ρυθμίσεων λίστας", diff --git a/src/NzbDrone.Core/Localization/Core/en.json b/src/NzbDrone.Core/Localization/Core/en.json index 2c67fc1ed..5f9c76b0c 100644 --- a/src/NzbDrone.Core/Localization/Core/en.json +++ b/src/NzbDrone.Core/Localization/Core/en.json @@ -197,6 +197,7 @@ "ChangeCategoryMultipleHint": "Changes downloads to the 'Post-Import Category' from Download Client", "ChangeFileDate": "Change File Date", "ChangeHasNotBeenSavedYet": "Change has not been saved yet", + "CheckDownloadClientForDetails": "check download client for more details", "ChmodFolder": "chmod Folder", "ChmodFolderHelpText": "Octal, applied during import/rename to media folders and files (without execute bits)", "ChmodFolderHelpTextWarning": "This only works if the user running {appName} is the owner of the file. It's better to ensure the download client sets the permissions properly.", @@ -406,7 +407,9 @@ "DownloadPropersAndRepacksHelpTextWarning": "Use custom formats for automatic upgrades to Propers/Repacks", "DownloadPropersAndRepacksHelpTexts1": "Whether or not to automatically upgrade to Propers/Repacks", "DownloadPropersAndRepacksHelpTexts2": "Use 'Do not Prefer' to sort by preferred word score over propers/repacks", + "DownloadWarning": "Download warning: {warningMessage}", "DownloadWarningCheckDownloadClientForMoreDetails": "Download warning: check download client for more details", + "Downloaded": "Downloaded", "DownloadedImporting": "'Downloaded - Importing'", "DownloadedUnableToImportCheckLogsForDetails": "'Downloaded - Unable to Import: check logs for details'", "DownloadedWaitingToImport": "'Downloaded - Waiting to Import'", @@ -571,9 +574,10 @@ "IllRestartLater": "I'll restart later", "Implementation": "Implementation", "Import": "Import", + "ImportCompleteFailed": "Import Failed", "ImportExtraFiles": "Import Extra Files", "ImportExtraFilesHelpText": "Import matching extra files (subtitles, nfo, etc) after importing an track file", - "ImportFailed": "Import Failed", + "ImportFailed": "Import Failed: {sourceTitle}", "ImportFailedInterp": "Import failed: {0}", "ImportFailures": "Import failures", "ImportList": "Import List", @@ -891,7 +895,10 @@ "Path": "Path", "PathHelpText": "Root Folder containing your music library", "PathHelpTextWarning": "This must be different to the directory where your download client puts files", + "Paused": "Paused", "Peers": "Peers", + "Pending": "Pending", + "PendingDownloadClientUnavailable": "Pending - Download client is unavailable", "Period": "Period", "Permissions": "Permissions", "Playlist": "Playlist", @@ -1268,6 +1275,7 @@ "UnableToAddANewQualityProfilePleaseTryAgain": "Unable to add a new quality profile, please try again.", "UnableToAddANewRemotePathMappingPleaseTryAgain": "Unable to add a new remote path mapping, please try again.", "UnableToAddANewRootFolderPleaseTryAgain": "Unable to add a new root folder, please try again.", + "UnableToImportAutomatically": "Unable to Import Automatically", "UnableToLoadBackups": "Unable to load backups", "UnableToLoadBlocklist": "Unable to load blocklist", "UnableToLoadCustomFormats": "Unable to load custom formats", @@ -1335,6 +1343,8 @@ "UsingExternalUpdateMechanismBranchToUseToUpdateLidarr": "Branch to use to update {appName}", "UsingExternalUpdateMechanismBranchUsedByExternalUpdateMechanism": "Branch used by external update mechanism", "Version": "Version", + "WaitingToImport": "Waiting to Import", + "WaitingToProcess": "Waiting to Process", "Wanted": "Wanted", "Warn": "Warn", "WatchLibraryForChangesHelpText": "Rescan automatically when files change in a root folder", diff --git a/src/NzbDrone.Core/Localization/Core/es.json b/src/NzbDrone.Core/Localization/Core/es.json index 9db5c4a91..2dc642ba6 100644 --- a/src/NzbDrone.Core/Localization/Core/es.json +++ b/src/NzbDrone.Core/Localization/Core/es.json @@ -1126,7 +1126,7 @@ "DefaultLidarrTags": "Etiquetas predeterminadas de {appName}", "ExpandItemsByDefault": "Expandir elementos predeterminados", "DownloadedWaitingToImport": "'Descargados - Esperando para importar'", - "ImportFailed": "La importación falló", + "ImportCompleteFailed": "La importación falló", "IsInUseCantDeleteAMetadataProfileThatIsAttachedToAnArtistOrImportList": "No se puede eliminar un perfil de metadatos que está enlazado a un artista o a una lista de importación", "IsExpandedShowTracks": "Mostrar pistas", "IsInUseCantDeleteAQualityProfileThatIsAttachedToAnArtistOrImportList": "No se puede eliminar un perfil de calidad que está enlazado a un artista o a una lista de importación", diff --git a/src/NzbDrone.Core/Localization/Core/fi.json b/src/NzbDrone.Core/Localization/Core/fi.json index 1497c82e6..4429df780 100644 --- a/src/NzbDrone.Core/Localization/Core/fi.json +++ b/src/NzbDrone.Core/Localization/Core/fi.json @@ -773,7 +773,7 @@ "ExistingAlbumsData": "Valvo albumeita, joille on tiedostoja tai joita ei ole vielä julkaistu.", "ForNewImportsOnly": "Vain uusille tuonneille", "HasMonitoredAlbumsNoMonitoredAlbumsForThisArtist": "Esittäjältä ei valvota albumeita", - "ImportFailed": "Tuonti epäonnistui", + "ImportCompleteFailed": "Tuonti epäonnistui", "ImportFailures": "Tuontivirheet", "ImportLists": "Tuontilistat", "ImportListSettings": "Tuontilistojen yleisasetukset", diff --git a/src/NzbDrone.Core/Localization/Core/fr.json b/src/NzbDrone.Core/Localization/Core/fr.json index a3b29285c..e824e21dd 100644 --- a/src/NzbDrone.Core/Localization/Core/fr.json +++ b/src/NzbDrone.Core/Localization/Core/fr.json @@ -897,7 +897,7 @@ "DeleteMetadataProfile": "Supprimer le profil de métadonnées", "HasMonitoredAlbumsNoMonitoredAlbumsForThisArtist": "Aucun album surveillé pour cet artiste", "ImportFailures": "Échecs d’importation", - "ImportFailed": "Échec de l'importation", + "ImportCompleteFailed": "Échec de l'importation", "IndexerIdHelpTextWarning": "L'utilisation d'un indexeur spécifique avec les mots préférés peut conduire à la saisie de versions en double", "LastAlbum": "Dernier album", "ListRefreshInterval": "Intervalle d'actualisation de la liste", diff --git a/src/NzbDrone.Core/Localization/Core/hu.json b/src/NzbDrone.Core/Localization/Core/hu.json index b7c150824..387c736c6 100644 --- a/src/NzbDrone.Core/Localization/Core/hu.json +++ b/src/NzbDrone.Core/Localization/Core/hu.json @@ -790,7 +790,7 @@ "ForNewImportsOnly": "Csak új importokra", "EndedOnly": "Csak a véget értek", "ContinuingOnly": "Csak folytatás", - "ImportFailed": "Az importálás sikertelen", + "ImportCompleteFailed": "Az importálás sikertelen", "MediaCount": "Médiaszám", "MissingTracks": "Hiányzó számok", "MonitorNewItems": "Új albumok monitorozása", diff --git a/src/NzbDrone.Core/Localization/Core/pt_BR.json b/src/NzbDrone.Core/Localization/Core/pt_BR.json index bc8215799..e0c1db1d5 100644 --- a/src/NzbDrone.Core/Localization/Core/pt_BR.json +++ b/src/NzbDrone.Core/Localization/Core/pt_BR.json @@ -789,7 +789,7 @@ "EditMetadata": "Editar metadados", "EditReleaseProfile": "Editar perfil de lançamento", "ForNewImportsOnly": "Para novas importações somente", - "ImportFailed": "Falha na importação", + "ImportCompleteFailed": "Falha na importação", "MissingTracks": "Faixas Ausentes", "NewAlbums": "Novos Álbuns", "NextAlbum": "Próximo Álbum", diff --git a/src/NzbDrone.Core/Localization/Core/zh_CN.json b/src/NzbDrone.Core/Localization/Core/zh_CN.json index a423a7c51..7247d2857 100644 --- a/src/NzbDrone.Core/Localization/Core/zh_CN.json +++ b/src/NzbDrone.Core/Localization/Core/zh_CN.json @@ -708,7 +708,7 @@ "Other": "其他", "OutputPath": "输出路径", "QualitiesHelpText": "即使未勾选,列表中靠前的质量优先级更高。同组内的质量优先级相同。仅需勾选需要的质量", - "ImportFailed": "导入失败", + "ImportCompleteFailed": "导入失败", "TrackArtist": "歌曲歌手", "OnAlbumDelete": "当专辑删除时", "OnArtistDelete": "当歌手删除时",