// Kyoo - A portable and vast media library solution.
// Copyright (c) Kyoo.
//
// See AUTHORS.md and LICENSE file in the project root for full license information.
//
// Kyoo is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// any later version.
//
// Kyoo is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Kyoo. If not, see .
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Text.Json.Serialization;
using Kyoo.Utils;
namespace Kyoo.Abstractions.Models
{
///
/// The type of item, ether a show, a movie or a collection.
///
public enum ItemKind
{
///
/// The is a .
///
Show,
///
/// The is a Movie.
///
Movie,
///
/// The is a .
///
Collection
}
public class LibraryItem : IResource, IThumbnails, IMetadata, IAddedDate
{
///
public int Id { get; set; }
///
[MaxLength(256)]
public string Slug { get; set; }
///
/// The title of this show.
///
public string Name { get; set; }
///
/// A catchphrase for this movie.
///
public string? Tagline { get; set; }
///
/// The list of alternative titles of this show.
///
public string[] Aliases { get; set; } = Array.Empty();
///
/// The path of the movie video file.
///
public string? Path { get; set; }
///
/// The summary of this show.
///
public string? Overview { get; set; }
///
/// A list of tags that match this movie.
///
public string[] Tags { get; set; } = Array.Empty();
///
/// The list of genres (themes) this show has.
///
public Genre[] Genres { get; set; } = Array.Empty();
///
/// Is this show airing, not aired yet or finished?
///
public Status Status { get; set; }
///
/// How well this item is rated? (from 0 to 100).
///
public int Rating { get; set; }
///
/// How long is this movie? (in minutes)
///
public int? Runtime { get; set; }
///
/// The date this show started airing. It can be null if this is unknown.
///
public DateTime? StartAir { get; set; }
///
/// The date this show finished airing.
/// It can also be null if this is unknown.
///
public DateTime? EndAir { get; set; }
///
/// The date this movie aired.
///
public DateTime? AirDate { get; set; }
///
public DateTime AddedDate { get; set; }
///
public Image? Poster { get; set; }
///
public Image? Thumbnail { get; set; }
///
public Image? Logo { get; set; }
///
/// A video of a few minutes that tease the content.
///
public string? Trailer { get; set; }
///
/// Is the item a collection, a movie or a show?
///
public ItemKind Kind { get; set; }
///
public Dictionary ExternalId { get; set; } = new();
///
/// Links to watch this movie.
///
public VideoLinks? Links => Kind == ItemKind.Movie ? new()
{
Direct = $"/video/movie/{Slug}/direct",
Hls = $"/video/movie/{Slug}/master.m3u8",
}
: null;
public LibraryItem() { }
[JsonConstructor]
public LibraryItem(string name)
{
Slug = Utility.ToSlug(name);
Name = name;
}
}
}