mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-21 14:03:29 -07:00
cleaned up refresh series info
This commit is contained in:
parent
7a96cb763a
commit
49949bbe74
15 changed files with 361 additions and 240 deletions
|
@ -1,5 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using NzbDrone.Common.Messaging;
|
||||
using NzbDrone.Core.Datastore;
|
||||
|
@ -11,6 +10,7 @@ namespace NzbDrone.Core.MediaFiles
|
|||
EpisodeFile GetFileByPath(string path);
|
||||
List<EpisodeFile> GetFilesBySeries(int seriesId);
|
||||
List<EpisodeFile> GetFilesBySeason(int seriesId, int seasonNumber);
|
||||
bool Exists(string path);
|
||||
}
|
||||
|
||||
|
||||
|
@ -27,6 +27,11 @@ namespace NzbDrone.Core.MediaFiles
|
|||
return Query.SingleOrDefault(c => c.Path == path);
|
||||
}
|
||||
|
||||
public bool Exists(string path)
|
||||
{
|
||||
return Query.Any(c => c.Path == path);
|
||||
}
|
||||
|
||||
public List<EpisodeFile> GetFilesBySeries(int seriesId)
|
||||
{
|
||||
return Query.Where(c => c.SeriesId == seriesId).ToList();
|
||||
|
|
|
@ -23,16 +23,14 @@ namespace NzbDrone.Core.MediaFiles
|
|||
public class MediaFileService : IMediaFileService, IHandleAsync<SeriesDeletedEvent>
|
||||
{
|
||||
private readonly IConfigService _configService;
|
||||
private readonly IEpisodeService _episodeService;
|
||||
private readonly IMessageAggregator _messageAggregator;
|
||||
private readonly Logger _logger;
|
||||
private readonly IMediaFileRepository _mediaFileRepository;
|
||||
|
||||
public MediaFileService(IMediaFileRepository mediaFileRepository, IConfigService configService, IEpisodeService episodeService, IMessageAggregator messageAggregator, Logger logger)
|
||||
public MediaFileService(IMediaFileRepository mediaFileRepository, IConfigService configService, IMessageAggregator messageAggregator, Logger logger)
|
||||
{
|
||||
_mediaFileRepository = mediaFileRepository;
|
||||
_configService = configService;
|
||||
_episodeService = episodeService;
|
||||
_messageAggregator = messageAggregator;
|
||||
_logger = logger;
|
||||
}
|
||||
|
@ -57,7 +55,7 @@ namespace NzbDrone.Core.MediaFiles
|
|||
|
||||
public bool Exists(string path)
|
||||
{
|
||||
return GetFileByPath(path) != null;
|
||||
return _mediaFileRepository.Exists(path);
|
||||
}
|
||||
|
||||
public EpisodeFile GetFileByPath(string path)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue