Пример #1
0
        public Raw_AniDB_Episode GetEpisodeInfo(int episodeID)
        {
            if (!Login())
            {
                return(null);
            }

            enHelperActivityType        ev         = enHelperActivityType.NoSuchEpisode;
            AniDBCommand_GetEpisodeInfo getInfoCmd = null;

            lock (lockAniDBConnections)
            {
                getInfoCmd = new AniDBCommand_GetEpisodeInfo();
                getInfoCmd.Init(episodeID, true);
                SetWaitingOnResponse(true);
                ev = getInfoCmd.Process(ref soUdp, ref remoteIpEndPoint, curSessionID, new UnicodeEncoding(true, false));
                SetWaitingOnResponse(false);
            }

            if (ev == enHelperActivityType.GotEpisodeInfo && getInfoCmd != null && getInfoCmd.EpisodeInfo != null)
            {
                try
                {
                    logger.Trace("ProcessResult_GetEpisodeInfo: {0}", getInfoCmd.EpisodeInfo.ToString());
                    return(getInfoCmd.EpisodeInfo);
                }
                catch (Exception ex)
                {
                    logger.Error(ex.ToString());
                    return(null);
                }
            }

            return(null);
        }
Пример #2
0
        public bool AddFileToMyList(int animeID, int episodeNumber, ref DateTime?watchedDate)
        {
            if (!ServerSettings.AniDB_MyList_AddFiles)
            {
                return(false);
            }

            if (!Login())
            {
                return(false);
            }

            enHelperActivityType ev         = enHelperActivityType.NoSuchMyListFile;
            AniDBCommand_AddFile cmdAddFile = null;

            lock (lockAniDBConnections)
            {
                Pause();

                cmdAddFile = new AniDBCommand_AddFile();
                cmdAddFile.Init(animeID, episodeNumber, ServerSettings.AniDB_MyList_StorageState);
                SetWaitingOnResponse(true);
                ev = cmdAddFile.Process(ref soUdp, ref remoteIpEndPoint, curSessionID, new UnicodeEncoding(true, false));
                SetWaitingOnResponse(false);
            }

            // if the user already has this file on
            if (ev == enHelperActivityType.FileAlreadyExists && cmdAddFile.FileData != null)
            {
                watchedDate = cmdAddFile.WatchedDate;
                return(cmdAddFile.ReturnIsWatched);
            }

            return(false);
        }
Пример #3
0
        public bool GetUpdated(ref List <int> updatedAnimeIDs, ref long startTime)
        {
            //startTime = 0;
            updatedAnimeIDs = new List <int>();

            if (!Login())
            {
                return(false);
            }

            lock (lockAniDBConnections)
            {
                Pause();

                AniDBCommand_GetUpdated cmdUpdated = new AniDBCommand_GetUpdated();
                cmdUpdated.Init(startTime.ToString());
                SetWaitingOnResponse(true);
                enHelperActivityType ev = cmdUpdated.Process(ref soUdp, ref remoteIpEndPoint, curSessionID, new UnicodeEncoding(true, false));
                SetWaitingOnResponse(false);

                if (ev == enHelperActivityType.GotUpdated && cmdUpdated != null && cmdUpdated.RecordCount > 0)
                {
                    startTime       = long.Parse(cmdUpdated.StartTime);
                    updatedAnimeIDs = cmdUpdated.AnimeIDList;

                    return(true);
                }
            }

            return(false);
        }
Пример #4
0
        public AniDB_Review GetReviewUDP(int reviewID)
        {
            if (!Login())
            {
                return(null);
            }

            enHelperActivityType   ev  = enHelperActivityType.NoSuchReview;
            AniDBCommand_GetReview cmd = null;

            lock (lockAniDBConnections)
            {
                cmd = new AniDBCommand_GetReview();
                cmd.Init(reviewID);
                SetWaitingOnResponse(true);
                ev = cmd.Process(ref soUdp, ref remoteIpEndPoint, curSessionID, new UnicodeEncoding(true, false));
                SetWaitingOnResponse(false);
            }

            AniDB_Review review = null;

            if (ev == enHelperActivityType.GotReview && cmd.ReviewInfo != null)
            {
                review = RepoFactory.AniDB_Review.GetByReviewID(reviewID);
                if (review == null)
                {
                    review = new AniDB_Review();
                }

                review.Populate(cmd.ReviewInfo);
                RepoFactory.AniDB_Review.Save(review);
            }

            return(review);
        }
Пример #5
0
        public void UpdateMyListStats()
        {
            if (!Login())
            {
                return;
            }

            lock (lockAniDBConnections)
            {
                Pause();

                AniDBCommand_GetMyListStats cmdGetMylistStats = new AniDBCommand_GetMyListStats();
                cmdGetMylistStats.Init();
                SetWaitingOnResponse(true);
                enHelperActivityType ev = cmdGetMylistStats.Process(ref soUdp, ref remoteIpEndPoint, curSessionID, new UnicodeEncoding(true, false));
                SetWaitingOnResponse(false);
                if (ev == enHelperActivityType.GotMyListStats && cmdGetMylistStats.MyListStats != null)
                {
                    AniDB_MylistStatsRepository repStats = new AniDB_MylistStatsRepository();
                    AniDB_MylistStats           stat     = null;
                    List <AniDB_MylistStats>    allStats = repStats.GetAll();
                    if (allStats.Count == 0)
                    {
                        stat = new AniDB_MylistStats();
                    }
                    else
                    {
                        stat = allStats[0];
                    }

                    stat.Populate(cmdGetMylistStats.MyListStats);
                    repStats.Save(stat);
                }
            }
        }
Пример #6
0
        public CalendarCollection GetCalendarUDP()
        {
            if (!Login())
            {
                return(null);
            }

            enHelperActivityType     ev  = enHelperActivityType.CalendarEmpty;
            AniDBCommand_GetCalendar cmd = null;

            lock (lockAniDBConnections)
            {
                Pause();

                cmd = new AniDBCommand_GetCalendar();
                cmd.Init();
                SetWaitingOnResponse(true);
                ev = cmd.Process(ref soUdp, ref remoteIpEndPoint, curSessionID, new UnicodeEncoding(true, false));
                SetWaitingOnResponse(false);
            }

            if (ev == enHelperActivityType.GotCalendar && cmd.Calendars != null)
            {
                return(cmd.Calendars);
            }

            return(null);
        }
Пример #7
0
        /// <summary>
        /// This is for generic files (manually linked)
        /// </summary>
        /// <param name="animeID"></param>
        /// <param name="episodeNumber"></param>
        /// <param name="watched"></param>
        public void UpdateMyListFileStatus(int animeID, int episodeNumber, bool watched)
        {
            if (!ServerSettings.AniDB_MyList_AddFiles)
            {
                return;
            }

            if (!Login())
            {
                return;
            }

            lock (lockAniDBConnections)
            {
                Pause();

                AniDBCommand_UpdateFile cmdUpdateFile = new AniDBCommand_UpdateFile();
                cmdUpdateFile.Init(animeID, episodeNumber, watched, true);
                SetWaitingOnResponse(true);
                enHelperActivityType ev = cmdUpdateFile.Process(ref soUdp, ref remoteIpEndPoint, curSessionID, new UnicodeEncoding(true, false));
                SetWaitingOnResponse(false);
                if (ev == enHelperActivityType.NoSuchMyListFile && watched)
                {
                    // the file is not actually on the user list, so let's add it
                    // we do this by issueing the same command without the edit flag
                    cmdUpdateFile = new AniDBCommand_UpdateFile();
                    cmdUpdateFile.Init(animeID, episodeNumber, watched, false);
                    ev = cmdUpdateFile.Process(ref soUdp, ref remoteIpEndPoint, curSessionID, new UnicodeEncoding(true, false));
                }
            }
        }
Пример #8
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;
            }
        }
Пример #9
0
        public bool DeleteFileFromMyList(int fileID)
        {
            if (!ServerSettings.AniDB_MyList_AddFiles)
            {
                return(false);
            }

            if (!Login())
            {
                return(false);
            }

            enHelperActivityType    ev         = enHelperActivityType.NoSuchMyListFile;
            AniDBCommand_DeleteFile cmdDelFile = null;

            lock (lockAniDBConnections)
            {
                Pause();

                cmdDelFile = new AniDBCommand_DeleteFile();
                cmdDelFile.Init(fileID);
                SetWaitingOnResponse(true);
                ev = cmdDelFile.Process(ref soUdp, ref remoteIpEndPoint, curSessionID, new UnicodeEncoding(true, false));
                SetWaitingOnResponse(false);
            }

            return(true);
        }
Пример #10
0
        // NO LONGER USED

        /*public AniDB_Seiyuu GetCreatorInfoUDP(int creatorID)
         *      {
         *              if (!Login()) return null;
         *
         *              enHelperActivityType ev = enHelperActivityType.NoSuchCreator;
         *              AniDBCommand_GetCreatorInfo getCreatorCmd = null;
         *              lock (lockAniDBConnections)
         *              {
         *                      Pause();
         *
         *                      getCreatorCmd = new AniDBCommand_GetCreatorInfo();
         *                      getCreatorCmd.Init(creatorID, true);
         *                      ev = getCreatorCmd.Process(ref soUdp, ref remoteIpEndPoint, curSessionID, new UnicodeEncoding(true, false));
         *              }
         *
         *              AniDB_Seiyuu chr = null;
         *              if (ev == enHelperActivityType.GotCreatorInfo && getCreatorCmd.CreatorInfo != null)
         *              {
         *                      AniDB_CreatorRepository repCreator = new AniDB_CreatorRepository();
         *                      chr = repCreator.GetByCreatorID(creatorID);
         *                      if (chr == null) chr = new AniDB_Seiyuu();
         *
         *                      chr.Populate(getCreatorCmd.CreatorInfo);
         *                      repCreator.Save(chr);
         *              }
         *
         *              return chr;
         *      }*/

        public AniDB_ReleaseGroup GetReleaseGroupUDP(int groupID)
        {
            if (!Login())
            {
                return(null);
            }

            enHelperActivityType  ev     = enHelperActivityType.NoSuchGroup;
            AniDBCommand_GetGroup getCmd = null;

            lock (lockAniDBConnections)
            {
                getCmd = new AniDBCommand_GetGroup();
                getCmd.Init(groupID);
                SetWaitingOnResponse(true);
                ev = getCmd.Process(ref soUdp, ref remoteIpEndPoint, curSessionID, new UnicodeEncoding(true, false));
                SetWaitingOnResponse(false);
            }

            AniDB_ReleaseGroup relGroup = null;

            if (ev == enHelperActivityType.GotGroup && getCmd.Group != null)
            {
                relGroup = RepoFactory.AniDB_ReleaseGroup.GetByGroupID(groupID);
                if (relGroup == null)
                {
                    relGroup = new AniDB_ReleaseGroup();
                }

                relGroup.Populate(getCmd.Group);
                RepoFactory.AniDB_ReleaseGroup.Save(relGroup);
            }

            return(relGroup);
        }
Пример #11
0
        public AniDB_Character GetCharacterInfoUDP(int charID)
        {
            if (!Login())
            {
                return(null);
            }

            enHelperActivityType          ev         = enHelperActivityType.NoSuchChar;
            AniDBCommand_GetCharacterInfo getCharCmd = null;

            lock (lockAniDBConnections)
            {
                getCharCmd = new AniDBCommand_GetCharacterInfo();
                getCharCmd.Init(charID, true);
                SetWaitingOnResponse(true);
                ev = getCharCmd.Process(ref soUdp, ref remoteIpEndPoint, curSessionID, new UnicodeEncoding(true, false));
                SetWaitingOnResponse(false);
            }

            AniDB_Character chr = null;

            if (ev == enHelperActivityType.GotCharInfo && getCharCmd.CharInfo != null)
            {
                chr = RepoFactory.AniDB_Character.GetByCharID(charID);
                if (chr == null)
                {
                    chr = new AniDB_Character();
                }

                chr.PopulateFromUDP(getCharCmd.CharInfo);
                RepoFactory.AniDB_Character.Save(chr);
            }

            return(chr);
        }
Пример #12
0
        public AniDB_Anime GetAnimeInfoUDP(int animeID, bool forceRefresh)
        {
            AniDB_Anime anime = null;

            bool skip = true;

            if (forceRefresh)
            {
                skip = false;
            }
            else
            {
                anime = RepoFactory.AniDB_Anime.GetByAnimeID(animeID);
                if (anime == null)
                {
                    skip = false;
                }
            }

            if (skip)
            {
                if (anime == null)
                {
                    anime = RepoFactory.AniDB_Anime.GetByAnimeID(animeID);
                }

                return(anime);
            }

            if (!Login())
            {
                return(null);
            }

            enHelperActivityType      ev          = enHelperActivityType.NoSuchAnime;
            AniDBCommand_GetAnimeInfo getAnimeCmd = null;

            lock (lockAniDBConnections)
            {
                getAnimeCmd = new AniDBCommand_GetAnimeInfo();
                getAnimeCmd.Init(animeID, forceRefresh);
                SetWaitingOnResponse(true);
                ev = getAnimeCmd.Process(ref soUdp, ref remoteIpEndPoint, curSessionID, new UnicodeEncoding(true, false));
                SetWaitingOnResponse(false);
            }

            if (ev == enHelperActivityType.GotAnimeInfo && getAnimeCmd.AnimeInfo != null)
            {
                // check for an existing record so we don't over write the description
                anime = RepoFactory.AniDB_Anime.GetByAnimeID(getAnimeCmd.AnimeInfo.AnimeID);
                if (anime == null)
                {
                    anime = new AniDB_Anime();
                }

                anime.PopulateAndSaveFromUDP(getAnimeCmd.AnimeInfo);
            }

            return(anime);
        }
Пример #13
0
        public static void PopulateMyListIDs()
        {
            // Get the list from AniDB
            AniDBHTTPCommand_GetMyList cmd = new AniDBHTTPCommand_GetMyList();

            cmd.Init(ServerSettings.AniDB_Username, ServerSettings.AniDB_Password);
            enHelperActivityType ev = cmd.Process();

            if (ev != enHelperActivityType.GotMyListHTTP)
            {
                logger.Warn("AniDB did not return a successful code: " + ev);
                return;
            }
            // Add missing files on AniDB
            var onlineFiles  = cmd.MyListItems.ToLookup(a => a.FileID);
            var dictAniFiles = RepoFactory.AniDB_File.GetAll().ToLookup(a => a.Hash);

            var list  = RepoFactory.VideoLocal.GetAll().Where(a => !string.IsNullOrEmpty(a.Hash)).ToList();
            int count = 0;

            foreach (SVR_VideoLocal vid in list)
            {
                count++;
                if (count % 10 == 0)
                {
                    ServerState.Instance.CurrentSetupStatus = string.Format(
                        Commons.Properties.Resources.Database_Validating, "Populating MyList IDs (this will help solve MyList issues)",
                        $" {count}/{list.Count}");
                }

                // Does it have a linked AniFile
                if (!dictAniFiles.Contains(vid.Hash))
                {
                    continue;
                }

                int fileID = dictAniFiles[vid.Hash].FirstOrDefault()?.FileID ?? 0;
                if (fileID == 0)
                {
                    continue;
                }
                // Is it in MyList
                if (!onlineFiles.Contains(fileID))
                {
                    continue;
                }

                Raw_AniDB_MyListFile file = onlineFiles[fileID].FirstOrDefault(a => a != null && a.ListID != 0);
                if (file == null || vid.MyListID != 0)
                {
                    continue;
                }

                vid.MyListID = file.ListID;
                RepoFactory.VideoLocal.Save(vid);
            }
        }
Пример #14
0
        public bool VoteAnime(int animeID, decimal voteValue, enAniDBVoteType voteType)
        {
            if (!Login())
            {
                return(false);
            }

            enHelperActivityType ev      = enHelperActivityType.NoSuchVote;
            AniDBCommand_Vote    cmdVote = null;

            AniDB_VoteRepository repVotes = new AniDB_VoteRepository();

            lock (lockAniDBConnections)
            {
                Pause();

                cmdVote = new AniDBCommand_Vote();
                cmdVote.Init(animeID, voteValue, voteType);
                SetWaitingOnResponse(true);
                ev = cmdVote.Process(ref soUdp, ref remoteIpEndPoint, curSessionID, new UnicodeEncoding(true, false));
                SetWaitingOnResponse(false);
                if (ev == enHelperActivityType.Voted || ev == enHelperActivityType.VoteUpdated)
                {
                    List <AniDB_Vote> dbVotes  = repVotes.GetByEntity(cmdVote.EntityID);
                    AniDB_Vote        thisVote = null;
                    foreach (AniDB_Vote dbVote in dbVotes)
                    {
                        // we can only have anime permanent or anime temp but not both
                        if (cmdVote.VoteType == enAniDBVoteType.Anime || cmdVote.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 = cmdVote.EntityID;
                    }
                    thisVote.VoteType  = (int)cmdVote.VoteType;
                    thisVote.VoteValue = cmdVote.VoteValue;
                    repVotes.Save(thisVote);
                }
            }

            return(false);
        }
Пример #15
0
        public bool Login()
        {
            // check if we are already logged in
            if (isLoggedOn)
            {
                return(true);
            }

            if (!ValidAniDBCredentials())
            {
                return(false);
            }

            AniDBCommand_Login login = new AniDBCommand_Login();

            login.Init(userName, password);

            string msg = login.commandText.Replace(userName, "******");

            msg = msg.Replace(password, "******");
            logger.Trace("udp command: {0}", msg);
            SetWaitingOnResponse(true);
            enHelperActivityType ev = login.Process(ref soUdp, ref remoteIpEndPoint, curSessionID, new UnicodeEncoding(true, false));

            SetWaitingOnResponse(false);

            if (login.errorOccurred)
            {
                logger.Trace("error in login: {0}", login.errorMessage);
            }
            //else
            //	logger.Info("socketResponse: {0}", login.socketResponse);

            Thread.Sleep(2200);

            if (ev != enHelperActivityType.LoggedIn)
            {
                //BaseConfig.MyAnimeLog.Write("ProcessCommands: Login Failed!");
                //OnAniDBStatusEvent(new AniDBStatusEventArgs(enHelperActivityType.LoginFailed, ""));
                //aniDBCommands.Clear();
                //OnQueueUpdateEvent(new QueueUpdateEventArgs(this.QueueCount));
                // this will exit the thread
                return(false);
            }
            else
            {
                curSessionID          = login.SessionID;
                encoding              = login.Encoding;
                this.isLoggedOn       = true;
                this.IsInvalidSession = false;
                return(true);
            }
        }
Пример #16
0
        public Raw_AniDB_File GetFileInfo(IHash vidLocal)
        {
            if (!Login())
            {
                return(null);
            }

            enHelperActivityType     ev         = enHelperActivityType.NoSuchFile;
            AniDBCommand_GetFileInfo getInfoCmd = null;

            lock (lockAniDBConnections)
            {
                Pause(AniDBPause.Short);

                getInfoCmd = new AniDBCommand_GetFileInfo();
                getInfoCmd.Init(vidLocal, true);
                SetWaitingOnResponse(true);
                ev = getInfoCmd.Process(ref soUdp, ref remoteIpEndPoint, curSessionID, new UnicodeEncoding(true, false));
                SetWaitingOnResponse(false);
            }

            if (ev == enHelperActivityType.GotFileInfo && getInfoCmd != null && getInfoCmd.fileInfo != null)
            {
                try
                {
                    logger.Trace("ProcessResult_GetFileInfo: {0}", getInfoCmd.fileInfo.ToString());

                    if (ServerSettings.AniDB_DownloadReleaseGroups)
                    {
                        CommandRequest_GetReleaseGroup cmdRelgrp = new CommandRequest_GetReleaseGroup(getInfoCmd.fileInfo.GroupID, false);
                        cmdRelgrp.Save();
                    }



                    return(getInfoCmd.fileInfo);
                }
                catch (Exception ex)
                {
                    logger.Error(ex.ToString());
                    return(null);
                }
            }

            return(null);
        }
Пример #17
0
        public bool MarkFileAsDeleted(string hash, long fileSize)
        {
            if (!Login())
            {
                return(false);
            }

            enHelperActivityType           ev         = enHelperActivityType.NoSuchMyListFile;
            AniDBCommand_MarkFileAsDeleted cmdDelFile = null;

            lock (lockAniDBConnections)
            {
                cmdDelFile = new AniDBCommand_MarkFileAsDeleted();
                cmdDelFile.Init(hash, fileSize);
                SetWaitingOnResponse(true);
                ev = cmdDelFile.Process(ref soUdp, ref remoteIpEndPoint, curSessionID, new UnicodeEncoding(true, false));
                SetWaitingOnResponse(false);
            }

            return(true);
        }
Пример #18
0
        public void GetMyListFileStatus(int aniDBFileID)
        {
            if (!ServerSettings.AniDB_MyList_ReadWatched)
            {
                return;
            }

            if (!Login())
            {
                return;
            }

            lock (lockAniDBConnections)
            {
                AniDBCommand_GetMyListFileInfo cmdGetFileStatus = new AniDBCommand_GetMyListFileInfo();
                cmdGetFileStatus.Init(aniDBFileID);
                SetWaitingOnResponse(true);
                enHelperActivityType ev = cmdGetFileStatus.Process(ref soUdp, ref remoteIpEndPoint, curSessionID,
                                                                   new UnicodeEncoding(true, false));
                SetWaitingOnResponse(false);
            }
        }
Пример #19
0
        internal bool MarkFileAsUnknown(string Hash, long FileSize)
        {
            if (!Login())
            {
                return(false);
            }

            enHelperActivityType           ev = enHelperActivityType.NoSuchMyListFile;
            AniDBCommand_MarkFileAsUnknown cmdMarkFileUnknown = null;

            lock (lockAniDBConnections)
            {
                cmdMarkFileUnknown = new AniDBCommand_MarkFileAsUnknown();
                cmdMarkFileUnknown.Init(Hash, FileSize);
                SetWaitingOnResponse(true);
                ev = cmdMarkFileUnknown.Process(ref soUdp, ref remoteIpEndPoint, curSessionID,
                                                new UnicodeEncoding(true, false));
                SetWaitingOnResponse(false);
            }

            return(true);
        }
Пример #20
0
        public override void ProcessCommand()
        {
            logger.Info("Processing CommandRequest_SyncMyList");

            try
            {
                // we will always assume that an anime was downloaded via http first
                ScheduledUpdateRepository repSched     = new ScheduledUpdateRepository();
                AniDB_FileRepository      repAniFile   = new AniDB_FileRepository();
                VideoLocalRepository      repVidLocals = new VideoLocalRepository();

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

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

                AniDBHTTPCommand_GetMyList cmd = new AniDBHTTPCommand_GetMyList();
                cmd.Init(ServerSettings.AniDB_Username, ServerSettings.AniDB_Password);
                enHelperActivityType ev = cmd.Process();
                if (ev == enHelperActivityType.GotMyListHTTP && cmd.MyListItems.Count > 1)
                {
                    int    totalItems    = 0;
                    int    watchedItems  = 0;
                    int    modifiedItems = 0;
                    double pct           = 0;

                    // 2. find files locally for the user, which are not recorded on anidb
                    //    and then add them to anidb
                    Dictionary <int, Raw_AniDB_MyListFile> onlineFiles = new Dictionary <int, Raw_AniDB_MyListFile>();
                    foreach (Raw_AniDB_MyListFile myitem in cmd.MyListItems)
                    {
                        onlineFiles[myitem.FileID] = myitem;
                    }

                    Dictionary <string, AniDB_File> dictAniFiles = new Dictionary <string, AniDB_File>();
                    List <AniDB_File> allAniFiles = repAniFile.GetAll();
                    foreach (AniDB_File anifile in allAniFiles)
                    {
                        dictAniFiles[anifile.Hash] = anifile;
                    }

                    int missingFiles = 0;
                    foreach (VideoLocal vid in repVidLocals.GetAll())
                    {
                        if (!dictAniFiles.ContainsKey(vid.Hash))
                        {
                            continue;
                        }

                        int fileID = dictAniFiles[vid.Hash].FileID;

                        if (!onlineFiles.ContainsKey(fileID))
                        {
                            // means we have found a file in our local collection, which is not recorded online
                            CommandRequest_AddFileToMyList cmdAddFile = new CommandRequest_AddFileToMyList(vid.Hash);
                            cmdAddFile.Save();
                            missingFiles++;
                        }
                    }
                    logger.Info(string.Format("MYLIST Missing Files: {0} Added to queue for inclusion", missingFiles));

                    JMMUserRepository repUsers   = new JMMUserRepository();
                    List <JMMUser>    aniDBUsers = repUsers.GetAniDBUsers();

                    VideoLocal_UserRepository       repVidUsers = new VideoLocal_UserRepository();
                    CrossRef_File_EpisodeRepository repFileEp   = new CrossRef_File_EpisodeRepository();

                    // 1 . sync mylist items
                    foreach (Raw_AniDB_MyListFile myitem in cmd.MyListItems)
                    {
                        // ignore files mark as deleted by the user
                        if (myitem.State == (int)AniDBFileStatus.Deleted)
                        {
                            continue;
                        }

                        totalItems++;
                        if (myitem.IsWatched)
                        {
                            watchedItems++;
                        }

                        //calculate percentage
                        pct = (double)totalItems / (double)cmd.MyListItems.Count * (double)100;
                        string spct = pct.ToString("#0.0");

                        string hash = string.Empty;

                        AniDB_File anifile = repAniFile.GetByFileID(myitem.FileID);
                        if (anifile != null)
                        {
                            hash = anifile.Hash;
                        }
                        else
                        {
                            // look for manually linked files
                            List <CrossRef_File_Episode> xrefs = repFileEp.GetByEpisodeID(myitem.EpisodeID);
                            foreach (CrossRef_File_Episode xref in xrefs)
                            {
                                if (xref.CrossRefSource != (int)CrossRefSource.AniDB)
                                {
                                    hash = xref.Hash;
                                    break;
                                }
                            }
                        }


                        if (!string.IsNullOrEmpty(hash))
                        {
                            // find the video associated with this record
                            VideoLocal vl = repVidLocals.GetByHash(hash);
                            if (vl == null)
                            {
                                continue;
                            }

                            foreach (JMMUser juser in aniDBUsers)
                            {
                                bool localStatus = false;
                                int? jmmUserID   = null;

                                // doesn't matter which anidb user we use
                                jmmUserID = juser.JMMUserID;
                                VideoLocal_User userRecord = vl.GetUserRecord(juser.JMMUserID);
                                if (userRecord != null)
                                {
                                    localStatus = true;
                                }

                                string action = "";
                                if (localStatus != myitem.IsWatched)
                                {
                                    if (localStatus == true)
                                    {
                                        // local = watched, anidb = unwatched
                                        if (ServerSettings.AniDB_MyList_ReadUnwatched)
                                        {
                                            modifiedItems++;
                                            if (jmmUserID.HasValue)
                                            {
                                                vl.ToggleWatchedStatus(myitem.IsWatched, false, myitem.WatchedDate,
                                                                       false, false, jmmUserID.Value, false,
                                                                       true);
                                            }
                                            action = "Used AniDB Status";
                                        }
                                    }
                                    else
                                    {
                                        // means local is un-watched, and anidb is watched
                                        if (ServerSettings.AniDB_MyList_ReadWatched)
                                        {
                                            modifiedItems++;
                                            if (jmmUserID.HasValue)
                                            {
                                                vl.ToggleWatchedStatus(true, false, myitem.WatchedDate, false, false,
                                                                       jmmUserID.Value, false, true);
                                            }
                                            action = "Updated Local record to Watched";
                                        }
                                    }

                                    string msg =
                                        string.Format(
                                            "MYLISTDIFF:: File {0} - Local Status = {1}, AniDB Status = {2} --- {3}",
                                            vl.FullServerPath, localStatus, myitem.IsWatched, action);
                                    logger.Info(msg);
                                }
                            }


                            //string msg = string.Format("MYLIST:: File {0} - Local Status = {1}, AniDB Status = {2} --- {3}",
                            //	vl.FullServerPath, localStatus, myitem.IsWatched, action);
                            //logger.Info(msg);
                        }
                    }


                    // now update all stats
                    Importer.UpdateAllStats();

                    logger.Info("Process MyList: {0} Items, {1} Watched, {2} Modified", totalItems, watchedItems,
                                modifiedItems);

                    sched.LastUpdate = DateTime.Now;
                    repSched.Save(sched);
                }
            }
            catch (Exception ex)
            {
                logger.Error("Error processing CommandRequest_SyncMyList: {0} ", ex.ToString());
                return;
            }
        }
Пример #21
0
        public static void PopulateMyListIDs()
        {
            // Don't bother with no AniDB creds, we assume first run
            if (!ShokoService.AnidbProcessor.ValidAniDBCredentials())
            {
                return;
            }

            // Don't even bother on new DBs
            using (var session = DatabaseFactory.SessionFactory.OpenSession())
            {
                long vlCount = session.CreateSQLQuery("SELECT COUNT(VideoLocalID) FROM VideoLocal").UniqueResult <long>();
                if (vlCount == 0)
                {
                    return;
                }
            }

            // Get the list from AniDB
            AniDBHTTPCommand_GetMyList cmd = new AniDBHTTPCommand_GetMyList();

            cmd.Init(ServerSettings.Instance.AniDb.Username, ServerSettings.Instance.AniDb.Password);
            enHelperActivityType ev = cmd.Process();

            if (ev != enHelperActivityType.GotMyListHTTP)
            {
                logger.Warn("AniDB did not return a successful code: " + ev);
                return;
            }
            // Add missing files on AniDB
            var onlineFiles  = cmd.MyListItems.ToLookup(a => a.FileID);
            var dictAniFiles = RepoFactory.AniDB_File.GetAll().ToLookup(a => a.Hash);

            var list  = RepoFactory.VideoLocal.GetAll().Where(a => !string.IsNullOrEmpty(a.Hash)).ToList();
            int count = 0;

            foreach (SVR_VideoLocal vid in list)
            {
                count++;
                if (count % 10 == 0)
                {
                    ServerState.Instance.CurrentSetupStatus = string.Format(
                        Commons.Properties.Resources.Database_Validating, "Populating MyList IDs (this will help solve MyList issues)",
                        $" {count}/{list.Count}");
                }

                // Does it have a linked AniFile
                if (!dictAniFiles.Contains(vid.Hash))
                {
                    continue;
                }

                int fileID = dictAniFiles[vid.Hash].FirstOrDefault()?.FileID ?? 0;
                if (fileID == 0)
                {
                    continue;
                }
                // Is it in MyList
                if (!onlineFiles.Contains(fileID))
                {
                    continue;
                }

                Raw_AniDB_MyListFile file = onlineFiles[fileID].FirstOrDefault(a => a != null && a.ListID != 0);
                if (file == null || vid.MyListID != 0)
                {
                    continue;
                }

                vid.MyListID = file.ListID;
                RepoFactory.VideoLocal.Save(vid);
            }
        }
        public override void ProcessCommand()
        {
            logger.Info("Processing CommandRequest_SyncMyVotes");

            try
            {
                AniDBHTTPCommand_GetVotes cmd = new AniDBHTTPCommand_GetVotes();
                cmd.Init(ServerSettings.Instance.AniDb.Username, ServerSettings.Instance.AniDb.Password);
                enHelperActivityType ev = cmd.Process();
                if (ev == enHelperActivityType.GotVotesHTTP)
                {
                    foreach (Raw_AniDB_Vote_HTTP myVote in cmd.MyVotes)
                    {
                        List <AniDB_Vote> dbVotes  = Repo.Instance.AniDB_Vote.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 == AniDBVoteType.Anime || myVote.VoteType == AniDBVoteType.AnimeTemp)
                            {
                                if (dbVote.VoteType == (int)AniDBVoteType.Anime || dbVote.VoteType == (int)AniDBVoteType.AnimeTemp)
                                {
                                    thisVote = dbVote;
                                }
                            }
                            else
                            {
                                thisVote = dbVote;
                            }
                        }

                        using (var upd = Repo.Instance.AniDB_Vote.BeginAddOrUpdate(
                                   () => thisVote,
                                   () => new AniDB_Vote {
                            EntityID = myVote.EntityID
                        }
                                   ))
                        {
                            upd.Entity.VoteType  = (int)myVote.VoteType;
                            upd.Entity.VoteValue = myVote.VoteValue;

                            upd.Commit();
                        }

                        if (myVote.VoteType == AniDBVoteType.Anime || myVote.VoteType == AniDBVoteType.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);
            }
        }
Пример #23
0
        public override void ProcessCommand()
        {
            logger.Info("Processing CommandRequest_SyncMyList");

            try
            {
                // we will always assume that an anime was downloaded via http first
                ScheduledUpdate sched =
                    RepoFactory.ScheduledUpdate.GetByUpdateType((int)ScheduledUpdateType.AniDBMyListSync);
                if (sched == null)
                {
                    sched = new ScheduledUpdate
                    {
                        UpdateType    = (int)ScheduledUpdateType.AniDBMyListSync,
                        UpdateDetails = string.Empty
                    };
                }
                else
                {
                    int freqHours = Utils.GetScheduledHours(ServerSettings.AniDB_MyList_UpdateFrequency);

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

                // Get the list from AniDB
                AniDBHTTPCommand_GetMyList cmd = new AniDBHTTPCommand_GetMyList();
                cmd.Init(ServerSettings.AniDB_Username, ServerSettings.AniDB_Password);
                enHelperActivityType ev = cmd.Process();
                if (ev != enHelperActivityType.GotMyListHTTP)
                {
                    logger.Warn("AniDB did not return a successful code: " + ev);
                    return;
                }

                int    totalItems    = 0;
                int    watchedItems  = 0;
                int    modifiedItems = 0;
                double pct           = 0;

                // Add missing files on AniDB
                var onlineFiles  = cmd.MyListItems.ToLookup(a => a.FileID);
                var dictAniFiles = RepoFactory.AniDB_File.GetAll().ToLookup(a => a.Hash);

                int missingFiles = 0;
                foreach (SVR_VideoLocal vid in RepoFactory.VideoLocal.GetAll()
                         .Where(a => !string.IsNullOrEmpty(a.Hash)).ToList())
                {
                    // Does it have a linked AniFile
                    if (!dictAniFiles.Contains(vid.Hash))
                    {
                        continue;
                    }

                    int fileID = dictAniFiles[vid.Hash].FirstOrDefault()?.FileID ?? 0;
                    if (fileID == 0)
                    {
                        continue;
                    }
                    // Is it in MyList
                    if (onlineFiles.Contains(fileID))
                    {
                        Raw_AniDB_MyListFile file = onlineFiles[fileID].FirstOrDefault(a => a != null);

                        // Update file state if deleted
                        if (file != null && file.State != (int)ServerSettings.AniDB_MyList_StorageState)
                        {
                            int seconds = Commons.Utils.AniDB.GetAniDBDateAsSeconds(file.WatchedDate);
                            CommandRequest_UpdateMyListFileStatus cmdUpdateFile =
                                new CommandRequest_UpdateMyListFileStatus(vid.Hash, file.WatchedDate.HasValue, false,
                                                                          seconds);
                            cmdUpdateFile.Save();
                        }
                        else if (file != null)
                        {
                            continue;
                        }
                    }

                    // means we have found a file in our local collection, which is not recorded online
                    if (ServerSettings.AniDB_MyList_AddFiles)
                    {
                        CommandRequest_AddFileToMyList cmdAddFile = new CommandRequest_AddFileToMyList(vid.Hash);
                        cmdAddFile.Save();
                    }
                    missingFiles++;
                }
                logger.Info($"MYLIST Missing Files: {missingFiles} Added to queue for inclusion");

                List <SVR_JMMUser> aniDBUsers = RepoFactory.JMMUser.GetAniDBUsers();
                LinkedHashSet <SVR_AnimeSeries> modifiedSeries = new LinkedHashSet <SVR_AnimeSeries>();

                // Remove Missing Files and update watched states (single loop)
                List <int> filesToRemove = new List <int>();
                foreach (Raw_AniDB_MyListFile myitem in cmd.MyListItems)
                {
                    totalItems++;
                    if (myitem.IsWatched)
                    {
                        watchedItems++;
                    }

                    string hash = string.Empty;

                    SVR_AniDB_File anifile = RepoFactory.AniDB_File.GetByFileID(myitem.FileID);
                    if (anifile != null)
                    {
                        hash = anifile.Hash;
                    }
                    else
                    {
                        // look for manually linked files
                        List <CrossRef_File_Episode> xrefs =
                            RepoFactory.CrossRef_File_Episode.GetByEpisodeID(myitem.EpisodeID);
                        foreach (CrossRef_File_Episode xref in xrefs)
                        {
                            if (xref.CrossRefSource == (int)CrossRefSource.AniDB)
                            {
                                continue;
                            }
                            hash = xref.Hash;
                            break;
                        }
                    }

                    // We couldn't evem find a hash, so remove it
                    if (string.IsNullOrEmpty(hash))
                    {
                        filesToRemove.Add(myitem.FileID);
                        continue;
                    }

                    // If there's no video local, we don't have it
                    SVR_VideoLocal vl = RepoFactory.VideoLocal.GetByHash(hash);
                    if (vl == null)
                    {
                        filesToRemove.Add(myitem.FileID);
                        continue;
                    }

                    foreach (SVR_JMMUser juser in aniDBUsers)
                    {
                        bool localStatus = false;

                        // doesn't matter which anidb user we use
                        int             jmmUserID  = juser.JMMUserID;
                        VideoLocal_User userRecord = vl.GetUserRecord(juser.JMMUserID);
                        if (userRecord != null)
                        {
                            localStatus = userRecord.WatchedDate.HasValue;
                        }

                        string action = string.Empty;
                        if (localStatus == myitem.IsWatched)
                        {
                            continue;
                        }

                        // localStatus and AniDB Status are different
                        DateTime?watchedDate = myitem.WatchedDate ?? DateTime.Now;
                        if (localStatus)
                        {
                            // local = watched, anidb = unwatched
                            if (ServerSettings.AniDB_MyList_ReadUnwatched)
                            {
                                modifiedItems++;
                                vl.ToggleWatchedStatus(false, false, watchedDate,
                                                       false, false, jmmUserID, false,
                                                       true);
                                action = "Used AniDB Status";
                            }
                            else if (ServerSettings.AniDB_MyList_SetWatched)
                            {
                                vl.ToggleWatchedStatus(true, true, userRecord.WatchedDate, false, false, jmmUserID,
                                                       false, true);
                            }
                        }
                        else
                        {
                            // means local is un-watched, and anidb is watched
                            if (ServerSettings.AniDB_MyList_ReadWatched)
                            {
                                modifiedItems++;
                                vl.ToggleWatchedStatus(true, false, watchedDate, false, false,
                                                       jmmUserID, false, true);
                                action = "Updated Local record to Watched";
                            }
                            else if (ServerSettings.AniDB_MyList_SetUnwatched)
                            {
                                vl.ToggleWatchedStatus(false, true, watchedDate, false, false, jmmUserID,
                                                       false, true);
                            }
                        }
                        vl.GetAnimeEpisodes().Select(a => a.GetAnimeSeries()).Where(a => a != null).ForEach(a => modifiedSeries.Add(a));
                        logger.Info($"MYLISTDIFF:: File {vl.FileName} - Local Status = {localStatus}, AniDB Status = {myitem.IsWatched} --- {action}");
                    }
                }

                // Actually remove the files
                if (filesToRemove.Count > 0)
                {
                    foreach (int fileID in filesToRemove)
                    {
                        CommandRequest_DeleteFileFromMyList deleteCommand =
                            new CommandRequest_DeleteFileFromMyList(fileID);
                        deleteCommand.Save();
                    }
                    logger.Info($"MYLIST Missing Files: {filesToRemove.Count} Added to queue for deletion");
                }

                modifiedSeries.ForEach(a => a.QueueUpdateStats());

                logger.Info($"Process MyList: {totalItems} Items, {missingFiles} Added, {filesToRemove.Count} Deleted, {watchedItems} Watched, {modifiedItems} Modified");

                sched.LastUpdate = DateTime.Now;
                RepoFactory.ScheduledUpdate.Save(sched);
            }
            catch (Exception ex)
            {
                logger.Error(ex, "Error processing CommandRequest_SyncMyList: {0} ", ex.Message);
            }
        }
Пример #24
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.UpdateStats(true, true, true);
                            //series.TopLevelAnimeGroup.UpdateStatsFromTopLevel(true, true, true);
                        }
                    }
                }
            }

            return(getCmd.GrpStatusCollection);
        }
Пример #25
0
        public override void Run(IProgress <ICommand> progress = null)
        {
            logger.Info("Processing CommandRequest_SyncMyVotes");
            try
            {
                ReportInit(progress);
                AniDBHTTPCommand_GetVotes cmd = new AniDBHTTPCommand_GetVotes();
                cmd.Init(ServerSettings.Instance.AniDb.Username, ServerSettings.Instance.AniDb.Password);
                ReportUpdate(progress, 30);
                enHelperActivityType ev = cmd.Process();
                ReportUpdate(progress, 60);
                if (ev == enHelperActivityType.GotVotesHTTP)
                {
                    List <ICommand> cmdstoAdd = new List <ICommand>();
                    foreach (Raw_AniDB_Vote_HTTP myVote in cmd.MyVotes)
                    {
                        List <AniDB_Vote> dbVotes  = Repo.Instance.AniDB_Vote.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 == AniDBVoteType.Anime || myVote.VoteType == AniDBVoteType.AnimeTemp)
                            {
                                if (dbVote.VoteType == (int)AniDBVoteType.Anime || dbVote.VoteType == (int)AniDBVoteType.AnimeTemp)
                                {
                                    thisVote = dbVote;
                                }
                            }
                            else
                            {
                                thisVote = dbVote;
                            }
                        }

                        using (var upd = Repo.Instance.AniDB_Vote.BeginAddOrUpdate(thisVote, () => new AniDB_Vote {
                            EntityID = myVote.EntityID
                        }))
                        {
                            upd.Entity.VoteType  = (int)myVote.VoteType;
                            upd.Entity.VoteValue = myVote.VoteValue;

                            upd.Commit();
                        }

                        if ((myVote.VoteType == AniDBVoteType.Anime || myVote.VoteType == AniDBVoteType.AnimeTemp) && (thisVote != null))
                        {
                            cmdstoAdd.Add(new CmdAniDBGetAnimeHTTP(thisVote.EntityID, false, false));
                        }
                    }
                    if (cmdstoAdd.Count > 0)
                    {
                        Queue.Instance.AddRange(cmdstoAdd);
                    }
                    ReportUpdate(progress, 90);
                    logger.Info("Processed Votes: {0} Items", cmd.MyVotes.Count);
                }
                ReportFinish(progress);
            }
            catch (Exception ex)
            {
                ReportError(progress, $"Error processing AniDb.SyncMyVotes: {ex}", ex);
            }
        }