Created
May 26, 2025 18:44
-
-
Save jumoog/94c19906b80dcffbdbaa68f57a8cd3eb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text.Json.Serialization; | |
using MediaBrowser.Controller.Entities; // For BaseItem | |
using MediaBrowser.Controller.Providers; // For MetadataProvider | |
namespace IntroSkipper.Api.Models | |
{ | |
public class SeasonExportData | |
{ | |
public ExportMetadata Metadata { get; set; } | |
public SeriesData Series { get; set; } | |
} | |
public class ExportMetadata | |
{ | |
public string ExportVersion { get; set; } = "1.0"; | |
public DateTime ExportDate { get; set; } | |
public string PluginVersion { get; set; } | |
public string ExportedBy { get; set; } = "intro-skipper-plugin"; | |
} | |
public class SeriesData | |
{ | |
public string Name { get; set; } | |
public ProviderIds ProviderIds { get; set; } | |
[JsonPropertyName("seasons")] | |
public Dictionary<int, SeasonData> Seasons { get; set; } = new Dictionary<int, SeasonData>(); | |
} | |
public class SeasonData | |
{ | |
[JsonPropertyName("episodes")] | |
public Dictionary<int, EpisodeData> Episodes { get; set; } = new Dictionary<int, EpisodeData>(); | |
} | |
public class EpisodeData | |
{ | |
public string Title { get; set; } | |
public int Duration { get; set; } | |
[JsonPropertyName("file_hash")] | |
public string FileHash { get; set; } | |
[JsonPropertyName("provider_ids")] | |
public ProviderIds ProviderIds { get; set; } | |
public List<SegmentData> Segments { get; set; } = new List<SegmentData>(); | |
} | |
public class ProviderIds | |
{ | |
[JsonPropertyName("tvdbid")] | |
public string TvdbId { get; set; } | |
[JsonPropertyName("imdbid")] | |
public string ImdbId { get; set; } | |
[JsonPropertyName("tmdbid")] | |
public string TmdbId { get; set; } | |
[JsonPropertyName("anidbid")] | |
public string AnidbId { get; set; } | |
[JsonPropertyName("anilistid")] | |
public string AnilistId { get; set; } | |
[JsonPropertyName("anisearchid")] | |
public string AnisearchId { get; set; } | |
public bool HasAnyId() | |
{ | |
return !string.IsNullOrEmpty(TvdbId) || | |
!string.IsNullOrEmpty(ImdbId) || | |
!string.IsNullOrEmpty(TmdbId) || | |
!string.IsNullOrEmpty(AnidbId) || | |
!string.IsNullOrEmpty(AnilistId) || | |
!string.IsNullOrEmpty(AnisearchId); | |
} | |
public Dictionary<string, string> GetProviderIdDictionary() | |
{ | |
var dict = new Dictionary<string, string>(); | |
if (!string.IsNullOrEmpty(TvdbId)) dict["tvdb"] = TvdbId; | |
if (!string.IsNullOrEmpty(ImdbId)) dict["imdb"] = ImdbId; | |
if (!string.IsNullOrEmpty(TmdbId)) dict["tmdb"] = TmdbId; | |
if (!string.IsNullOrEmpty(AnidbId)) dict["anidb"] = AnidbId; | |
if (!string.IsNullOrEmpty(AnilistId)) dict["anilist"] = AnilistId; | |
if (!string.IsNullOrEmpty(AnisearchId)) dict["anisearch"] = AnisearchId; | |
return dict; | |
} | |
} | |
public class SegmentData | |
{ | |
public string Type { get; set; } // "commercial", "preview", "recap", "outro", "intro" | |
public double Start { get; set; } | |
public double End { get; set; } | |
} | |
// For API responses | |
public class SimpleSeriesInfo | |
{ | |
public Guid Id { get; set; } | |
public string Name { get; set; } | |
public List<int> SeasonNumbers { get; set; } = new List<int>(); | |
} | |
public class ImportResult | |
{ | |
public bool Success { get; set; } | |
public string Message { get; set; } | |
public int ImportedSegmentsCount { get; set; } | |
public List<string> Errors { get; set; } = new List<string>(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment