Skip to content

Commit

Permalink
Fix models for latest server daily
Browse files Browse the repository at this point in the history
  • Loading branch information
harshithmohan committed Aug 7, 2024
1 parent 359bfef commit 35bb6ca
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 11 deletions.
16 changes: 13 additions & 3 deletions Shokofin/API/Models/Image.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class Image
/// The image's id. Usually an int, but in the case of <see cref="ImageType.Static"/> resources
/// then it is the resource name.
/// </summary>
public string ID { get; set; } = string.Empty;
public int ID { get; set; } = 0;


/// <summary>
Expand Down Expand Up @@ -123,7 +123,12 @@ public enum ImageType
/// <summary>
///
/// </summary>
Fanart = 4,
Backdrop = 4,

/// <summary>
///
/// </summary>
Fanart = Backdrop,

/// <summary>
///
Expand All @@ -135,8 +140,13 @@ public enum ImageType
/// </summary>
Staff = 6,

/// <summary>
/// Clear-text logo.
/// </summary>
Logo = 7,

/// <summary>
/// Static resources are only valid if the <see cref="Image.Source"/> is set to <see cref="ImageSource.Shoko"/>.
/// </summary>
Static = 100
}
}
2 changes: 1 addition & 1 deletion Shokofin/API/Models/Images.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ public class Images
{
public List<Image> Posters { get; set; } = new List<Image>();

public List<Image> Fanarts { get; set; } = new List<Image>();
public List<Image> Backdrops { get; set; } = new List<Image>();

public List<Image> Banners { get; set; } = new List<Image>();
}
17 changes: 11 additions & 6 deletions Shokofin/API/Models/Series.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace Shokofin.API.Models;
public class Series
{
public string Name { get; set; } = string.Empty;

public int Size { get; set; }

/// <summary>
Expand Down Expand Up @@ -40,7 +40,7 @@ public class Series
/// </summary>
[JsonPropertyName("TvDB")]
public List<TvDB> TvDBEntityList { get; set; }= new();

public SeriesSizes Sizes { get; set; } = new();

/// <summary>
Expand Down Expand Up @@ -106,7 +106,7 @@ public class AniDB
public int? EpisodeCount { get; set; }

/// <summary>
/// The average rating for the anime. Only available on
/// The average rating for the anime. Only available on
/// </summary>
public Rating? Rating { get; set; }

Expand Down Expand Up @@ -135,7 +135,7 @@ public class AniDBWithDate : AniDB
public new List<Title> Titles { get; set; } = new();

/// <summary>
/// The average rating for the anime. Only available on
/// The average rating for the anime. Only available on
/// </summary>
public new Rating Rating { get; set; } = new();

Expand Down Expand Up @@ -210,13 +210,18 @@ public class SeriesIDs : IDs

public List<int> TvDB { get; set; } = new List<int>();

public List<int> TMDB { get; set; } = new List<int>();
public TmdbSeriesIDs TMDB { get; set; } = new();

public List<int> MAL { get; set; } = new List<int>();

public List<string> TraktTv { get; set; } = new List<string>();

public List<int> AniList { get; set; } = new List<int>();
public class TmdbSeriesIDs
{
public List<int> Movie { get; init; } = new List<int>();

public List<int> Show { get; init; } = new List<int>();
}
}

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion Shokofin/Providers/ImageProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ private static void AddImagesForSeries(ref List<RemoteImageInfo> list, API.Model
{
foreach (var image in images.Posters.OrderByDescending(image => image.IsDefault))
AddImage(ref list, ImageType.Primary, image);
foreach (var image in images.Fanarts.OrderByDescending(image => image.IsDefault))
foreach (var image in images.Backdrops.OrderByDescending(image => image.IsDefault))
AddImage(ref list, ImageType.Backdrop, image);
foreach (var image in images.Banners.OrderByDescending(image => image.IsDefault))
AddImage(ref list, ImageType.Banner, image);
Expand Down

0 comments on commit 35bb6ca

Please sign in to comment.