Пример #1
0
 protected void AddMultiCategoryMapping(TorznabCategory newznabCategory, params int[] trackerCategories)
 {
     foreach (var trackerCat in trackerCategories)
     {
         categoryMapping.Add(new CategoryMapping(trackerCat.ToString(), newznabCategory.ID));
     }
 }
Пример #2
0
 protected void AddMultiCategoryMapping(TorznabCategory newznabCategory, params int[] trackerCategories)
 {
     foreach (var trackerCat in trackerCategories)
     {
         AddCategoryMapping(trackerCat, newznabCategory);
     }
 }
Пример #3
0
        protected void AddCategoryMapping(string trackerCategory, TorznabCategory newznabCategory, string trackerCategoryDesc = null)
        {
            categoryMapping.Add(new CategoryMapping(trackerCategory, trackerCategoryDesc, newznabCategory.ID));
            if (!TorznabCaps.Categories.Contains(newznabCategory))
            {
                TorznabCaps.Categories.Add(newznabCategory);
                if (TorznabCatType.Movies.Contains(newznabCategory))
                {
                    TorznabCaps.MovieSearchAvailable = true;
                }
            }

            // add 1:1 categories
            if (trackerCategoryDesc != null && trackerCategory != null)
            {
                try
                {
                    var trackerCategoryInt = int.Parse(trackerCategory);
                    var CustomCat          = new TorznabCategory(trackerCategoryInt + 100000, trackerCategoryDesc);
                    if (!TorznabCaps.Categories.Contains(CustomCat))
                    {
                        TorznabCaps.Categories.Add(CustomCat);
                    }
                }
                catch (FormatException)
                {
                    // trackerCategory is not an integer, continue
                }
            }
        }
Пример #4
0
 protected void AddCategoryMapping(string trackerCategory, TorznabCategory newznabCategory)
 {
     categoryMapping.Add(new CategoryMapping(trackerCategory, newznabCategory.ID));
     if (!TorznabCaps.Categories.Contains(newznabCategory))
     {
         TorznabCaps.Categories.Add(newznabCategory);
     }
 }
Пример #5
0
 protected void AddResultCategoryMapping(string trackerCategory, TorznabCategory newznabCategory)
 {
     resultMapping.Add(new CategoryMapping(trackerCategory.ToString(), null, newznabCategory.ID));
     if (!TorznabCaps.Categories.Contains(newznabCategory))
     {
         TorznabCaps.Categories.Add(newznabCategory);
     }
 }
Пример #6
0
 private void AddCategoryMappingAndParent(string trackerCategory, TorznabCategory newznabCategory,
                                          TorznabCategory parentCategory = null)
 {
     AddCategoryMapping(trackerCategory, newznabCategory);
     if (parentCategory != null && parentCategory.ID != newznabCategory.ID)
     {
         AddCategoryMapping(trackerCategory, parentCategory);
     }
 }
