Exemplo n.º 1
0
        public override void ProcessCommand()
        {
            SVR_GroupFilter gf = RepoFactory.GroupFilter.GetByID(GroupFilterID);

            if (gf == null)
            {
                return;
            }
            gf.EvaluateAnimeSeries();
            gf.EvaluateAnimeGroups();
            RepoFactory.GroupFilter.Save(gf);
        }
Exemplo n.º 2
0
        private void CreateInitialGroupFilters()
        {
            // group filters

            if (RepoFactory.GroupFilter.GetAll().Count() > 0)
            {
                return;
            }

            Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo(ServerSettings.Culture);

            // Favorites
            SVR_GroupFilter gf = new SVR_GroupFilter();

            gf.GroupFilterName = Shoko.Commons.Properties.Resources.Filter_Favorites;
            gf.ApplyToSeries   = 0;
            gf.BaseCondition   = 1;
            gf.Locked          = 0;
            gf.FilterType      = (int)GroupFilterType.UserDefined;
            GroupFilterCondition gfc = new GroupFilterCondition();

            gfc.ConditionType      = (int)GroupFilterConditionType.Favourite;
            gfc.ConditionOperator  = (int)GroupFilterOperator.Include;
            gfc.ConditionParameter = "";
            gf.Conditions.Add(gfc);
            gf.EvaluateAnimeGroups();
            gf.EvaluateAnimeSeries();
            RepoFactory.GroupFilter.Save(gf);

            // Missing Episodes
            gf = new SVR_GroupFilter();
            gf.GroupFilterName = Shoko.Commons.Properties.Resources.Filter_MissingEpisodes;
            gf.ApplyToSeries   = 0;
            gf.BaseCondition   = 1;
            gf.Locked          = 0;
            gf.FilterType      = (int)GroupFilterType.UserDefined;
            gfc = new GroupFilterCondition();
            gfc.ConditionType      = (int)GroupFilterConditionType.MissingEpisodesCollecting;
            gfc.ConditionOperator  = (int)GroupFilterOperator.Include;
            gfc.ConditionParameter = "";
            gf.Conditions.Add(gfc);
            gf.EvaluateAnimeGroups();
            gf.EvaluateAnimeSeries();
            RepoFactory.GroupFilter.Save(gf);


            // Newly Added Series
            gf = new SVR_GroupFilter();
            gf.GroupFilterName = Shoko.Commons.Properties.Resources.Filter_Added;
            gf.ApplyToSeries   = 0;
            gf.BaseCondition   = 1;
            gf.Locked          = 0;
            gf.FilterType      = (int)GroupFilterType.UserDefined;
            gfc = new GroupFilterCondition();
            gfc.ConditionType      = (int)GroupFilterConditionType.SeriesCreatedDate;
            gfc.ConditionOperator  = (int)GroupFilterOperator.LastXDays;
            gfc.ConditionParameter = "10";
            gf.Conditions.Add(gfc);
            gf.EvaluateAnimeGroups();
            gf.EvaluateAnimeSeries();
            RepoFactory.GroupFilter.Save(gf);

            // Newly Airing Series
            gf = new SVR_GroupFilter();
            gf.GroupFilterName = Shoko.Commons.Properties.Resources.Filter_Airing;
            gf.ApplyToSeries   = 0;
            gf.BaseCondition   = 1;
            gf.Locked          = 0;
            gf.FilterType      = (int)GroupFilterType.UserDefined;
            gfc = new GroupFilterCondition();
            gfc.ConditionType      = (int)GroupFilterConditionType.AirDate;
            gfc.ConditionOperator  = (int)GroupFilterOperator.LastXDays;
            gfc.ConditionParameter = "30";
            gf.Conditions.Add(gfc);
            gf.EvaluateAnimeGroups();
            gf.EvaluateAnimeSeries();
            RepoFactory.GroupFilter.Save(gf);

            // Votes Needed
            gf = new SVR_GroupFilter();
            gf.GroupFilterName = Shoko.Commons.Properties.Resources.Filter_Votes;
            gf.ApplyToSeries   = 1;
            gf.BaseCondition   = 1;
            gf.Locked          = 0;
            gf.FilterType      = (int)GroupFilterType.UserDefined;
            gfc = new GroupFilterCondition();
            gfc.ConditionType      = (int)GroupFilterConditionType.CompletedSeries;
            gfc.ConditionOperator  = (int)GroupFilterOperator.Include;
            gfc.ConditionParameter = "";
            gf.Conditions.Add(gfc);
            gfc = new GroupFilterCondition();
            gfc.ConditionType      = (int)GroupFilterConditionType.HasUnwatchedEpisodes;
            gfc.ConditionOperator  = (int)GroupFilterOperator.Exclude;
            gfc.ConditionParameter = "";
            gf.Conditions.Add(gfc);
            gfc = new GroupFilterCondition();
            gfc.ConditionType      = (int)GroupFilterConditionType.UserVotedAny;
            gfc.ConditionOperator  = (int)GroupFilterOperator.Exclude;
            gfc.ConditionParameter = "";
            gf.Conditions.Add(gfc);
            gf.EvaluateAnimeGroups();
            gf.EvaluateAnimeSeries();
            RepoFactory.GroupFilter.Save(gf);

            // Recently Watched
            gf = new SVR_GroupFilter();
            gf.GroupFilterName = Shoko.Commons.Properties.Resources.Filter_RecentlyWatched;
            gf.ApplyToSeries   = 0;
            gf.BaseCondition   = 1;
            gf.Locked          = 0;
            gf.FilterType      = (int)GroupFilterType.UserDefined;
            gfc = new GroupFilterCondition();
            gfc.ConditionType      = (int)GroupFilterConditionType.EpisodeWatchedDate;
            gfc.ConditionOperator  = (int)GroupFilterOperator.LastXDays;
            gfc.ConditionParameter = "10";
            gf.Conditions.Add(gfc);
            gf.EvaluateAnimeGroups();
            gf.EvaluateAnimeSeries();
            RepoFactory.GroupFilter.Save(gf);

            // TvDB/MovieDB Link Missing
            gf = new SVR_GroupFilter();
            gf.GroupFilterName = Shoko.Commons.Properties.Resources.Filter_LinkMissing;
            gf.ApplyToSeries   = 1; // This makes far more sense as applied to series
            gf.BaseCondition   = 1;
            gf.Locked          = 0;
            gf.FilterType      = (int)GroupFilterType.UserDefined;
            gfc = new GroupFilterCondition();
            gfc.ConditionType      = (int)GroupFilterConditionType.AssignedTvDBOrMovieDBInfo;
            gfc.ConditionOperator  = (int)GroupFilterOperator.Exclude;
            gfc.ConditionParameter = "";
            gf.Conditions.Add(gfc);
            gf.EvaluateAnimeGroups();
            gf.EvaluateAnimeSeries();
            RepoFactory.GroupFilter.Save(gf);
        }