Ejemplo n.º 1
0
        public override void ProcessCommand()
        {
            logger.Info("Processing CommandRequest_SyncMyVotes");

            try
            {
                AniDB_VoteRepository repVotes = new AniDB_VoteRepository();

                AniDBHTTPCommand_GetVotes cmd = new AniDBHTTPCommand_GetVotes();
                cmd.Init(ServerSettings.AniDB_Username, ServerSettings.AniDB_Password);
                enHelperActivityType ev = cmd.Process();
                if (ev == enHelperActivityType.GotVotesHTTP)
                {
                    foreach (Raw_AniDB_Vote_HTTP myVote in cmd.MyVotes)
                    {
                        List <AniDB_Vote> dbVotes  = repVotes.GetByEntity(myVote.EntityID);
                        AniDB_Vote        thisVote = null;
                        foreach (AniDB_Vote dbVote in dbVotes)
                        {
                            // we can only have anime permanent or anime temp but not both
                            if (myVote.VoteType == enAniDBVoteType.Anime || myVote.VoteType == enAniDBVoteType.AnimeTemp)
                            {
                                if (dbVote.VoteType == (int)enAniDBVoteType.Anime || dbVote.VoteType == (int)enAniDBVoteType.AnimeTemp)
                                {
                                    thisVote = dbVote;
                                }
                            }
                            else
                            {
                                thisVote = dbVote;
                            }
                        }

                        if (thisVote == null)
                        {
                            thisVote          = new AniDB_Vote();
                            thisVote.EntityID = myVote.EntityID;
                        }
                        thisVote.VoteType  = (int)myVote.VoteType;
                        thisVote.VoteValue = myVote.VoteValue;

                        repVotes.Save(thisVote);

                        if (myVote.VoteType == enAniDBVoteType.Anime || myVote.VoteType == enAniDBVoteType.AnimeTemp)
                        {
                            // download the anime info if the user doesn't already have it
                            CommandRequest_GetAnimeHTTP cmdAnime = new CommandRequest_GetAnimeHTTP(thisVote.EntityID, false, false);
                            cmdAnime.Save();
                        }
                    }

                    logger.Info("Processed Votes: {0} Items", cmd.MyVotes.Count);
                }
            }
            catch (Exception ex)
            {
                logger.Error("Error processing CommandRequest_SyncMyVotes: {0} ", ex.ToString());
                return;
            }
        }
        public override void ProcessCommand()
        {
            logger.Info("Processing CommandRequest_GetCalendar");

            try
            {
                // we will always assume that an anime was downloaded via http first
                ScheduledUpdateRepository repSched = new ScheduledUpdateRepository();
                AniDB_AnimeRepository     repAnime = new AniDB_AnimeRepository();

                ScheduledUpdate sched = repSched.GetByUpdateType((int)ScheduledUpdateType.AniDBCalendar);
                if (sched == null)
                {
                    sched               = new ScheduledUpdate();
                    sched.UpdateType    = (int)ScheduledUpdateType.AniDBCalendar;
                    sched.UpdateDetails = "";
                }
                else
                {
                    int freqHours = Utils.GetScheduledHours(ServerSettings.AniDB_Calendar_UpdateFrequency);

                    // if we have run this in the last 12 hours and are not forcing it, then exit
                    TimeSpan tsLastRun = DateTime.Now - sched.LastUpdate;
                    if (tsLastRun.TotalHours < freqHours)
                    {
                        if (!ForceRefresh)
                        {
                            return;
                        }
                    }
                }

                sched.LastUpdate = DateTime.Now;
                repSched.Save(sched);

                CalendarCollection colCalendars = JMMService.AnidbProcessor.GetCalendarUDP();
                if (colCalendars == null || colCalendars.Calendars == null)
                {
                    logger.Error("Could not get calendar from AniDB");
                    return;
                }
                foreach (AniDBAPI.Calendar cal in colCalendars.Calendars)
                {
                    AniDB_Anime anime = repAnime.GetByAnimeID(cal.AnimeID);
                    if (anime != null)
                    {
                        // don't update if the local data is less 2 days old
                        TimeSpan ts = DateTime.Now - anime.DateTimeUpdated;
                        if (ts.TotalDays >= 2)
                        {
                            CommandRequest_GetAnimeHTTP cmdAnime = new CommandRequest_GetAnimeHTTP(cal.AnimeID, true,
                                                                                                   false);
                            cmdAnime.Save();
                        }
                        else
                        {
                            // update the release date even if we don't update the anime record
                            if (anime.AirDate != cal.ReleaseDate)
                            {
                                anime.AirDate = cal.ReleaseDate;
                                repAnime.Save(anime);
                                AnimeSeriesRepository srepo = new AnimeSeriesRepository();
                                AnimeSeries           ser   = srepo.GetByAnimeID(anime.AnimeID);
                                if (ser != null)
                                {
                                    srepo.Save(ser, true, false);
                                }
                            }
                        }
                    }
                    else
                    {
                        CommandRequest_GetAnimeHTTP cmdAnime = new CommandRequest_GetAnimeHTTP(cal.AnimeID, true, false);
                        cmdAnime.Save();
                    }
                }
            }
            catch (Exception ex)
            {
                logger.ErrorException("Error processing CommandRequest_GetCalendar: " + ex.ToString(), ex);
                return;
            }
        }
