mirror of
https://github.com/jellyfin/jellyfin-plugin-trakt.git
synced 2024-11-27 07:40:26 +00:00
Merge pull request #124 from Shadowghost/fixup
This commit is contained in:
commit
a56fff07c1
@ -180,7 +180,7 @@ public static class Extensions
|
||||
/// <param name="dateTime">The <see cref="DateTime"/>.</param>
|
||||
/// <returns>string.</returns>
|
||||
public static string ToISO8601(this DateTime dateTime)
|
||||
=> dateTime.ToUniversalTime().ToString("yyyy-MM-dd'T'HH:mm:ss.fffffff'Z'", CultureInfo.InvariantCulture);
|
||||
=> dateTime.ToUniversalTime().ToString("o", CultureInfo.InvariantCulture);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the season number of an <see cref="Episode"/>.
|
||||
@ -405,23 +405,4 @@ public static class Extensions
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks if a <see cref="Episode"/> matches a <see cref="TraktEpisodeWatched"/>.
|
||||
/// </summary>
|
||||
/// <param name="item">The <see cref="Episode"/>.</param>
|
||||
/// <param name="episode">The <see cref="TraktEpisodeWatched"/>.</param>
|
||||
/// <returns><see cref="bool"/> indicating if the <see cref="Episode"/> matches a <see cref="TraktEpisodeWatched"/>.</returns>
|
||||
public static bool IsMatch(Episode item, TraktEpisodeWatched episode)
|
||||
{
|
||||
var episodeNumber = episode.Number;
|
||||
var itemIndexNumber = item.IndexNumber;
|
||||
var itemIndexNumberEnd = item.IndexNumberEnd;
|
||||
|
||||
return !itemIndexNumber.HasValue
|
||||
? episodeNumber == -1
|
||||
: (itemIndexNumberEnd.HasValue && itemIndexNumberEnd > itemIndexNumber
|
||||
? itemIndexNumber <= episodeNumber && episodeNumber <= itemIndexNumberEnd
|
||||
: episodeNumber == itemIndexNumber);
|
||||
}
|
||||
}
|
||||
|
@ -334,7 +334,7 @@ public class SyncFromTraktTask : IScheduledTask
|
||||
if (matchedWatchedSeason != null)
|
||||
{
|
||||
// Check for matching episodes including multi-episode entities
|
||||
var matchedWatchedEpisode = matchedWatchedSeason.Episodes.FirstOrDefault(x => Extensions.IsMatch(episode, x));
|
||||
var matchedWatchedEpisode = matchedWatchedSeason.Episodes.FirstOrDefault(x => episode.ContainsEpisodeNumber(x.Number));
|
||||
|
||||
// Prepend a check if the matched episode is on a rewatch cycle and
|
||||
// discard it if the last play date was before the reset date
|
||||
|
@ -463,9 +463,9 @@ public class SyncLibraryTask : IScheduledTask
|
||||
{
|
||||
isPlayedTraktTv = traktWatchedShow.Seasons.Any(
|
||||
season => season.Number == episode.GetSeasonNumber()
|
||||
&& season.Episodes != null
|
||||
&& season.Episodes.Any(e => Extensions.IsMatch(episode, e)
|
||||
&& e.Plays > 0));
|
||||
&& season.Episodes != null
|
||||
&& season.Episodes.Any(e => episode.ContainsEpisodeNumber(e.Number)
|
||||
&& e.Plays > 0));
|
||||
}
|
||||
|
||||
// If the show has been played locally and is unplayed on trakt.tv then add it to the list
|
||||
|
Loading…
Reference in New Issue
Block a user