void cboEpisodeTypeFilter_SelectionChanged(object sender, SelectionChangedEventArgs e) { //return; ComboBox cbo = (ComboBox)sender; object obj = cbo.SelectedItem; if (obj == null) { return; } try { VM_AnimeEpisodeType epType = obj as VM_AnimeEpisodeType; VM_AnimeSeries_User animeSeries = (VM_AnimeSeries_User)DataContext; if (animeSeries == null) { return; } episodeType = epType.EpisodeType; RefreshEpisodes(); } catch (Exception ex) { Utils.ShowErrorMessage(ex); } }
public void InitEpisode(int entityid, int epno, decimal votevalue, enEpisodeType epType) { // allow the user to enter a vote value between 1 and 10 // can be 9.5 etc // then multiple by 100 to get anidb value // type: 1=anime, 2=anime tmpvote, 3=group // entity: anime, episode, or group // for episode voting add epno on type=1 // value: negative number means revoke, 0 means retrieve (default), 100-1000 are valid vote values, rest is illegal // votes will be updated automatically (no questions asked) // tmpvoting when there exist a perm vote is not possible this.entityID = entityid; this.episodeNumber = epno; if (votevalue > 0) { this.voteValue = (int)(votevalue * 100); } else { this.voteValue = (int)votevalue; } this.voteType = enAniDBVoteType.Episode; this.episodeType = epType; commandID = entityID.ToString(); int iVoteType = 1; string epNumberFormatted = episodeNumber.ToString(); switch (epType) { case enEpisodeType.Credits: epNumberFormatted = "C" + epno.ToString(); break; case enEpisodeType.Special: epNumberFormatted = "S" + epno.ToString(); break; case enEpisodeType.Other: epNumberFormatted = "0" + epno.ToString(); break; case enEpisodeType.Trailer: epNumberFormatted = "T" + epno.ToString(); break; case enEpisodeType.Parody: epNumberFormatted = "P" + epno.ToString(); break; } commandText = "VOTE type=" + iVoteType.ToString(); commandText += "&id=" + entityID.ToString(); commandText += "&value=" + voteValue.ToString(); commandText += "&epno=" + epNumberFormatted; }
public override bool LoadFromDBCommand(CommandRequest cq) { this.CommandID = cq.CommandID; this.CommandRequestID = cq.CommandRequestID; this.CommandType = cq.CommandType; this.Priority = cq.Priority; this.CommandDetails = cq.CommandDetails; this.DateTimeUpdated = cq.DateTimeUpdated; // read xml to get parameters if (this.CommandDetails.Trim().Length > 0) { XmlDocument docCreator = new XmlDocument(); docCreator.LoadXml(this.CommandDetails); // populate the fields this.animeID = int.Parse(TryGetProperty(docCreator, "CommandRequest_LinkAniDBTvDB", "animeID")); this.aniEpType = (enEpisodeType)Enum.Parse(typeof(enEpisodeType), TryGetProperty(docCreator, "CommandRequest_LinkAniDBTvDB", "aniEpType")); this.aniEpNumber = int.Parse(TryGetProperty(docCreator, "CommandRequest_LinkAniDBTvDB", "aniEpNumber")); this.tvDBID = int.Parse(TryGetProperty(docCreator, "CommandRequest_LinkAniDBTvDB", "tvDBID")); this.tvSeasonNumber = int.Parse( TryGetProperty(docCreator, "CommandRequest_LinkAniDBTvDB", "tvSeasonNumber")); this.tvEpNumber = int.Parse(TryGetProperty(docCreator, "CommandRequest_LinkAniDBTvDB", "tvEpNumber")); this.excludeFromWebCache = bool.Parse( TryGetProperty(docCreator, "CommandRequest_LinkAniDBTvDB", "excludeFromWebCache")); this.additiveLink = bool.Parse( TryGetProperty(docCreator, "CommandRequest_LinkAniDBTvDB", "additiveLink")); } return(true); }
public static string EpisodeTypeTranslated(enEpisodeType epType) { switch (epType) { case enEpisodeType.Credits: return("Credits"); case enEpisodeType.Episode: return("Episodes"); case enEpisodeType.Other: return("Other"); case enEpisodeType.Parody: return("Parody"); case enEpisodeType.Special: return("Specials"); case enEpisodeType.Trailer: return("Trailers"); default: return("Other"); } }
public static string EpisodeTypeTranslated(enEpisodeType epType) { switch (epType) { case enEpisodeType.Credits: return(Translation.Credits); case enEpisodeType.Episode: return(Translation.Episodes); case enEpisodeType.Other: return(Translation.Other); case enEpisodeType.Parody: return(Translation.Parody); case enEpisodeType.Special: return(Translation.Specials); case enEpisodeType.Trailer: return(Translation.Trailers); default: return(Translation.Other); } }
public void Init(int animeID, int episodeNumber, enEpisodeType epType) { this.episodeNumber = episodeNumber; this.animeID = animeID; this.episodeType = epType; string epNumberFormatted = episodeNumber.ToString(); switch (epType) { case enEpisodeType.Credits: epNumberFormatted = "C" + episodeNumber.ToString(); break; case enEpisodeType.Special: epNumberFormatted = "S" + episodeNumber.ToString(); break; case enEpisodeType.Other: epNumberFormatted = "0" + episodeNumber.ToString(); break; case enEpisodeType.Trailer: epNumberFormatted = "T" + episodeNumber.ToString(); break; case enEpisodeType.Parody: epNumberFormatted = "P" + episodeNumber.ToString(); break; } key = "AniDBCommand_GetEpisodeInfo_" + animeID.ToString() + "_" + epNumberFormatted; commandText = string.Format("EPISODE aid={0}&epno={1}", animeID, epNumberFormatted); //BaseConfig.MyAnimeLog.Write("AniDBCommand_GetEpisodeInfo.Process: Request: {0}", commandText); commandID = animeID.ToString(); }
public void Init(int entityid, decimal votevalue, enAniDBVoteType votetype) { // allow the user to enter a vote value between 1 and 10 // can be 9.5 etc // then multiple by 100 to get anidb value // type: 1=anime, 2=anime tmpvote, 3=group // entity: anime, episode, or group // for episode voting add epno on type=1 // value: negative number means revoke, 0 means retrieve (default), 100-1000 are valid vote values, rest is illegal // votes will be updated automatically (no questions asked) // tmpvoting when there exist a perm vote is not possible this.entityID = entityid; this.episodeNumber = -1; if (votevalue > 0) { this.voteValue = (int)(votevalue * 100); } else { this.voteValue = (int)votevalue; } this.voteType = votetype; this.episodeType = enEpisodeType.Episode; commandID = entityID.ToString(); int iVoteType = 1; switch (voteType) { case enAniDBVoteType.Anime: iVoteType = 1; break; case enAniDBVoteType.AnimeTemp: iVoteType = 2; break; case enAniDBVoteType.Group: iVoteType = 3; break; case enAniDBVoteType.Episode: iVoteType = 1; break; } commandText = "VOTE type=" + iVoteType.ToString(); commandText += "&id=" + entityID.ToString(); commandText += "&value=" + voteValue.ToString(); }
public List<AniDB_Episode> GetByAnimeIDAndEpisodeTypeNumber(int animeid, enEpisodeType epType, int epnumber) { using (var session = JMMService.SessionFactory.OpenSession()) { var eps = session .CreateCriteria(typeof(AniDB_Episode)) .Add(Restrictions.Eq("AnimeID", animeid)) .Add(Restrictions.Eq("EpisodeNumber", epnumber)) .Add(Restrictions.Eq("EpisodeType", (int)epType)) .List<AniDB_Episode>(); return new List<AniDB_Episode>(eps); } }
public List <AnimeEpisodeVM> GetEpisodesByType(enEpisodeType epType) { List <AnimeEpisodeVM> eps = new List <AnimeEpisodeVM>(); foreach (AnimeEpisodeVM ep in AllEpisodes) { if (ep.EpisodeTypeEnum == epType) { eps.Add(ep); } } return(eps); }
public List <AniDB_Episode> GetByAnimeIDAndEpisodeTypeNumber(int animeid, enEpisodeType epType, int epnumber) { using (var session = JMMService.SessionFactory.OpenSession()) { var eps = session .CreateCriteria(typeof(AniDB_Episode)) .Add(Restrictions.Eq("AnimeID", animeid)) .Add(Restrictions.Eq("EpisodeNumber", epnumber)) .Add(Restrictions.Eq("EpisodeType", (int)epType)) .List <AniDB_Episode>(); return(new List <AniDB_Episode>(eps)); } }
public List <VM_AnimeEpisode_User> GetEpisodesByType(enEpisodeType epType) { List <VM_AnimeEpisode_User> eps = new List <VM_AnimeEpisode_User>(); foreach (VM_AnimeEpisode_User ep in AllEpisodes) { if (ep.EpisodeTypeEnum == epType) { eps.Add(ep); } } return(eps); }
public List <AniDB_Episode> GetByAnimeIDAndEpisodeTypeNumber(int animeid, enEpisodeType epType, int epnumber) { return(Animes.GetMultiple(animeid).Where(a => a.EpisodeNumber == epnumber && a.EpisodeTypeEnum == epType).ToList()); /* using (var session = JMMService.SessionFactory.OpenSession()) * { * var eps = session * .CreateCriteria(typeof(AniDB_Episode)) * .Add(Restrictions.Eq("AnimeID", animeid)) * .Add(Restrictions.Eq("EpisodeNumber", epnumber)) * .Add(Restrictions.Eq("EpisodeType", (int) epType)) * .List<AniDB_Episode>(); * * return new List<AniDB_Episode>(eps); * }*/ }
public CommandRequest_LinkAniDBTvDB(int animeID, enEpisodeType aniEpType, int aniEpNumber, int tvDBID, int tvSeasonNumber, int tvEpNumber, bool excludeFromWebCache, bool additiveLink = false) { this.animeID = animeID; this.aniEpType = aniEpType; this.aniEpNumber = aniEpNumber; this.tvDBID = tvDBID; this.tvSeasonNumber = tvSeasonNumber; this.tvEpNumber = tvEpNumber; this.excludeFromWebCache = excludeFromWebCache; this.additiveLink = additiveLink; this.CommandType = (int)CommandRequestType.LinkAniDBTvDB; this.Priority = (int)DefaultPriority; GenerateCommandID(); }
public void ProcessVoteFoundEpisode(string sRecMessage, int animeID, int epno, enEpisodeType epType) { // remove the header info string[] sDetails = sRecMessage.Substring(15).Split('|'); //261 VOTE FOUNDThe Day a New Demon Was Born|700|1|63091 // 261 VOTE FOUND // 0. The Day a New Demon Was Born // 1. 700 ** vote value // 2. 1 ** ??? // 3. 63091 ** episodeid this.EntityID = animeID; this.EpisodeNumber = epno; this.VoteValue = int.Parse(sDetails[1].Trim()); this.VoteType = (int) enAniDBVoteType.Episode; this.EpisodeType = (int) epType; }
// Removes all TVDB information from a series, bringing it back to a blank state. public static void RemoveLinkAniDBTvDB(int animeID, enEpisodeType aniEpType, int aniEpNumber, int tvDBID, int tvSeasonNumber, int tvEpNumber) { CrossRef_AniDB_TvDBV2Repository repCrossRef = new CrossRef_AniDB_TvDBV2Repository(); CrossRef_AniDB_TvDBV2 xref = repCrossRef.GetByTvDBID(tvDBID, tvSeasonNumber, tvEpNumber, animeID, (int)aniEpType, aniEpNumber); if (xref == null) { return; } repCrossRef.Delete(xref.CrossRef_AniDB_TvDBV2ID); StatsCache.Instance.UpdateUsingAnime(animeID); CommandRequest_WebCacheDeleteXRefAniDBTvDB req = new CommandRequest_WebCacheDeleteXRefAniDBTvDB(animeID, (int)aniEpType, aniEpNumber, tvDBID, tvSeasonNumber, tvEpNumber); req.Save(); }
public List <VM_AnimeEpisode_User> GetEpisodesToDisplay(enEpisodeType epType) { List <VM_AnimeEpisode_User> eps = new List <VM_AnimeEpisode_User>(); foreach (VM_AnimeEpisode_User ep in GetEpisodesByType(epType)) { bool useEp = true; if (BaseConfig.Settings.ShowOnlyAvailableEpisodes && ep.LocalFileCount == 0) { useEp = false; } if (useEp) { eps.Add(ep); } } return(eps); }
public static string EpisodeTypeTranslated(enEpisodeType epType) { switch (epType) { case enEpisodeType.Credits: return Translation.Credits; case enEpisodeType.Episode: return Translation.Episodes; case enEpisodeType.Other: return Translation.Other; case enEpisodeType.Parody: return Translation.Parody; case enEpisodeType.Special: return Translation.Specials; case enEpisodeType.Trailer: return Translation.Trailers; default: return Translation.Other; } }
public static string EpisodeTypeTranslated(enEpisodeType epType) { switch (epType) { case enEpisodeType.Credits: return "Credits"; case enEpisodeType.Episode: return "Episodes"; case enEpisodeType.Other: return "Other"; case enEpisodeType.Parody: return "Parody"; case enEpisodeType.Special: return "Specials"; case enEpisodeType.Trailer: return "Trailers"; default: return "Other"; } }
public void GetWatchedUnwatchedCount(enEpisodeType epType, ref int unwatched, ref int watched) { unwatched = 0; watched = 0; foreach (VM_AnimeEpisode_User ep in GetEpisodesByType(epType)) { if (ep.LocalFileCount == 0) { continue; } if (ep.Watched) { watched++; } else { unwatched++; } } }
// Removes all TVDB information from a series, bringing it back to a blank state. public static void RemoveLinkAniDBTvDB(int animeID, enEpisodeType aniEpType, int aniEpNumber, int tvDBID, int tvSeasonNumber, int tvEpNumber) { CrossRef_AniDB_TvDBV2 xref = RepoFactory.CrossRef_AniDB_TvDBV2.GetByTvDBID(tvDBID, tvSeasonNumber, tvEpNumber, animeID, (int)aniEpType, aniEpNumber); if (xref == null) { return; } RepoFactory.CrossRef_AniDB_TvDBV2.Delete(xref.CrossRef_AniDB_TvDBV2ID); AniDB_Anime.UpdateStatsByAnimeID(animeID); CommandRequest_WebCacheDeleteXRefAniDBTvDB req = new CommandRequest_WebCacheDeleteXRefAniDBTvDB(animeID, (int)aniEpType, aniEpNumber, tvDBID, tvSeasonNumber, tvEpNumber); req.Save(); }
private void LinkAniDBToTVDB(AnimeSeriesVM ser, int animeID, enEpisodeType anidbEpType, int anidbEpNumber, int tvDBID, int tvSeason, int tvEpNumber) { string res = JMMServerVM.Instance.clientBinaryHTTP.LinkAniDBTvDB(animeID, (int)anidbEpType, anidbEpNumber, tvDBID, tvSeason, tvEpNumber, null); if (res.Length > 0) Utils.DialogMsg("Error", res); ser = JMMServerHelper.GetSeries(ser.AnimeSeriesID.Value); }
public static void RemoveLinkAniDBTrakt(int animeID, enEpisodeType aniEpType, int aniEpNumber, string traktID, int seasonNumber, int traktEpNumber) { CrossRef_AniDB_TraktV2Repository repCrossRef = new CrossRef_AniDB_TraktV2Repository(); CrossRef_AniDB_TraktV2 xref = repCrossRef.GetByTraktID(traktID, seasonNumber, traktEpNumber, animeID, (int)aniEpType, aniEpNumber); if (xref == null) return; repCrossRef.Delete(xref.CrossRef_AniDB_TraktV2ID); StatsCache.Instance.UpdateUsingAnime(animeID); if (ServerSettings.WebCache_Trakt_Send) { CommandRequest_WebCacheDeleteXRefAniDBTrakt req = new CommandRequest_WebCacheDeleteXRefAniDBTrakt(animeID, (int)aniEpType, aniEpNumber, traktID, seasonNumber, traktEpNumber); req.Save(); } }
public static string LinkAniDBTrakt(int animeID, enEpisodeType aniEpType, int aniEpNumber, string traktID, int seasonNumber, int traktEpNumber, bool excludeFromWebCache) { using (var session = JMMService.SessionFactory.OpenSession()) { return LinkAniDBTrakt(session, animeID, aniEpType, aniEpNumber, traktID, seasonNumber, traktEpNumber, excludeFromWebCache); } }
public static string LinkAniDBTvDB(int animeID, enEpisodeType aniEpType, int aniEpNumber, int tvDBID, int tvSeasonNumber, int tvEpNumber, bool excludeFromWebCache) { using (var session = JMMService.SessionFactory.OpenSession()) { CrossRef_AniDB_TvDBV2Repository repCrossRef = new CrossRef_AniDB_TvDBV2Repository(); List<CrossRef_AniDB_TvDBV2> xrefTemps = repCrossRef.GetByAnimeIDEpTypeEpNumber(session, animeID, (int)aniEpType, aniEpNumber); if (xrefTemps != null && xrefTemps.Count > 0) { foreach (CrossRef_AniDB_TvDBV2 xrefTemp in xrefTemps) { // delete the existing one if we are updating TvDBHelper.RemoveLinkAniDBTvDB(xrefTemp.AnimeID, (enEpisodeType)xrefTemp.AniDBStartEpisodeType, xrefTemp.AniDBStartEpisodeNumber, xrefTemp.TvDBID, xrefTemp.TvDBSeasonNumber, xrefTemp.TvDBStartEpisodeNumber); } } // check if we have this information locally // if not download it now TvDB_SeriesRepository repSeries = new TvDB_SeriesRepository(); TvDB_Series tvSeries = repSeries.GetByTvDBID(tvDBID); if (tvSeries == null) { // we download the series info here just so that we have the basic info in the // database before the queued task runs later tvSeries = GetSeriesInfoOnline(tvDBID); } // download and update series info, episode info and episode images // will also download fanart, posters and wide banners CommandRequest_TvDBUpdateSeriesAndEpisodes cmdSeriesEps = new CommandRequest_TvDBUpdateSeriesAndEpisodes(tvDBID, false); cmdSeriesEps.Save(); CrossRef_AniDB_TvDBV2 xref = repCrossRef.GetByTvDBID(session, tvDBID, tvSeasonNumber, tvEpNumber, animeID, (int)aniEpType, aniEpNumber); if (xref == null) xref = new CrossRef_AniDB_TvDBV2(); xref.AnimeID = animeID; xref.AniDBStartEpisodeType = (int)aniEpType; xref.AniDBStartEpisodeNumber = aniEpNumber; xref.TvDBID = tvDBID; xref.TvDBSeasonNumber = tvSeasonNumber; xref.TvDBStartEpisodeNumber = tvEpNumber; if (tvSeries != null) xref.TvDBTitle = tvSeries.SeriesName; if (excludeFromWebCache) xref.CrossRefSource = (int)CrossRefSource.WebCache; else xref.CrossRefSource = (int)CrossRefSource.User; repCrossRef.Save(xref); StatsCache.Instance.UpdateUsingAnime(animeID); logger.Trace("Changed tvdb association: {0}", animeID); if (!excludeFromWebCache) { CommandRequest_WebCacheSendXRefAniDBTvDB req = new CommandRequest_WebCacheSendXRefAniDBTvDB(xref.CrossRef_AniDB_TvDBV2ID); req.Save(); } if (ServerSettings.Trakt_IsEnabled && !string.IsNullOrEmpty(ServerSettings.Trakt_AuthToken)) { CrossRef_AniDB_TraktV2Repository repTraktXrefs = new CrossRef_AniDB_TraktV2Repository(); if (repTraktXrefs.GetByAnimeID(animeID).Count == 0) { // check for Trakt associations CommandRequest_TraktSearchAnime cmd2 = new CommandRequest_TraktSearchAnime(animeID, false); cmd2.Save(session); } } } return ""; }
public void ProcessVoteFoundEpisode(string sRecMessage, int animeID, int epno, enEpisodeType epType) { // remove the header info string[] sDetails = sRecMessage.Substring(15).Split('|'); //261 VOTE FOUNDThe Day a New Demon Was Born|700|1|63091 // 261 VOTE FOUND // 0. The Day a New Demon Was Born // 1. 700 ** vote value // 2. 1 ** ??? // 3. 63091 ** episodeid this.EntityID = animeID; this.EpisodeNumber = epno; this.VoteValue = int.Parse(sDetails[1].Trim()); this.VoteType = (int)enAniDBVoteType.Episode; this.EpisodeType = (int)epType; }
public List<AnimeEpisodeVM> GetEpisodesToDisplay(enEpisodeType epType) { List<AnimeEpisodeVM> eps = new List<AnimeEpisodeVM>(); foreach (AnimeEpisodeVM ep in GetEpisodesByType(epType)) { bool useEp = true; if (BaseConfig.Settings.ShowOnlyAvailableEpisodes && ep.LocalFileCount == 0) useEp = false; if (useEp) eps.Add(ep); } return eps; }
public List<AnimeEpisodeVM> GetEpisodesByType(enEpisodeType epType) { List<AnimeEpisodeVM> eps = new List<AnimeEpisodeVM>(); foreach (AnimeEpisodeVM ep in AllEpisodes) { if (ep.EpisodeTypeEnum == epType) eps.Add(ep); } return eps; }
public static string LinkAniDBTvDB(int animeID, enEpisodeType aniEpType, int aniEpNumber, int tvDBID, int tvSeasonNumber, int tvEpNumber, bool excludeFromWebCache, bool additiveLink = false) { using (var session = DatabaseFactory.SessionFactory.OpenSession()) { if (!additiveLink) { // remove all current links RemoveAllAniDBTvDBLinks(session.Wrap(), animeID); } // check if we have this information locally // if not download it now TvDB_Series tvSeries = RepoFactory.TvDB_Series.GetByTvDBID(tvDBID); if (tvSeries == null) { // we download the series info here just so that we have the basic info in the // database before the queued task runs later tvSeries = GetSeriesInfoOnline(tvDBID); } // download and update series info, episode info and episode images // will also download fanart, posters and wide banners CommandRequest_TvDBUpdateSeriesAndEpisodes cmdSeriesEps = new CommandRequest_TvDBUpdateSeriesAndEpisodes(tvDBID, false); //Optimize for batch updates, if there are a lot of LinkAniDBTvDB commands queued //this will cause only one updateSeriesAndEpisodes command to be created if (RepoFactory.CommandRequest.GetByCommandID(cmdSeriesEps.CommandID) == null) { cmdSeriesEps.Save(); } CrossRef_AniDB_TvDBV2 xref = RepoFactory.CrossRef_AniDB_TvDBV2.GetByTvDBID(session, tvDBID, tvSeasonNumber, tvEpNumber, animeID, (int)aniEpType, aniEpNumber); if (xref == null) { xref = new CrossRef_AniDB_TvDBV2(); } xref.AnimeID = animeID; xref.AniDBStartEpisodeType = (int)aniEpType; xref.AniDBStartEpisodeNumber = aniEpNumber; xref.TvDBID = tvDBID; xref.TvDBSeasonNumber = tvSeasonNumber; xref.TvDBStartEpisodeNumber = tvEpNumber; if (tvSeries != null) { xref.TvDBTitle = tvSeries.SeriesName; } if (excludeFromWebCache) { xref.CrossRefSource = (int)CrossRefSource.WebCache; } else { xref.CrossRefSource = (int)CrossRefSource.User; } RepoFactory.CrossRef_AniDB_TvDBV2.Save(xref); AniDB_Anime.UpdateStatsByAnimeID(animeID); logger.Trace("Changed tvdb association: {0}", animeID); if (!excludeFromWebCache) { CommandRequest_WebCacheSendXRefAniDBTvDB req = new CommandRequest_WebCacheSendXRefAniDBTvDB(xref.CrossRef_AniDB_TvDBV2ID); req.Save(); } if (ServerSettings.Trakt_IsEnabled && !string.IsNullOrEmpty(ServerSettings.Trakt_AuthToken)) { if (RepoFactory.CrossRef_AniDB_TraktV2.GetByAnimeID(animeID).Count == 0) { // check for Trakt associations CommandRequest_TraktSearchAnime cmd2 = new CommandRequest_TraktSearchAnime(animeID, false); cmd2.Save(session); } } } return(""); }
public static string LinkAniDBTvDB(int animeID, enEpisodeType aniEpType, int aniEpNumber, int tvDBID, int tvSeasonNumber, int tvEpNumber, bool excludeFromWebCache, bool additiveLink=false) { using (var session = DatabaseFactory.SessionFactory.OpenSession()) { if(!additiveLink) // remove all current links RemoveAllAniDBTvDBLinks(session.Wrap(), animeID); // check if we have this information locally // if not download it now TvDB_Series tvSeries = RepoFactory.TvDB_Series.GetByTvDBID(tvDBID); if (tvSeries == null) { // we download the series info here just so that we have the basic info in the // database before the queued task runs later tvSeries = GetSeriesInfoOnline(tvDBID); } // download and update series info, episode info and episode images // will also download fanart, posters and wide banners CommandRequest_TvDBUpdateSeriesAndEpisodes cmdSeriesEps = new CommandRequest_TvDBUpdateSeriesAndEpisodes(tvDBID, false); //Optimize for batch updates, if there are a lot of LinkAniDBTvDB commands queued //this will cause only one updateSeriesAndEpisodes command to be created if (RepoFactory.CommandRequest.GetByCommandID(cmdSeriesEps.CommandID) == null) { cmdSeriesEps.Save(); } CrossRef_AniDB_TvDBV2 xref = RepoFactory.CrossRef_AniDB_TvDBV2.GetByTvDBID(session, tvDBID, tvSeasonNumber, tvEpNumber, animeID, (int) aniEpType, aniEpNumber); if (xref == null) xref = new CrossRef_AniDB_TvDBV2(); xref.AnimeID = animeID; xref.AniDBStartEpisodeType = (int) aniEpType; xref.AniDBStartEpisodeNumber = aniEpNumber; xref.TvDBID = tvDBID; xref.TvDBSeasonNumber = tvSeasonNumber; xref.TvDBStartEpisodeNumber = tvEpNumber; if (tvSeries != null) xref.TvDBTitle = tvSeries.SeriesName; if (excludeFromWebCache) xref.CrossRefSource = (int) CrossRefSource.WebCache; else xref.CrossRefSource = (int) CrossRefSource.User; RepoFactory.CrossRef_AniDB_TvDBV2.Save(xref); AniDB_Anime.UpdateStatsByAnimeID(animeID); logger.Trace("Changed tvdb association: {0}", animeID); if (!excludeFromWebCache) { CommandRequest_WebCacheSendXRefAniDBTvDB req = new CommandRequest_WebCacheSendXRefAniDBTvDB(xref.CrossRef_AniDB_TvDBV2ID); req.Save(); } if (ServerSettings.Trakt_IsEnabled && !string.IsNullOrEmpty(ServerSettings.Trakt_AuthToken)) { if (RepoFactory.CrossRef_AniDB_TraktV2.GetByAnimeID(animeID).Count == 0) { // check for Trakt associations CommandRequest_TraktSearchAnime cmd2 = new CommandRequest_TraktSearchAnime(animeID, false); cmd2.Save(session); } } } return ""; }
public static void EpisodeTypeTranslated(PlexEpisodeType tp, enEpisodeType epType, AnimeTypes an, int cnt) { tp.Type = (int)epType; tp.Count = cnt; tp.AnimeType = an; bool plural = cnt > 1; switch (epType) { case enEpisodeType.Credits: tp.Name = plural ? "Credits" : "Credit"; tp.Image = "plex_credits.png"; return; case enEpisodeType.Episode: switch (an) { case AnimeTypes.Movie: tp.Name = plural ? "Movies" : "Movie"; tp.Image = "plex_movies.png"; return; case AnimeTypes.OVA: tp.Name = plural ? "Ovas" : "Ova"; tp.Image = "plex_ovas.png"; return; case AnimeTypes.Other: tp.Name = plural ? "Others" : "Other"; tp.Image = "plex_others.png"; return; case AnimeTypes.TV_Series: tp.Name = plural ? "Episodes" : "Episode"; tp.Image = "plex_episodes.png"; return; case AnimeTypes.TV_Special: tp.Name = plural ? "TV Episodes" : "TV Episode"; tp.Image = "plex_tvepisodes.png"; return; case AnimeTypes.Web: tp.Name = plural ? "Web Clips" : "Web Clip"; tp.Image = "plex_webclips.png"; return; } tp.Name = plural ? "Episodes" : "Episode"; tp.Image = "plex_episodes.png"; return; case enEpisodeType.Parody: tp.Name = plural ? "Parodies" : "Parody"; tp.Image = "plex_parodies.png"; return; case enEpisodeType.Special: tp.Name = plural ? "Specials" : "Special"; tp.Image = "plex_specials.png"; return; case enEpisodeType.Trailer: tp.Name = plural ? "Trailers" : "Trailer"; tp.Image = "plex_trailers.png"; return; default: tp.Name = "Misc"; tp.Image = "plex_misc.png"; return; } }
// Removes all TVDB information from a series, bringing it back to a blank state. public static void RemoveLinkAniDBTvDB(int animeID, enEpisodeType aniEpType, int aniEpNumber, int tvDBID, int tvSeasonNumber, int tvEpNumber) { CrossRef_AniDB_TvDBV2 xref = RepoFactory.CrossRef_AniDB_TvDBV2.GetByTvDBID(tvDBID, tvSeasonNumber, tvEpNumber, animeID, (int) aniEpType, aniEpNumber); if (xref == null) return; RepoFactory.CrossRef_AniDB_TvDBV2.Delete(xref.CrossRef_AniDB_TvDBV2ID); AniDB_Anime.UpdateStatsByAnimeID(animeID); CommandRequest_WebCacheDeleteXRefAniDBTvDB req = new CommandRequest_WebCacheDeleteXRefAniDBTvDB(animeID, (int) aniEpType, aniEpNumber, tvDBID, tvSeasonNumber, tvEpNumber); req.Save(); }
public void Init(int entityid, decimal votevalue, enAniDBVoteType votetype) { // allow the user to enter a vote value between 1 and 10 // can be 9.5 etc // then multiple by 100 to get anidb value // type: 1=anime, 2=anime tmpvote, 3=group // entity: anime, episode, or group // for episode voting add epno on type=1 // value: negative number means revoke, 0 means retrieve (default), 100-1000 are valid vote values, rest is illegal // votes will be updated automatically (no questions asked) // tmpvoting when there exist a perm vote is not possible this.entityID = entityid; this.episodeNumber = -1; if (votevalue > 0) this.voteValue = (int)(votevalue * 100); else this.voteValue = (int)votevalue; this.voteType = votetype; this.episodeType = enEpisodeType.Episode; commandID = entityID.ToString(); int iVoteType = 1; switch (voteType) { case enAniDBVoteType.Anime: iVoteType = 1; break; case enAniDBVoteType.AnimeTemp: iVoteType = 2; break; case enAniDBVoteType.Group: iVoteType = 3; break; case enAniDBVoteType.Episode: iVoteType = 1; break; } commandText = "VOTE type=" + iVoteType.ToString(); commandText += "&id=" + entityID.ToString(); commandText += "&value=" + voteValue.ToString(); }
public static void RemoveLinkAniDBTrakt(int animeID, enEpisodeType aniEpType, int aniEpNumber, string traktID, int seasonNumber, int traktEpNumber) { CrossRef_AniDB_TraktV2 xref = RepoFactory.CrossRef_AniDB_TraktV2.GetByTraktID(traktID, seasonNumber, traktEpNumber, animeID, (int) aniEpType, aniEpNumber); if (xref == null) return; RepoFactory.CrossRef_AniDB_TraktV2.Delete(xref.CrossRef_AniDB_TraktV2ID); AniDB_Anime.UpdateStatsByAnimeID(animeID); if (ServerSettings.WebCache_Trakt_Send) { CommandRequest_WebCacheDeleteXRefAniDBTrakt req = new CommandRequest_WebCacheDeleteXRefAniDBTrakt(animeID, (int) aniEpType, aniEpNumber, traktID, seasonNumber, traktEpNumber); req.Save(); } }
public static void SetWatchedStatusOnSeries(bool watchedStatus, int maxEpisodeNumber, int animeSeriesID, enEpisodeType episodeType) { try { JMMServerVM.Instance.clientBinaryHTTP.SetWatchedStatusOnSeries(animeSeriesID, watchedStatus, maxEpisodeNumber, (int)episodeType, JMMServerVM.Instance.CurrentUser.JMMUserID); } catch (Exception ex) { BaseConfig.MyAnimeLog.Write("SetWatchedStatusOnSeries: " + ex.Message); } }
public void InitEpisode(int entityid, int epno, decimal votevalue, enEpisodeType epType) { // allow the user to enter a vote value between 1 and 10 // can be 9.5 etc // then multiple by 100 to get anidb value // type: 1=anime, 2=anime tmpvote, 3=group // entity: anime, episode, or group // for episode voting add epno on type=1 // value: negative number means revoke, 0 means retrieve (default), 100-1000 are valid vote values, rest is illegal // votes will be updated automatically (no questions asked) // tmpvoting when there exist a perm vote is not possible this.entityID = entityid; this.episodeNumber = epno; if (votevalue > 0) this.voteValue = (int)(votevalue * 100); else this.voteValue = (int)votevalue; this.voteType = enAniDBVoteType.Episode; this.episodeType = epType; commandID = entityID.ToString(); int iVoteType = 1; string epNumberFormatted = episodeNumber.ToString(); switch (epType) { case enEpisodeType.Credits: epNumberFormatted = "C" + epno.ToString(); break; case enEpisodeType.Special: epNumberFormatted = "S" + epno.ToString(); break; case enEpisodeType.Other: epNumberFormatted = "0" + epno.ToString(); break; case enEpisodeType.Trailer: epNumberFormatted = "T" + epno.ToString(); break; case enEpisodeType.Parody: epNumberFormatted = "P" + epno.ToString(); break; } commandText = "VOTE type=" + iVoteType.ToString(); commandText += "&id=" + entityID.ToString(); commandText += "&value=" + voteValue.ToString(); commandText += "&epno=" + epNumberFormatted; }
// Removes all TVDB information from a series, bringing it back to a blank state. public static void RemoveLinkAniDBTvDB(int animeID, enEpisodeType aniEpType, int aniEpNumber, int tvDBID, int tvSeasonNumber, int tvEpNumber) { CrossRef_AniDB_TvDBV2Repository repCrossRef = new CrossRef_AniDB_TvDBV2Repository(); CrossRef_AniDB_TvDBV2 xref = repCrossRef.GetByTvDBID(tvDBID, tvSeasonNumber, tvEpNumber, animeID, (int)aniEpType, aniEpNumber); if (xref == null) return; repCrossRef.Delete(xref.CrossRef_AniDB_TvDBV2ID); StatsCache.Instance.UpdateUsingAnime(animeID); CommandRequest_WebCacheDeleteXRefAniDBTvDB req = new CommandRequest_WebCacheDeleteXRefAniDBTvDB(animeID, (int)aniEpType, aniEpNumber, tvDBID, tvSeasonNumber, tvEpNumber); req.Save(); }
public static string LinkAniDBTvDB(int animeID, enEpisodeType aniEpType, int aniEpNumber, int tvDBID, int tvSeasonNumber, int tvEpNumber, bool excludeFromWebCache) { using (var session = JMMService.SessionFactory.OpenSession()) { CrossRef_AniDB_TvDBV2Repository repCrossRef = new CrossRef_AniDB_TvDBV2Repository(); List <CrossRef_AniDB_TvDBV2> xrefTemps = repCrossRef.GetByAnimeIDEpTypeEpNumber(session, animeID, (int)aniEpType, aniEpNumber); if (xrefTemps != null && xrefTemps.Count > 0) { foreach (CrossRef_AniDB_TvDBV2 xrefTemp in xrefTemps) { // delete the existing one if we are updating TvDBHelper.RemoveLinkAniDBTvDB(xrefTemp.AnimeID, (enEpisodeType)xrefTemp.AniDBStartEpisodeType, xrefTemp.AniDBStartEpisodeNumber, xrefTemp.TvDBID, xrefTemp.TvDBSeasonNumber, xrefTemp.TvDBStartEpisodeNumber); } } // check if we have this information locally // if not download it now TvDB_SeriesRepository repSeries = new TvDB_SeriesRepository(); TvDB_Series tvSeries = repSeries.GetByTvDBID(tvDBID); if (tvSeries == null) { // we download the series info here just so that we have the basic info in the // database before the queued task runs later tvSeries = GetSeriesInfoOnline(tvDBID); } // download and update series info, episode info and episode images // will also download fanart, posters and wide banners CommandRequest_TvDBUpdateSeriesAndEpisodes cmdSeriesEps = new CommandRequest_TvDBUpdateSeriesAndEpisodes(tvDBID, false); cmdSeriesEps.Save(); CrossRef_AniDB_TvDBV2 xref = repCrossRef.GetByTvDBID(session, tvDBID, tvSeasonNumber, tvEpNumber, animeID, (int)aniEpType, aniEpNumber); if (xref == null) { xref = new CrossRef_AniDB_TvDBV2(); } xref.AnimeID = animeID; xref.AniDBStartEpisodeType = (int)aniEpType; xref.AniDBStartEpisodeNumber = aniEpNumber; xref.TvDBID = tvDBID; xref.TvDBSeasonNumber = tvSeasonNumber; xref.TvDBStartEpisodeNumber = tvEpNumber; if (tvSeries != null) { xref.TvDBTitle = tvSeries.SeriesName; } if (excludeFromWebCache) { xref.CrossRefSource = (int)CrossRefSource.WebCache; } else { xref.CrossRefSource = (int)CrossRefSource.User; } repCrossRef.Save(xref); StatsCache.Instance.UpdateUsingAnime(animeID); logger.Trace("Changed tvdb association: {0}", animeID); if (!excludeFromWebCache) { CommandRequest_WebCacheSendXRefAniDBTvDB req = new CommandRequest_WebCacheSendXRefAniDBTvDB(xref.CrossRef_AniDB_TvDBV2ID); req.Save(); } } return(""); }
public static string LinkAniDBTrakt(ISession session, int animeID, enEpisodeType aniEpType, int aniEpNumber, string traktID, int seasonNumber, int traktEpNumber, bool excludeFromWebCache) { CrossRef_AniDB_TraktV2Repository repCrossRef = new CrossRef_AniDB_TraktV2Repository(); List<CrossRef_AniDB_TraktV2> xrefTemps = repCrossRef.GetByAnimeIDEpTypeEpNumber(session, animeID, (int)aniEpType, aniEpNumber); if (xrefTemps != null && xrefTemps.Count > 0) { foreach (CrossRef_AniDB_TraktV2 xrefTemp in xrefTemps) { // delete the existing one if we are updating TraktTVHelper.RemoveLinkAniDBTrakt(xrefTemp.AnimeID, (enEpisodeType)xrefTemp.AniDBStartEpisodeType, xrefTemp.AniDBStartEpisodeNumber, xrefTemp.TraktID, xrefTemp.TraktSeasonNumber, xrefTemp.TraktStartEpisodeNumber); } } // check if we have this information locally // if not download it now Trakt_ShowRepository repSeries = new Trakt_ShowRepository(); Trakt_Show traktShow = repSeries.GetByTraktSlug(traktID); if (traktShow == null) { // we download the series info here just so that we have the basic info in the // database before the queued task runs later TraktV2ShowExtended tvshow = GetShowInfoV2(traktID); } // download and update series info, episode info and episode images // will also download fanart, posters and wide banners // download fanart, posters DownloadAllImages(traktID); CrossRef_AniDB_TraktV2 xref = repCrossRef.GetByTraktID(session, traktID, seasonNumber, traktEpNumber, animeID, (int)aniEpType, aniEpNumber); if (xref == null) xref = new CrossRef_AniDB_TraktV2(); xref.AnimeID = animeID; xref.AniDBStartEpisodeType = (int)aniEpType; xref.AniDBStartEpisodeNumber = aniEpNumber; xref.TraktID = traktID; xref.TraktSeasonNumber = seasonNumber; xref.TraktStartEpisodeNumber = traktEpNumber; if (traktShow != null) xref.TraktTitle = traktShow.Title; if (excludeFromWebCache) xref.CrossRefSource = (int)CrossRefSource.WebCache; else xref.CrossRefSource = (int)CrossRefSource.User; repCrossRef.Save(xref); StatsCache.Instance.UpdateUsingAnime(animeID); logger.Trace("Changed trakt association: {0}", animeID); if (!excludeFromWebCache && ServerSettings.WebCache_Trakt_Send) { CommandRequest_WebCacheSendXRefAniDBTrakt req = new CommandRequest_WebCacheSendXRefAniDBTrakt(xref.CrossRef_AniDB_TraktV2ID); req.Save(); } return ""; }
public void Init(int animeID, string animeName, enEpisodeType aniEpType, int aniEpNumber, string traktID, int traktSeason, int traktEpNumber, string trakSeriesName, VM_AniDB_Anime anime, int?crossRef_AniDB_TraktV2ID) { Anime = anime; AnimeID = animeID; AnimeName = animeName; AnimeEpisodeType = (int)aniEpType; AnimeEpisodeNumber = aniEpNumber; TraktID = traktID; TraktSeason = traktSeason; TraktEpisodeNumber = traktEpNumber; TraktSeriesName = trakSeriesName; CrossRef_AniDB_TraktV2ID = crossRef_AniDB_TraktV2ID; AnimeURL = string.Format(Constants.URLS.AniDB_Series, AnimeID); TraktURL = string.Format(Constants.URLS.Trakt_Series, TraktID); bool hasSpecials = false; AniDBEpisodes = new List <VM_AniDB_Episode>(); foreach (VM_AniDB_Episode contract in VM_ShokoServer.Instance.ShokoServices.GetAniDBEpisodesForAnime(AnimeID).Cast <VM_AniDB_Episode>()) { AniDBEpisodes.Add(contract); if (contract.EpisodeType == (int)enEpisodeType.Special) { hasSpecials = true; } } cboEpisodeType.Items.Clear(); cboEpisodeType.Items.Add(Shoko.Commons.Properties.Resources.Anime_Episodes); if (hasSpecials) { cboEpisodeType.Items.Add(Shoko.Commons.Properties.Resources.Anime_Specials); } cboEpisodeType.SelectionChanged += new SelectionChangedEventHandler(cboEpisodeType_SelectionChanged); if (aniEpType == enEpisodeType.Episode) { cboEpisodeType.SelectedIndex = 0; } else { cboEpisodeType.SelectedIndex = 1; } // get the seasons try { cboSeasonNumber.Items.Clear(); List <int> seasons = null; if (anime.traktSummary.traktDetails.ContainsKey(traktID)) { traktDetails = anime.traktSummary.traktDetails[traktID]; seasons = anime.traktSummary.traktDetails[traktID].DictTraktSeasons.Keys.ToList(); } else { VM_ShokoServer.Instance.ShokoServices.UpdateTraktData(traktID); traktDetails = new VM_TraktDetails(traktID); seasons = traktDetails.DictTraktSeasons.Keys.ToList(); } int i = 0; int idx = 0; foreach (int season in seasons) { cboSeasonNumber.Items.Add(season.ToString()); if (season == traktSeason) { idx = i; } i++; } cboSeasonNumber.SelectionChanged += new SelectionChangedEventHandler(cboSeasonNumber_SelectionChanged); cboEpisodeNumber.SelectionChanged += new SelectionChangedEventHandler(cboEpisodeNumber_SelectionChanged); cboSeasonNumber.SelectedIndex = idx; } catch (Exception ex) { Utils.ShowErrorMessage(ex); } }
public void GetWatchedUnwatchedCount(enEpisodeType epType, ref int unwatched, ref int watched) { unwatched = 0; watched = 0; foreach (AnimeEpisodeVM ep in GetEpisodesByType(epType)) { if (ep.LocalFileCount == 0) continue; if (ep.Watched) watched++; else unwatched++; } }