mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-06 04:52:21 -07:00
New: Include with files in album group info
This commit is contained in:
parent
30e681e843
commit
eb04673040
5 changed files with 37 additions and 17 deletions
|
@ -12,16 +12,13 @@ import TrackRowConnector from './TrackRowConnector';
|
|||
import styles from './AlbumDetailsMedium.css';
|
||||
|
||||
function getMediumStatistics(tracks) {
|
||||
let trackCount = 0;
|
||||
const trackCount = tracks.length;
|
||||
let trackFileCount = 0;
|
||||
let totalTrackCount = 0;
|
||||
|
||||
tracks.forEach((track) => {
|
||||
if (track.trackFileId) {
|
||||
trackCount++;
|
||||
trackFileCount++;
|
||||
} else {
|
||||
trackCount++;
|
||||
}
|
||||
|
||||
totalTrackCount++;
|
||||
|
|
|
@ -10,6 +10,7 @@ function AlbumGroupInfo(props) {
|
|||
const {
|
||||
totalAlbumCount,
|
||||
monitoredAlbumCount,
|
||||
albumFileCount,
|
||||
trackFileCount,
|
||||
sizeOnDisk
|
||||
} = props;
|
||||
|
@ -30,6 +31,13 @@ function AlbumGroupInfo(props) {
|
|||
data={monitoredAlbumCount}
|
||||
/>
|
||||
|
||||
<DescriptionListItem
|
||||
titleClassName={styles.title}
|
||||
descriptionClassName={styles.description}
|
||||
title={translate('WithFiles')}
|
||||
data={albumFileCount}
|
||||
/>
|
||||
|
||||
<DescriptionListItem
|
||||
titleClassName={styles.title}
|
||||
descriptionClassName={styles.description}
|
||||
|
@ -50,6 +58,7 @@ function AlbumGroupInfo(props) {
|
|||
AlbumGroupInfo.propTypes = {
|
||||
totalAlbumCount: PropTypes.number.isRequired,
|
||||
monitoredAlbumCount: PropTypes.number.isRequired,
|
||||
albumFileCount: PropTypes.number.isRequired,
|
||||
trackFileCount: PropTypes.number.isRequired,
|
||||
sizeOnDisk: PropTypes.number.isRequired
|
||||
};
|
||||
|
|
|
@ -160,7 +160,7 @@ class AlbumRow extends Component {
|
|||
return (
|
||||
<TableRowCell key={name}>
|
||||
{
|
||||
statistics.totalTrackCount
|
||||
totalTrackCount
|
||||
}
|
||||
</TableRowCell>
|
||||
);
|
||||
|
|
|
@ -22,32 +22,43 @@ import styles from './ArtistDetailsSeason.css';
|
|||
|
||||
function getAlbumStatistics(albums) {
|
||||
let albumCount = 0;
|
||||
let albumFileCount = 0;
|
||||
let trackFileCount = 0;
|
||||
let totalAlbumCount = 0;
|
||||
let monitoredAlbumCount = 0;
|
||||
let hasMonitoredAlbums = false;
|
||||
let sizeOnDisk = 0;
|
||||
|
||||
albums.forEach((album) => {
|
||||
if (album.statistics) {
|
||||
sizeOnDisk = sizeOnDisk + album.statistics.sizeOnDisk;
|
||||
trackFileCount = trackFileCount + album.statistics.trackFileCount;
|
||||
albums.forEach(({ monitored, releaseDate, statistics = {} }) => {
|
||||
const {
|
||||
trackFileCount: albumTrackFileCount = 0,
|
||||
totalTrackCount: albumTotalTrackCount = 0,
|
||||
sizeOnDisk: albumSizeOnDisk = 0
|
||||
} = statistics;
|
||||
|
||||
if (album.statistics.trackFileCount === album.statistics.totalTrackCount || (album.monitored && isBefore(album.airDateUtc))) {
|
||||
albumCount++;
|
||||
}
|
||||
const hasFiles = albumTrackFileCount > 0 && albumTrackFileCount === albumTotalTrackCount;
|
||||
|
||||
if (hasFiles || (monitored && isBefore(releaseDate))) {
|
||||
albumCount++;
|
||||
}
|
||||
|
||||
if (album.monitored) {
|
||||
if (hasFiles) {
|
||||
albumFileCount++;
|
||||
}
|
||||
|
||||
if (monitored) {
|
||||
monitoredAlbumCount++;
|
||||
hasMonitoredAlbums = true;
|
||||
}
|
||||
|
||||
totalAlbumCount++;
|
||||
trackFileCount = trackFileCount + albumTrackFileCount;
|
||||
sizeOnDisk = sizeOnDisk + albumSizeOnDisk;
|
||||
});
|
||||
|
||||
return {
|
||||
albumCount,
|
||||
albumFileCount,
|
||||
totalAlbumCount,
|
||||
trackFileCount,
|
||||
monitoredAlbumCount,
|
||||
|
@ -56,8 +67,8 @@ function getAlbumStatistics(albums) {
|
|||
};
|
||||
}
|
||||
|
||||
function getAlbumCountKind(monitored, albumCount, monitoredAlbumCount) {
|
||||
if (albumCount === monitoredAlbumCount && monitoredAlbumCount > 0) {
|
||||
function getAlbumCountKind(monitored, albumCount, albumFileCount) {
|
||||
if (albumCount === albumFileCount && albumFileCount > 0) {
|
||||
return kinds.SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -192,6 +203,7 @@ class ArtistDetailsSeason extends Component {
|
|||
|
||||
const {
|
||||
albumCount,
|
||||
albumFileCount,
|
||||
totalAlbumCount,
|
||||
trackFileCount,
|
||||
monitoredAlbumCount,
|
||||
|
@ -226,9 +238,9 @@ class ArtistDetailsSeason extends Component {
|
|||
anchor={
|
||||
<Label
|
||||
size={sizes.LARGE}
|
||||
kind={getAlbumCountKind(hasMonitoredAlbums, albumCount, monitoredAlbumCount)}
|
||||
kind={getAlbumCountKind(hasMonitoredAlbums, albumCount, albumFileCount)}
|
||||
>
|
||||
<span>{albumCount} / {monitoredAlbumCount}</span>
|
||||
<span>{albumFileCount} / {albumCount}</span>
|
||||
</Label>
|
||||
}
|
||||
title={translate('GroupInformation')}
|
||||
|
@ -237,6 +249,7 @@ class ArtistDetailsSeason extends Component {
|
|||
<AlbumGroupInfo
|
||||
totalAlbumCount={totalAlbumCount}
|
||||
monitoredAlbumCount={monitoredAlbumCount}
|
||||
albumFileCount={albumFileCount}
|
||||
trackFileCount={trackFileCount}
|
||||
sizeOnDisk={sizeOnDisk}
|
||||
/>
|
||||
|
|
|
@ -1294,6 +1294,7 @@
|
|||
"WatchRootFoldersForFileChanges": "Watch Root Folders for file changes",
|
||||
"WeekColumnHeader": "Week Column Header",
|
||||
"WhatsNew": "What's New?",
|
||||
"WithFiles": "With Files",
|
||||
"WouldYouLikeToRestoreBackup": "Would you like to restore the backup '{name}'?",
|
||||
"WriteAudioTagsHelpTextWarning": "Selecting 'All files' will alter existing files when they are imported.",
|
||||
"WriteMetadataTags": "Write Metadata Tags",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue