Beispiel #1
0
        public static void InitCache()
        {
            string t = "AnimeGroups";

            ServerState.Instance.CurrentSetupStatus = string.Format(JMMServer.Properties.Resources.Database_Cache, t, string.Empty);
            AnimeGroupRepository repo = new AnimeGroupRepository();

            Cache = new PocoCache <int, AnimeGroup>(repo.InternalGetAll(), a => a.AnimeGroupID);
            Changes.AddOrUpdateRange(Cache.Keys);
            Parents = Cache.CreateIndex(a => a.AnimeGroupParentID ?? 0);
            List <AnimeGroup> grps = Cache.Values.Where(a => a.ContractVersion < AnimeGroup.CONTRACT_VERSION).ToList();
            int max = grps.Count;
            int cnt = 0;

            foreach (AnimeGroup g in grps)
            {
                repo.Save(g, true, false, false);
                cnt++;
                if (cnt % 10 == 0)
                {
                    ServerState.Instance.CurrentSetupStatus = string.Format(JMMServer.Properties.Resources.Database_Cache, t,
                                                                            " DbRegen - " + cnt + "/" + max);
                }
            }
            ServerState.Instance.CurrentSetupStatus = string.Format(JMMServer.Properties.Resources.Database_Cache, t,
                                                                    " DbRegen - " + max + "/" + max);
        }
 internal override void ClearIndexes()
 {
     AnimeIDs  = null;
     StaffIDs  = null;
     RoleIDs   = null;
     RoleTypes = null;
 }
 internal override void ClearIndexes()
 {
     Hashes  = null;
     SHA1    = null;
     MD5     = null;
     Ignored = null;
 }
 internal override void PopulateIndexes()
 {
     Hashes  = new PocoIndex <int, SVR_VideoLocal, string>(Cache, a => a.Hash);
     SHA1    = new PocoIndex <int, SVR_VideoLocal, string>(Cache, a => a.SHA1);
     MD5     = new PocoIndex <int, SVR_VideoLocal, string>(Cache, a => a.MD5);
     Ignored = new PocoIndex <int, SVR_VideoLocal, int>(Cache, a => a.IsIgnored);
 }
 public override void PopulateIndexes()
 {
     AnimeIDs  = new PocoIndex <int, CrossRef_Anime_Staff, int>(Cache, a => a.AniDB_AnimeID);
     StaffIDs  = new PocoIndex <int, CrossRef_Anime_Staff, int>(Cache, a => a.StaffID);
     RoleIDs   = new PocoIndex <int, CrossRef_Anime_Staff, int?>(Cache, a => a.RoleID);
     RoleTypes = new PocoIndex <int, CrossRef_Anime_Staff, StaffRoleType>(Cache, a => (StaffRoleType)a.RoleType);
 }
Beispiel #6
0
 internal override void ClearIndexes()
 {
     Hashes    = null;
     Animes    = null;
     Episodes  = null;
     Filenames = null;
 }
Beispiel #7
0
 public override void PopulateIndexes()
 {
     Hashes    = new PocoIndex <int, CrossRef_File_Episode, string>(Cache, a => a.Hash);
     Animes    = new PocoIndex <int, CrossRef_File_Episode, int>(Cache, a => a.AnimeID);
     Episodes  = new PocoIndex <int, CrossRef_File_Episode, int>(Cache, a => a.EpisodeID);
     Filenames = new PocoIndex <int, CrossRef_File_Episode, string>(Cache, a => a.FileName);
 }
Beispiel #8
0
 internal override void PopulateIndexes()
 {
     FileImport1 = new PocoIndex <int, DuplicateFile, string, int>(Cache, a => a.FilePathFile1, a => a.ImportFolderIDFile1);
     FileImport2 = new PocoIndex <int, DuplicateFile, string, int>(Cache, a => a.FilePathFile2, a => a.ImportFolderIDFile2);
     Folder1     = new PocoIndex <int, DuplicateFile, int>(Cache, a => a.ImportFolderIDFile1);
     Folder2     = new PocoIndex <int, DuplicateFile, int>(Cache, a => a.ImportFolderIDFile2);
 }