Ejemplo n.º 3
0
        public override void ProcessCommand()
        {
            logger.Info("Processing CommandRequest_GetCalendar");

            try
            {
                // we will always assume that an anime was downloaded via http first
                ScheduledUpdateRepository repSched = new ScheduledUpdateRepository();
                AniDB_AnimeRepository repAnime = new AniDB_AnimeRepository();

                ScheduledUpdate sched = repSched.GetByUpdateType((int)ScheduledUpdateType.AniDBCalendar);
                if (sched == null)
                {
                    sched = new ScheduledUpdate();
                    sched.UpdateType = (int)ScheduledUpdateType.AniDBCalendar;
                    sched.UpdateDetails = "";
                }
                else
                {
                    int freqHours = Utils.GetScheduledHours(ServerSettings.AniDB_Calendar_UpdateFrequency);

                    // if we have run this in the last 12 hours and are not forcing it, then exit
                    TimeSpan tsLastRun = DateTime.Now - sched.LastUpdate;
                    if (tsLastRun.TotalHours < freqHours)
                    {
                        if (!ForceRefresh) return;
                    }
                }

                sched.LastUpdate = DateTime.Now;
                repSched.Save(sched);

                CalendarCollection colCalendars = JMMService.AnidbProcessor.GetCalendarUDP();
                if (colCalendars == null || colCalendars.Calendars == null)
                {
                    logger.Error("Could not get calendar from AniDB");
                    return;
                }
                foreach (AniDBAPI.Calendar cal in colCalendars.Calendars)
                {
                    AniDB_Anime anime = repAnime.GetByAnimeID(cal.AnimeID);
                    if (anime != null)
                    {
                        // don't update if the local data is less 2 days old
                        TimeSpan ts = DateTime.Now - anime.DateTimeUpdated;
                        if (ts.TotalDays >= 2)
                        {
                            CommandRequest_GetAnimeHTTP cmdAnime = new CommandRequest_GetAnimeHTTP(cal.AnimeID, true, false);
                            cmdAnime.Save();
                        }
                        else
                        {
                            // update the release date even if we don't update the anime record
                            anime.AirDate = cal.ReleaseDate;
                            repAnime.Save(anime);

                        }
                    }
                    else
                    {
                        CommandRequest_GetAnimeHTTP cmdAnime = new CommandRequest_GetAnimeHTTP(cal.AnimeID, true, false);
                        cmdAnime.Save();
                    }
                }
            }
            catch (Exception ex)
            {
                logger.ErrorException("Error processing CommandRequest_GetCalendar: " + ex.ToString(), ex);
                return;
            }
        }
Ejemplo n.º 4
0
		public override void ProcessCommand()
		{
			logger.Info("Processing CommandRequest_SyncMyVotes");

			try
			{
				AniDB_VoteRepository repVotes = new AniDB_VoteRepository();

				AniDBHTTPCommand_GetVotes cmd = new AniDBHTTPCommand_GetVotes();
				cmd.Init(ServerSettings.AniDB_Username, ServerSettings.AniDB_Password);
				enHelperActivityType ev = cmd.Process();
				if (ev == enHelperActivityType.GotVotesHTTP)
				{
					foreach (Raw_AniDB_Vote_HTTP myVote in cmd.MyVotes)
					{
						List<AniDB_Vote> dbVotes = repVotes.GetByEntity(myVote.EntityID);
						AniDB_Vote thisVote = null;
						foreach (AniDB_Vote dbVote in dbVotes)
						{
							// we can only have anime permanent or anime temp but not both
							if (myVote.VoteType == enAniDBVoteType.Anime || myVote.VoteType == enAniDBVoteType.AnimeTemp)
							{
								if (dbVote.VoteType == (int)enAniDBVoteType.Anime || dbVote.VoteType == (int)enAniDBVoteType.AnimeTemp)
								{
									thisVote = dbVote;
								}
							}
							else
							{
								thisVote = dbVote;
							}
						}

						if (thisVote == null)
						{
							thisVote = new AniDB_Vote();
							thisVote.EntityID = myVote.EntityID;
						}
						thisVote.VoteType = (int)myVote.VoteType;
						thisVote.VoteValue = myVote.VoteValue;

						repVotes.Save(thisVote);

						if (myVote.VoteType == enAniDBVoteType.Anime || myVote.VoteType == enAniDBVoteType.AnimeTemp)
						{
							// download the anime info if the user doesn't already have it
							CommandRequest_GetAnimeHTTP cmdAnime = new CommandRequest_GetAnimeHTTP(thisVote.EntityID, false, false);
							cmdAnime.Save();
						}
					}

					logger.Info("Processed Votes: {0} Items", cmd.MyVotes.Count);
				}
			}
			catch (Exception ex)
			{
				logger.Error("Error processing CommandRequest_SyncMyVotes: {0} ", ex.ToString());
				return;
			}
		}
Ejemplo n.º 5
0
        public override void ProcessCommand()
        {
            logger.Info("Processing CommandRequest_GetUpdated");

            try
            {
                List <int> animeIDsToUpdate         = new List <int>();
                ScheduledUpdateRepository repSched  = new ScheduledUpdateRepository();
                AnimeSeriesRepository     repSeries = new AnimeSeriesRepository();
                AniDB_AnimeRepository     repAnime  = new AniDB_AnimeRepository();

                // check the automated update table to see when the last time we ran this command
                ScheduledUpdate sched = repSched.GetByUpdateType((int)ScheduledUpdateType.AniDBUpdates);
                if (sched != null)
                {
                    int freqHours = Utils.GetScheduledHours(ServerSettings.AniDB_Anime_UpdateFrequency);

                    // if we have run this in the last 12 hours and are not forcing it, then exit
                    TimeSpan tsLastRun = DateTime.Now - sched.LastUpdate;
                    if (tsLastRun.TotalHours < freqHours)
                    {
                        if (!ForceRefresh)
                        {
                            return;
                        }
                    }
                }



                long webUpdateTime    = 0;
                long webUpdateTimeNew = 0;
                if (sched == null)
                {
                    // if this is the first time, lets ask for last 3 days
                    DateTime localTime = DateTime.Now.AddDays(-3);
                    DateTime utcTime   = localTime.ToUniversalTime();
                    webUpdateTime    = long.Parse(Utils.AniDBDate(utcTime));
                    webUpdateTimeNew = long.Parse(Utils.AniDBDate(DateTime.Now.ToUniversalTime()));

                    sched            = new ScheduledUpdate();
                    sched.UpdateType = (int)ScheduledUpdateType.AniDBUpdates;
                }
                else
                {
                    logger.Trace("Last anidb info update was : {0}", sched.UpdateDetails);
                    webUpdateTime    = long.Parse(sched.UpdateDetails);
                    webUpdateTimeNew = long.Parse(Utils.AniDBDate(DateTime.Now.ToUniversalTime()));

                    DateTime timeNow = DateTime.Now.ToUniversalTime();
                    logger.Info(string.Format("{0} since last UPDATED command",
                                              Utils.FormatSecondsToDisplayTime(int.Parse((webUpdateTimeNew - webUpdateTime).ToString()))));
                }

                // get a list of updates from AniDB
                // startTime will contain the date/time from which the updates apply to
                JMMService.AnidbProcessor.GetUpdated(ref animeIDsToUpdate, ref webUpdateTime);

                // now save the update time from AniDB
                // we will use this next time as a starting point when querying the web cache
                sched.LastUpdate    = DateTime.Now;
                sched.UpdateDetails = webUpdateTimeNew.ToString();
                repSched.Save(sched);

                if (animeIDsToUpdate.Count == 0)
                {
                    logger.Info("No anime to be updated");
                    return;
                }


                int countAnime  = 0;
                int countSeries = 0;
                foreach (int animeID in animeIDsToUpdate)
                {
                    // update the anime from HTTP
                    AniDB_Anime anime = repAnime.GetByAnimeID(animeID);
                    if (anime == null)
                    {
                        logger.Trace("No local record found for Anime ID: {0}, so skipping...", animeID);
                        continue;
                    }

                    logger.Info("Updating CommandRequest_GetUpdated: {0} ", animeID);

                    // but only if it hasn't been recently updated
                    TimeSpan ts = DateTime.Now - anime.DateTimeUpdated;
                    if (ts.TotalHours > 4)
                    {
                        CommandRequest_GetAnimeHTTP cmdAnime = new CommandRequest_GetAnimeHTTP(animeID, true, false);
                        cmdAnime.Save();
                        countAnime++;
                    }

                    // update the group status
                    // this will allow us to determine which anime has missing episodes
                    // so we wonly get by an amime where we also have an associated series
                    AnimeSeries ser = repSeries.GetByAnimeID(animeID);
                    if (ser != null)
                    {
                        CommandRequest_GetReleaseGroupStatus cmdStatus = new CommandRequest_GetReleaseGroupStatus(animeID, true);
                        cmdStatus.Save();
                        countSeries++;
                    }
                }

                logger.Info("Updating {0} anime records, and {1} group status records", countAnime, countSeries);
            }
            catch (Exception ex)
            {
                logger.Error("Error processing CommandRequest_GetUpdated: {0}", ex.ToString());
                return;
            }
        }
Ejemplo n.º 6
0
		private static void CreateTestCommandRequests()
		{
			CommandRequest_GetAnimeHTTP cr_anime = new CommandRequest_GetAnimeHTTP(5415, false, true);
			cr_anime.Save();

			/*
			cr_anime = new CommandRequest_GetAnimeHTTP(7382); cr_anime.Save();
			cr_anime = new CommandRequest_GetAnimeHTTP(6239); cr_anime.Save();
			cr_anime = new CommandRequest_GetAnimeHTTP(69); cr_anime.Save();
			cr_anime = new CommandRequest_GetAnimeHTTP(6751); cr_anime.Save();
			cr_anime = new CommandRequest_GetAnimeHTTP(3168); cr_anime.Save();
			cr_anime = new CommandRequest_GetAnimeHTTP(4196); cr_anime.Save();
			cr_anime = new CommandRequest_GetAnimeHTTP(634); cr_anime.Save();
			cr_anime = new CommandRequest_GetAnimeHTTP(2002); cr_anime.Save();


			
			cr_anime = new CommandRequest_GetAnimeHTTP(1); cr_anime.Save();
			cr_anime = new CommandRequest_GetAnimeHTTP(2); cr_anime.Save();
			cr_anime = new CommandRequest_GetAnimeHTTP(3); cr_anime.Save();
			cr_anime = new CommandRequest_GetAnimeHTTP(4); cr_anime.Save();
			cr_anime = new CommandRequest_GetAnimeHTTP(5); cr_anime.Save();
			cr_anime = new CommandRequest_GetAnimeHTTP(6); cr_anime.Save();
			cr_anime = new CommandRequest_GetAnimeHTTP(7); cr_anime.Save();
			cr_anime = new CommandRequest_GetAnimeHTTP(8); cr_anime.Save();
			cr_anime = new CommandRequest_GetAnimeHTTP(9); cr_anime.Save();
			cr_anime = new CommandRequest_GetAnimeHTTP(10); cr_anime.Save();
			cr_anime = new CommandRequest_GetAnimeHTTP(11); cr_anime.Save();
			cr_anime = new CommandRequest_GetAnimeHTTP(12); cr_anime.Save();
			cr_anime = new CommandRequest_GetAnimeHTTP(13); cr_anime.Save();
			cr_anime = new CommandRequest_GetAnimeHTTP(14); cr_anime.Save();
			cr_anime = new CommandRequest_GetAnimeHTTP(15); cr_anime.Save();
			cr_anime = new CommandRequest_GetAnimeHTTP(16); cr_anime.Save();
			cr_anime = new CommandRequest_GetAnimeHTTP(17); cr_anime.Save();
			cr_anime = new CommandRequest_GetAnimeHTTP(18); cr_anime.Save();
			cr_anime = new CommandRequest_GetAnimeHTTP(19); cr_anime.Save();*/
		}
