From 00eb6c0d6f6aba88c66c2e9b55b9f5f4df949b59 Mon Sep 17 00:00:00 2001 From: JPVenson Date: Mon, 5 Aug 2024 14:20:27 +0200 Subject: Add media segments API (#12345) * Added Media segment manager * Added "HasSegments" to MediaSourceInfo when requesting though baseitem * Fixed ordering of Media Segements * Added media segment API controller * Added .ConfigureAwait(false) on media segments manager * renamed MediaSegmentsController removed empty route * Added Model layer for Media Segments Fixed review comments Media segments * Updated media segment naming refactored api and manager usage * Added mediaSegment type filter * Fixed codesmell * Fixed naming and typos * Added EF Migration * Added Identity Generation for MediaSegments Made mediasegment filter optional * Fixed optional filter parameter * refactored segment namespace * Added SegmentProviderId to MediaSegment * Media segment comment indentation * Added MediaSegmentManager query notracking --- Jellyfin.Data/Entities/MediaSegment.cs | 42 +++++++++++++++++++++++++++++++++ Jellyfin.Data/Enums/MediaSegmentType.cs | 39 ++++++++++++++++++++++++++++++ 2 files changed, 81 insertions(+) create mode 100644 Jellyfin.Data/Entities/MediaSegment.cs create mode 100644 Jellyfin.Data/Enums/MediaSegmentType.cs (limited to 'Jellyfin.Data') diff --git a/Jellyfin.Data/Entities/MediaSegment.cs b/Jellyfin.Data/Entities/MediaSegment.cs new file mode 100644 index 000000000..90120d772 --- /dev/null +++ b/Jellyfin.Data/Entities/MediaSegment.cs @@ -0,0 +1,42 @@ +using System; +using System.ComponentModel.DataAnnotations.Schema; +using Jellyfin.Data.Enums; + +namespace Jellyfin.Data.Entities; + +/// +/// An entity representing the metadata for a group of trickplay tiles. +/// +public class MediaSegment +{ + /// + /// Gets or sets the id of the media segment. + /// + [DatabaseGenerated(DatabaseGeneratedOption.Identity)] + public Guid Id { get; set; } + + /// + /// Gets or sets the id of the associated item. + /// + public Guid ItemId { get; set; } + + /// + /// Gets or sets the Type of content this segment defines. + /// + public MediaSegmentType Type { get; set; } + + /// + /// Gets or sets the end of the segment. + /// + public long EndTicks { get; set; } + + /// + /// Gets or sets the start of the segment. + /// + public long StartTicks { get; set; } + + /// + /// Gets or sets Id of the media segment provider this entry originates from. + /// + public required string SegmentProviderId { get; set; } +} diff --git a/Jellyfin.Data/Enums/MediaSegmentType.cs b/Jellyfin.Data/Enums/MediaSegmentType.cs new file mode 100644 index 000000000..458635450 --- /dev/null +++ b/Jellyfin.Data/Enums/MediaSegmentType.cs @@ -0,0 +1,39 @@ +using Jellyfin.Data.Entities; + +namespace Jellyfin.Data.Enums; + +/// +/// Defines the types of content an individual represents. +/// +public enum MediaSegmentType +{ + /// + /// Default media type or custom one. + /// + Unknown = 0, + + /// + /// Commercial. + /// + Commercial = 1, + + /// + /// Preview. + /// + Preview = 2, + + /// + /// Recap. + /// + Recap = 3, + + /// + /// Outro. + /// + Outro = 4, + + /// + /// Intro. + /// + Intro = 5 +} -- cgit v1.2.3