Skip to content

Commit

Permalink
Added extra column in movie table #1328
Browse files Browse the repository at this point in the history
  • Loading branch information
mregni committed Aug 18, 2020
1 parent 913a993 commit a40d82a
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 11 deletions.
5 changes: 4 additions & 1 deletion EmbyStat.Common/Extensions/BaseItemDtoExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,10 @@ public static class BaseItemDtoExtension
AverageFrameRate = y.AverageFrameRate,
Channels = y.Channels,
Height = y.Height,
Width = y.Width
Width = y.Width,
BitDepth = y.BitDepth,
Codec = y.Codec,
IsDefault = y.IsDefault
}).ToList();
}
else
Expand Down
3 changes: 3 additions & 0 deletions EmbyStat.Common/Models/Entities/Helpers/VideoStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,8 @@ public class VideoStream
public int? Height { get; set; }
public string Language { get; set; }
public int? Width { get; set; }
public int? BitDepth { get; set; }
public string Codec { get; set; }
public bool IsDefault { get; set; }
}
}
6 changes: 5 additions & 1 deletion EmbyStat.Controllers/Movie/MovieColumnViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ public class MovieColumnViewModel
public string SortName { get; set; }
public string Path { get; set; }
public DateTimeOffset? PremiereDate { get; set; }
public string[] Resolutions { get; set; }
public double SizeInMb { get; set; }
public double BitRate { get; set; }
public int? Height { get; set; }
public int? Width { get; set; }
public string Codec { get; set; }
public int? BitDepth { get; set; }
}
}
8 changes: 6 additions & 2 deletions EmbyStat.Services/MovieService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,12 @@ public Page<MovieColumn> GetMoviePage(int skip, int take, string sort, Filter[]
Subtitles = x.SubtitleStreams.Select(y => y.Language).ToArray(),
TMDB = x.TMDB,
Thumb = x.Thumb,
Resolutions = x.VideoStreams.Select(y => $"{y.Height}x{y.Width} ({Math.Round((y.BitRate ?? 0d) / 1048576, 2)} Mbps)").ToArray(),
SizeInMb = x.MediaSources.FirstOrDefault()?.SizeInMb ?? 0
Height = x.VideoStreams.FirstOrDefault()?.Height,
Width = x.VideoStreams.FirstOrDefault()?.Width,
SizeInMb = x.MediaSources.FirstOrDefault()?.SizeInMb ?? 0,
BitRate = Math.Round((x.VideoStreams.FirstOrDefault()?.BitRate ?? 0d) / 1048576, 2),
Codec = x.VideoStreams.FirstOrDefault()?.Codec,
BitDepth = x.VideoStreams.FirstOrDefault()?.BitDepth
});

var page = new Page<MovieColumn> { Data = list };
Expand Down
6 changes: 5 additions & 1 deletion EmbyStat.Web/ClientApp/public/locales/base.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,11 @@
"SIZE": "Size",
"HEIGHT": "Height",
"WIDTH": "Width",
"TOTALGENRES": "Total Genres"
"TOTALGENRES": "Total Genres",
"BITRATE": "Bitrate",
"SIZEINMB": "Size in MB",
"BITDEPTH": "Bit depth",
"CODEC": "Codec"
},
"LOGS": {
"ANONYMISED": "Anonymised",
Expand Down
38 changes: 32 additions & 6 deletions EmbyStat.Web/ClientApp/src/pages/movies/MoviesList/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import { ActiveFilter } from '../../../shared/models/filter';
import { getItemDetailLink } from '../../../shared/utils/MediaServerUrlUtil';
import { RootState } from '../../../store/RootReducer';
import { useServerType } from '../../../shared/hooks';
import calculateFileSize from '../../../shared/utils/CalculateFileSize';

const useStyles = makeStyles((theme) => ({
container: {
Expand Down Expand Up @@ -98,6 +99,10 @@ const MovieList = (props: Props) => {
return data.genres.join(', ');
};

const getSizeInMbValue = (data) => {
return calculateFileSize(data.sizeInMb)
}

const getSubtitleValues = (row) => {
return (
<Grid container>
Expand Down Expand Up @@ -128,10 +133,6 @@ const MovieList = (props: Props) => {
);
};

const getResolutionValues = (data) => {
return data.resolutions.join(', ');
};

const renderLinks = (row) => {
return (
<Grid container direction="row" justify="flex-end" alignItems="center">
Expand Down Expand Up @@ -231,8 +232,33 @@ const MovieList = (props: Props) => {
dataField="officialRating"
/>
<Column
caption={t('COMMON.RESOLUTION')}
calculateCellValue={getResolutionValues}
caption={t('COMMON.HEIGHT')}
dataField="height"
allowSorting={false}
/>
<Column
caption={t('COMMON.WIDTH')}
dataField="width"
allowSorting={false}
/>
<Column
caption={t('COMMON.BITRATE') + " (Mbps)"}
dataField="bitRate"
allowSorting={false}
/>
<Column
caption={t('COMMON.SIZEINMB')}
calculateCellValue={getSizeInMbValue}
allowSorting={false}
/>
<Column
caption={t('COMMON.BITDEPTH')}
dataField="bitDepth"
allowSorting={false}
/>
<Column
caption={t('COMMON.CODEC')}
dataField="codec"
allowSorting={false}
/>
<Column caption={t('COMMON.RATING')} dataField="communityRating" />
Expand Down

0 comments on commit a40d82a

Please sign in to comment.