Ejemplo n.º 7
0
		private void SendToAzure()
		{
			Dictionary<int, int> validAnimeIDs = new Dictionary<int, int>();

			string line;

			// Read the file and display it line by line.
			System.IO.StreamReader file =
			   new System.IO.StreamReader(@"e:\animetitles.txt");
			while ((line = file.ReadLine()) != null)
			{
				string[] titlesArray = line.Split('|');

				try
				{
					int aid = int.Parse(titlesArray[0]);
					validAnimeIDs[aid] = aid;
				}
				catch { }
			}

			file.Close();

			string aids = "9516,6719,9606,8751,7453,6969,7821,7738,6694,6854,6101,8267,9398,9369,7395,7687,7345,8748,6350,6437,6408,7824,6334,8976,4651,7329,6433,8750,9498,8306,6919,8598,6355,6084,6775,8482,6089,7441,7541,7130,9013,6299,6983,7740,6329,6401,9459,8458,8800,7290,8859,6957,8503,6057,7758,7086,7943,8007,8349,6858,7776,7194,8807,6822,8058,7274,6818,9309,9488,7564,9593,8906,6155,7191,7267,7861,7109,9617,7954,7944,6359,7877,7701,7447,8736,7260,8492,9107,9578,6843,7190,9036,7614,6404,6018,8895,6234,6855,7041,7504,6847,6889,7092,8672,9452,9086,8770,4515,8103,8100,8122,9441,7025,8403,6335,9607,8559,7193,7273,7553,6242,7108,7052,6171,9634,7846,8471,7772,7557,9597,7827,6039,6712,7784,7830,8330,6902,6187,8431,8258,7956,7373,8083,8130,7535,8003,8237,7153,8170,7439,8094,9332,6539,6773,6812,7220,7703,7406,7670,7876,8497,8407,7299,9299,7583,7825,7556,6950,8127,7147,7747,9009,6044,6393,6864,7616,9567,8612,6705,7139,7070,6804,7901,8133,7817,6596,6553,8073,6718,8303,7782,8724,6972,8671,6907,8030,7030,7141,6878,8036,8231,7594,6813,7920,7841,7922,7095,6927,6754,6936,7427,7497,9251,7253,8140,9601,6735,7160,7538,6893,7203,7346,6797,6516,8500,8245,8440,7863,7467,7975,8808,6277,6481,6733,8790,7117,7063,6924,8293,6208,6882,6892";
			string[] aidArray = aids.Split(',');

			logger.Info(string.Format("Queueing {0} anime updates", aidArray.Length));
			int cnt = 0;
			foreach (string animeid in aidArray)
			{
				if (validAnimeIDs.ContainsKey(int.Parse(animeid)))
				{
					CommandRequest_GetAnimeHTTP cmd = new CommandRequest_GetAnimeHTTP(int.Parse(animeid), true, false);
					cmd.Save();
					cnt++;
				}
			}
			logger.Info(string.Format("Queued {0} anime updates", cnt)); 
		}
