Faster tag view in UI for large libraries
This commit is contained in:
parent
48ee1158ad
commit
b050e1d2eb
|
@ -112,7 +112,7 @@ namespace NzbDrone.Core.Tags
|
||||||
var importLists = _importListFactory.All();
|
var importLists = _importListFactory.All();
|
||||||
var notifications = _notificationFactory.All();
|
var notifications = _notificationFactory.All();
|
||||||
var restrictions = _releaseProfileService.All();
|
var restrictions = _releaseProfileService.All();
|
||||||
var series = _seriesService.GetAllSeries();
|
var series = _seriesService.GetAllSeriesTags();
|
||||||
var indexers = _indexerService.All();
|
var indexers = _indexerService.All();
|
||||||
var autotags = _autoTaggingService.All();
|
var autotags = _autoTaggingService.All();
|
||||||
|
|
||||||
|
@ -128,7 +128,7 @@ namespace NzbDrone.Core.Tags
|
||||||
ImportListIds = importLists.Where(c => c.Tags.Contains(tag.Id)).Select(c => c.Id).ToList(),
|
ImportListIds = importLists.Where(c => c.Tags.Contains(tag.Id)).Select(c => c.Id).ToList(),
|
||||||
NotificationIds = notifications.Where(c => c.Tags.Contains(tag.Id)).Select(c => c.Id).ToList(),
|
NotificationIds = notifications.Where(c => c.Tags.Contains(tag.Id)).Select(c => c.Id).ToList(),
|
||||||
RestrictionIds = restrictions.Where(c => c.Tags.Contains(tag.Id)).Select(c => c.Id).ToList(),
|
RestrictionIds = restrictions.Where(c => c.Tags.Contains(tag.Id)).Select(c => c.Id).ToList(),
|
||||||
SeriesIds = series.Where(c => c.Tags.Contains(tag.Id)).Select(c => c.Id).ToList(),
|
SeriesIds = series.Where(c => c.Value.Contains(tag.Id)).Select(c => c.Key).ToList(),
|
||||||
IndexerIds = indexers.Where(c => c.Tags.Contains(tag.Id)).Select(c => c.Id).ToList(),
|
IndexerIds = indexers.Where(c => c.Tags.Contains(tag.Id)).Select(c => c.Id).ToList(),
|
||||||
AutoTagIds = autotags.Where(c => c.Tags.Contains(tag.Id)).Select(c => c.Id).ToList(),
|
AutoTagIds = autotags.Where(c => c.Tags.Contains(tag.Id)).Select(c => c.Id).ToList(),
|
||||||
});
|
});
|
||||||
|
|
|
@ -17,6 +17,7 @@ namespace NzbDrone.Core.Tv
|
||||||
Series FindByPath(string path);
|
Series FindByPath(string path);
|
||||||
List<int> AllSeriesTvdbIds();
|
List<int> AllSeriesTvdbIds();
|
||||||
Dictionary<int, string> AllSeriesPaths();
|
Dictionary<int, string> AllSeriesPaths();
|
||||||
|
Dictionary<int, List<int>> AllSeriesTags();
|
||||||
}
|
}
|
||||||
|
|
||||||
public class SeriesRepository : BasicRepository<Series>, ISeriesRepository
|
public class SeriesRepository : BasicRepository<Series>, ISeriesRepository
|
||||||
|
@ -90,6 +91,15 @@ namespace NzbDrone.Core.Tv
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Dictionary<int, List<int>> AllSeriesTags()
|
||||||
|
{
|
||||||
|
using (var conn = _database.OpenConnection())
|
||||||
|
{
|
||||||
|
var strSql = "SELECT Id AS [Key], Tags AS [Value] FROM Series WHERE Tags IS NOT NULL";
|
||||||
|
return conn.Query<KeyValuePair<int, List<int>>>(strSql).ToDictionary(x => x.Key, x => x.Value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private Series ReturnSingleSeriesOrThrow(List<Series> series)
|
private Series ReturnSingleSeriesOrThrow(List<Series> series)
|
||||||
{
|
{
|
||||||
if (series.Count == 0)
|
if (series.Count == 0)
|
||||||
|
|
|
@ -24,6 +24,7 @@ namespace NzbDrone.Core.Tv
|
||||||
List<Series> GetAllSeries();
|
List<Series> GetAllSeries();
|
||||||
List<int> AllSeriesTvdbIds();
|
List<int> AllSeriesTvdbIds();
|
||||||
Dictionary<int, string> GetAllSeriesPaths();
|
Dictionary<int, string> GetAllSeriesPaths();
|
||||||
|
Dictionary<int, List<int>> GetAllSeriesTags();
|
||||||
List<Series> AllForTag(int tagId);
|
List<Series> AllForTag(int tagId);
|
||||||
Series UpdateSeries(Series series, bool updateEpisodesToMatchSeason = true, bool publishUpdatedEvent = true);
|
Series UpdateSeries(Series series, bool updateEpisodesToMatchSeason = true, bool publishUpdatedEvent = true);
|
||||||
List<Series> UpdateSeries(List<Series> series, bool useExistingRelativeFolder);
|
List<Series> UpdateSeries(List<Series> series, bool useExistingRelativeFolder);
|
||||||
|
@ -169,6 +170,11 @@ namespace NzbDrone.Core.Tv
|
||||||
return _seriesRepository.AllSeriesPaths();
|
return _seriesRepository.AllSeriesPaths();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Dictionary<int, List<int>> GetAllSeriesTags()
|
||||||
|
{
|
||||||
|
return _seriesRepository.AllSeriesTags();
|
||||||
|
}
|
||||||
|
|
||||||
public List<Series> AllForTag(int tagId)
|
public List<Series> AllForTag(int tagId)
|
||||||
{
|
{
|
||||||
return GetAllSeries().Where(s => s.Tags.Contains(tagId))
|
return GetAllSeries().Where(s => s.Tags.Contains(tagId))
|
||||||
|
|
Loading…
Reference in New Issue