Beispiel #9
0
 internal override void ClearIndexes()
 {
     FileImport1 = null;
     FileImport2 = null;
     Folder1     = null;
     Folder2     = null;
 }
Beispiel #10
0
 public override void PopulateIndexes()
 {
     VideoLocalIDs    = new PocoIndex <int, VideoLocal_User, int>(Cache, a => a.VideoLocalID);
     Users            = new PocoIndex <int, VideoLocal_User, int>(Cache, a => a.JMMUserID);
     UsersVideoLocals =
         new PocoIndex <int, VideoLocal_User, int, int>(Cache, a => a.JMMUserID, a => a.VideoLocalID);
 }
Beispiel #11
0
 public override void PopulateIndexes()
 {
     //Fix null hashes
     foreach (SVR_VideoLocal l in Cache.Values)
     {
         if (l.MD5 == null || l.SHA1 == null || l.Hash == null || l.FileName == null)
         {
             l.MediaVersion = 0;
             if (l.MD5 == null)
             {
                 l.MD5 = string.Empty;
             }
             if (l.SHA1 == null)
             {
                 l.SHA1 = string.Empty;
             }
             if (l.Hash == null)
             {
                 l.Hash = string.Empty;
             }
             if (l.FileName == null)
             {
                 l.FileName = string.Empty;
             }
         }
     }
     Hashes  = new PocoIndex <int, SVR_VideoLocal, string>(Cache, a => a.Hash);
     SHA1    = new PocoIndex <int, SVR_VideoLocal, string>(Cache, a => a.SHA1);
     MD5     = new PocoIndex <int, SVR_VideoLocal, string>(Cache, a => a.MD5);
     Ignored = new PocoIndex <int, SVR_VideoLocal, int>(Cache, a => a.IsIgnored);
 }
        public static void InitCache()
        {
            string t = "AnimeEpisodes";

            ServerState.Instance.CurrentSetupStatus = string.Format(JMMServer.Properties.Resources.Database_Cache, t, string.Empty);
            AnimeEpisodeRepository repo = new AnimeEpisodeRepository();

            Cache      = new PocoCache <int, AnimeEpisode>(repo.InternalGetAll(), a => a.AnimeEpisodeID);
            Series     = Cache.CreateIndex(a => a.AnimeSeriesID);
            EpisodeIDs = Cache.CreateIndex(a => a.AniDB_EpisodeID);

            int cnt = 0;
            List <AnimeEpisode> grps =
                Cache.Values.Where(a => a.PlexContractVersion < AnimeEpisode.PLEXCONTRACT_VERSION).ToList();
            int max = grps.Count;

            foreach (AnimeEpisode g in grps)
            {
                repo.Save(g);
                cnt++;
                if (cnt % 10 == 0)
                {
                    ServerState.Instance.CurrentSetupStatus = string.Format(JMMServer.Properties.Resources.Database_Cache, t,
                                                                            " DbRegen - " + cnt + "/" + max);
                }
            }
            ServerState.Instance.CurrentSetupStatus = string.Format(JMMServer.Properties.Resources.Database_Cache, t,
                                                                    " DbRegen - " + max + "/" + max);
        }
