show chapter markers in media info (#1568)
This commit is contained in:
+2
-1
@@ -27,7 +27,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|||||||
- `Blocks` - ordered list of items to play within the specified duration
|
- `Blocks` - ordered list of items to play within the specified duration
|
||||||
- `Templates` - a generic "day" that consists of blocks scheduled at specific times
|
- `Templates` - a generic "day" that consists of blocks scheduled at specific times
|
||||||
- `Playout Templates` - templates to schedule using the specified criteria. Only one template will be selected each day
|
- `Playout Templates` - templates to schedule using the specified criteria. Only one template will be selected each day
|
||||||
- Much more to come on this feature as development continues
|
- Much more to come on this feature as development continues
|
||||||
|
- Show chapter markers in movie and episode media info
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- Fix error loading path replacements when using MySql
|
- Fix error loading path replacements when using MySql
|
||||||
|
|||||||
@@ -16,4 +16,5 @@ public record MediaItemInfo(
|
|||||||
VideoScanKind VideoScanKind,
|
VideoScanKind VideoScanKind,
|
||||||
int Width,
|
int Width,
|
||||||
int Height,
|
int Height,
|
||||||
List<MediaItemInfoStream> Streams);
|
List<MediaItemInfoStream> Streams,
|
||||||
|
List<MediaItemInfoChapter> Chapters);
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
namespace ErsatzTV.Application.MediaItems;
|
||||||
|
|
||||||
|
public record MediaItemInfoChapter(string Title, TimeSpan StartTime, TimeSpan EndTime);
|
||||||
@@ -31,8 +31,12 @@ public class GetMediaItemInfoHandler : IRequestHandler<GetMediaItemInfo, Either<
|
|||||||
.Include(i => (i as Movie).MovieMetadata)
|
.Include(i => (i as Movie).MovieMetadata)
|
||||||
.ThenInclude(mv => mv.Subtitles)
|
.ThenInclude(mv => mv.Subtitles)
|
||||||
.Include(i => (i as Movie).MediaVersions)
|
.Include(i => (i as Movie).MediaVersions)
|
||||||
|
.ThenInclude(mv => mv.Chapters)
|
||||||
|
.Include(i => (i as Movie).MediaVersions)
|
||||||
.ThenInclude(mv => mv.Streams)
|
.ThenInclude(mv => mv.Streams)
|
||||||
.Include(i => (i as Episode).MediaVersions)
|
.Include(i => (i as Episode).MediaVersions)
|
||||||
|
.ThenInclude(mv => mv.Chapters)
|
||||||
|
.Include(i => (i as Episode).MediaVersions)
|
||||||
.ThenInclude(mv => mv.Streams)
|
.ThenInclude(mv => mv.Streams)
|
||||||
.Include(i => (i as Episode).EpisodeMetadata)
|
.Include(i => (i as Episode).EpisodeMetadata)
|
||||||
.ThenInclude(mv => mv.Subtitles)
|
.ThenInclude(mv => mv.Subtitles)
|
||||||
@@ -71,6 +75,8 @@ public class GetMediaItemInfoHandler : IRequestHandler<GetMediaItemInfo, Either<
|
|||||||
// include external subtitles from local libraries
|
// include external subtitles from local libraries
|
||||||
allStreams.AddRange(subtitles.Filter(s => s.SubtitleKind is SubtitleKind.Sidecar).Map(ProjectToStream));
|
allStreams.AddRange(subtitles.Filter(s => s.SubtitleKind is SubtitleKind.Sidecar).Map(ProjectToStream));
|
||||||
|
|
||||||
|
var allChapters = (version.Chapters ?? []).OrderBy(c => c.StartTime).Map(Project).ToList();
|
||||||
|
|
||||||
return new MediaItemInfo(
|
return new MediaItemInfo(
|
||||||
mediaItem.Id,
|
mediaItem.Id,
|
||||||
mediaItem.GetType().Name,
|
mediaItem.GetType().Name,
|
||||||
@@ -85,7 +91,8 @@ public class GetMediaItemInfoHandler : IRequestHandler<GetMediaItemInfo, Either<
|
|||||||
version.VideoScanKind,
|
version.VideoScanKind,
|
||||||
version.Width,
|
version.Width,
|
||||||
version.Height,
|
version.Height,
|
||||||
allStreams);
|
allStreams,
|
||||||
|
allChapters);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static MediaItemInfoStream Project(MediaStream mediaStream) =>
|
private static MediaItemInfoStream Project(MediaStream mediaStream) =>
|
||||||
@@ -129,4 +136,7 @@ public class GetMediaItemInfoHandler : IRequestHandler<GetMediaItemInfo, Either<
|
|||||||
null,
|
null,
|
||||||
string.IsNullOrWhiteSpace(subtitle.Path) ? null : Path.GetFileName(subtitle.Path),
|
string.IsNullOrWhiteSpace(subtitle.Path) ? null : Path.GetFileName(subtitle.Path),
|
||||||
null);
|
null);
|
||||||
|
|
||||||
|
private static MediaItemInfoChapter Project(MediaChapter chapter) =>
|
||||||
|
new(chapter.Title, chapter.StartTime, chapter.EndTime);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user