public void UpdateGroupFilters() { List <GroupFilter> gfs = RepoFactory.GroupFilter.GetAll(); List <AnimeGroup> allGrps = RepoFactory.AnimeGroup.GetAllTopLevelGroups(); // No Need of subgroups List <AnimeSeries> allSeries = RepoFactory.AnimeSeries.GetAll(); foreach (GroupFilter gf in gfs) { bool change = false; foreach (AnimeGroup grp in allGrps) { Contract_AnimeGroup cgrp = grp.GetUserContract(this.JMMUserID); change |= gf.CalculateGroupFilterGroups(cgrp, Contract, JMMUserID); } foreach (AnimeSeries ser in allSeries) { Contract_AnimeSeries cser = ser.GetUserContract(this.JMMUserID); change |= gf.CalculateGroupFilterSeries(cser, Contract, JMMUserID); } if (change) { RepoFactory.GroupFilter.Save(gf); } } }
internal static Directory FromGroup(Contract_AnimeGroup grp, Contract_AnimeSeries ser, int userid) { Directory p = new Directory(); p.Key = ServerUrl(int.Parse(ServerSettings.JMMServerPort), MainWindow.PathAddressKodi + "/GetMetadata/" + userid + "/" + (int)JMMType.Group + "/" + grp.AnimeGroupID.ToString()); p.Title = grp.GroupName; p.Summary = grp.Description; p.Type = "show"; p.AirDate = grp.Stat_AirDate_Min.HasValue ? grp.Stat_AirDate_Min.Value : DateTime.MinValue; Contract_AniDBAnime anime = ser.AniDBAnime; if (anime != null) { Contract_AniDB_Anime_DefaultImage poster = anime.DefaultImagePoster; Contract_AniDB_Anime_DefaultImage fanart = anime.DefaultImageFanart; p.Thumb = poster != null?poster.GenPoster() : ServerUrl(int.Parse(ServerSettings.JMMServerPort), MainWindow.PathAddressKodi + "/GetSupportImage/plex_404V.png"); if (fanart != null) { p.Art = fanart.GenArt(); } } p.LeafCount = (grp.UnwatchedEpisodeCount + grp.WatchedEpisodeCount).ToString(); p.ViewedLeafCount = grp.WatchedEpisodeCount.ToString(); return(p); }
public static Video VideoFromAnimeGroup(ISession session, AnimeGroup grp, int userid, List <AnimeSeries> allSeries) { Contract_AnimeGroup cgrp = grp.ToContract(grp.GetUserRecord(session, userid)); if (StatsCache.Instance.StatGroupSeriesCount[grp.AnimeGroupID] == 1) { AnimeSeries ser = JMMServiceImplementation.GetSeriesForGroup(grp.AnimeGroupID, allSeries); if (ser != null) { Contract_AnimeSeries cserie = ser.ToContract(ser.GetUserRecord(session, userid), true); Video v = FromSerieWithPossibleReplacement(cserie, ser, userid); v.AirDate = ser.AirDate.HasValue ? ser.AirDate.Value : DateTime.MinValue; v.Group = cgrp; return(v); } } else { AnimeSeries ser = grp.DefaultAnimeSeriesID.HasValue ? allSeries.FirstOrDefault(a => a.AnimeSeriesID == grp.DefaultAnimeSeriesID.Value) : JMMServiceImplementation.GetSeriesForGroup(grp.AnimeGroupID, allSeries); if (ser != null) { Video v = FromGroup(cgrp, ser.ToContract(ser.GetUserRecord(session, userid), true), userid); v.Group = cgrp; v.AirDate = cgrp.Stat_AirDate_Min.HasValue ? cgrp.Stat_AirDate_Min.Value : DateTime.MinValue; return(v); } } return(null); }
public static Contract_AnimeGroup DeepCopy(this Contract_AnimeGroup c) { Contract_AnimeGroup contract = new Contract_AnimeGroup(); contract.AnimeGroupID = c.AnimeGroupID; contract.AnimeGroupParentID = c.AnimeGroupParentID; contract.DefaultAnimeSeriesID = c.DefaultAnimeSeriesID; contract.GroupName = c.GroupName; contract.Description = c.Description; contract.IsFave = c.IsFave; contract.IsManuallyNamed = c.IsManuallyNamed; contract.UnwatchedEpisodeCount = c.UnwatchedEpisodeCount; contract.DateTimeUpdated = c.DateTimeUpdated; contract.WatchedEpisodeCount = c.WatchedEpisodeCount; contract.SortName = c.SortName; contract.WatchedDate = c.WatchedDate; contract.EpisodeAddedDate = c.EpisodeAddedDate; contract.LatestEpisodeAirDate = c.LatestEpisodeAirDate; contract.PlayedCount = c.PlayedCount; contract.WatchedCount = c.WatchedCount; contract.StoppedCount = c.StoppedCount; contract.OverrideDescription = c.OverrideDescription; contract.MissingEpisodeCount = c.MissingEpisodeCount; contract.MissingEpisodeCountGroups = c.MissingEpisodeCountGroups; contract.Stat_AirDate_Min = c.Stat_AirDate_Min; contract.Stat_AirDate_Max = c.Stat_AirDate_Max; contract.Stat_EndDate = c.Stat_EndDate; contract.Stat_SeriesCreatedDate = c.Stat_SeriesCreatedDate; contract.Stat_UserVotePermanent = c.Stat_UserVotePermanent; contract.Stat_UserVoteTemporary = c.Stat_UserVoteTemporary; contract.Stat_UserVoteOverall = c.Stat_UserVoteOverall; contract.Stat_IsComplete = c.Stat_IsComplete; contract.Stat_HasFinishedAiring = c.Stat_HasFinishedAiring; contract.Stat_IsCurrentlyAiring = c.Stat_IsCurrentlyAiring; contract.Stat_HasTvDBLink = c.Stat_HasTvDBLink; contract.Stat_HasMALLink = c.Stat_HasMALLink; contract.Stat_HasMovieDBLink = c.Stat_HasMovieDBLink; contract.Stat_HasMovieDBOrTvDBLink = c.Stat_HasMovieDBOrTvDBLink; contract.Stat_SeriesCount = c.Stat_SeriesCount; contract.Stat_EpisodeCount = c.Stat_EpisodeCount; contract.Stat_AniDBRating = c.Stat_AniDBRating; contract.ServerPosterPath = c.ServerPosterPath; contract.SeriesForNameOverride = c.SeriesForNameOverride; contract.Stat_AllCustomTags = new HashSet <string>(c.Stat_AllCustomTags); contract.Stat_AllTags = new HashSet <string>(c.Stat_AllTags); contract.Stat_AllTitles = new HashSet <string>(c.Stat_AllTitles); contract.Stat_AnimeTypes = new HashSet <string>(c.Stat_AnimeTypes); contract.Stat_AllVideoQuality = new HashSet <string>(c.Stat_AllVideoQuality); contract.Stat_AllVideoQuality_Episodes = new HashSet <string>(c.Stat_AllVideoQuality_Episodes); contract.Stat_AudioLanguages = new HashSet <string>(c.Stat_AudioLanguages); contract.Stat_SubtitleLanguages = new HashSet <string>(c.Stat_SubtitleLanguages); return(contract); }
public static Contract_AnimeGroup DeepCopy(this Contract_AnimeGroup c) { Contract_AnimeGroup contract = new Contract_AnimeGroup(); contract.AnimeGroupID = c.AnimeGroupID; contract.AnimeGroupParentID = c.AnimeGroupParentID; contract.DefaultAnimeSeriesID = c.DefaultAnimeSeriesID; contract.GroupName = c.GroupName; contract.Description = c.Description; contract.IsFave = c.IsFave; contract.IsManuallyNamed = c.IsManuallyNamed; contract.UnwatchedEpisodeCount = c.UnwatchedEpisodeCount; contract.DateTimeUpdated = c.DateTimeUpdated; contract.WatchedEpisodeCount = c.WatchedEpisodeCount; contract.SortName = c.SortName; contract.WatchedDate = c.WatchedDate; contract.EpisodeAddedDate = c.EpisodeAddedDate; contract.LatestEpisodeAirDate = c.LatestEpisodeAirDate; contract.PlayedCount = c.PlayedCount; contract.WatchedCount = c.WatchedCount; contract.StoppedCount = c.StoppedCount; contract.OverrideDescription = c.OverrideDescription; contract.MissingEpisodeCount = c.MissingEpisodeCount; contract.MissingEpisodeCountGroups = c.MissingEpisodeCountGroups; contract.Stat_AirDate_Min = c.Stat_AirDate_Min; contract.Stat_AirDate_Max = c.Stat_AirDate_Max; contract.Stat_EndDate = c.Stat_EndDate; contract.Stat_SeriesCreatedDate = c.Stat_SeriesCreatedDate; contract.Stat_UserVotePermanent = c.Stat_UserVotePermanent; contract.Stat_UserVoteTemporary = c.Stat_UserVoteTemporary; contract.Stat_UserVoteOverall = c.Stat_UserVoteOverall; contract.Stat_IsComplete = c.Stat_IsComplete; contract.Stat_HasFinishedAiring = c.Stat_HasFinishedAiring; contract.Stat_IsCurrentlyAiring = c.Stat_IsCurrentlyAiring; contract.Stat_HasTvDBLink = c.Stat_HasTvDBLink; contract.Stat_HasMALLink = c.Stat_HasMALLink; contract.Stat_HasMovieDBLink = c.Stat_HasMovieDBLink; contract.Stat_HasMovieDBOrTvDBLink = c.Stat_HasMovieDBOrTvDBLink; contract.Stat_SeriesCount = c.Stat_SeriesCount; contract.Stat_EpisodeCount = c.Stat_EpisodeCount; contract.Stat_AniDBRating = c.Stat_AniDBRating; contract.ServerPosterPath = c.ServerPosterPath; contract.SeriesForNameOverride = c.SeriesForNameOverride; contract.Stat_AllCustomTags = new HashSet<string>(c.Stat_AllCustomTags,StringComparer.InvariantCultureIgnoreCase); contract.Stat_AllTags = new HashSet<string>(c.Stat_AllTags, StringComparer.InvariantCultureIgnoreCase); contract.Stat_AllYears = new HashSet<int>(c.Stat_AllYears); contract.Stat_AllTitles = new HashSet<string>(c.Stat_AllTitles, StringComparer.InvariantCultureIgnoreCase); contract.Stat_AnimeTypes = new HashSet<string>(c.Stat_AnimeTypes, StringComparer.InvariantCultureIgnoreCase); contract.Stat_AllVideoQuality = new HashSet<string>(c.Stat_AllVideoQuality, StringComparer.InvariantCultureIgnoreCase); contract.Stat_AllVideoQuality_Episodes = new HashSet<string>(c.Stat_AllVideoQuality_Episodes, StringComparer.InvariantCultureIgnoreCase); contract.Stat_AudioLanguages = new HashSet<string>(c.Stat_AudioLanguages, StringComparer.InvariantCultureIgnoreCase); contract.Stat_SubtitleLanguages = new HashSet<string>(c.Stat_SubtitleLanguages, StringComparer.InvariantCultureIgnoreCase); return contract; }
public System.IO.Stream GetItemsFromGroup(int userid, string GroupId) { KodiObject ret = new KodiObject(KodiHelper.NewMediaContainer("Groups", true)); if (!ret.Init()) { return(new MemoryStream()); } int groupID; int.TryParse(GroupId, out groupID); List <Video> retGroups = new List <Video>(); if (groupID == -1) { return(new MemoryStream()); } using (var session = JMMService.SessionFactory.OpenSession()) { AnimeGroupRepository repGroups = new AnimeGroupRepository(); AnimeGroup grp = repGroups.GetByID(groupID); if (grp != null) { Contract_AnimeGroup basegrp = grp.ToContract(grp.GetUserRecord(session, userid)); ret.MediaContainer.Title1 = ret.MediaContainer.Title2 = basegrp.GroupName; List <AnimeSeries> sers2 = grp.GetSeries(session); ret.MediaContainer.Art = KodiHelper.GetRandomFanartFromSeries(sers2, session); foreach (AnimeGroup grpChild in grp.GetChildGroups()) { Video v = StatsCache.Instance.StatKodiGroupsCache[userid][grpChild.AnimeGroupID]; v.Type = "show"; if (v != null) { retGroups.Add(v.Clone()); } } foreach (AnimeSeries ser in grp.GetSeries()) { Contract_AnimeSeries cserie = ser.ToContract(ser.GetUserRecord(session, userid), true); Video v = KodiHelper.FromSerieWithPossibleReplacement(cserie, ser, userid); v.AirDate = ser.AirDate.HasValue ? ser.AirDate.Value : DateTime.MinValue; v.Group = basegrp; retGroups.Add(v); } } ret.Childrens = retGroups.OrderBy(a => a.AirDate).ToList(); return(ret.GetStream()); } }
internal static Video FromGroup(Contract_AnimeGroup grp, Contract_AnimeSeries ser, int userid) { Directory p = new Directory(); p.Key = ConstructGroupIdUrl(userid, grp.AnimeGroupID); p.Title = grp.GroupName; p.Summary = grp.Description; p.Type = "show"; p.AirDate = grp.Stat_AirDate_Min.HasValue ? grp.Stat_AirDate_Min.Value : DateTime.MinValue; p.Thumb = ser.AniDBAnime?.DefaultImagePoster.GenPoster(); p.Art = ser.AniDBAnime?.DefaultImageFanart.GenArt(); p.LeafCount = (grp.UnwatchedEpisodeCount + grp.WatchedEpisodeCount).ToString(); p.ViewedLeafCount = grp.WatchedEpisodeCount.ToString(); return(p); }
public System.IO.Stream GetItemsFromGroup(int userid, string GroupId, HistoryInfo info) { PlexObject ret = new PlexObject(PlexHelper.NewMediaContainer(MediaContainerTypes.Show, info, false)); if (!ret.Init()) { return(new MemoryStream()); } int groupID; int.TryParse(GroupId, out groupID); List <Video> retGroups = new List <Video>(); if (groupID == -1) { return(new MemoryStream()); } using (var session = JMMService.SessionFactory.OpenSession()) { AnimeGroupRepository repGroups = new AnimeGroupRepository(); AnimeGroup grp = repGroups.GetByID(groupID); if (grp != null) { Contract_AnimeGroup basegrp = grp.ToContract(grp.GetUserRecord(session, userid)); List <AnimeSeries> sers2 = grp.GetSeries(session); foreach (AnimeGroup grpChild in grp.GetChildGroups()) { Video v = StatsCache.Instance.StatPlexGroupsCache[userid][grpChild.AnimeGroupID]; if (v != null) { retGroups.Add(v.Clone(), info); } } foreach (AnimeSeries ser in grp.GetSeries()) { Contract_AnimeSeries cserie = ser.ToContract(ser.GetUserRecord(session, userid), true); Video v = PlexHelper.FromSerieWithPossibleReplacement(cserie, ser, ser.GetAnime(), userid); v.AirDate = ser.AirDate.HasValue ? ser.AirDate.Value : DateTime.MinValue; v.Group = basegrp; retGroups.Add(v, info); } } ret.Childrens = PlexHelper.ConvertToDirectoryIfNotUnique(retGroups.OrderBy(a => a.AirDate).ToList()); return(ret.GetStream()); } }
private static Video FromGroup(Contract_AnimeGroup grp, Contract_AnimeSeries ser, int userid, int subgrpcnt) { Directory p = new Directory(); p.Id = grp.AnimeGroupID.ToString(); p.AnimeType = JMMContracts.PlexAndKodi.AnimeTypes.AnimeGroup.ToString(); p.Title = grp.GroupName; p.Summary = grp.Description; p.Type = "show"; p.AirDate = grp.Stat_AirDate_Min.HasValue ? grp.Stat_AirDate_Min.Value : DateTime.MinValue; if (ser != null) { p.Thumb = ser.AniDBAnime?.AniDBAnime.DefaultImagePoster.GenPoster(); p.Art = ser.AniDBAnime?.AniDBAnime.DefaultImageFanart.GenArt(); } p.LeafCount = (grp.UnwatchedEpisodeCount + grp.WatchedEpisodeCount).ToString(); p.ViewedLeafCount = grp.WatchedEpisodeCount.ToString(); p.ChildCount = (grp.Stat_SeriesCount + subgrpcnt).ToString(); if ((grp.UnwatchedEpisodeCount == 0) && grp.WatchedDate.HasValue) { p.LastViewedAt = grp.WatchedDate.Value.ToUnixTime(); } return(p); }
public static Video GenerateFromAnimeGroup(ISession session, AnimeGroup grp, int userid, List <AnimeSeries> allSeries) { Contract_AnimeGroup cgrp = grp.GetUserContract(userid); int subgrpcnt = grp.GetAllChildGroups().Count; if ((cgrp.Stat_SeriesCount == 1) && (subgrpcnt == 0)) { AnimeSeries ser = JMMServiceImplementation.GetSeriesForGroup(grp.AnimeGroupID, allSeries); if (ser != null) { Contract_AnimeSeries cserie = ser.GetUserContract(userid); if (cserie != null) { Video v = GenerateFromSeries(cserie, ser, ser.GetAnime(session), userid); v.AirDate = ser.AirDate; v.UpdatedAt = ser.LatestEpisodeAirDate.HasValue ? ser.LatestEpisodeAirDate.Value.ToUnixTime() : null; v.Group = cgrp; return(v); } } } else { AnimeSeries ser = grp.DefaultAnimeSeriesID.HasValue ? allSeries.FirstOrDefault(a => a.AnimeSeriesID == grp.DefaultAnimeSeriesID.Value) : allSeries.Find(a => a.AirDate != DateTime.MinValue); if ((ser == null) && (allSeries != null && allSeries.Count > 0)) { ser = allSeries[0]; } Contract_AnimeSeries cserie = ser?.GetUserContract(userid); Video v = FromGroup(cgrp, cserie, userid, subgrpcnt); v.Group = cgrp; v.AirDate = cgrp.Stat_AirDate_Min ?? DateTime.MinValue; v.UpdatedAt = cgrp.LatestEpisodeAirDate?.ToUnixTime(); v.Rating = "" + Math.Round((grp.AniDBRating / 100), 1); List <Tag> newTags = new List <Tag>(); foreach (AniDB_Tag tag in grp.Tags) { Tag newTag = new Tag(); TextInfo textInfo = new CultureInfo("en-US", false).TextInfo; newTag.Value = textInfo.ToTitleCase(tag.TagName.Trim()); if (!newTags.Contains(newTag)) { newTags.Add(newTag); } } v.Genres = newTags; if (ser != null) { List <AnimeTitle> newTitles = new List <AnimeTitle>(); foreach (AniDB_Anime_Title title in ser.GetAnime(session).GetTitles()) { AnimeTitle newTitle = new AnimeTitle(); newTitle.Title = title.Title; newTitle.Language = title.Language; newTitle.Type = title.TitleType; newTitles.Add(newTitle); } v.Titles = newTitles; v.Roles = new List <RoleTag>(); //TODO Character implementation is limited in JMM, One Character, could have more than one Seiyuu if (ser.GetAnime(session).Contract?.AniDBAnime?.Characters != null) { foreach (Contract_AniDB_Character c in ser.GetAnime(session).Contract.AniDBAnime.Characters) { string ch = c?.CharName; Contract_AniDB_Seiyuu seiyuu = c?.Seiyuu; if (!string.IsNullOrEmpty(ch)) { RoleTag t = new RoleTag(); t.Value = seiyuu?.SeiyuuName; if (seiyuu != null) { t.TagPicture = Helper.ConstructSeiyuuImage(seiyuu.AniDB_SeiyuuID); } t.Role = ch; t.RoleDescription = c?.CharDescription; t.RolePicture = Helper.ConstructCharacterImage(c.CharID); v.Roles.Add(t); } } } } return(v); } return(null); }
public bool EvaluateGroupFilter(Contract_AnimeGroup contractGroup, Contract_JMMUser curUser) { //Directories don't count if ((this.FilterType & (int) GroupFilterType.Directory) == (int) GroupFilterType.Directory) return false; // sub groups don't count if (contractGroup.AnimeGroupParentID.HasValue) return false; // make sure the user has not filtered this out if ((curUser != null) && curUser.HideCategories.FindInEnumerable(contractGroup.Stat_AllTags)) return false; // first check for anime groups which are included exluded every time foreach (GroupFilterCondition gfc in Conditions) { if (gfc.ConditionTypeEnum != GroupFilterConditionType.AnimeGroup) continue; int groupID = 0; int.TryParse(gfc.ConditionParameter, out groupID); if (groupID == 0) break; if (gfc.ConditionOperatorEnum == GroupFilterOperator.Equals && groupID == contractGroup.AnimeGroupID) return true; if (gfc.ConditionOperatorEnum == GroupFilterOperator.NotEquals && groupID != contractGroup.AnimeGroupID) return true; return false; } NumberStyles style = NumberStyles.Number; CultureInfo culture = CultureInfo.InvariantCulture; if (BaseCondition == (int) GroupFilterBaseCondition.Exclude) return false; // now check other conditions foreach (GroupFilterCondition gfc in Conditions) { switch (gfc.ConditionTypeEnum) { case GroupFilterConditionType.Favourite: if (gfc.ConditionOperatorEnum == GroupFilterOperator.Include && contractGroup.IsFave == 0) return false; if (gfc.ConditionOperatorEnum == GroupFilterOperator.Exclude && contractGroup.IsFave == 1) return false; break; case GroupFilterConditionType.MissingEpisodes: if (gfc.ConditionOperatorEnum == GroupFilterOperator.Include && (contractGroup.MissingEpisodeCount > 0 || contractGroup.MissingEpisodeCountGroups > 0) == false) return false; if (gfc.ConditionOperatorEnum == GroupFilterOperator.Exclude && (contractGroup.MissingEpisodeCount > 0 || contractGroup.MissingEpisodeCountGroups > 0) == true) return false; break; case GroupFilterConditionType.MissingEpisodesCollecting: if (gfc.ConditionOperatorEnum == GroupFilterOperator.Include && contractGroup.MissingEpisodeCountGroups > 0 == false) return false; if (gfc.ConditionOperatorEnum == GroupFilterOperator.Exclude && contractGroup.MissingEpisodeCountGroups > 0 == true) return false; break; case GroupFilterConditionType.Tag: if ((gfc.ConditionOperatorEnum == GroupFilterOperator.In || gfc.ConditionOperatorEnum == GroupFilterOperator.Include) && !contractGroup.Stat_AllTags.Contains(gfc.ConditionParameter,StringComparer.InvariantCultureIgnoreCase)) return false; if ((gfc.ConditionOperatorEnum == GroupFilterOperator.NotIn || gfc.ConditionOperatorEnum == GroupFilterOperator.Exclude) && contractGroup.Stat_AllTags.Contains(gfc.ConditionParameter, StringComparer.InvariantCultureIgnoreCase)) return false; break; case GroupFilterConditionType.Year: if (!contractGroup.Stat_AirDate_Min.HasValue) return false; string year = contractGroup.Stat_AirDate_Min.Value.Year.ToString(); if (gfc.ConditionOperatorEnum == GroupFilterOperator.Include && year != gfc.ConditionParameter) return false; if (gfc.ConditionOperatorEnum == GroupFilterOperator.Exclude && year == gfc.ConditionParameter) return false; break; case GroupFilterConditionType.HasWatchedEpisodes: if (gfc.ConditionOperatorEnum == GroupFilterOperator.Include && contractGroup.WatchedEpisodeCount > 0 == false) return false; if (gfc.ConditionOperatorEnum == GroupFilterOperator.Exclude && contractGroup.WatchedEpisodeCount > 0 == true) return false; break; case GroupFilterConditionType.HasUnwatchedEpisodes: if (gfc.ConditionOperatorEnum == GroupFilterOperator.Include && contractGroup.UnwatchedEpisodeCount > 0 == false) return false; if (gfc.ConditionOperatorEnum == GroupFilterOperator.Exclude && contractGroup.UnwatchedEpisodeCount > 0 == true) return false; break; case GroupFilterConditionType.AssignedTvDBInfo: if (gfc.ConditionOperatorEnum == GroupFilterOperator.Include && contractGroup.Stat_HasTvDBLink == false) return false; if (gfc.ConditionOperatorEnum == GroupFilterOperator.Exclude && contractGroup.Stat_HasTvDBLink == true) return false; break; case GroupFilterConditionType.AssignedMALInfo: if (gfc.ConditionOperatorEnum == GroupFilterOperator.Include && contractGroup.Stat_HasMALLink == false) return false; if (gfc.ConditionOperatorEnum == GroupFilterOperator.Exclude && contractGroup.Stat_HasMALLink == true) return false; break; case GroupFilterConditionType.AssignedMovieDBInfo: if (gfc.ConditionOperatorEnum == GroupFilterOperator.Include && contractGroup.Stat_HasMovieDBLink == false) return false; if (gfc.ConditionOperatorEnum == GroupFilterOperator.Exclude && contractGroup.Stat_HasMovieDBLink == true) return false; break; case GroupFilterConditionType.AssignedTvDBOrMovieDBInfo: if (gfc.ConditionOperatorEnum == GroupFilterOperator.Include && contractGroup.Stat_HasMovieDBOrTvDBLink == false) return false; if (gfc.ConditionOperatorEnum == GroupFilterOperator.Exclude && contractGroup.Stat_HasMovieDBOrTvDBLink == true) return false; break; case GroupFilterConditionType.CompletedSeries: if (gfc.ConditionOperatorEnum == GroupFilterOperator.Include && contractGroup.Stat_IsComplete == false) return false; if (gfc.ConditionOperatorEnum == GroupFilterOperator.Exclude && contractGroup.Stat_IsComplete == true) return false; break; case GroupFilterConditionType.FinishedAiring: if (gfc.ConditionOperatorEnum == GroupFilterOperator.Include && contractGroup.Stat_HasFinishedAiring == false) return false; if (gfc.ConditionOperatorEnum == GroupFilterOperator.Exclude && contractGroup.Stat_IsCurrentlyAiring == false) return false; break; case GroupFilterConditionType.UserVoted: if (gfc.ConditionOperatorEnum == GroupFilterOperator.Include && contractGroup.Stat_UserVotePermanent.HasValue == false) return false; if (gfc.ConditionOperatorEnum == GroupFilterOperator.Exclude && contractGroup.Stat_UserVotePermanent.HasValue == true) return false; break; case GroupFilterConditionType.UserVotedAny: if (gfc.ConditionOperatorEnum == GroupFilterOperator.Include && contractGroup.Stat_UserVoteOverall.HasValue == false) return false; if (gfc.ConditionOperatorEnum == GroupFilterOperator.Exclude && contractGroup.Stat_UserVoteOverall.HasValue == true) return false; break; case GroupFilterConditionType.AirDate: DateTime filterDate; if (gfc.ConditionOperatorEnum == GroupFilterOperator.LastXDays) { int days = 0; int.TryParse(gfc.ConditionParameter, out days); filterDate = DateTime.Today.AddDays(0 - days); } else filterDate = GetDateFromString(gfc.ConditionParameter); if (gfc.ConditionOperatorEnum == GroupFilterOperator.GreaterThan || gfc.ConditionOperatorEnum == GroupFilterOperator.LastXDays) { if (!contractGroup.Stat_AirDate_Min.HasValue || !contractGroup.Stat_AirDate_Max.HasValue) return false; if (contractGroup.Stat_AirDate_Max.Value < filterDate) return false; } if (gfc.ConditionOperatorEnum == GroupFilterOperator.LessThan) { if (!contractGroup.Stat_AirDate_Min.HasValue || !contractGroup.Stat_AirDate_Max.HasValue) return false; if (contractGroup.Stat_AirDate_Min.Value > filterDate) return false; } break; case GroupFilterConditionType.LatestEpisodeAirDate: DateTime filterDateEpisodeLastAired; if (gfc.ConditionOperatorEnum == GroupFilterOperator.LastXDays) { int days = 0; int.TryParse(gfc.ConditionParameter, out days); filterDateEpisodeLastAired = DateTime.Today.AddDays(0 - days); } else filterDateEpisodeLastAired = GetDateFromString(gfc.ConditionParameter); if (gfc.ConditionOperatorEnum == GroupFilterOperator.GreaterThan || gfc.ConditionOperatorEnum == GroupFilterOperator.LastXDays) { if (!contractGroup.LatestEpisodeAirDate.HasValue) return false; if (contractGroup.LatestEpisodeAirDate.Value < filterDateEpisodeLastAired) return false; } if (gfc.ConditionOperatorEnum == GroupFilterOperator.LessThan) { if (!contractGroup.LatestEpisodeAirDate.HasValue) return false; if (contractGroup.LatestEpisodeAirDate.Value > filterDateEpisodeLastAired) return false; } break; case GroupFilterConditionType.SeriesCreatedDate: DateTime filterDateSeries; if (gfc.ConditionOperatorEnum == GroupFilterOperator.LastXDays) { int days = 0; int.TryParse(gfc.ConditionParameter, out days); filterDateSeries = DateTime.Today.AddDays(0 - days); } else filterDateSeries = GetDateFromString(gfc.ConditionParameter); if (gfc.ConditionOperatorEnum == GroupFilterOperator.GreaterThan || gfc.ConditionOperatorEnum == GroupFilterOperator.LastXDays) { if (!contractGroup.Stat_SeriesCreatedDate.HasValue) return false; if (contractGroup.Stat_SeriesCreatedDate.Value < filterDateSeries) return false; } if (gfc.ConditionOperatorEnum == GroupFilterOperator.LessThan) { if (!contractGroup.Stat_SeriesCreatedDate.HasValue) return false; if (contractGroup.Stat_SeriesCreatedDate.Value > filterDateSeries) return false; } break; case GroupFilterConditionType.EpisodeWatchedDate: DateTime filterDateEpsiodeWatched; if (gfc.ConditionOperatorEnum == GroupFilterOperator.LastXDays) { int days = 0; int.TryParse(gfc.ConditionParameter, out days); filterDateEpsiodeWatched = DateTime.Today.AddDays(0 - days); } else filterDateEpsiodeWatched = GetDateFromString(gfc.ConditionParameter); if (gfc.ConditionOperatorEnum == GroupFilterOperator.GreaterThan || gfc.ConditionOperatorEnum == GroupFilterOperator.LastXDays) { if (!contractGroup.WatchedDate.HasValue) return false; if (contractGroup.WatchedDate.Value < filterDateEpsiodeWatched) return false; } if (gfc.ConditionOperatorEnum == GroupFilterOperator.LessThan) { if (contractGroup == null) return false; if (!contractGroup.WatchedDate.HasValue) return false; if (contractGroup.WatchedDate.Value > filterDateEpsiodeWatched) return false; } break; case GroupFilterConditionType.EpisodeAddedDate: DateTime filterDateEpisodeAdded; if (gfc.ConditionOperatorEnum == GroupFilterOperator.LastXDays) { int days = 0; int.TryParse(gfc.ConditionParameter, out days); filterDateEpisodeAdded = DateTime.Today.AddDays(0 - days); } else filterDateEpisodeAdded = GetDateFromString(gfc.ConditionParameter); if (gfc.ConditionOperatorEnum == GroupFilterOperator.GreaterThan || gfc.ConditionOperatorEnum == GroupFilterOperator.LastXDays) { if (!contractGroup.EpisodeAddedDate.HasValue) return false; if (contractGroup.EpisodeAddedDate.Value < filterDateEpisodeAdded) return false; } if (gfc.ConditionOperatorEnum == GroupFilterOperator.LessThan) { if (!contractGroup.EpisodeAddedDate.HasValue) return false; if (contractGroup.EpisodeAddedDate.Value > filterDateEpisodeAdded) return false; } break; case GroupFilterConditionType.EpisodeCount: int epCount = -1; int.TryParse(gfc.ConditionParameter, out epCount); if (gfc.ConditionOperatorEnum == GroupFilterOperator.GreaterThan && contractGroup.Stat_EpisodeCount < epCount) return false; if (gfc.ConditionOperatorEnum == GroupFilterOperator.LessThan && contractGroup.Stat_EpisodeCount > epCount) return false; break; case GroupFilterConditionType.AniDBRating: decimal dRating = -1; decimal.TryParse(gfc.ConditionParameter, style, culture, out dRating); decimal thisRating = contractGroup.Stat_AniDBRating/(decimal) 100; if (gfc.ConditionOperatorEnum == GroupFilterOperator.GreaterThan && thisRating < dRating) return false; if (gfc.ConditionOperatorEnum == GroupFilterOperator.LessThan && thisRating > dRating) return false; break; case GroupFilterConditionType.UserRating: if (!contractGroup.Stat_UserVoteOverall.HasValue) return false; decimal dUserRating = -1; decimal.TryParse(gfc.ConditionParameter, style, culture, out dUserRating); if (gfc.ConditionOperatorEnum == GroupFilterOperator.GreaterThan && contractGroup.Stat_UserVoteOverall.Value < dUserRating) return false; if (gfc.ConditionOperatorEnum == GroupFilterOperator.LessThan && contractGroup.Stat_UserVoteOverall.Value > dUserRating) return false; break; case GroupFilterConditionType.CustomTags: List<string> ctags = gfc.ConditionParameter.Trim() .Split(new char[] {','}, StringSplitOptions.RemoveEmptyEntries) .Select(a => a.ToLowerInvariant().Trim()) .ToList(); bool foundTag = ctags.FindInEnumerable(contractGroup.Stat_AllCustomTags); if ((gfc.ConditionOperatorEnum == GroupFilterOperator.In) && !foundTag) return false; if ((gfc.ConditionOperatorEnum == GroupFilterOperator.NotIn) && foundTag) return false; break; case GroupFilterConditionType.AnimeType: List<string> ctypes = gfc.ConditionParameter .Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries) .Select(a => ((int)AniDB_Anime.RawToType(a)).ToString()) .ToList(); bool foundAnimeType = ctypes.FindInEnumerable(contractGroup.Stat_AnimeTypes); if ((gfc.ConditionOperatorEnum == GroupFilterOperator.In) && !foundAnimeType) return false; if ((gfc.ConditionOperatorEnum == GroupFilterOperator.NotIn) && foundAnimeType) return false; break; case GroupFilterConditionType.VideoQuality: List<string> vqs = gfc.ConditionParameter .Split(new char[] {','}, StringSplitOptions.RemoveEmptyEntries) .Select(a => a.ToLowerInvariant().Trim()) .ToList(); bool foundVid = vqs.FindInEnumerable(contractGroup.Stat_AllVideoQuality); bool foundVidAllEps = vqs.FindInEnumerable(contractGroup.Stat_AllVideoQuality_Episodes); if (gfc.ConditionOperatorEnum == GroupFilterOperator.In && !foundVid) return false; if (gfc.ConditionOperatorEnum == GroupFilterOperator.NotIn && foundVid) return false; if (gfc.ConditionOperatorEnum == GroupFilterOperator.InAllEpisodes && !foundVidAllEps) return false; if (gfc.ConditionOperatorEnum == GroupFilterOperator.NotInAllEpisodes && foundVidAllEps) return false; break; case GroupFilterConditionType.AudioLanguage: List<string> als = gfc.ConditionParameter.Trim() .Split(new char[] {','}, StringSplitOptions.RemoveEmptyEntries) .Select(a => a.ToLowerInvariant().Trim()) .ToList(); bool foundLang = als.FindInEnumerable(contractGroup.Stat_AudioLanguages); if (gfc.ConditionOperatorEnum == GroupFilterOperator.In && !foundLang) return false; if (gfc.ConditionOperatorEnum == GroupFilterOperator.NotIn && foundLang) return false; break; case GroupFilterConditionType.SubtitleLanguage: List<string> ass = gfc.ConditionParameter .Split(new char[] {','}, StringSplitOptions.RemoveEmptyEntries) .Select(a => a.ToLowerInvariant().Trim()) .ToList(); bool foundSub = ass.FindInEnumerable(contractGroup.Stat_SubtitleLanguages); if (gfc.ConditionOperatorEnum == GroupFilterOperator.In && !foundSub) return false; if (gfc.ConditionOperatorEnum == GroupFilterOperator.NotIn && foundSub) return false; break; } } return true; }
public bool CalculateGroupFilterGroups(Contract_AnimeGroup grp, Contract_JMMUser user, int jmmUserId) { bool change = false; HashSet<int> groupIds; GroupsIds.TryGetValue(jmmUserId, out groupIds); if (EvaluateGroupFilter(grp, user)) { if (groupIds == null) { groupIds = new HashSet<int>(); GroupsIds[jmmUserId] = groupIds; } change = groupIds.Add(grp.AnimeGroupID); } else if (groupIds != null) { change = groupIds.Remove(grp.AnimeGroupID); } return change; }
public Contract_AnimeGroup ToContract(AnimeGroup_User userRecord) { Contract_AnimeGroup contract = new Contract_AnimeGroup(); contract.AnimeGroupID = this.AnimeGroupID; contract.AnimeGroupParentID = this.AnimeGroupParentID; contract.DefaultAnimeSeriesID = this.DefaultAnimeSeriesID; contract.GroupName = this.GroupName; contract.Description = this.Description; contract.SortName = this.SortName; contract.EpisodeAddedDate = this.EpisodeAddedDate; contract.OverrideDescription = this.OverrideDescription; contract.DateTimeUpdated = this.DateTimeUpdated; if (userRecord == null) { contract.IsFave = 0; contract.UnwatchedEpisodeCount = 0; contract.WatchedEpisodeCount = 0; contract.WatchedDate = null; contract.PlayedCount = 0; contract.WatchedCount = 0; contract.StoppedCount = 0; } else { contract.IsFave = userRecord.IsFave; contract.UnwatchedEpisodeCount = userRecord.UnwatchedEpisodeCount; contract.WatchedEpisodeCount = userRecord.WatchedEpisodeCount; contract.WatchedDate = userRecord.WatchedDate; contract.PlayedCount = userRecord.PlayedCount; contract.WatchedCount = userRecord.WatchedCount; contract.StoppedCount = userRecord.StoppedCount; } contract.MissingEpisodeCount = this.MissingEpisodeCount; contract.MissingEpisodeCountGroups = this.MissingEpisodeCountGroups; if (StatsCache.Instance.StatGroupAudioLanguages.ContainsKey(this.AnimeGroupID)) contract.Stat_AudioLanguages = StatsCache.Instance.StatGroupAudioLanguages[this.AnimeGroupID]; else contract.Stat_AudioLanguages = ""; if (StatsCache.Instance.StatGroupSubtitleLanguages.ContainsKey(this.AnimeGroupID)) contract.Stat_SubtitleLanguages = StatsCache.Instance.StatGroupSubtitleLanguages[this.AnimeGroupID]; else contract.Stat_SubtitleLanguages = ""; if (StatsCache.Instance.StatGroupVideoQuality.ContainsKey(this.AnimeGroupID)) contract.Stat_AllVideoQuality = StatsCache.Instance.StatGroupVideoQuality[this.AnimeGroupID]; else contract.Stat_AllVideoQuality = ""; if (StatsCache.Instance.StatGroupVideoQualityEpisodes.ContainsKey(this.AnimeGroupID)) contract.Stat_AllVideoQuality_Episodes = StatsCache.Instance.StatGroupVideoQualityEpisodes[this.AnimeGroupID]; else contract.Stat_AllVideoQuality_Episodes = ""; if (StatsCache.Instance.StatGroupIsComplete.ContainsKey(this.AnimeGroupID)) contract.Stat_IsComplete = StatsCache.Instance.StatGroupIsComplete[this.AnimeGroupID]; else contract.Stat_IsComplete = false; if (StatsCache.Instance.StatGroupHasTvDB.ContainsKey(this.AnimeGroupID)) contract.Stat_HasTvDBLink = StatsCache.Instance.StatGroupHasTvDB[this.AnimeGroupID]; else contract.Stat_HasTvDBLink = false; if (StatsCache.Instance.StatGroupHasMAL.ContainsKey(this.AnimeGroupID)) contract.Stat_HasMALLink = StatsCache.Instance.StatGroupHasMAL[this.AnimeGroupID]; else contract.Stat_HasMALLink = false; if (StatsCache.Instance.StatGroupHasMovieDB.ContainsKey(this.AnimeGroupID)) contract.Stat_HasMovieDBLink = StatsCache.Instance.StatGroupHasMovieDB[this.AnimeGroupID]; else contract.Stat_HasMovieDBLink = false; if (StatsCache.Instance.StatGroupHasMovieDBOrTvDB.ContainsKey(this.AnimeGroupID)) contract.Stat_HasMovieDBOrTvDBLink = StatsCache.Instance.StatGroupHasMovieDBOrTvDB[this.AnimeGroupID]; else contract.Stat_HasMovieDBOrTvDBLink = false; if (StatsCache.Instance.StatGroupIsFinishedAiring.ContainsKey(this.AnimeGroupID)) contract.Stat_HasFinishedAiring = StatsCache.Instance.StatGroupIsFinishedAiring[this.AnimeGroupID]; else contract.Stat_HasFinishedAiring = false; if (StatsCache.Instance.StatGroupIsCurrentlyAiring.ContainsKey(this.AnimeGroupID)) contract.Stat_IsCurrentlyAiring = StatsCache.Instance.StatGroupIsCurrentlyAiring[this.AnimeGroupID]; else contract.Stat_IsCurrentlyAiring = false; if (StatsCache.Instance.StatGroupAirDate_Max.ContainsKey(this.AnimeGroupID)) contract.Stat_AirDate_Max = StatsCache.Instance.StatGroupAirDate_Max[this.AnimeGroupID]; else contract.Stat_AirDate_Max = null; if (StatsCache.Instance.StatGroupAirDate_Min.ContainsKey(this.AnimeGroupID)) contract.Stat_AirDate_Min = StatsCache.Instance.StatGroupAirDate_Min[this.AnimeGroupID]; else contract.Stat_AirDate_Min = null; if (StatsCache.Instance.StatGroupCategories.ContainsKey(this.AnimeGroupID)) contract.Stat_AllCategories = StatsCache.Instance.StatGroupCategories[this.AnimeGroupID]; else contract.Stat_AllCategories = ""; if (StatsCache.Instance.StatGroupEndDate.ContainsKey(this.AnimeGroupID)) contract.Stat_EndDate = StatsCache.Instance.StatGroupEndDate[this.AnimeGroupID]; else contract.Stat_EndDate = null; if (StatsCache.Instance.StatGroupSeriesCreatedDate.ContainsKey(this.AnimeGroupID)) contract.Stat_SeriesCreatedDate = StatsCache.Instance.StatGroupSeriesCreatedDate[this.AnimeGroupID]; else contract.Stat_SeriesCreatedDate = null; if (StatsCache.Instance.StatGroupTitles.ContainsKey(this.AnimeGroupID)) contract.Stat_AllTitles = StatsCache.Instance.StatGroupTitles[this.AnimeGroupID]; else contract.Stat_AllTitles = ""; if (StatsCache.Instance.StatGroupUserVoteOverall.ContainsKey(this.AnimeGroupID)) contract.Stat_UserVoteOverall = StatsCache.Instance.StatGroupUserVoteOverall[this.AnimeGroupID]; else contract.Stat_UserVoteOverall = null; if (StatsCache.Instance.StatGroupUserVotePermanent.ContainsKey(this.AnimeGroupID)) contract.Stat_UserVotePermanent = StatsCache.Instance.StatGroupUserVotePermanent[this.AnimeGroupID]; else contract.Stat_UserVotePermanent = null; if (StatsCache.Instance.StatGroupUserVoteTemporary.ContainsKey(this.AnimeGroupID)) contract.Stat_UserVoteTemporary = StatsCache.Instance.StatGroupUserVoteTemporary[this.AnimeGroupID]; else contract.Stat_UserVoteTemporary = null; if (StatsCache.Instance.StatGroupSeriesCount.ContainsKey(this.AnimeGroupID)) contract.Stat_SeriesCount = StatsCache.Instance.StatGroupSeriesCount[this.AnimeGroupID]; else contract.Stat_SeriesCount = 0; if (StatsCache.Instance.StatGroupEpisodeCount.ContainsKey(this.AnimeGroupID)) contract.Stat_EpisodeCount = StatsCache.Instance.StatGroupEpisodeCount[this.AnimeGroupID]; else contract.Stat_EpisodeCount = 0; if (StatsCache.Instance.StatGroupAniDBRating.ContainsKey(this.AnimeGroupID)) contract.Stat_AniDBRating = StatsCache.Instance.StatGroupAniDBRating[this.AnimeGroupID]; else contract.Stat_AniDBRating = 0; //contract.AniDB_AirDate = this.AirDate; //contract.AniDB_Year = animeRec.Year; return contract; }
public Contract_AnimeGroup ToContract(AnimeGroup_User userRecord) { Contract_AnimeGroup contract = new Contract_AnimeGroup(); contract.AnimeGroupID = this.AnimeGroupID; contract.AnimeGroupParentID = this.AnimeGroupParentID; contract.DefaultAnimeSeriesID = this.DefaultAnimeSeriesID; contract.GroupName = this.GroupName; contract.Description = this.Description; contract.SortName = this.SortName; contract.EpisodeAddedDate = this.EpisodeAddedDate; contract.OverrideDescription = this.OverrideDescription; contract.DateTimeUpdated = this.DateTimeUpdated; if (userRecord == null) { contract.IsFave = 0; contract.UnwatchedEpisodeCount = 0; contract.WatchedEpisodeCount = 0; contract.WatchedDate = null; contract.PlayedCount = 0; contract.WatchedCount = 0; contract.StoppedCount = 0; } else { contract.IsFave = userRecord.IsFave; contract.UnwatchedEpisodeCount = userRecord.UnwatchedEpisodeCount; contract.WatchedEpisodeCount = userRecord.WatchedEpisodeCount; contract.WatchedDate = userRecord.WatchedDate; contract.PlayedCount = userRecord.PlayedCount; contract.WatchedCount = userRecord.WatchedCount; contract.StoppedCount = userRecord.StoppedCount; } contract.MissingEpisodeCount = this.MissingEpisodeCount; contract.MissingEpisodeCountGroups = this.MissingEpisodeCountGroups; if (StatsCache.Instance.StatGroupAudioLanguages.ContainsKey(this.AnimeGroupID)) { contract.Stat_AudioLanguages = StatsCache.Instance.StatGroupAudioLanguages[this.AnimeGroupID]; } else { contract.Stat_AudioLanguages = ""; } if (StatsCache.Instance.StatGroupSubtitleLanguages.ContainsKey(this.AnimeGroupID)) { contract.Stat_SubtitleLanguages = StatsCache.Instance.StatGroupSubtitleLanguages[this.AnimeGroupID]; } else { contract.Stat_SubtitleLanguages = ""; } if (StatsCache.Instance.StatGroupVideoQuality.ContainsKey(this.AnimeGroupID)) { contract.Stat_AllVideoQuality = StatsCache.Instance.StatGroupVideoQuality[this.AnimeGroupID]; } else { contract.Stat_AllVideoQuality = ""; } if (StatsCache.Instance.StatGroupVideoQualityEpisodes.ContainsKey(this.AnimeGroupID)) { contract.Stat_AllVideoQuality_Episodes = StatsCache.Instance.StatGroupVideoQualityEpisodes[this.AnimeGroupID]; } else { contract.Stat_AllVideoQuality_Episodes = ""; } if (StatsCache.Instance.StatGroupIsComplete.ContainsKey(this.AnimeGroupID)) { contract.Stat_IsComplete = StatsCache.Instance.StatGroupIsComplete[this.AnimeGroupID]; } else { contract.Stat_IsComplete = false; } if (StatsCache.Instance.StatGroupHasTvDB.ContainsKey(this.AnimeGroupID)) { contract.Stat_HasTvDBLink = StatsCache.Instance.StatGroupHasTvDB[this.AnimeGroupID]; } else { contract.Stat_HasTvDBLink = false; } if (StatsCache.Instance.StatGroupHasMAL.ContainsKey(this.AnimeGroupID)) { contract.Stat_HasMALLink = StatsCache.Instance.StatGroupHasMAL[this.AnimeGroupID]; } else { contract.Stat_HasMALLink = false; } if (StatsCache.Instance.StatGroupHasMovieDB.ContainsKey(this.AnimeGroupID)) { contract.Stat_HasMovieDBLink = StatsCache.Instance.StatGroupHasMovieDB[this.AnimeGroupID]; } else { contract.Stat_HasMovieDBLink = false; } if (StatsCache.Instance.StatGroupHasMovieDBOrTvDB.ContainsKey(this.AnimeGroupID)) { contract.Stat_HasMovieDBOrTvDBLink = StatsCache.Instance.StatGroupHasMovieDBOrTvDB[this.AnimeGroupID]; } else { contract.Stat_HasMovieDBOrTvDBLink = false; } if (StatsCache.Instance.StatGroupIsFinishedAiring.ContainsKey(this.AnimeGroupID)) { contract.Stat_HasFinishedAiring = StatsCache.Instance.StatGroupIsFinishedAiring[this.AnimeGroupID]; } else { contract.Stat_HasFinishedAiring = false; } if (StatsCache.Instance.StatGroupIsCurrentlyAiring.ContainsKey(this.AnimeGroupID)) { contract.Stat_IsCurrentlyAiring = StatsCache.Instance.StatGroupIsCurrentlyAiring[this.AnimeGroupID]; } else { contract.Stat_IsCurrentlyAiring = false; } if (StatsCache.Instance.StatGroupAirDate_Max.ContainsKey(this.AnimeGroupID)) { contract.Stat_AirDate_Max = StatsCache.Instance.StatGroupAirDate_Max[this.AnimeGroupID]; } else { contract.Stat_AirDate_Max = null; } if (StatsCache.Instance.StatGroupAirDate_Min.ContainsKey(this.AnimeGroupID)) { contract.Stat_AirDate_Min = StatsCache.Instance.StatGroupAirDate_Min[this.AnimeGroupID]; } else { contract.Stat_AirDate_Min = null; } if (StatsCache.Instance.StatGroupCategories.ContainsKey(this.AnimeGroupID)) { contract.Stat_AllCategories = StatsCache.Instance.StatGroupCategories[this.AnimeGroupID]; } else { contract.Stat_AllCategories = ""; } if (StatsCache.Instance.StatGroupEndDate.ContainsKey(this.AnimeGroupID)) { contract.Stat_EndDate = StatsCache.Instance.StatGroupEndDate[this.AnimeGroupID]; } else { contract.Stat_EndDate = null; } if (StatsCache.Instance.StatGroupSeriesCreatedDate.ContainsKey(this.AnimeGroupID)) { contract.Stat_SeriesCreatedDate = StatsCache.Instance.StatGroupSeriesCreatedDate[this.AnimeGroupID]; } else { contract.Stat_SeriesCreatedDate = null; } if (StatsCache.Instance.StatGroupTitles.ContainsKey(this.AnimeGroupID)) { contract.Stat_AllTitles = StatsCache.Instance.StatGroupTitles[this.AnimeGroupID]; } else { contract.Stat_AllTitles = ""; } if (StatsCache.Instance.StatGroupUserVoteOverall.ContainsKey(this.AnimeGroupID)) { contract.Stat_UserVoteOverall = StatsCache.Instance.StatGroupUserVoteOverall[this.AnimeGroupID]; } else { contract.Stat_UserVoteOverall = null; } if (StatsCache.Instance.StatGroupUserVotePermanent.ContainsKey(this.AnimeGroupID)) { contract.Stat_UserVotePermanent = StatsCache.Instance.StatGroupUserVotePermanent[this.AnimeGroupID]; } else { contract.Stat_UserVotePermanent = null; } if (StatsCache.Instance.StatGroupUserVoteTemporary.ContainsKey(this.AnimeGroupID)) { contract.Stat_UserVoteTemporary = StatsCache.Instance.StatGroupUserVoteTemporary[this.AnimeGroupID]; } else { contract.Stat_UserVoteTemporary = null; } if (StatsCache.Instance.StatGroupSeriesCount.ContainsKey(this.AnimeGroupID)) { contract.Stat_SeriesCount = StatsCache.Instance.StatGroupSeriesCount[this.AnimeGroupID]; } else { contract.Stat_SeriesCount = 0; } if (StatsCache.Instance.StatGroupEpisodeCount.ContainsKey(this.AnimeGroupID)) { contract.Stat_EpisodeCount = StatsCache.Instance.StatGroupEpisodeCount[this.AnimeGroupID]; } else { contract.Stat_EpisodeCount = 0; } if (StatsCache.Instance.StatGroupAniDBRating.ContainsKey(this.AnimeGroupID)) { contract.Stat_AniDBRating = StatsCache.Instance.StatGroupAniDBRating[this.AnimeGroupID]; } else { contract.Stat_AniDBRating = 0; } //contract.AniDB_AirDate = this.AirDate; //contract.AniDB_Year = animeRec.Year; return(contract); }