Beispiel #13
0
 public override void PopulateIndexes()
 {
     Changes.AddOrUpdateRange(Cache.Keys);
     Parents            = Cache.CreateIndex(a => a.ParentGroupFilterID ?? 0);
     Types              = new BiDictionaryManyToMany <int, GroupFilterConditionType>(Cache.Values.ToDictionary(a => a.GroupFilterID, a => a.Types));
     PostProcessFilters = new List <GroupFilter>();
 }
        public static void InitCache()
        {
            string t = "AnimeSeries_User";

            ServerState.Instance.CurrentSetupStatus = string.Format(JMMServer.Properties.Resources.Database_Cache, t, string.Empty);
            AnimeSeries_UserRepository repo = new AnimeSeries_UserRepository();

            Cache       = new PocoCache <int, AnimeSeries_User>(repo.InternalGetAll(), a => a.AnimeSeries_UserID);
            Users       = Cache.CreateIndex(a => a.JMMUserID);
            Series      = Cache.CreateIndex(a => a.AnimeSeriesID);
            UsersSeries = Cache.CreateIndex(a => a.JMMUserID, a => a.AnimeSeriesID);
            foreach (int n in Cache.Values.Select(a => a.JMMUserID).Distinct())
            {
                Changes[n] = new ChangeTracker <int>();
                Changes[n].AddOrUpdateRange(Users.GetMultiple(n).Select(a => a.AnimeSeriesID));
            }
            int cnt = 0;
            List <AnimeSeries_User> sers =
                Cache.Values.Where(a => a.PlexContractVersion < AnimeGroup_User.PLEXCONTRACT_VERSION).ToList();
            int max = sers.Count;

            foreach (AnimeSeries_User g in sers)
            {
                repo.Save(g);
                cnt++;
                if (cnt % 10 == 0)
                {
                    ServerState.Instance.CurrentSetupStatus = string.Format(JMMServer.Properties.Resources.Database_Cache, t,
                                                                            " DbRegen - " + cnt + "/" + max);
                }
            }
            ServerState.Instance.CurrentSetupStatus = string.Format(JMMServer.Properties.Resources.Database_Cache, t,
                                                                    " DbRegen - " + max + "/" + max);
        }
Beispiel #15
0
        public static void InitCache()
        {
            string t = "AnimeSeries";

            ServerState.Instance.CurrentSetupStatus = string.Format(JMMServer.Properties.Resources.Database_Cache, t, string.Empty);

            AnimeSeriesRepository repo = new AnimeSeriesRepository();

            Cache = new PocoCache <int, AnimeSeries>(repo.InternalGetAll(), a => a.AnimeSeriesID);
            Changes.AddOrUpdateRange(Cache.Keys);
            AniDBIds = Cache.CreateIndex(a => a.AniDB_ID);
            Groups   = Cache.CreateIndex(a => a.AnimeGroupID);
            int cnt = 0;
            List <AnimeSeries> sers =
                Cache.Values.Where(
                    a => a.ContractVersion < AnimeSeries.CONTRACT_VERSION || a.Contract?.AniDBAnime?.AniDBAnime == null)
                .ToList();
            int max = sers.Count;

            foreach (AnimeSeries s in sers)
            {
                repo.Save(s, false, false, true);
                cnt++;
                if (cnt % 10 == 0)
                {
                    ServerState.Instance.CurrentSetupStatus = string.Format(JMMServer.Properties.Resources.Database_Cache, t,
                                                                            " DbRegen - " + cnt + "/" + max);
                }
            }
            ServerState.Instance.CurrentSetupStatus = string.Format(JMMServer.Properties.Resources.Database_Cache, t,
                                                                    " DbRegen - " + max + "/" + max);
        }
        public static List <GroupFilter> InitCache()
        {
            string t = "GroupFilter";

            ServerState.Instance.CurrentSetupStatus = string.Format(JMMServer.Properties.Resources.Database_Cache, t, string.Empty);

            GroupFilterConditionRepository repConds = new GroupFilterConditionRepository();

            GroupFilterRepository repo    = new GroupFilterRepository();
            List <GroupFilter>    filters = repo.InternalGetAll();

            Cache = new PocoCache <int, GroupFilter>(filters, a => a.GroupFilterID);
            Changes.AddOrUpdateRange(Cache.Keys);
            Parents = Cache.CreateIndex(a => a.ParentGroupFilterID ?? 0);
            Types   =
                new BiDictionaryManyToMany <int, GroupFilterConditionType>(Cache.Values.ToDictionary(
                                                                               a => a.GroupFilterID,
                                                                               a => a.Types));
            List <GroupFilter> recalc = new List <GroupFilter>();

            foreach (GroupFilter g in Cache.Values.ToList())
            {
                if (g.GroupFilterID != 0 && g.GroupsIdsVersion < GroupFilter.GROUPFILTER_VERSION ||
                    g.GroupConditionsVersion < GroupFilter.GROUPCONDITIONS_VERSION)
                {
                    if (g.GroupConditionsVersion == 0)
                    {
                        g.Conditions = repConds.GetByGroupFilterID(g.GroupFilterID);
                    }
                    repo.Save(g, true);
                    recalc.Add(g);
                }
            }
            return(recalc);
        }
Beispiel #17
0
 internal override void ClearIndexes()
 {
     Series        = null;
     UsersEpisodes = null;
     Users         = null;
     Episodes      = null;
     UsersSeries   = null;
 }
Beispiel #18
0
 public override void PopulateIndexes()
 {
     Series        = Cache.CreateIndex(a => a.AnimeSeriesID);
     UsersEpisodes = Cache.CreateIndex(a => a.JMMUserID, a => a.AnimeEpisodeID);
     Users         = Cache.CreateIndex(a => a.JMMUserID);
     Episodes      = Cache.CreateIndex(a => a.AnimeEpisodeID);
     UsersSeries   = Cache.CreateIndex(a => a.JMMUserID, a => a.AnimeSeriesID);
 }
 internal override void ClearIndexes()
 {
     InternalVersions = null;
     Resolutions      = null;
     Animes           = null;
     MD5s             = null;
     SHA1s            = null;
     Hashes           = null;
 }
        public static void InitCache()
        {
            string t = "VideoInfos";

            ServerState.Instance.CurrentSetupStatus = string.Format(JMMServer.Properties.Resources.Database_Cache, t, string.Empty);
            VideoInfoRepository repo = new VideoInfoRepository();

            Cache  = new PocoCache <int, VideoInfo>(repo.InternalGetAll(), a => a.VideoInfoID);
            Hashes = new PocoIndex <int, VideoInfo, string>(Cache, a => a.Hash);
        }
 internal override void PopulateIndexes()
 {
     // Only populated from main thread before these are accessible, so no lock
     Hashes           = new PocoIndex <int, SVR_AniDB_File, string>(Cache, a => a.Hash);
     SHA1s            = new PocoIndex <int, SVR_AniDB_File, string>(Cache, a => a.SHA1);
     MD5s             = new PocoIndex <int, SVR_AniDB_File, string>(Cache, a => a.MD5);
     Animes           = new PocoIndex <int, SVR_AniDB_File, int>(Cache, a => a.AnimeID);
     Resolutions      = new PocoIndex <int, SVR_AniDB_File, string>(Cache, a => a.File_VideoResolution);
     InternalVersions = new PocoIndex <int, SVR_AniDB_File, int>(Cache, a => a.InternalVersion);
 }
 public override void PopulateIndexes()
 {
     Hashes           = new PocoIndex <int, AniDB_File, string>(Cache, a => a.Hash);
     SHA1s            = new PocoIndex <int, AniDB_File, string>(Cache, a => a.SHA1);
     MD5s             = new PocoIndex <int, AniDB_File, string>(Cache, a => a.MD5);
     FileIds          = new PocoIndex <int, AniDB_File, int>(Cache, a => a.FileID);
     Animes           = new PocoIndex <int, AniDB_File, int>(Cache, a => a.AnimeID);
     Resolutions      = new PocoIndex <int, AniDB_File, string>(Cache, a => a.File_VideoResolution);
     InternalVersions = new PocoIndex <int, AniDB_File, int>(Cache, a => a.InternalVersion);
 }
