Compare commits

..

7 Commits

Author SHA1 Message Date
Mark McDowall
102481ed60 Fixed: Import queue not processing after incomplete import
(cherry picked from commit 3afae968ebc72ad35abe07cfc4b84d7e243b1840)
2024-07-15 19:08:22 +00:00
Bogdan
2fb1b8af20 Bump version to 0.3.32 2024-07-14 12:31:38 +03:00
Bogdan
af1f389f8e Fixed: Validate metadata and quality profiles for root folders
Don't allow `0` as possible value for metadata and quality profiles, and permit to edit root folders with bad values in UI.
2024-07-12 16:37:16 +03:00
Bogdan
b5334da253 Fixed: Creating root folders without default tags 2024-07-12 16:32:19 +03:00
Bogdan
68b3904382 Bump version to 0.3.31 2024-07-07 21:55:01 +03:00
Bogdan
c8b09b9e29 Fixed: Already imported downloads appearing in Queue briefly
(cherry picked from commit 8099ba10afded446779290de29b1baaf0be932c3)

Closes #3538
2024-07-01 08:45:01 +03:00
Bogdan
d910fc42ab Bump mac image to 12 2024-06-26 23:51:49 +03:00
17 changed files with 46 additions and 36 deletions

View File

@@ -9,7 +9,7 @@ variables:
testsFolder: './_tests' testsFolder: './_tests'
yarnCacheFolder: $(Pipeline.Workspace)/.yarn yarnCacheFolder: $(Pipeline.Workspace)/.yarn
nugetCacheFolder: $(Pipeline.Workspace)/.nuget/packages nugetCacheFolder: $(Pipeline.Workspace)/.nuget/packages
majorVersion: '0.3.30' majorVersion: '0.3.32'
minorVersion: $[counter('minorVersion', 1)] minorVersion: $[counter('minorVersion', 1)]
readarrVersion: '$(majorVersion).$(minorVersion)' readarrVersion: '$(majorVersion).$(minorVersion)'
buildName: '$(Build.SourceBranchName).$(readarrVersion)' buildName: '$(Build.SourceBranchName).$(readarrVersion)'
@@ -20,7 +20,7 @@ variables:
innoVersion: '6.2.0' innoVersion: '6.2.0'
windowsImage: 'windows-2022' windowsImage: 'windows-2022'
linuxImage: 'ubuntu-20.04' linuxImage: 'ubuntu-20.04'
macImage: 'macOS-11' macImage: 'macOS-12'
trigger: trigger:
branches: branches:

View File

