Skip to content

Commit ea9b46e

Browse files
JeWe37mynameisbogdan
authored andcommittedJan 21, 2024
Order for track/album import aggregators
(cherry picked from commit 69f99373e56a2fca49a2be645e6640624cf12339) Closes #4495 Closes #4496
1 parent 2cf2ebc commit ea9b46e

File tree

5 files changed

+10
-2
lines changed

5 files changed

+10
-2
lines changed
 

‎src/NzbDrone.Core/MediaFiles/TrackImport/Aggregation/AggregationService.cs

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System;
22
using System.Collections.Generic;
33
using System.IO;
4+
using System.Linq;
45
using NLog;
56
using NzbDrone.Common.Disk;
67
using NzbDrone.Core.MediaFiles.TrackImport.Aggregation.Aggregators;
@@ -26,8 +27,8 @@ public AugmentingService(IEnumerable<IAggregate<LocalTrack>> trackAugmenters,
2627
IDiskProvider diskProvider,
2728
Logger logger)
2829
{
29-
_trackAugmenters = trackAugmenters;
30-
_albumAugmenters = albumAugmenters;
30+
_trackAugmenters = trackAugmenters.OrderBy(a => a.Order).ToList();
31+
_albumAugmenters = albumAugmenters.OrderBy(a => a.Order).ToList();
3132
_diskProvider = diskProvider;
3233
_logger = logger;
3334
}

‎src/NzbDrone.Core/MediaFiles/TrackImport/Aggregation/Aggregators/AggregateFilenameInfo.cs

+2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ namespace NzbDrone.Core.MediaFiles.TrackImport.Aggregation.Aggregators
1111
{
1212
public class AggregateFilenameInfo : IAggregate<LocalAlbumRelease>
1313
{
14+
public int Order => 1;
15+
1416
private readonly Logger _logger;
1517

1618
private static readonly List<Tuple<string, string>> CharsAndSeps = new List<Tuple<string, string>>

‎src/NzbDrone.Core/MediaFiles/TrackImport/Aggregation/Aggregators/AggregateQuality.cs

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ namespace NzbDrone.Core.MediaFiles.TrackImport.Aggregation.Aggregators
44
{
55
public class AggregateQuality : IAggregate<LocalTrack>
66
{
7+
public int Order => 1;
8+
79
public LocalTrack Aggregate(LocalTrack localTrack, bool otherFiles)
810
{
911
var quality = localTrack.FileTrackInfo?.Quality;

‎src/NzbDrone.Core/MediaFiles/TrackImport/Aggregation/Aggregators/AggregateReleaseGroup.cs

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ namespace NzbDrone.Core.MediaFiles.TrackImport.Aggregation.Aggregators
55
{
66
public class AggregateReleaseGroup : IAggregate<LocalTrack>
77
{
8+
public int Order => 1;
9+
810
public LocalTrack Aggregate(LocalTrack localTrack, bool otherFiles)
911
{
1012
var releaseGroup = localTrack.DownloadClientAlbumInfo?.ReleaseGroup;

‎src/NzbDrone.Core/MediaFiles/TrackImport/Aggregation/Aggregators/IAggregateLocalTrack.cs

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ namespace NzbDrone.Core.MediaFiles.TrackImport.Aggregation.Aggregators
22
{
33
public interface IAggregate<T>
44
{
5+
int Order { get; }
56
T Aggregate(T item, bool otherFiles);
67
}
78
}

0 commit comments

Comments
 (0)
Please sign in to comment.