Beispiel #23
0
        public override void PopulateIndexes()
        {
            Groups      = Cache.CreateIndex(a => a.AnimeGroupID);
            Users       = Cache.CreateIndex(a => a.JMMUserID);
            UsersGroups = Cache.CreateIndex(a => a.JMMUserID, a => a.AnimeGroupID);

            foreach (int n in Cache.Values.Select(a => a.JMMUserID).Distinct())
            {
                Changes[n] = new ChangeTracker <int>();
                Changes[n].AddOrUpdateRange(Users.GetMultiple(n).Select(a => a.AnimeGroupID));
            }
        }
        public static void InitCache()
        {
            string t = "VideoLocal_Users";

            ServerState.Instance.CurrentSetupStatus = string.Format(JMMServer.Properties.Resources.Database_Cache, t, string.Empty);
            VideoLocal_UserRepository repo = new VideoLocal_UserRepository();

            Cache            = new PocoCache <int, VideoLocal_User>(repo.InternalGetAll(), a => a.VideoLocal_UserID);
            VideoLocalIDs    = new PocoIndex <int, VideoLocal_User, int>(Cache, a => a.VideoLocalID);
            Users            = new PocoIndex <int, VideoLocal_User, int>(Cache, a => a.JMMUserID);
            UsersVideoLocals = new PocoIndex <int, VideoLocal_User, int, int>(Cache, a => a.JMMUserID,
                                                                              a => a.VideoLocalID);
        }
        public static void InitCache()
        {
            string t = "VideoLocal";

            ServerState.Instance.CurrentSetupStatus = string.Format(JMMServer.Properties.Resources.Database_Cache, t, string.Empty);
            VideoLocalRepository repo = new VideoLocalRepository();

            Cache         = new PocoCache <int, VideoLocal>(repo.InternalGetAll(), a => a.VideoLocalID);
            Hashes        = new PocoIndex <int, VideoLocal, string>(Cache, a => a.Hash);
            Paths         = new PocoIndex <int, VideoLocal, string>(Cache, a => a.FilePath);
            Ignored       = new PocoIndex <int, VideoLocal, int>(Cache, a => a.IsIgnored);
            ImportFolders = new PocoIndex <int, VideoLocal, int>(Cache, a => a.ImportFolderID);
            int cnt = 0;
            List <VideoLocal> grps = Cache.Values.Where(a => a.MediaVersion < VideoLocal.MEDIA_VERSION || a.MediaBlob == null).ToList();
            int max = grps.Count;

            foreach (VideoLocal g in grps)
            {
                try
                {
                    if (File.Exists(g.FullServerPath))
                    {
                        repo.Save(g, false);
                    }
                }
                catch (Exception)
                {
                    // ignored
                }
                cnt++;
                if (cnt % 10 == 0)
                {
                    ServerState.Instance.CurrentSetupStatus = string.Format(JMMServer.Properties.Resources.Database_Cache, t,
                                                                            " DbRegen - " + cnt + "/" + max);
                }
            }
            ServerState.Instance.CurrentSetupStatus = string.Format(JMMServer.Properties.Resources.Database_Cache, t,
                                                                    " DbRegen - " + max + "/" + max);
        }
Beispiel #26
0
 public override void PopulateIndexes()
 {
     Changes.AddOrUpdateRange(Cache.Keys);
     AniDBIds = Cache.CreateIndex(a => a.AniDB_ID);
     Groups   = Cache.CreateIndex(a => a.AnimeGroupID);
 }
Beispiel #27
0
 internal override void ClearIndexes()
 {
     Scans      = null;
     ScanStatus = null;
 }
 public override void PopulateIndexes()
 {
     SeriesIDs = new PocoIndex <int, TvDB_ImagePoster, int>(Cache, a => a.SeriesID);
     TvDBIDs   = new PocoIndex <int, TvDB_ImagePoster, int>(Cache, a => a.Id);
 }
Beispiel #29
0
 public override void PopulateIndexes()
 {
     VideoLocals   = new PocoIndex <int, SVR_VideoLocal_Place, int>(Cache, a => a.VideoLocalID);
     ImportFolders = new PocoIndex <int, SVR_VideoLocal_Place, int>(Cache, a => a.ImportFolderID);
     Paths         = new PocoIndex <int, SVR_VideoLocal_Place, string>(Cache, a => a.FilePath);
 }
 public override void PopulateIndexes()
 {
     EpisodesIds = new PocoIndex <int, AniDB_Episode, int>(Cache, a => a.EpisodeID);
     Animes      = new PocoIndex <int, AniDB_Episode, int>(Cache, a => a.AnimeID);
 }