Skip to content

Commit

Permalink
Support for more variables
Browse files Browse the repository at this point in the history
Support for `AirTime`, `EpisodePremiereDate`, `SeriesPremiereDate` and `Genres`
  • Loading branch information
zeroquinc authored Sep 27, 2023
1 parent 971c17d commit 21b90d1
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions Jellyfin.Plugin.Webhook/Helpers/DataObjectHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@ public static Dictionary<string, object> AddBaseItemData(this Dictionary<string,
dataObject["SeasonId"] = episode.SeasonId;
}

if (episode.Series?.PremiereDate is not null)
{
dataObject["SeriesPremiereDate"] = episode.Series.PremiereDate.Value.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture);
}

if (episode.Season?.IndexNumber is not null)
{
dataObject["SeasonNumber"] = episode.Season.IndexNumber;
Expand All @@ -124,14 +129,14 @@ public static Dictionary<string, object> AddBaseItemData(this Dictionary<string,
dataObject["EpisodeNumberEnd000"] = episode.IndexNumberEnd.Value.ToString("000", CultureInfo.InvariantCulture);
}

if (episode.Series?.ProductionYear is not null)
if (episode.PremiereDate is not null)
{
dataObject["Year"] = episode.Series.ProductionYear;
dataObject["EpisodePremiereDate"] = episode.PremiereDate.Value.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture);
}

if (episode.Series?.PremiereDate is not null)
if (episode.Series?.ProductionYear is not null)
{
dataObject["PremiereDate"] = episode.Series.PremiereDate.Value.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture);
dataObject["Year"] = episode.Series.ProductionYear;
}

if (episode.Series?.AirTime is not null)
Expand Down Expand Up @@ -377,4 +382,4 @@ public static Dictionary<string, object> AddUserItemData(this Dictionary<string,
/// <returns>Escaped string.</returns>
private static string Escape(this string? input)
=> input?.Replace("\"", "\\\"", StringComparison.Ordinal) ?? string.Empty;
}
}

0 comments on commit 21b90d1

Please sign in to comment.