2024-11-02 18:17:22 +01:00
|
|
|
// Copyright (C) 2024 Intro-Skipper contributors <intro-skipper.org>
|
|
|
|
// SPDX-License-Identifier: GPL-3.0-only.
|
|
|
|
|
|
|
|
using System;
|
|
|
|
using IntroSkipper.Data;
|
|
|
|
|
|
|
|
namespace IntroSkipper.Db;
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// All times are measured in seconds relative to the beginning of the media file.
|
|
|
|
/// </summary>
|
|
|
|
/// <remarks>
|
|
|
|
/// Initializes a new instance of the <see cref="DbSegment"/> class.
|
|
|
|
/// </remarks>
|
|
|
|
public class DbSegment
|
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// Initializes a new instance of the <see cref="DbSegment"/> class.
|
|
|
|
/// </summary>
|
2024-11-21 15:42:55 +01:00
|
|
|
/// <param name="segment">The segment to initialize the instance with.</param>
|
|
|
|
/// <param name="type">The type of analysis that was used to determine this segment.</param>
|
|
|
|
public DbSegment(Segment segment, AnalysisMode type)
|
2024-11-02 18:17:22 +01:00
|
|
|
{
|
|
|
|
ItemId = segment.EpisodeId;
|
|
|
|
Start = segment.Start;
|
|
|
|
End = segment.End;
|
2024-11-21 15:42:55 +01:00
|
|
|
Type = type;
|
2024-11-02 18:17:22 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Initializes a new instance of the <see cref="DbSegment"/> class.
|
|
|
|
/// </summary>
|
|
|
|
public DbSegment()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
2024-11-21 15:42:55 +01:00
|
|
|
/// Gets or sets the episode id.
|
2024-11-02 18:17:22 +01:00
|
|
|
/// </summary>
|
2024-11-21 15:42:55 +01:00
|
|
|
public Guid ItemId { get; set; }
|
2024-11-02 18:17:22 +01:00
|
|
|
|
|
|
|
/// <summary>
|
2024-11-21 15:42:55 +01:00
|
|
|
/// Gets or sets the start time.
|
2024-11-02 18:17:22 +01:00
|
|
|
/// </summary>
|
2024-11-21 15:42:55 +01:00
|
|
|
public double Start { get; set; }
|
2024-11-02 18:17:22 +01:00
|
|
|
|
|
|
|
/// <summary>
|
2024-11-21 15:42:55 +01:00
|
|
|
/// Gets or sets the end time.
|
2024-11-02 18:17:22 +01:00
|
|
|
/// </summary>
|
2024-11-21 15:42:55 +01:00
|
|
|
public double End { get; set; }
|
2024-11-02 18:17:22 +01:00
|
|
|
|
|
|
|
/// <summary>
|
2024-11-21 15:42:55 +01:00
|
|
|
/// Gets the type of analysis that was used to determine this segment.
|
2024-11-02 18:17:22 +01:00
|
|
|
/// </summary>
|
|
|
|
public AnalysisMode Type { get; private set; }
|
2024-11-21 15:42:55 +01:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Converts the instance to a <see cref="Segment"/> object.
|
|
|
|
/// </summary>
|
|
|
|
/// <returns>A <see cref="Segment"/> object.</returns>
|
|
|
|
internal Segment ToSegment()
|
|
|
|
{
|
|
|
|
return new Segment(ItemId, new TimeRange(Start, End));
|
|
|
|
}
|
2024-11-02 18:17:22 +01:00
|
|
|
}
|