@@ -8,6 +8,7 @@ import TagListConnector from 'Components/TagListConnector';
import { createMetadataProfileSelectorForHook } from 'Store/Selectors/createMetadataProfileSelector'; import { createMetadataProfileSelectorForHook } from 'Store/Selectors/createMetadataProfileSelector';
import { createQualityProfileSelectorForHook } from 'Store/Selectors/createQualityProfileSelector'; import { createQualityProfileSelectorForHook } from 'Store/Selectors/createQualityProfileSelector';
import { SelectStateInputProps } from 'typings/props'; import { SelectStateInputProps } from 'typings/props';
import translate from 'Utilities/String/translate';
import styles from './ManageImportListsModalRow.css'; import styles from './ManageImportListsModalRow.css';
interface ManageImportListsModalRowProps { interface ManageImportListsModalRowProps {
@@ -70,7 +71,7 @@ function ManageImportListsModalRow(props: ManageImportListsModalRowProps) {
</TableRowCell> </TableRowCell>
<TableRowCell className={styles.qualityProfileId}> <TableRowCell className={styles.qualityProfileId}>
{qualityProfile?.name ?? 'None'} {qualityProfile?.name ?? translate('None')}
</TableRowCell> </TableRowCell>
<TableRowCell className={styles.metadataProfileId}> <TableRowCell className={styles.metadataProfileId}>
@@ -82,7 +83,7 @@ function ManageImportListsModalRow(props: ManageImportListsModalRowProps) {
</TableRowCell> </TableRowCell>
<TableRowCell className={styles.enableAutomaticAdd}> <TableRowCell className={styles.enableAutomaticAdd}>
{enableAutomaticAdd ? 'Yes' : 'No'} {enableAutomaticAdd ? translate('Yes') : translate('No')}
</TableRowCell> </TableRowCell>
<TableRowCell className={styles.tags}> <TableRowCell className={styles.tags}>

View File

@@ -75,12 +75,12 @@ class RootFolder extends Component {
{path} {path}
</Label> </Label>
<Label kind={kinds.SUCCESS}> <Label kind={qualityProfile?.name ? kinds.SUCCESS : kinds.DANGER}>
{qualityProfile.name} {qualityProfile?.name || translate('None')}
</Label> </Label>
<Label kind={kinds.SUCCESS}> <Label kind={metadataProfile?.name ? kinds.SUCCESS : kinds.DANGER}>
{metadataProfile.name} {metadataProfile?.name || translate('None')}
</Label> </Label>
</div> </div>

View File

@@ -46,6 +46,7 @@ namespace NzbDrone.Core.Test.QueueTests
_trackedDownloads = Builder<TrackedDownload>.CreateListOfSize(1) _trackedDownloads = Builder<TrackedDownload>.CreateListOfSize(1)
.All() .All()
.With(v => v.IsTrackable = true)
.With(v => v.DownloadItem = downloadItem) .With(v => v.DownloadItem = downloadItem)
.With(v => v.RemoteBook = remoteBook) .With(v => v.RemoteBook = remoteBook)
.Build() .Build()

View File

@@ -15,18 +15,18 @@ namespace NzbDrone.Core.Books
public class BookCutoffService : IBookCutoffService public class BookCutoffService : IBookCutoffService
{ {
private readonly IBookRepository _bookRepository; private readonly IBookRepository _bookRepository;
private readonly IProfileService _profileService; private readonly IQualityProfileService _qualityProfileService;
public BookCutoffService(IBookRepository bookRepository, IProfileService profileService) public BookCutoffService(IBookRepository bookRepository, IQualityProfileService qualityProfileService)
{ {
_bookRepository = bookRepository; _bookRepository = bookRepository;
_profileService = profileService; _qualityProfileService = qualityProfileService;
} }
public PagingSpec<Book> BooksWhereCutoffUnmet(PagingSpec<Book> pagingSpec) public PagingSpec<Book> BooksWhereCutoffUnmet(PagingSpec<Book> pagingSpec)
{ {
var qualitiesBelowCutoff = new List<QualitiesBelowCutoff>(); var qualitiesBelowCutoff = new List<QualitiesBelowCutoff>();
var profiles = _profileService.All(); var profiles = _qualityProfileService.All();
//Get all items less than the cutoff //Get all items less than the cutoff
foreach (var profile in profiles) foreach (var profile in profiles)

View File

@@ -173,6 +173,9 @@ namespace NzbDrone.Core.Download
.Log(); .Log();
} }
var episodes = _episodeService.GetEpisodes(trackedDownload.RemoteEpisode.Episodes.Select(e => e.Id));
var files = _mediaFileService.GetFiles(episodes.Select(e => e.EpisodeFileId).Where(i => i > 0).Distinct());
trackedDownload.State = TrackedDownloadState.Imported; trackedDownload.State = TrackedDownloadState.Imported;
var importedAuthorId = historyItems.Where(x => x.EventType == EntityHistoryEventType.BookFileImported) var importedAuthorId = historyItems.Where(x => x.EventType == EntityHistoryEventType.BookFileImported)

View File

@@ -62,8 +62,8 @@ namespace NzbDrone.Core.Download
public void Check(TrackedDownload trackedDownload) public void Check(TrackedDownload trackedDownload)
{ {
// Only process tracked downloads that are still downloading or import is blocked (if they fail after attempting to be processed) // Only process tracked downloads that are still downloading
if (trackedDownload.State != TrackedDownloadState.Downloading && trackedDownload.State != TrackedDownloadState.ImportBlocked) if (trackedDownload.State != TrackedDownloadState.Downloading)
{ {
return; return;
} }

View File

@@ -115,7 +115,7 @@ namespace NzbDrone.Core.Download.TrackedDownloads
{ {
var trackedDownload = _trackedDownloadService.TrackDownload((DownloadClientDefinition)downloadClient.Definition, downloadItem); var trackedDownload = _trackedDownloadService.TrackDownload((DownloadClientDefinition)downloadClient.Definition, downloadItem);
if (trackedDownload is { State: TrackedDownloadState.Downloading or TrackedDownloadState.ImportBlocked }) if (trackedDownload != null && trackedDownload.State == TrackedDownloadState.Downloading)
{ {
_failedDownloadService.Check(trackedDownload); _failedDownloadService.Check(trackedDownload);
_completedDownloadService.Check(trackedDownload); _completedDownloadService.Check(trackedDownload);

View File

@@ -53,7 +53,7 @@ namespace NzbDrone.Core.MediaFiles.BookImport
private readonly IAugmentingService _augmentingService; private readonly IAugmentingService _augmentingService;
private readonly IIdentificationService _identificationService; private readonly IIdentificationService _identificationService;
private readonly IRootFolderService _rootFolderService; private readonly IRootFolderService _rootFolderService;
private readonly IProfileService _qualityProfileService; private readonly IQualityProfileService _qualityProfileService;
private readonly Logger _logger; private readonly Logger _logger;
public ImportDecisionMaker(IEnumerable<IImportDecisionEngineSpecification<LocalBook>> trackSpecifications, public ImportDecisionMaker(IEnumerable<IImportDecisionEngineSpecification<LocalBook>> trackSpecifications,
@@ -63,7 +63,7 @@ namespace NzbDrone.Core.MediaFiles.BookImport
IAugmentingService augmentingService, IAugmentingService augmentingService,
IIdentificationService identificationService, IIdentificationService identificationService,
IRootFolderService rootFolderService, IRootFolderService rootFolderService,
IProfileService qualityProfileService, IQualityProfileService qualityProfileService,
Logger logger) Logger logger)
{ {
_trackSpecifications = trackSpecifications; _trackSpecifications = trackSpecifications;

View File

@@ -13,7 +13,7 @@ using NzbDrone.Core.RootFolders;
namespace NzbDrone.Core.Profiles.Qualities namespace NzbDrone.Core.Profiles.Qualities
{ {
public interface IProfileService public interface IQualityProfileService
{ {
QualityProfile Add(QualityProfile profile); QualityProfile Add(QualityProfile profile);
void Update(QualityProfile profile); void Update(QualityProfile profile);
@@ -24,7 +24,7 @@ namespace NzbDrone.Core.Profiles.Qualities
QualityProfile GetDefaultProfile(string name, Quality cutoff = null, params Quality[] allowed); QualityProfile GetDefaultProfile(string name, Quality cutoff = null, params Quality[] allowed);
} }
public class QualityProfileService : IProfileService, public class QualityProfileService : IQualityProfileService,
IHandle<ApplicationStartedEvent>, IHandle<ApplicationStartedEvent>,
IHandle<CustomFormatAddedEvent>, IHandle<CustomFormatAddedEvent>,
IHandle<CustomFormatDeletedEvent> IHandle<CustomFormatDeletedEvent>

View File

@@ -20,7 +20,7 @@ namespace NzbDrone.Core.Queue
public class QueueService : IQueueService, IHandle<TrackedDownloadRefreshedEvent> public class QueueService : IQueueService, IHandle<TrackedDownloadRefreshedEvent>
{ {
private readonly IEventAggregator _eventAggregator; private readonly IEventAggregator _eventAggregator;
private static List<Queue> _queue = new List<Queue>(); private static List<Queue> _queue = new ();
private readonly IHistoryService _historyService; private readonly IHistoryService _historyService;
public QueueService(IEventAggregator eventAggregator, public QueueService(IEventAggregator eventAggregator,
@@ -105,8 +105,11 @@ namespace NzbDrone.Core.Queue
public void Handle(TrackedDownloadRefreshedEvent message) public void Handle(TrackedDownloadRefreshedEvent message)
{ {
_queue = message.TrackedDownloads.OrderBy(c => c.DownloadItem.RemainingTime).SelectMany(MapQueue) _queue = message.TrackedDownloads
.ToList(); .Where(t => t.IsTrackable)
.OrderBy(c => c.DownloadItem.RemainingTime)
.SelectMany(MapQueue)
.ToList();
_eventAggregator.PublishEvent(new QueueUpdatedEvent()); _eventAggregator.PublishEvent(new QueueUpdatedEvent());
} }

View File

@@ -13,7 +13,7 @@ namespace NzbDrone.Core.RootFolders
public int DefaultQualityProfileId { get; set; } public int DefaultQualityProfileId { get; set; }
public MonitorTypes DefaultMonitorOption { get; set; } public MonitorTypes DefaultMonitorOption { get; set; }
public NewItemMonitorTypes DefaultNewItemMonitorOption { get; set; } public NewItemMonitorTypes DefaultNewItemMonitorOption { get; set; }
public HashSet<int> DefaultTags { get; set; } public HashSet<int> DefaultTags { get; set; } = new ();
public bool IsCalibreLibrary { get; set; } public bool IsCalibreLibrary { get; set; }
public CalibreSettings CalibreSettings { get; set; } public CalibreSettings CalibreSettings { get; set; }

View File

@@ -5,11 +5,11 @@ namespace NzbDrone.Core.Validation
{ {
public class QualityProfileExistsValidator : PropertyValidator public class QualityProfileExistsValidator : PropertyValidator
{ {
private readonly IProfileService _profileService; private readonly IQualityProfileService _qualityProfileService;
public QualityProfileExistsValidator(IProfileService profileService) public QualityProfileExistsValidator(IQualityProfileService qualityProfileService)
{ {
_profileService = profileService; _qualityProfileService = qualityProfileService;
} }
protected override string GetDefaultMessageTemplate() => "Quality Profile does not exist"; protected override string GetDefaultMessageTemplate() => "Quality Profile does not exist";
@@ -21,7 +21,7 @@ namespace NzbDrone.Core.Validation
return true; return true;
} }
return _profileService.Exists((int)context.PropertyValue); return _qualityProfileService.Exists((int)context.PropertyValue);
} }
} }
} }

View File

@@ -14,10 +14,10 @@ namespace Readarr.Api.V1.Profiles.Quality
[V1ApiController] [V1ApiController]
public class QualityProfileController : RestController<QualityProfileResource> public class QualityProfileController : RestController<QualityProfileResource>
{ {
private readonly IProfileService _qualityProfileService; private readonly IQualityProfileService _qualityProfileService;
private readonly ICustomFormatService _formatService; private readonly ICustomFormatService _formatService;
public QualityProfileController(IProfileService qualityProfileService, ICustomFormatService formatService) public QualityProfileController(IQualityProfileService qualityProfileService, ICustomFormatService formatService)
{ {
_qualityProfileService = qualityProfileService; _qualityProfileService = qualityProfileService;
_formatService = formatService; _formatService = formatService;

View File

@@ -7,17 +7,17 @@ namespace Readarr.Api.V1.Profiles.Quality
[V1ApiController("qualityprofile/schema")] [V1ApiController("qualityprofile/schema")]
public class QualityProfileSchemaController : Controller public class QualityProfileSchemaController : Controller
{ {
private readonly IProfileService _profileService; private readonly IQualityProfileService _qualityProfileService;
public QualityProfileSchemaController(IProfileService profileService) public QualityProfileSchemaController(IQualityProfileService qualityProfileService)
{ {
_profileService = profileService; _qualityProfileService = qualityProfileService;
} }
[HttpGet] [HttpGet]
public QualityProfileResource GetSchema() public QualityProfileResource GetSchema()
{ {
var qualityProfile = _profileService.GetDefaultProfile(string.Empty); var qualityProfile = _qualityProfileService.GetDefaultProfile(string.Empty);
return qualityProfile.ToResource(); return qualityProfile.ToResource();
} }

View File

@@ -60,10 +60,12 @@ namespace Readarr.Api.V1.RootFolders
SharedValidator.RuleFor(c => c.Name) SharedValidator.RuleFor(c => c.Name)
.NotEmpty(); .NotEmpty();
SharedValidator.RuleFor(c => c.DefaultMetadataProfileId) SharedValidator.RuleFor(c => c.DefaultMetadataProfileId).Cascade(CascadeMode.Stop)
.ValidId()
.SetValidator(metadataProfileExistsValidator); .SetValidator(metadataProfileExistsValidator);
SharedValidator.RuleFor(c => c.DefaultQualityProfileId) SharedValidator.RuleFor(c => c.DefaultQualityProfileId).Cascade(CascadeMode.Stop)
.ValidId()
.SetValidator(qualityProfileExistsValidator); .SetValidator(qualityProfileExistsValidator);
SharedValidator.RuleFor(c => c.Host).ValidHost().When(x => x.IsCalibreLibrary); SharedValidator.RuleFor(c => c.Host).ValidHost().When(x => x.IsCalibreLibrary);

View File

@@ -108,7 +108,7 @@ namespace Readarr.Api.V1.RootFolders
DefaultQualityProfileId = resource.DefaultQualityProfileId, DefaultQualityProfileId = resource.DefaultQualityProfileId,
DefaultMonitorOption = resource.DefaultMonitorOption, DefaultMonitorOption = resource.DefaultMonitorOption,
DefaultNewItemMonitorOption = resource.DefaultNewItemMonitorOption, DefaultNewItemMonitorOption = resource.DefaultNewItemMonitorOption,
DefaultTags = resource.DefaultTags, DefaultTags = resource.DefaultTags ?? new HashSet<int>(),
IsCalibreLibrary = resource.IsCalibreLibrary, IsCalibreLibrary = resource.IsCalibreLibrary,
CalibreSettings = cs CalibreSettings = cs
}; };