Ejemplo n.º 8
0
        public override void ProcessCommand()
        {
            logger.Info("Processing CommandRequest_GetUpdated");

            try
            {
                List<int> animeIDsToUpdate = new List<int>();
                ScheduledUpdateRepository repSched = new ScheduledUpdateRepository();
                AnimeSeriesRepository repSeries = new AnimeSeriesRepository();
                AniDB_AnimeRepository repAnime = new AniDB_AnimeRepository();

                // check the automated update table to see when the last time we ran this command
                ScheduledUpdate sched = repSched.GetByUpdateType((int)ScheduledUpdateType.AniDBUpdates);
                if (sched != null)
                {
                    int freqHours = Utils.GetScheduledHours(ServerSettings.AniDB_Anime_UpdateFrequency);

                    // if we have run this in the last 12 hours and are not forcing it, then exit
                    TimeSpan tsLastRun = DateTime.Now - sched.LastUpdate;
                    if (tsLastRun.TotalHours < freqHours)
                    {
                        if (!ForceRefresh) return;
                    }
                }

                long webUpdateTime = 0;
                long webUpdateTimeNew = 0;
                if (sched == null)
                {
                    // if this is the first time, lets ask for last 3 days
                    DateTime localTime = DateTime.Now.AddDays(-3);
                    DateTime utcTime = localTime.ToUniversalTime();
                    webUpdateTime = long.Parse(Utils.AniDBDate(utcTime));
                    webUpdateTimeNew = long.Parse(Utils.AniDBDate(DateTime.Now.ToUniversalTime()));

                    sched = new ScheduledUpdate();
                    sched.UpdateType = (int)ScheduledUpdateType.AniDBUpdates;
                }
                else
                {
                    logger.Trace("Last anidb info update was : {0}", sched.UpdateDetails);
                    webUpdateTime = long.Parse(sched.UpdateDetails);
                    webUpdateTimeNew = long.Parse(Utils.AniDBDate(DateTime.Now.ToUniversalTime()));

                    DateTime timeNow = DateTime.Now.ToUniversalTime();
                    logger.Info(string.Format("{0} since last UPDATED command",
                        Utils.FormatSecondsToDisplayTime(int.Parse((webUpdateTimeNew -  webUpdateTime).ToString()))));
                }

                // get a list of updates from AniDB
                // startTime will contain the date/time from which the updates apply to
                JMMService.AnidbProcessor.GetUpdated(ref animeIDsToUpdate, ref webUpdateTime);

                // now save the update time from AniDB
                // we will use this next time as a starting point when querying the web cache
                sched.LastUpdate = DateTime.Now;
                sched.UpdateDetails = webUpdateTimeNew.ToString();
                repSched.Save(sched);

                if (animeIDsToUpdate.Count == 0)
                {
                    logger.Info("No anime to be updated");
                    return;
                }

                int countAnime = 0;
                int countSeries = 0;
                foreach (int animeID in animeIDsToUpdate)
                {
                    // update the anime from HTTP
                    AniDB_Anime anime = repAnime.GetByAnimeID(animeID);
                    if (anime == null)
                    {
                        logger.Trace("No local record found for Anime ID: {0}, so skipping...", animeID);
                        continue;
                    }

                    logger.Info("Updating CommandRequest_GetUpdated: {0} ", animeID);

                    // but only if it hasn't been recently updated
                    TimeSpan ts = DateTime.Now - anime.DateTimeUpdated;
                    if (ts.TotalHours > 4)
                    {
                        CommandRequest_GetAnimeHTTP cmdAnime = new CommandRequest_GetAnimeHTTP(animeID, true, false);
                        cmdAnime.Save();
                        countAnime++;
                    }

                    // update the group status
                    // this will allow us to determine which anime has missing episodes
                    // so we wonly get by an amime where we also have an associated series
                    AnimeSeries ser = repSeries.GetByAnimeID(animeID);
                    if (ser != null)
                    {
                        CommandRequest_GetReleaseGroupStatus cmdStatus = new CommandRequest_GetReleaseGroupStatus(animeID, true);
                        cmdStatus.Save();
                        countSeries++;
                    }

                }

                logger.Info("Updating {0} anime records, and {1} group status records", countAnime, countSeries);

            }
            catch (Exception ex)
            {
                logger.Error("Error processing CommandRequest_GetUpdated: {0}", ex.ToString());
                return;
            }
        }
