コード例 #1
0
        public static void CleanupDatabase()
        {
            try
            {
                // get all the shows from the database and make sure they are still valid Trakt Slugs
                Trakt_ShowRepository repShows = new Trakt_ShowRepository();

                foreach (Trakt_Show show in repShows.GetAll())
                {
                    // let's check if we can get this show on Trakt
                    int traktCode = TraktStatusCodes.Success;

                    // note - getting extended show info also updates as well
                    TraktV2ShowExtended showOnline = GetShowInfoV2(show.TraktID, ref traktCode);
                    if (showOnline == null && traktCode == TraktStatusCodes.Not_Found)
                    {
                        logger.Info("TRAKT_CLEANUP: Could not find '{0}' on Trakt so starting removal from database", show.TraktID);
                        RemoveTraktDBEntries(show);

                    }
                }

            }
            catch (Exception ex)
            {
                logger.ErrorException("Error in TraktTVHelper.CleanupDatabase: " + ex.ToString(), ex);
            }
        }