mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-10-30 07:22:35 +01:00
New: Option to show release group column on series list
This commit is contained in:
parent
acdf02d569
commit
f1d07f74ee
@ -37,6 +37,7 @@
|
||||
flex: 1 0 125px;
|
||||
}
|
||||
|
||||
.releaseGroups,
|
||||
.nextAiring,
|
||||
.previousAiring,
|
||||
.added,
|
||||
|
@ -73,6 +73,7 @@
|
||||
flex: 1 0 125px;
|
||||
}
|
||||
|
||||
.releaseGroups,
|
||||
.nextAiring,
|
||||
.previousAiring,
|
||||
.added,
|
||||
|
@ -114,6 +114,7 @@ class SeriesIndexRow extends Component {
|
||||
episodeCount,
|
||||
episodeFileCount,
|
||||
totalEpisodeCount,
|
||||
releaseGroups,
|
||||
sizeOnDisk
|
||||
} = statistics;
|
||||
|
||||
@ -413,6 +414,24 @@ class SeriesIndexRow extends Component {
|
||||
);
|
||||
}
|
||||
|
||||
if (name === 'releaseGroups') {
|
||||
const joinedReleaseGroups = releaseGroups.join(', ');
|
||||
const truncatedReleaseGroups = releaseGroups.length > 3 ?
|
||||
`${releaseGroups.slice(0, 3).join(', ')}...` :
|
||||
joinedReleaseGroups;
|
||||
|
||||
return (
|
||||
<VirtualTableRowCell
|
||||
key={name}
|
||||
className={styles[name]}
|
||||
>
|
||||
<span title={joinedReleaseGroups}>
|
||||
{truncatedReleaseGroups}
|
||||
</span>
|
||||
</VirtualTableRowCell>
|
||||
);
|
||||
}
|
||||
|
||||
if (name === 'tags') {
|
||||
return (
|
||||
<VirtualTableRowCell
|
||||
@ -534,7 +553,8 @@ SeriesIndexRow.defaultProps = {
|
||||
seasonCount: 0,
|
||||
episodeCount: 0,
|
||||
episodeFileCount: 0,
|
||||
totalEpisodeCount: 0
|
||||
totalEpisodeCount: 0,
|
||||
releaseGroups: []
|
||||
},
|
||||
genres: [],
|
||||
tags: []
|
||||
|
@ -131,6 +131,18 @@ export const filterPredicates = {
|
||||
return predicate(item.ratings.value * 10, filterValue);
|
||||
},
|
||||
|
||||
releaseGroups: function(item, filterValue, type) {
|
||||
const { statistics = {} } = item;
|
||||
|
||||
const {
|
||||
releaseGroups = []
|
||||
} = statistics;
|
||||
|
||||
const predicate = filterTypePredicates[type];
|
||||
|
||||
return predicate(releaseGroups, filterValue);
|
||||
},
|
||||
|
||||
seasonCount: function(item, filterValue, type) {
|
||||
const predicate = filterTypePredicates[type];
|
||||
const seasonCount = item.statistics ? item.statistics.seasonCount : 0;
|
||||
@ -261,6 +273,11 @@ export const filterBuilderProps = [
|
||||
return tagList.sort(sortByName);
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'releaseGroups',
|
||||
label: 'Release Groups',
|
||||
type: filterBuilderTypes.ARRAY
|
||||
},
|
||||
{
|
||||
name: 'ratings',
|
||||
label: 'Rating',
|
||||
|
@ -167,6 +167,12 @@ export const defaultState = {
|
||||
isSortable: false,
|
||||
isVisible: false
|
||||
},
|
||||
{
|
||||
name: 'releaseGroups',
|
||||
label: 'Release Groups',
|
||||
isSortable: false,
|
||||
isVisible: false
|
||||
},
|
||||
{
|
||||
name: 'tags',
|
||||
label: 'Tags',
|
||||
|
@ -1,5 +1,8 @@
|
||||
using System;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Core.Datastore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace NzbDrone.Core.SeriesStats
|
||||
{
|
||||
@ -14,6 +17,7 @@ namespace NzbDrone.Core.SeriesStats
|
||||
public int AvailableEpisodeCount { get; set; }
|
||||
public int TotalEpisodeCount { get; set; }
|
||||
public long SizeOnDisk { get; set; }
|
||||
public string ReleaseGroupsString { get; set; }
|
||||
|
||||
public DateTime? NextAiring
|
||||
{
|
||||
@ -54,5 +58,25 @@ namespace NzbDrone.Core.SeriesStats
|
||||
return previousAiring;
|
||||
}
|
||||
}
|
||||
|
||||
public List<string> ReleaseGroups
|
||||
{
|
||||
get
|
||||
{
|
||||
var releasegroups = new List<string>();
|
||||
|
||||
if (ReleaseGroupsString.IsNotNullOrWhiteSpace())
|
||||
{
|
||||
releasegroups = ReleaseGroupsString
|
||||
.Split('|')
|
||||
.Distinct()
|
||||
.Where(rg => rg.IsNotNullOrWhiteSpace())
|
||||
.OrderBy(rg => rg)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
return releasegroups;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -13,6 +13,7 @@ namespace NzbDrone.Core.SeriesStats
|
||||
public int EpisodeCount { get; set; }
|
||||
public int TotalEpisodeCount { get; set; }
|
||||
public long SizeOnDisk { get; set; }
|
||||
public List<string> ReleaseGroups { get; set; }
|
||||
public List<SeasonStatistics> SeasonStatistics { get; set; }
|
||||
|
||||
public DateTime? NextAiring
|
||||
|
@ -53,7 +53,7 @@ namespace NzbDrone.Core.SeriesStats
|
||||
|
||||
private string GetSelectClause(bool series)
|
||||
{
|
||||
return @"SELECT Episodes.*, SUM(EpisodeFiles.Size) as SizeOnDisk FROM
|
||||
return @"SELECT Episodes.*, SUM(EpisodeFiles.Size) as SizeOnDisk, GROUP_CONCAT(EpisodeFiles.ReleaseGroup, '|') AS ReleaseGroupsString FROM
|
||||
(SELECT
|
||||
Episodes.SeriesId,
|
||||
Episodes.SeasonNumber,
|
||||
|
@ -43,7 +43,8 @@ namespace NzbDrone.Core.SeriesStats
|
||||
EpisodeFileCount = seasonStatistics.Sum(s => s.EpisodeFileCount),
|
||||
EpisodeCount = seasonStatistics.Sum(s => s.EpisodeCount),
|
||||
TotalEpisodeCount = seasonStatistics.Sum(s => s.TotalEpisodeCount),
|
||||
SizeOnDisk = seasonStatistics.Sum(s => s.SizeOnDisk)
|
||||
SizeOnDisk = seasonStatistics.Sum(s => s.SizeOnDisk),
|
||||
ReleaseGroups = seasonStatistics.SelectMany(s => s.ReleaseGroups).Distinct().ToList()
|
||||
};
|
||||
|
||||
var nextAiring = seasonStatistics.Where(s => s.NextAiring != null)
|
||||
|
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using NzbDrone.Core.SeriesStats;
|
||||
|
||||
namespace Sonarr.Api.V3.Series
|
||||
@ -11,6 +12,7 @@ namespace Sonarr.Api.V3.Series
|
||||
public int EpisodeCount { get; set; }
|
||||
public int TotalEpisodeCount { get; set; }
|
||||
public long SizeOnDisk { get; set; }
|
||||
public List<string> ReleaseGroups { get; set; }
|
||||
|
||||
public decimal PercentOfEpisodes
|
||||
{
|
||||
@ -36,7 +38,8 @@ namespace Sonarr.Api.V3.Series
|
||||
EpisodeFileCount = model.EpisodeFileCount,
|
||||
EpisodeCount = model.EpisodeCount,
|
||||
TotalEpisodeCount = model.TotalEpisodeCount,
|
||||
SizeOnDisk = model.SizeOnDisk
|
||||
SizeOnDisk = model.SizeOnDisk,
|
||||
ReleaseGroups = model.ReleaseGroups
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ namespace Sonarr.Api.V3.Series
|
||||
public int EpisodeCount { get; set; }
|
||||
public int TotalEpisodeCount { get; set; }
|
||||
public long SizeOnDisk { get; set; }
|
||||
public List<string> ReleaseGroups { get; set; }
|
||||
|
||||
public decimal PercentOfEpisodes
|
||||
{
|
||||
@ -37,7 +38,8 @@ namespace Sonarr.Api.V3.Series
|
||||
EpisodeFileCount = model.EpisodeFileCount,
|
||||
EpisodeCount = model.EpisodeCount,
|
||||
TotalEpisodeCount = model.TotalEpisodeCount,
|
||||
SizeOnDisk = model.SizeOnDisk
|
||||
SizeOnDisk = model.SizeOnDisk,
|
||||
ReleaseGroups = model.ReleaseGroups
|
||||
};
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user