Ejemplo n.º 9
0
		public static void RunImport_UpdateAllAniDB()
		{
			AniDB_AnimeRepository repAnime = new AniDB_AnimeRepository();
			foreach (AniDB_Anime anime in repAnime.GetAll())
			{
				CommandRequest_GetAnimeHTTP cmd = new CommandRequest_GetAnimeHTTP(anime.AnimeID, true, false);
				cmd.Save();
			}
		}
Ejemplo n.º 10
0
		public GroupStatusCollection GetReleaseGroupStatusUDP(int animeID)
		{
			if (!Login()) return null;

			enHelperActivityType ev = enHelperActivityType.NoSuchCreator;
			AniDBCommand_GetGroupStatus getCmd = null;
			lock (lockAniDBConnections)
			{
				Pause();

				getCmd = new AniDBCommand_GetGroupStatus();
				getCmd.Init(animeID);
				SetWaitingOnResponse(true);
				ev = getCmd.Process(ref soUdp, ref remoteIpEndPoint, curSessionID, new UnicodeEncoding(true, false));
				SetWaitingOnResponse(false);
			}

			if (ev == enHelperActivityType.GotGroupStatus && getCmd.GrpStatusCollection != null)
			{
				// delete existing records
				AniDB_GroupStatusRepository repGrpStat = new AniDB_GroupStatusRepository();
				AniDB_AnimeRepository repAnime = new AniDB_AnimeRepository();
				AniDB_EpisodeRepository repAniEp = new AniDB_EpisodeRepository();
				AnimeSeriesRepository repSeries = new AnimeSeriesRepository();

				repGrpStat.DeleteForAnime(animeID);

				// save the records
				foreach (Raw_AniDB_GroupStatus raw in getCmd.GrpStatusCollection.Groups)
				{
					AniDB_GroupStatus grpstat = new AniDB_GroupStatus(raw);
					repGrpStat.Save(grpstat);
				}

				// updated cached stats
				// we don't do it in the save method as it would be too many unecessary updates
				logger.Trace("Updating group stats by anime from GetReleaseGroupStatusUDP: {0}", animeID);
				StatsCache.Instance.UpdateUsingAnime(animeID);
				
				if (getCmd.GrpStatusCollection.LatestEpisodeNumber > 0)
				{
					// update the anime with a record of the latest subbed episode
					AniDB_Anime anime = repAnime.GetByAnimeID(animeID);
					if (anime != null)
					{
						anime.LatestEpisodeNumber = getCmd.GrpStatusCollection.LatestEpisodeNumber;
						repAnime.Save(anime);

						// check if we have this episode in the database
						// if not get it now by updating the anime record
						List<AniDB_Episode> eps = repAniEp.GetByAnimeIDAndEpisodeNumber(animeID, getCmd.GrpStatusCollection.LatestEpisodeNumber);
						if (eps.Count == 0)
						{
							CommandRequest_GetAnimeHTTP cr_anime = new CommandRequest_GetAnimeHTTP(animeID, true, false);
							cr_anime.Save();
						}

						// update the missing episode stats on groups and children
						AnimeSeries series = repSeries.GetByAnimeID(animeID);
						if (series != null)
						{
                            series.QueueUpdateStats();
							//series.TopLevelAnimeGroup.UpdateStatsFromTopLevel(true, true, true);
						}

					}
				}
			}

			return getCmd.GrpStatusCollection;
		}