mirror of
https://github.com/Radarr/Radarr.git
synced 2024-11-04 10:02:40 +01: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);
|
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}
|
onRemovePress={this.onRemoveSelectedConfirmed}
|
||||||
onModalClose={this.onConfirmRemoveModalClose}
|
onModalClose={this.onConfirmRemoveModalClose}
|
||||||
/>
|
/>
|
||||||
|
@ -332,6 +332,7 @@ class QueueRow extends Component {
|
|||||||
isOpen={isRemoveQueueItemModalOpen}
|
isOpen={isRemoveQueueItemModalOpen}
|
||||||
sourceTitle={title}
|
sourceTitle={title}
|
||||||
canIgnore={!!movie}
|
canIgnore={!!movie}
|
||||||
|
isPending={isPending}
|
||||||
onRemovePress={this.onRemoveQueueItemModalConfirmed}
|
onRemovePress={this.onRemoveQueueItemModalConfirmed}
|
||||||
onModalClose={this.onRemoveQueueItemModalClose}
|
onModalClose={this.onRemoveQueueItemModalClose}
|
||||||
/>
|
/>
|
||||||
|
@ -66,7 +66,8 @@ class RemoveQueueItemModal extends Component {
|
|||||||
const {
|
const {
|
||||||
isOpen,
|
isOpen,
|
||||||
sourceTitle,
|
sourceTitle,
|
||||||
canIgnore
|
canIgnore,
|
||||||
|
isPending
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
const { remove, blocklist } = this.state;
|
const { remove, blocklist } = this.state;
|
||||||
@ -89,18 +90,22 @@ class RemoveQueueItemModal extends Component {
|
|||||||
{translate('RemoveFromQueueText', [sourceTitle])}
|
{translate('RemoveFromQueueText', [sourceTitle])}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<FormGroup>
|
{
|
||||||
<FormLabel>{translate('RemoveFromDownloadClient')}</FormLabel>
|
isPending ?
|
||||||
|
null :
|
||||||
|
<FormGroup>
|
||||||
|
<FormLabel>{translate('RemoveFromDownloadClient')}</FormLabel>
|
||||||
|
|
||||||
<FormInputGroup
|
<FormInputGroup
|
||||||
type={inputTypes.CHECK}
|
type={inputTypes.CHECK}
|
||||||
name="remove"
|
name="remove"
|
||||||
value={remove}
|
value={remove}
|
||||||
helpTextWarning={translate('RemoveHelpTextWarning')}
|
helpTextWarning={translate('RemoveHelpTextWarning')}
|
||||||
isDisabled={!canIgnore}
|
isDisabled={!canIgnore}
|
||||||
onChange={this.onRemoveChange}
|
onChange={this.onRemoveChange}
|
||||||
/>
|
/>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
|
}
|
||||||
|
|
||||||
<FormGroup>
|
<FormGroup>
|
||||||
<FormLabel>{translate('BlocklistRelease')}</FormLabel>
|
<FormLabel>{translate('BlocklistRelease')}</FormLabel>
|
||||||
@ -137,6 +142,7 @@ RemoveQueueItemModal.propTypes = {
|
|||||||
isOpen: PropTypes.bool.isRequired,
|
isOpen: PropTypes.bool.isRequired,
|
||||||
sourceTitle: PropTypes.string.isRequired,
|
sourceTitle: PropTypes.string.isRequired,
|
||||||
canIgnore: PropTypes.bool.isRequired,
|
canIgnore: PropTypes.bool.isRequired,
|
||||||
|
isPending: PropTypes.bool.isRequired,
|
||||||
onRemovePress: PropTypes.func.isRequired,
|
onRemovePress: PropTypes.func.isRequired,
|
||||||
onModalClose: PropTypes.func.isRequired
|
onModalClose: PropTypes.func.isRequired
|
||||||
};
|
};
|
||||||
|
@ -67,7 +67,8 @@ class RemoveQueueItemsModal extends Component {
|
|||||||
const {
|
const {
|
||||||
isOpen,
|
isOpen,
|
||||||
selectedCount,
|
selectedCount,
|
||||||
canIgnore
|
canIgnore,
|
||||||
|
allPending
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
const { remove, blocklist } = this.state;
|
const { remove, blocklist } = this.state;
|
||||||
@ -90,18 +91,22 @@ class RemoveQueueItemsModal extends Component {
|
|||||||
{translate('AreYouSureYouWantToRemoveSelectedItemsFromQueue', [selectedCount, selectedCount > 1 ? 's' : ''])}
|
{translate('AreYouSureYouWantToRemoveSelectedItemsFromQueue', [selectedCount, selectedCount > 1 ? 's' : ''])}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<FormGroup>
|
{
|
||||||
<FormLabel>{translate('RemoveFromDownloadClient')}</FormLabel>
|
allPending ?
|
||||||
|
null :
|
||||||
|
<FormGroup>
|
||||||
|
<FormLabel>{translate('RemoveFromDownloadClient')}</FormLabel>
|
||||||
|
|
||||||
<FormInputGroup
|
<FormInputGroup
|
||||||
type={inputTypes.CHECK}
|
type={inputTypes.CHECK}
|
||||||
name="remove"
|
name="remove"
|
||||||
value={remove}
|
value={remove}
|
||||||
helpTextWarning={translate('RemoveHelpTextWarning')}
|
helpTextWarning={translate('RemoveHelpTextWarning')}
|
||||||
isDisabled={!canIgnore}
|
isDisabled={!canIgnore}
|
||||||
onChange={this.onRemoveChange}
|
onChange={this.onRemoveChange}
|
||||||
/>
|
/>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
|
}
|
||||||
|
|
||||||
<FormGroup>
|
<FormGroup>
|
||||||
<FormLabel>
|
<FormLabel>
|
||||||
@ -141,6 +146,7 @@ RemoveQueueItemsModal.propTypes = {
|
|||||||
isOpen: PropTypes.bool.isRequired,
|
isOpen: PropTypes.bool.isRequired,
|
||||||
selectedCount: PropTypes.number.isRequired,
|
selectedCount: PropTypes.number.isRequired,
|
||||||
canIgnore: PropTypes.bool.isRequired,
|
canIgnore: PropTypes.bool.isRequired,
|
||||||
|
allPending: PropTypes.bool.isRequired,
|
||||||
onRemovePress: PropTypes.func.isRequired,
|
onRemovePress: PropTypes.func.isRequired,
|
||||||
onModalClose: PropTypes.func.isRequired
|
onModalClose: PropTypes.func.isRequired
|
||||||
};
|
};
|
||||||
|
@ -17,6 +17,7 @@ public interface IBlocklistService
|
|||||||
bool Blocklisted(int movieId, ReleaseInfo release);
|
bool Blocklisted(int movieId, ReleaseInfo release);
|
||||||
PagingSpec<Blocklist> Paged(PagingSpec<Blocklist> pagingSpec);
|
PagingSpec<Blocklist> Paged(PagingSpec<Blocklist> pagingSpec);
|
||||||
List<Blocklist> GetByMovieId(int movieId);
|
List<Blocklist> GetByMovieId(int movieId);
|
||||||
|
void Block(RemoteMovie remoteMovie, string message);
|
||||||
void Delete(int id);
|
void Delete(int id);
|
||||||
void Delete(List<int> ids);
|
void Delete(List<int> ids);
|
||||||
}
|
}
|
||||||
@ -72,6 +73,29 @@ public List<Blocklist> GetByMovieId(int movieId)
|
|||||||
return _blocklistRepository.BlocklistedByMovie(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)
|
public void Delete(int id)
|
||||||
{
|
{
|
||||||
_blocklistRepository.Delete(id);
|
_blocklistRepository.Delete(id);
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using NzbDrone.Common.Extensions;
|
using NzbDrone.Common.Extensions;
|
||||||
|
using NzbDrone.Core.Blocklisting;
|
||||||
using NzbDrone.Core.Datastore;
|
using NzbDrone.Core.Datastore;
|
||||||
using NzbDrone.Core.Datastore.Events;
|
using NzbDrone.Core.Datastore.Events;
|
||||||
using NzbDrone.Core.Download;
|
using NzbDrone.Core.Download;
|
||||||
@ -33,6 +34,7 @@ public class QueueController : RestControllerWithSignalR<QueueResource, NzbDrone
|
|||||||
private readonly IFailedDownloadService _failedDownloadService;
|
private readonly IFailedDownloadService _failedDownloadService;
|
||||||
private readonly IIgnoredDownloadService _ignoredDownloadService;
|
private readonly IIgnoredDownloadService _ignoredDownloadService;
|
||||||
private readonly IProvideDownloadClient _downloadClientProvider;
|
private readonly IProvideDownloadClient _downloadClientProvider;
|
||||||
|
private readonly IBlocklistService _blocklistService;
|
||||||
|
|
||||||
public QueueController(IBroadcastSignalRMessage broadcastSignalRMessage,
|
public QueueController(IBroadcastSignalRMessage broadcastSignalRMessage,
|
||||||
IQueueService queueService,
|
IQueueService queueService,
|
||||||
@ -41,7 +43,8 @@ public QueueController(IBroadcastSignalRMessage broadcastSignalRMessage,
|
|||||||
ITrackedDownloadService trackedDownloadService,
|
ITrackedDownloadService trackedDownloadService,
|
||||||
IFailedDownloadService failedDownloadService,
|
IFailedDownloadService failedDownloadService,
|
||||||
IIgnoredDownloadService ignoredDownloadService,
|
IIgnoredDownloadService ignoredDownloadService,
|
||||||
IProvideDownloadClient downloadClientProvider)
|
IProvideDownloadClient downloadClientProvider,
|
||||||
|
IBlocklistService blocklistService)
|
||||||
: base(broadcastSignalRMessage)
|
: base(broadcastSignalRMessage)
|
||||||
{
|
{
|
||||||
_queueService = queueService;
|
_queueService = queueService;
|
||||||
@ -50,6 +53,7 @@ public QueueController(IBroadcastSignalRMessage broadcastSignalRMessage,
|
|||||||
_failedDownloadService = failedDownloadService;
|
_failedDownloadService = failedDownloadService;
|
||||||
_ignoredDownloadService = ignoredDownloadService;
|
_ignoredDownloadService = ignoredDownloadService;
|
||||||
_downloadClientProvider = downloadClientProvider;
|
_downloadClientProvider = downloadClientProvider;
|
||||||
|
_blocklistService = blocklistService;
|
||||||
|
|
||||||
_qualityComparer = new QualityModelComparer(qualityProfileService.GetDefaultProfile(string.Empty));
|
_qualityComparer = new QualityModelComparer(qualityProfileService.GetDefaultProfile(string.Empty));
|
||||||
}
|
}
|
||||||
@ -200,6 +204,7 @@ private TrackedDownload Remove(int id, bool removeFromClient, bool blocklist)
|
|||||||
|
|
||||||
if (pendingRelease != null)
|
if (pendingRelease != null)
|
||||||
{
|
{
|
||||||
|
_blocklistService.Block(pendingRelease.RemoteMovie, "Pending release manually blocklisted");
|
||||||
_pendingReleaseService.RemovePendingQueueItems(pendingRelease.Id);
|
_pendingReleaseService.RemovePendingQueueItems(pendingRelease.Id);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
Loading…
Reference in New Issue
Block a user