Exemplo n.º 1
0
        /*
         *      private static void CreateContinueWatchingGroupFilter()
         *      {
         *              // group filters
         *              GroupFilterRepository repFilters = new GroupFilterRepository();
         *              GroupFilterConditionRepository repGFC = new GroupFilterConditionRepository();
         *
         *              using (var session = JMMService.SessionFactory.OpenSession())
         *              {
         *                      // check if it already exists
         *                      List<GroupFilter> lockedGFs = repFilters.GetLockedGroupFilters(session);
         *
         *                      if (lockedGFs != null)
         *                      {
         *          // if it already exists we can leave
         *          foreach (GroupFilter gfTemp in lockedGFs)
         *          {
         *              if (gfTemp.FilterType == (int)GroupFilterType.ContinueWatching)
         *                  return;
         *          }
         *
         *          // the default value when the column was added to the database was '1'
         *          // this is only needed for users of a migrated database
         *          foreach (GroupFilter gfTemp in lockedGFs)
         *          {
         *              if (gfTemp.GroupFilterName.Equals(Constants.GroupFilterName.ContinueWatching, StringComparison.InvariantCultureIgnoreCase) &&
         *                  gfTemp.FilterType != (int)GroupFilterType.ContinueWatching)
         *              {
         *                      DatabaseFixes.FixContinueWatchingGroupFilter_20160406();
         *                  return;
         *              }
         *          }
         *                      }
         *
         *                      GroupFilter gf = new GroupFilter();
         *                      gf.GroupFilterName = Constants.GroupFilterName.ContinueWatching;
         *                      gf.Locked = 1;
         *                      gf.SortingCriteria = "4;2"; // by last watched episode desc
         *                      gf.ApplyToSeries = 0;
         *                      gf.BaseCondition = 1; // all
         *      gf.FilterType = (int)GroupFilterType.ContinueWatching;
         *
         *      repFilters.Save(gf,true,null);
         *
         *                      GroupFilterCondition gfc = new GroupFilterCondition();
         *                      gfc.ConditionType = (int)GroupFilterConditionType.HasWatchedEpisodes;
         *                      gfc.ConditionOperator = (int)GroupFilterOperator.Include;
         *                      gfc.ConditionParameter = "";
         *                      gfc.GroupFilterID = gf.GroupFilterID;
         *                      repGFC.Save(gfc);
         *
         *                      gfc = new GroupFilterCondition();
         *                      gfc.ConditionType = (int)GroupFilterConditionType.HasUnwatchedEpisodes;
         *                      gfc.ConditionOperator = (int)GroupFilterOperator.Include;
         *                      gfc.ConditionParameter = "";
         *                      gfc.GroupFilterID = gf.GroupFilterID;
         *                      repGFC.Save(gfc);
         *              }
         *      }
         */

        public static void CreateInitialCustomTags(this IDatabase db)
        {
            try
            {
                // group filters
                CustomTagRepository repTags = new CustomTagRepository();

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

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

                // Dropped
                CustomTag tag = new CustomTag();
                tag.TagName        = JMMServer.Properties.Resources.CustomTag_Dropped;
                tag.TagDescription = JMMServer.Properties.Resources.CustomTag_DroppedInfo;
                repTags.Save(tag);

                // Pinned
                tag                = new CustomTag();
                tag.TagName        = JMMServer.Properties.Resources.CustomTag_Pinned;
                tag.TagDescription = JMMServer.Properties.Resources.CustomTag_PinnedInfo;
                repTags.Save(tag);

                // Ongoing
                tag                = new CustomTag();
                tag.TagName        = JMMServer.Properties.Resources.CustomTag_Ongoing;
                tag.TagDescription = JMMServer.Properties.Resources.CustomTag_OngoingInfo;
                repTags.Save(tag);

                // Waiting for Series Completion
                tag                = new CustomTag();
                tag.TagName        = JMMServer.Properties.Resources.CustomTag_SeriesComplete;
                tag.TagDescription = JMMServer.Properties.Resources.CustomTag_SeriesCompleteInfo;
                repTags.Save(tag);

                // Waiting for Bluray Completion
                tag                = new CustomTag();
                tag.TagName        = JMMServer.Properties.Resources.CustomTag_BlurayComplete;
                tag.TagDescription = JMMServer.Properties.Resources.CustomTag_BlurayCompleteInfo;
                repTags.Save(tag);
            }
            catch (Exception ex)
            {
                logger.ErrorException("Could not Create Initial Custom Tags: " + ex.ToString(), ex);
            }
        }
Exemplo n.º 2
0
        public static void CreateInitialCustomTags()
        {
            try
            {
                // group filters
                CustomTagRepository repTags = new CustomTagRepository();

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

                // Dropped
                CustomTag tag = new CustomTag();
                tag.TagName        = "Dropped";
                tag.TagDescription = "Started watching this series, but have since dropped it";
                repTags.Save(tag);

                // Pinned
                tag                = new CustomTag();
                tag.TagName        = "Pinned";
                tag.TagDescription = "Pinned this series for whatever reason you like";
                repTags.Save(tag);

                // Ongoing
                tag                = new CustomTag();
                tag.TagName        = "Ongoing";
                tag.TagDescription = "This series does not have an end date";
                repTags.Save(tag);

                // Waiting for Series Completion
                tag                = new CustomTag();
                tag.TagName        = "Waiting for Series Completion";
                tag.TagDescription = "Will start watching this once this series is finished";
                repTags.Save(tag);

                // Waiting for Bluray Completion
                tag                = new CustomTag();
                tag.TagName        = "Waiting for Bluray Completion";
                tag.TagDescription = "Will start watching this once I have all episodes in bluray";
                repTags.Save(tag);
            }
            catch (Exception ex)
            {
                logger.ErrorException("Could not Create Initial Custom Tags: " + ex.ToString(), ex);
            }
        }