You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
821 B
32 lines
821 B
using System.Linq;
|
|
using NzbDrone.Core.Music;
|
|
using NzbDrone.Core.Parser;
|
|
|
|
namespace NzbDrone.Core.Housekeeping.Housekeepers
|
|
{
|
|
public class UpdateCleanTitleForArtist : IHousekeepingTask
|
|
{
|
|
private readonly IArtistRepository _artistRepository;
|
|
|
|
public UpdateCleanTitleForArtist(IArtistRepository artistRepository)
|
|
{
|
|
_artistRepository = artistRepository;
|
|
}
|
|
|
|
public void Clean()
|
|
{
|
|
var artists = _artistRepository.All().ToList();
|
|
|
|
artists.ForEach(s =>
|
|
{
|
|
var cleanName = s.Name.CleanArtistName();
|
|
if (s.CleanName != cleanName)
|
|
{
|
|
s.CleanName = cleanName;
|
|
_artistRepository.Update(s);
|
|
}
|
|
});
|
|
}
|
|
}
|
|
}
|