mirror of
https://github.com/Radarr/Radarr.git
synced 2024-09-11 20:12:41 +02:00
Fixed: Blocklisting pending releases
Closes #4598 (cherry picked from commit 3f60e28c42d946691c4d44eb391b7888466538d9)
This commit is contained in:
parent
a219b4a1b8
commit
86da4e87ea
@ -282,6 +282,17 @@ class Queue extends Component {
|
||||
return !!(item && item.movieId);
|
||||
})
|
||||
)}
|
||||
allPending={isConfirmRemoveModalOpen && (
|
||||
selectedIds.every((id) => {
|
||||
const item = items.find((i) => i.id === id);
|
||||
|
||||
if (!item) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return item.status === 'delay' || item.status === 'downloadClientUnavailable';
|
||||
})
|
||||
)}
|
||||
onRemovePress={this.onRemoveSelectedConfirmed}
|
||||
onModalClose={this.onConfirmRemoveModalClose}
|
||||
/>
|
||||
|
@ -332,6 +332,7 @@ class QueueRow extends Component {
|
||||
isOpen={isRemoveQueueItemModalOpen}
|
||||
sourceTitle={title}
|
||||
canIgnore={!!movie}
|
||||
isPending={isPending}
|
||||
onRemovePress={this.onRemoveQueueItemModalConfirmed}
|
||||
onModalClose={this.onRemoveQueueItemModalClose}
|
||||
/>
|
||||
|
@ -66,7 +66,8 @@ class RemoveQueueItemModal extends Component {
|
||||
const {
|
||||
isOpen,
|
||||
sourceTitle,
|
||||
canIgnore
|
||||
canIgnore,
|
||||
isPending
|
||||
} = this.props;
|
||||
|
||||
const { remove, blocklist } = this.state;
|
||||
@ -89,6 +90,9 @@ class RemoveQueueItemModal extends Component {
|
||||
{translate('RemoveFromQueueText', [sourceTitle])}
|
||||
</div>
|
||||
|
||||
{
|
||||
isPending ?
|
||||
null :
|
||||
<FormGroup>
|
||||
<FormLabel>{translate('RemoveFromDownloadClient')}</FormLabel>
|
||||
|
||||
@ -101,6 +105,7 @@ class RemoveQueueItemModal extends Component {
|
||||
onChange={this.onRemoveChange}
|
||||
/>
|
||||
</FormGroup>
|
||||
}
|
||||
|
||||
<FormGroup>
|
||||
<FormLabel>{translate('BlocklistRelease')}</FormLabel>
|
||||
@ -137,6 +142,7 @@ RemoveQueueItemModal.propTypes = {
|
||||
isOpen: PropTypes.bool.isRequired,
|
||||
sourceTitle: PropTypes.string.isRequired,
|
||||
canIgnore: PropTypes.bool.isRequired,
|
||||
isPending: PropTypes.bool.isRequired,
|
||||
onRemovePress: PropTypes.func.isRequired,
|
||||
onModalClose: PropTypes.func.isRequired
|
||||
};
|
||||
|
@ -67,7 +67,8 @@ class RemoveQueueItemsModal extends Component {
|
||||
const {
|
||||
isOpen,
|
||||
selectedCount,
|
||||
canIgnore
|
||||
canIgnore,
|
||||
allPending
|
||||
} = this.props;
|
||||
|
||||
const { remove, blocklist } = this.state;
|
||||
@ -90,6 +91,9 @@ class RemoveQueueItemsModal extends Component {
|
||||
{translate('AreYouSureYouWantToRemoveSelectedItemsFromQueue', [selectedCount, selectedCount > 1 ? 's' : ''])}
|
||||
</div>
|
||||
|
||||
{
|
||||
allPending ?
|
||||
null :
|
||||
<FormGroup>
|
||||
<FormLabel>{translate('RemoveFromDownloadClient')}</FormLabel>
|
||||
|
||||
@ -102,6 +106,7 @@ class RemoveQueueItemsModal extends Component {
|
||||
onChange={this.onRemoveChange}
|
||||
/>
|
||||
</FormGroup>
|
||||
}
|
||||
|
||||
<FormGroup>
|
||||
<FormLabel>
|
||||
@ -141,6 +146,7 @@ RemoveQueueItemsModal.propTypes = {
|
||||
isOpen: PropTypes.bool.isRequired,
|
||||
selectedCount: PropTypes.number.isRequired,
|
||||
canIgnore: PropTypes.bool.isRequired,
|
||||
allPending: PropTypes.bool.isRequired,
|
||||
onRemovePress: PropTypes.func.isRequired,
|
||||
onModalClose: PropTypes.func.isRequired
|
||||
};
|
||||
|
@ -17,6 +17,7 @@ public interface IBlocklistService
|
||||
bool Blocklisted(int movieId, ReleaseInfo release);
|
||||
PagingSpec<Blocklist> Paged(PagingSpec<Blocklist> pagingSpec);
|
||||
List<Blocklist> GetByMovieId(int movieId);
|
||||
void Block(RemoteMovie remoteMovie, string message);
|
||||
void Delete(int id);
|
||||
void Delete(List<int> ids);
|
||||
}
|
||||
@ -72,6 +73,29 @@ public List<Blocklist> GetByMovieId(int movieId)
|
||||
return _blocklistRepository.BlocklistedByMovie(movieId);
|
||||
}
|
||||
|
||||
public void Block(RemoteMovie remoteMovie, string message)
|
||||
{
|
||||
var blocklist = new Blocklist
|
||||
{
|
||||
MovieId = remoteMovie.Movie.Id,
|
||||
SourceTitle = remoteMovie.Release.Title,
|
||||
Quality = remoteMovie.ParsedMovieInfo.Quality,
|
||||
Date = DateTime.UtcNow,
|
||||
PublishedDate = remoteMovie.Release.PublishDate,
|
||||
Size = remoteMovie.Release.Size,
|
||||
Indexer = remoteMovie.Release.Indexer,
|
||||
Protocol = remoteMovie.Release.DownloadProtocol,
|
||||
Message = message
|
||||
};
|
||||
|
||||
if (remoteMovie.Release is TorrentInfo torrentRelease)
|
||||
{
|
||||
blocklist.TorrentInfoHash = torrentRelease.InfoHash;
|
||||
}
|
||||
|
||||
_blocklistRepository.Insert(blocklist);
|
||||
}
|
||||
|
||||
public void Delete(int id)
|
||||
{
|
||||
_blocklistRepository.Delete(id);
|
||||
|
@ -3,6 +3,7 @@
|
||||
using System.Linq;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Core.Blocklisting;
|
||||
using NzbDrone.Core.Datastore;
|
||||
using NzbDrone.Core.Datastore.Events;
|
||||
using NzbDrone.Core.Download;
|
||||
@ -33,6 +34,7 @@ public class QueueController : RestControllerWithSignalR<QueueResource, NzbDrone
|
||||
private readonly IFailedDownloadService _failedDownloadService;
|
||||
private readonly IIgnoredDownloadService _ignoredDownloadService;
|
||||
private readonly IProvideDownloadClient _downloadClientProvider;
|
||||
private readonly IBlocklistService _blocklistService;
|
||||
|
||||
public QueueController(IBroadcastSignalRMessage broadcastSignalRMessage,
|
||||
IQueueService queueService,
|
||||
@ -41,7 +43,8 @@ public QueueController(IBroadcastSignalRMessage broadcastSignalRMessage,
|
||||
ITrackedDownloadService trackedDownloadService,
|
||||
IFailedDownloadService failedDownloadService,
|
||||
IIgnoredDownloadService ignoredDownloadService,
|
||||
IProvideDownloadClient downloadClientProvider)
|
||||
IProvideDownloadClient downloadClientProvider,
|
||||
IBlocklistService blocklistService)
|
||||
: base(broadcastSignalRMessage)
|
||||
{
|
||||
_queueService = queueService;
|
||||
@ -50,6 +53,7 @@ public QueueController(IBroadcastSignalRMessage broadcastSignalRMessage,
|
||||
_failedDownloadService = failedDownloadService;
|
||||
_ignoredDownloadService = ignoredDownloadService;
|
||||
_downloadClientProvider = downloadClientProvider;
|
||||
_blocklistService = blocklistService;
|
||||
|
||||
_qualityComparer = new QualityModelComparer(qualityProfileService.GetDefaultProfile(string.Empty));
|
||||
}
|
||||
@ -200,6 +204,7 @@ private TrackedDownload Remove(int id, bool removeFromClient, bool blocklist)
|
||||
|
||||
if (pendingRelease != null)
|
||||
{
|
||||
_blocklistService.Block(pendingRelease.RemoteMovie, "Pending release manually blocklisted");
|
||||
_pendingReleaseService.RemovePendingQueueItems(pendingRelease.Id);
|
||||
|
||||
return null;
|
||||
|
Loading…
Reference in New Issue
Block a user