aboutsummaryrefslogtreecommitdiff
path: root/Jellyfin.Data
diff options
context:
space:
mode:
authorJPVenson <JPVenson@users.noreply.github.com>2024-08-05 14:20:27 +0200
committerGitHub <noreply@github.com>2024-08-05 14:20:27 +0200
commit00eb6c0d6f6aba88c66c2e9b55b9f5f4df949b59 (patch)
tree5c013f9ff550d00bed45b5e79b687889fed45ef7 /Jellyfin.Data
parent9a8298a84de89a2837e49b43b815d755995fbc1e (diff)
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
Diffstat (limited to 'Jellyfin.Data')
-rw-r--r--Jellyfin.Data/Entities/MediaSegment.cs42
-rw-r--r--Jellyfin.Data/Enums/MediaSegmentType.cs39
2 files changed, 81 insertions, 0 deletions
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;
+
+/// <summary>
+/// An entity representing the metadata for a group of trickplay tiles.
+/// </summary>
+public class MediaSegment
+{
+ /// <summary>
+ /// Gets or sets the id of the media segment.
+ /// </summary>
+ [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
+ public Guid Id { get; set; }
+
+ /// <summary>
+ /// Gets or sets the id of the associated item.
+ /// </summary>
+ public Guid ItemId { get; set; }
+
+ /// <summary>
+ /// Gets or sets the Type of content this segment defines.
+ /// </summary>
+ public MediaSegmentType Type { get; set; }
+
+ /// <summary>
+ /// Gets or sets the end of the segment.
+ /// </summary>
+ public long EndTicks { get; set; }
+
+ /// <summary>
+ /// Gets or sets the start of the segment.
+ /// </summary>
+ public long StartTicks { get; set; }
+
+ /// <summary>
+ /// Gets or sets Id of the media segment provider this entry originates from.
+ /// </summary>
+ 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;
+
+/// <summary>
+/// Defines the types of content an individual <see cref="MediaSegment"/> represents.
+/// </summary>
+public enum MediaSegmentType
+{
+ /// <summary>
+ /// Default media type or custom one.
+ /// </summary>
+ Unknown = 0,
+
+ /// <summary>
+ /// Commercial.
+ /// </summary>
+ Commercial = 1,
+
+ /// <summary>
+ /// Preview.
+ /// </summary>
+ Preview = 2,
+
+ /// <summary>
+ /// Recap.
+ /// </summary>
+ Recap = 3,
+
+ /// <summary>
+ /// Outro.
+ /// </summary>
+ Outro = 4,
+
+ /// <summary>
+ /// Intro.
+ /// </summary>
+ Intro = 5
+}