tesses-cms/Tesses.CMS/Episode.cs

45 lines
2.0 KiB
C#
Raw Permalink Normal View History

2024-01-04 02:53:13 +00:00
using System;
using System.Collections.Generic;
using System.IO;
using Newtonsoft.Json;
namespace Tesses.CMS
{
public class Episode
{
[JsonIgnore]
public long Id {get;set;}
2024-07-28 22:59:28 +00:00
[JsonProperty("proper_name")]
2024-01-04 02:53:13 +00:00
public string ProperName {get;set;}="";
2024-07-28 22:59:28 +00:00
[JsonProperty("season_number")]
2024-01-04 02:53:13 +00:00
public int SeasonNumber {get;set;}
2024-07-28 22:59:28 +00:00
[JsonProperty("episode_number")]
2024-01-04 02:53:13 +00:00
public int EpisodeNumber {get;set;}
2024-07-28 22:59:28 +00:00
[JsonProperty("episode_name")]
2024-01-04 02:53:13 +00:00
public string EpisodeName {get;set;}="";
[JsonIgnore]
public long ShowId {get;set;}
[JsonIgnore]
public long UserId {get;set;}
2024-07-28 22:59:28 +00:00
[JsonProperty("creation_time")]
2024-08-10 18:32:16 +00:00
public DateTime CreationTime {get;set;}=DateTime.Now;
2024-07-28 22:59:28 +00:00
[JsonProperty("last_updated_time")]
2024-08-10 18:32:16 +00:00
public DateTime LastUpdated {get;set;}=DateTime.Now;
2024-07-28 22:59:28 +00:00
[JsonProperty("description")]
2024-01-04 02:53:13 +00:00
public string Description {get;set;}="";
public object Scriban(CMSConfiguration configuration,string dir,string user,string show)
{
return new {
Proper = System.Web.HttpUtility.HtmlEncode( ProperName),
Season = SeasonNumber,
Episode = EpisodeNumber,
Description = System.Web.HttpUtility.HtmlEncode(Description),
2024-10-27 13:03:52 +00:00
Thumbnail = File.Exists(Path.Combine(dir,user,"show",show,$"Season {SeasonNumber.ToString("D2")}",$"{EpisodeName} S{SeasonNumber.ToString("D2")}E{EpisodeNumber.ToString("D2")}-thumbnail.jpg")) ? $"{configuration.Root.TrimEnd('/')}/content/{user}/show/{show}/Season%20{SeasonNumber.ToString("D2")}/{EpisodeName}%20S{SeasonNumber.ToString("D2")}E{EpisodeNumber.ToString("D2")}-thumbnail.jpg" : File.Exists(Path.Combine(dir,user,"show",show,$"Season {SeasonNumber.ToString("D2")}","thumbnail.jpg")) ? $"{configuration.Root.TrimEnd('/')}/content/{user}/show/{show}/Season%20{SeasonNumber.ToString("D2")}/thumbnail.jpg" : $"{configuration.Root.TrimEnd('/')}/content/{user}/show/{show}/thumbnail.jpg"
2024-01-04 02:53:13 +00:00
};
}
}
}