Пример #7
0
 protected void AddCategoryMapping(string trackerCategory, TorznabCategory newznabCategory, string trackerCategoryDesc = null)
 {
     categoryMapping.Add(new CategoryMapping(trackerCategory, trackerCategoryDesc, newznabCategory.ID));
     if (!TorznabCaps.Categories.Contains(newznabCategory))
     {
         TorznabCaps.Categories.Add(newznabCategory);
         if (TorznabCatType.Movies.Contains(newznabCategory))
         {
             TorznabCaps.MovieSearchAvailable = true;
         }
     }
 }
        public void TestConstructors()
        {
            // TODO: re-order atrributes in TorznabCapabilities
            // TODO: tv search should be disabled by default
            // TODO: TorznabCapabilities(params TorznabCategory[] cats) should re-use TorznabCapabilities
            // TODO: initialize MusicSearchAvailable
            var torznabCaps = new TorznabCapabilities();

            Assert.True(torznabCaps.SearchAvailable);
            Assert.True(torznabCaps.TVSearchAvailable);
            Assert.False(torznabCaps.MovieSearchAvailable);
            Assert.False(torznabCaps.MusicSearchAvailable); // init
            Assert.False(torznabCaps.BookSearchAvailable);
            Assert.False(torznabCaps.SupportsImdbMovieSearch);
            Assert.False(torznabCaps.SupportsImdbTVSearch);
            Assert.False(torznabCaps.SupportsTvdbSearch);
            Assert.False(torznabCaps.SupportsTmdbMovieSearch);
            Assert.False(torznabCaps.SupportsTVRageSearch);
            Assert.AreEqual(0, torznabCaps.SupportedMusicSearchParamsList.Count);
            Assert.AreEqual(0, torznabCaps.Categories.Count);

            var cats = new TorznabCategory[0]; // empty

            torznabCaps = new TorznabCapabilities(cats);
            Assert.True(torznabCaps.SearchAvailable);
            Assert.True(torznabCaps.TVSearchAvailable);
            Assert.False(torznabCaps.MovieSearchAvailable);
            Assert.False(torznabCaps.MusicSearchAvailable); // init
            Assert.False(torznabCaps.BookSearchAvailable);
            Assert.False(torznabCaps.SupportsImdbMovieSearch);
            Assert.False(torznabCaps.SupportsImdbTVSearch);
            Assert.False(torznabCaps.SupportsTvdbSearch);
            Assert.False(torznabCaps.SupportsTmdbMovieSearch);
            Assert.False(torznabCaps.SupportsTVRageSearch);
            Assert.AreEqual(0, torznabCaps.SupportedMusicSearchParamsList.Count);
            Assert.AreEqual(0, torznabCaps.Categories.Count);

            // TODO: movies category enables Movies Search ??
            cats        = new [] { TorznabCatType.MoviesSD };
            torznabCaps = new TorznabCapabilities(cats);
            Assert.AreEqual(1, torznabCaps.Categories.Count);
            Assert.AreEqual(TorznabCatType.MoviesSD, torznabCaps.Categories[0]);
            Assert.True(torznabCaps.MovieSearchAvailable);
        }
Пример #9
0
 protected void AddCategoryMapping(int trackerCategory, TorznabCategory newznabCategory, string trackerCategoryDesc = null)
 {
     AddCategoryMapping(trackerCategory.ToString(), newznabCategory, trackerCategoryDesc);
 }
Пример #10
0
 public void _AddMultiCategoryMapping(TorznabCategory newznabCategory, params int[] trackerCategories) =>
 AddMultiCategoryMapping(newznabCategory, trackerCategories);
Пример #11
0
 public void _AddCategoryMapping(int trackerCategory, TorznabCategory newznabCategory, string trackerCategoryDesc = null) =>
 AddCategoryMapping(trackerCategory, newznabCategory, trackerCategoryDesc);
Пример #12
0
 protected void AddCategoryMapping(int trackerCategory, TorznabCategory newznabCategory)
 {
     AddCategoryMapping(trackerCategory.ToString(), newznabCategory);
 }
Пример #13
0
 private void AddCategoryMapping(int trackerMediaCategory, int trackerCategory, TorznabCategory newznabCategory, string trackerCategoryDesc = null)
 {
     AddCategoryMapping(trackerCategory, newznabCategory, trackerCategoryDesc);
     if (!_mediaCategoryMapping.ContainsKey(trackerMediaCategory))
     {
         _mediaCategoryMapping.Add(trackerMediaCategory, new List <int>());
     }
     _mediaCategoryMapping[trackerMediaCategory].Add(trackerCategory);
 }
Пример #14
0
 public void addCategoryMappingByMediaType(string HDCityID, TorznabCategory torznabCategory, String mediaType)
 {
     mediaMappings.Add(HDCityID, mediaType);
     AddCategoryMapping(HDCityID, torznabCategory);
 }
Пример #15
0
 void AddCat(int cat, TorznabCategory catType, string label)
 {
     AddCategoryMapping(cat, catType);
     categoryLabels.Add(label, cat);
 }