mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-12-02 11:15:13 -05:00
92 lines
2.9 KiB
C#
92 lines
2.9 KiB
C#
using Newtonsoft.Json;
|
|
using System;
|
|
|
|
namespace Kyoo.Models
|
|
{
|
|
public class Episode
|
|
{
|
|
[JsonIgnore] public readonly long id;
|
|
[JsonIgnore] public long ShowID;
|
|
[JsonIgnore] public long SeasonID;
|
|
|
|
public long seasonNumber;
|
|
public long episodeNumber;
|
|
[JsonIgnore] public string Path;
|
|
public string Title;
|
|
public string Overview;
|
|
public DateTime? ReleaseDate;
|
|
|
|
public long Runtime; //This runtime variable should be in seconds (used by the video manager so we need precisions)
|
|
|
|
[JsonIgnore] public string ImgPrimary;
|
|
public string ExternalIDs;
|
|
|
|
public string Thumb; //Used in the API response only
|
|
|
|
public long RuntimeInMinutes
|
|
{
|
|
get
|
|
{
|
|
return Runtime / 60;
|
|
}
|
|
}
|
|
|
|
|
|
public Episode() { }
|
|
|
|
public Episode(long seasonNumber, long episodeNumber, string title, string overview, DateTime? releaseDate, long runtime, string imgPrimary, string externalIDs)
|
|
{
|
|
id = -1;
|
|
ShowID = -1;
|
|
SeasonID = -1;
|
|
this.seasonNumber = seasonNumber;
|
|
this.episodeNumber = episodeNumber;
|
|
Title = title;
|
|
Overview = overview;
|
|
ReleaseDate = releaseDate;
|
|
Runtime = runtime;
|
|
ImgPrimary = imgPrimary;
|
|
ExternalIDs = externalIDs;
|
|
}
|
|
|
|
public Episode(long id, long showID, long seasonID, long seasonNumber, long episodeNumber, string path, string title, string overview, DateTime? releaseDate, long runtime, string imgPrimary, string externalIDs)
|
|
{
|
|
this.id = id;
|
|
ShowID = showID;
|
|
SeasonID = seasonID;
|
|
this.seasonNumber = seasonNumber;
|
|
this.episodeNumber = episodeNumber;
|
|
Path = path;
|
|
Title = title;
|
|
Overview = overview;
|
|
ReleaseDate = releaseDate;
|
|
Runtime = runtime;
|
|
ImgPrimary = imgPrimary;
|
|
ExternalIDs = externalIDs;
|
|
}
|
|
|
|
public static Episode FromReader(System.Data.SQLite.SQLiteDataReader reader)
|
|
{
|
|
return new Episode((long)reader["id"],
|
|
(long)reader["showID"],
|
|
(long)reader["seasonID"],
|
|
(long)reader["seasonNumber"],
|
|
(long)reader["episodeNumber"],
|
|
reader["path"] as string,
|
|
reader["title"] as string,
|
|
reader["overview"] as string,
|
|
reader["releaseDate"] as DateTime?,
|
|
(long)reader["runtime"],
|
|
reader["imgPrimary"] as string,
|
|
reader["externalIDs"] as string);
|
|
}
|
|
|
|
|
|
public Episode SetThumb(string showSlug)
|
|
{
|
|
Thumb = "thumb/" + showSlug + "/s" + seasonNumber + "/e" + episodeNumber;
|
|
return this;
|
|
}
|
|
}
|
|
}
|