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;
|
flex: 1 0 125px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.releaseGroups,
|
||||||
.nextAiring,
|
.nextAiring,
|
||||||
.previousAiring,
|
.previousAiring,
|
||||||
.added,
|
.added,
|
||||||
|
|
|
@ -73,6 +73,7 @@
|
||||||
flex: 1 0 125px;
|
flex: 1 0 125px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.releaseGroups,
|
||||||
.nextAiring,
|
.nextAiring,
|
||||||
.previousAiring,
|
.previousAiring,
|
||||||
.added,
|
.added,
|
||||||
|
|
|
@ -114,6 +114,7 @@ class SeriesIndexRow extends Component {
|
||||||
episodeCount,
|
episodeCount,
|
||||||
episodeFileCount,
|
episodeFileCount,
|
||||||
totalEpisodeCount,
|
totalEpisodeCount,
|
||||||
|
releaseGroups,
|
||||||
sizeOnDisk
|
sizeOnDisk
|
||||||
} = statistics;
|
} = 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') {
|
if (name === 'tags') {
|
||||||
return (
|
return (
|
||||||
<VirtualTableRowCell
|
<VirtualTableRowCell
|
||||||
|
@ -534,7 +553,8 @@ SeriesIndexRow.defaultProps = {
|
||||||
seasonCount: 0,
|
seasonCount: 0,
|
||||||
episodeCount: 0,
|
episodeCount: 0,
|
||||||
episodeFileCount: 0,
|
episodeFileCount: 0,
|
||||||
totalEpisodeCount: 0
|
totalEpisodeCount: 0,
|
||||||
|
releaseGroups: []
|
||||||
},
|
},
|
||||||
genres: [],
|
genres: [],
|
||||||
tags: []
|
tags: []
|
||||||
|
|
|
@ -131,6 +131,18 @@ export const filterPredicates = {
|
||||||
return predicate(item.ratings.value * 10, filterValue);
|
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) {
|
seasonCount: function(item, filterValue, type) {
|
||||||
const predicate = filterTypePredicates[type];
|
const predicate = filterTypePredicates[type];
|
||||||
const seasonCount = item.statistics ? item.statistics.seasonCount : 0;
|
const seasonCount = item.statistics ? item.statistics.seasonCount : 0;
|
||||||
|
@ -261,6 +273,11 @@ export const filterBuilderProps = [
|
||||||
return tagList.sort(sortByName);
|
return tagList.sort(sortByName);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: 'releaseGroups',
|
||||||
|
label: 'Release Groups',
|
||||||
|
type: filterBuilderTypes.ARRAY
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: 'ratings',
|
name: 'ratings',
|
||||||
label: 'Rating',
|
label: 'Rating',
|
||||||
|
|
|
@ -167,6 +167,12 @@ export const defaultState = {
|
||||||
isSortable: false,
|
isSortable: false,
|
||||||
isVisible: false
|
isVisible: false
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: 'releaseGroups',
|
||||||
|
label: 'Release Groups',
|
||||||
|
isSortable: false,
|
||||||
|
isVisible: false
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: 'tags',
|
name: 'tags',
|
||||||
label: 'Tags',
|
label: 'Tags',
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
using System;
|
using NzbDrone.Common.Extensions;
|
||||||
using NzbDrone.Core.Datastore;
|
using NzbDrone.Core.Datastore;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
namespace NzbDrone.Core.SeriesStats
|
namespace NzbDrone.Core.SeriesStats
|
||||||
{
|
{
|
||||||
|
@ -14,6 +17,7 @@ namespace NzbDrone.Core.SeriesStats
|
||||||
public int AvailableEpisodeCount { get; set; }
|
public int AvailableEpisodeCount { get; set; }
|
||||||
public int TotalEpisodeCount { get; set; }
|
public int TotalEpisodeCount { get; set; }
|
||||||
public long SizeOnDisk { get; set; }
|
public long SizeOnDisk { get; set; }
|
||||||
|
public string ReleaseGroupsString { get; set; }
|
||||||
|
|
||||||
public DateTime? NextAiring
|
public DateTime? NextAiring
|
||||||
{
|
{
|
||||||
|
@ -54,5 +58,25 @@ namespace NzbDrone.Core.SeriesStats
|
||||||
return previousAiring;
|
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 EpisodeCount { get; set; }
|
||||||
public int TotalEpisodeCount { get; set; }
|
public int TotalEpisodeCount { get; set; }
|
||||||
public long SizeOnDisk { get; set; }
|
public long SizeOnDisk { get; set; }
|
||||||
|
public List<string> ReleaseGroups { get; set; }
|
||||||
public List<SeasonStatistics> SeasonStatistics { get; set; }
|
public List<SeasonStatistics> SeasonStatistics { get; set; }
|
||||||
|
|
||||||
public DateTime? NextAiring
|
public DateTime? NextAiring
|
||||||
|
|
|
@ -53,7 +53,7 @@ namespace NzbDrone.Core.SeriesStats
|
||||||
|
|
||||||
private string GetSelectClause(bool series)
|
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
|
(SELECT
|
||||||
Episodes.SeriesId,
|
Episodes.SeriesId,
|
||||||
Episodes.SeasonNumber,
|
Episodes.SeasonNumber,
|
||||||
|
|
|
@ -43,7 +43,8 @@ namespace NzbDrone.Core.SeriesStats
|
||||||
EpisodeFileCount = seasonStatistics.Sum(s => s.EpisodeFileCount),
|
EpisodeFileCount = seasonStatistics.Sum(s => s.EpisodeFileCount),
|
||||||
EpisodeCount = seasonStatistics.Sum(s => s.EpisodeCount),
|
EpisodeCount = seasonStatistics.Sum(s => s.EpisodeCount),
|
||||||
TotalEpisodeCount = seasonStatistics.Sum(s => s.TotalEpisodeCount),
|
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)
|
var nextAiring = seasonStatistics.Where(s => s.NextAiring != null)
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using NzbDrone.Core.SeriesStats;
|
using NzbDrone.Core.SeriesStats;
|
||||||
|
|
||||||
namespace Sonarr.Api.V3.Series
|
namespace Sonarr.Api.V3.Series
|
||||||
|
@ -11,6 +12,7 @@ namespace Sonarr.Api.V3.Series
|
||||||
public int EpisodeCount { get; set; }
|
public int EpisodeCount { get; set; }
|
||||||
public int TotalEpisodeCount { get; set; }
|
public int TotalEpisodeCount { get; set; }
|
||||||
public long SizeOnDisk { get; set; }
|
public long SizeOnDisk { get; set; }
|
||||||
|
public List<string> ReleaseGroups { get; set; }
|
||||||
|
|
||||||
public decimal PercentOfEpisodes
|
public decimal PercentOfEpisodes
|
||||||
{
|
{
|
||||||
|
@ -36,7 +38,8 @@ namespace Sonarr.Api.V3.Series
|
||||||
EpisodeFileCount = model.EpisodeFileCount,
|
EpisodeFileCount = model.EpisodeFileCount,
|
||||||
EpisodeCount = model.EpisodeCount,
|
EpisodeCount = model.EpisodeCount,
|
||||||
TotalEpisodeCount = model.TotalEpisodeCount,
|
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 EpisodeCount { get; set; }
|
||||||
public int TotalEpisodeCount { get; set; }
|
public int TotalEpisodeCount { get; set; }
|
||||||
public long SizeOnDisk { get; set; }
|
public long SizeOnDisk { get; set; }
|
||||||
|
public List<string> ReleaseGroups { get; set; }
|
||||||
|
|
||||||
public decimal PercentOfEpisodes
|
public decimal PercentOfEpisodes
|
||||||
{
|
{
|
||||||
|
@ -37,7 +38,8 @@ namespace Sonarr.Api.V3.Series
|
||||||
EpisodeFileCount = model.EpisodeFileCount,
|
EpisodeFileCount = model.EpisodeFileCount,
|
||||||
EpisodeCount = model.EpisodeCount,
|
EpisodeCount = model.EpisodeCount,
|
||||||
TotalEpisodeCount = model.TotalEpisodeCount,
|
TotalEpisodeCount = model.TotalEpisodeCount,
|
||||||
SizeOnDisk = model.SizeOnDisk
|
SizeOnDisk = model.SizeOnDisk,
|
||||||
|
ReleaseGroups = model.ReleaseGroups
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue