mirror of https://github.com/lidarr/Lidarr
Fixed: Search on Artist Add, Monitor None Option on Artist Add
This commit is contained in:
parent
f7f6ad159c
commit
9dcf90d241
|
@ -1,68 +1,31 @@
|
|||
import _ from 'lodash';
|
||||
|
||||
function monitorSeasons(seasons, startingSeason) {
|
||||
seasons.forEach((season) => {
|
||||
if (season.seasonNumber >= startingSeason) {
|
||||
season.monitored = true;
|
||||
} else {
|
||||
season.monitored = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function getMonitoringOptions(albums, monitor) {
|
||||
if (!albums.length) {
|
||||
return {
|
||||
albums: [],
|
||||
options: {
|
||||
ignoreEpisodesWithFiles: false,
|
||||
ignoreEpisodesWithoutFiles: false
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
const firstSeason = _.minBy(_.reject(albums, { seasonNumber: 0 }), 'seasonNumber').seasonNumber;
|
||||
const lastSeason = _.maxBy(albums, 'seasonNumber').seasonNumber;
|
||||
|
||||
monitorSeasons(albums, firstSeason);
|
||||
|
||||
function getMonitoringOptions(monitor) {
|
||||
const monitoringOptions = {
|
||||
ignoreEpisodesWithFiles: false,
|
||||
ignoreEpisodesWithoutFiles: false
|
||||
ignoreAlbumsWithFiles: false,
|
||||
ignoreAlbumsWithoutFiles: false,
|
||||
monitored: true
|
||||
};
|
||||
|
||||
switch (monitor) {
|
||||
case 'future':
|
||||
monitoringOptions.ignoreEpisodesWithFiles = true;
|
||||
monitoringOptions.ignoreEpisodesWithoutFiles = true;
|
||||
break;
|
||||
case 'latest':
|
||||
monitorSeasons(albums, lastSeason);
|
||||
break;
|
||||
case 'first':
|
||||
monitorSeasons(albums, lastSeason + 1);
|
||||
_.find(albums, { seasonNumber: firstSeason }).monitored = true;
|
||||
monitoringOptions.ignoreAlbumsWithFiles = true;
|
||||
monitoringOptions.ignoreAlbumsWithoutFiles = true;
|
||||
break;
|
||||
case 'missing':
|
||||
monitoringOptions.ignoreEpisodesWithFiles = true;
|
||||
monitoringOptions.ignoreAlbumsWithFiles = true;
|
||||
break;
|
||||
case 'existing':
|
||||
monitoringOptions.ignoreEpisodesWithoutFiles = true;
|
||||
monitoringOptions.ignoreAlbumsWithoutFiles = true;
|
||||
break;
|
||||
case 'none':
|
||||
monitorSeasons(albums, lastSeason + 1);
|
||||
monitoringOptions.monitored = false;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return {
|
||||
seasons: _.map(albums, (season) => {
|
||||
return _.pick(season, [
|
||||
'seasonNumber',
|
||||
'monitored'
|
||||
]);
|
||||
}),
|
||||
options: monitoringOptions
|
||||
};
|
||||
}
|
||||
|
|
|
@ -14,13 +14,13 @@ function getNewSeries(artist, payload) {
|
|||
searchForMissingAlbums = false
|
||||
} = payload;
|
||||
|
||||
// const {
|
||||
const {
|
||||
// seasons,
|
||||
// options: addOptions
|
||||
// } = getMonitoringOptions(artist.seasons, monitor);
|
||||
options: addOptions
|
||||
} = getMonitoringOptions(monitor);
|
||||
|
||||
// addOptions.searchForMissingAlbums = searchForMissingAlbums;
|
||||
// artist.addOptions = addOptions;
|
||||
addOptions.searchForMissingAlbums = searchForMissingAlbums;
|
||||
artist.addOptions = addOptions;
|
||||
// artist.seasons = seasons;
|
||||
artist.monitored = true;
|
||||
artist.qualityProfileId = qualityProfileId;
|
||||
|
|
|
@ -7,6 +7,6 @@ namespace NzbDrone.Core.Music
|
|||
{
|
||||
public class AddArtistOptions : MonitoringOptions
|
||||
{
|
||||
public bool SearchForMissingTracks { get; set; }
|
||||
public bool SearchForMissingAlbums { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ namespace NzbDrone.Core.Music
|
|||
_logger.Info("[{0}] was recently added, performing post-add actions", artist.Name);
|
||||
_albumMonitoredService.SetAlbumMonitoredStatus(artist, artist.AddOptions);
|
||||
|
||||
if (artist.AddOptions.SearchForMissingTracks)
|
||||
if (artist.AddOptions.SearchForMissingAlbums)
|
||||
{
|
||||
_commandQueueManager.Push(new MissingAlbumSearchCommand(artist.Id));
|
||||
}
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
using NzbDrone.Core.Datastore;
|
||||
using NzbDrone.Core.Datastore;
|
||||
|
||||
namespace NzbDrone.Core.Music
|
||||
{
|
||||
public class MonitoringOptions : IEmbeddedDocument
|
||||
{
|
||||
public bool IgnoreTracksWithFiles { get; set; }
|
||||
public bool IgnoreTracksWithoutFiles { get; set; }
|
||||
public bool IgnoreAlbumsWithFiles { get; set; }
|
||||
public bool IgnoreAlbumsWithoutFiles { get; set; }
|
||||
public bool Monitored { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ namespace NzbDrone.Core.Music
|
|||
|
||||
var tracks = _trackService.GetTracksByArtist(album.Id);
|
||||
|
||||
if (monitoringOptions.IgnoreTracksWithFiles)
|
||||
if (monitoringOptions.IgnoreAlbumsWithFiles)
|
||||
{
|
||||
_logger.Debug("Ignoring Tracks with Files");
|
||||
ToggleTracksMonitoredState(tracks.Where(e => e.HasFile), false);
|
||||
|
@ -44,7 +44,7 @@ namespace NzbDrone.Core.Music
|
|||
ToggleTracksMonitoredState(tracks.Where(e => e.HasFile), true);
|
||||
}
|
||||
|
||||
if (monitoringOptions.IgnoreTracksWithoutFiles)
|
||||
if (monitoringOptions.IgnoreAlbumsWithoutFiles)
|
||||
{
|
||||
_logger.Debug("Ignoring Tracks without Files");
|
||||
ToggleTracksMonitoredState(tracks.Where(e => !e.HasFile), false);
|
||||
|
|
Loading…
Reference in New Issue