From 6e51f7f864616eb1499b1fb433f0d5152285c443 Mon Sep 17 00:00:00 2001 From: tidusjar Date: Wed, 19 May 2021 20:23:15 +0100 Subject: [PATCH] Added the demo to the new apis... I hate that fruit company, lets see if we can get approved now --- src/Ombi.Core/Engine/BaseMediaEngine.cs | 19 + .../Engine/V2/MovieSearchEngineV2.cs | 6 + src/Ombi.Core/Engine/V2/MultiSearchEngine.cs | 8 + src/Ombi.Core/Engine/V2/TvSearchEngineV2.cs | 4 + src/Ombi.Helpers/DemoSingleton.cs | 455 +++++++++++++++++- src/Ombi/Extensions/StartupExtensions.cs | 2 - 6 files changed, 491 insertions(+), 3 deletions(-) diff --git a/src/Ombi.Core/Engine/BaseMediaEngine.cs b/src/Ombi.Core/Engine/BaseMediaEngine.cs index d2e18d2b2..deef9ebea 100644 --- a/src/Ombi.Core/Engine/BaseMediaEngine.cs +++ b/src/Ombi.Core/Engine/BaseMediaEngine.cs @@ -48,6 +48,8 @@ namespace Ombi.Core.Engine protected readonly ISettingsService OmbiSettings; protected readonly IRepository _subscriptionRepository; + private bool _demo = DemoSingleton.Instance.Demo; + protected async Task> GetMovieRequests() { var now = DateTime.Now.Ticks; @@ -193,6 +195,23 @@ namespace Ombi.Core.Engine return ombiSettings ?? (ombiSettings = await OmbiSettings.GetSettingsAsync()); } + protected bool DemoCheck(string title) + { + if (!title.HasValue()) + { + return false; + } + if (_demo) + { + if (ExcludedDemo.ExcludedContent.Any(x => title.Contains(x, System.Globalization.CompareOptions.OrdinalIgnoreCase))) + { + return true; + } + return false; + } + return false; + } + public class HideResult { public bool Hide { get; set; } diff --git a/src/Ombi.Core/Engine/V2/MovieSearchEngineV2.cs b/src/Ombi.Core/Engine/V2/MovieSearchEngineV2.cs index f131662be..f3023c848 100644 --- a/src/Ombi.Core/Engine/V2/MovieSearchEngineV2.cs +++ b/src/Ombi.Core/Engine/V2/MovieSearchEngineV2.cs @@ -315,6 +315,12 @@ namespace Ombi.Core.Engine.V2 foreach (var movie in movies) { var result = await ProcessSingleMovie(movie); + + if (DemoCheck(result.Title)) + { + continue; + } + if (settings.HideAvailableFromDiscover && result.Available) { continue; diff --git a/src/Ombi.Core/Engine/V2/MultiSearchEngine.cs b/src/Ombi.Core/Engine/V2/MultiSearchEngine.cs index b24f5a42c..fc2595676 100644 --- a/src/Ombi.Core/Engine/V2/MultiSearchEngine.cs +++ b/src/Ombi.Core/Engine/V2/MultiSearchEngine.cs @@ -35,6 +35,8 @@ namespace Ombi.Core.Engine.V2 private readonly ISettingsService _lidarrSettings; private readonly IMusicBrainzApi _musicApi; + private bool _demo = DemoSingleton.Instance.Demo; + public async Task> MultiSearch(string searchTerm, MultiSearchFilter filter, CancellationToken cancellationToken) { @@ -60,6 +62,12 @@ namespace Ombi.Core.Engine.V2 foreach (var multiSearch in movieDbData) { + + if (DemoCheck(multiSearch.title) || DemoCheck(multiSearch.name)) + { + continue; + } + var result = new MultiSearchResult { MediaType = multiSearch.media_type, diff --git a/src/Ombi.Core/Engine/V2/TvSearchEngineV2.cs b/src/Ombi.Core/Engine/V2/TvSearchEngineV2.cs index e02ae1c51..2dbd59712 100644 --- a/src/Ombi.Core/Engine/V2/TvSearchEngineV2.cs +++ b/src/Ombi.Core/Engine/V2/TvSearchEngineV2.cs @@ -155,6 +155,10 @@ namespace Ombi.Core.Engine.V2 foreach (var tvMazeSearch in items) { + if (DemoCheck(tvMazeSearch.Title)) + { + continue; + } if (settings.HideAvailableFromDiscover) { // To hide, we need to know if it's fully available, the only way to do this is to lookup it's episodes to check if we have every episode diff --git a/src/Ombi.Helpers/DemoSingleton.cs b/src/Ombi.Helpers/DemoSingleton.cs index 22b6b2f31..79510e26c 100644 --- a/src/Ombi.Helpers/DemoSingleton.cs +++ b/src/Ombi.Helpers/DemoSingleton.cs @@ -1,4 +1,6 @@ -namespace Ombi.Helpers +using System.Collections.Generic; + +namespace Ombi.Helpers { public class DemoSingleton { @@ -10,4 +12,455 @@ public bool Demo { get; set; } } + + public static class ExcludedDemo + { + public static HashSet ExcludedContent => new HashSet + { + "101 Dalmatians", + "102 Dalmatians", + "20,000 Leagues Under the Sea", + "A Bug's Life", + "A Far Off Place", + "A Goofy Movie", + "A Kid in King Arthur's Court", + "A Tale of Two Critters", + "A Tiger Walks", + "A Wrinkle in Time", + "ABCD 2", + "African Cats", + "Air Bud", + "Air Bud: Golden Receiver", + "Aladdin", + "Aladdin", + "Alexander and the Terrible, Horrible, No Good, Very Bad Day", + "Alice Through the Looking Glass", + "Alice in Wonderland", + "Alice in Wonderland", + "Aliens of the Deep", + "Almost Angels", + "America's Heart and Soul", + "Amy", + "Anaganaga O Dheerudu", + "Angels in the Outfield", + "Arjun: The Warrior Prince", + "Around the World in 80 Days", + "Artemis Fowl", + "Atlantis: The Lost Empire", + "Babes in Toyland", + "Bambi", + "Bears", + "Beauty and the Beast", + "Beauty and the Beast", + "Bedknobs and Broomsticks", + "Bedtime Stories", + "Benji the Hunted", + "Beverly Hills Chihuahua", + "Big Hero 6", + "Big Red", + "Blackbeard's Ghost", + "Blank Check", + "Blue", + "Bolt", + "Bon Voyage!", + "Born in China", + "Brave", + "Bridge to Terabithia", + "Brother Bear", + "Candleshoe", + "Cars", + "Cars 2", + "Cars 3", + "Charley and the Angel", + "Charlie, the Lonesome Cougar", + "Cheetah", + "Chicken Little", + "Chimpanzee", + "Christopher Robin", + "Cinderella", + "Cinderella", + "Coco", + "College Road Trip", + "Condorman", + "Confessions of a Teenage Drama Queen", + "Cool Runnings", + "D2: The Mighty Ducks", + "D3: The Mighty Ducks", + "Dangal", + "Darby O'Gill and the Little People", + "Dasavathaaram", + "Davy Crockett and the River Pirates", + "Davy Crockett, King of the Wild Frontier", + "Dinosaur", + "Disney's A Christmas Carol", + "Disney's The Kid", + "Do Dooni Chaar", + "Dolphin Reef", + "Doug's 1st Movie", + "Dragonslayer", + "DuckTales the Movie: Treasure of the Lost Lamp", + "Dumbo", + "Dumbo", + "Earth", + "Eight Below", + "Emil and the Detectives", + "Enchanted", + "Endurance", + "Escape to Witch Mountain", + "Expedition China", + "Fantasia", + "Fantasia 2000", + "Finding Dory", + "Finding Nemo", + "First Kid", + "Flight of the Navigator", + "Flubber", + "Follow Me, Boys!", + "Frank and Ollie", + "Frankenweenie", + "Freaky Friday", + "Freaky Friday", + "Frozen", + "Frozen II", + "Onward", + "Star Wars", + "Raya", + "Mandalorian", + "Fun and Fancy Free", + "G-Force", + "George of the Jungle", + "Ghost in the Shell 2: Innocence GITS2", + "Ghost of the Mountains", + "Ghosts of the Abyss", + "Glory Road", + "Greyfriars Bobby", + "Growing Up Wild", + "Gus", + "Hannah Montana and Miley Cyrus: Best of Both Worlds Concert", + "Hannah Montana: The Movie", + "Heavyweights", + "Herbie Goes Bananas", + "Herbie Goes to Monte Carlo", + "Herbie Rides Again", + "Herbie: Fully Loaded", + "Hercules", + "High School Musical 3: Senior Year", + "Hocus Pocus", + "Holes", + "Home on the Range", + "Homeward Bound II: Lost in San Francisco", + "Homeward Bound: The Incredible Journey", + "Honey, I Blew Up the Kid", + "Honey, I Shrunk the Kids", + "Hot Lead and Cold Feet", + "I'll Be Home for Christmas", + "Ice Princess", + "In Search of the Castaways", + "Incredibles 2", + "Inside Out", + "Inspector Gadget", + "Into the Woods", + "Invincible", + "Iron Will", + "Jagga Jasoos", + "James and the Giant Peach", + "John Carter", + "Johnny Tremain", + "Jonas Brothers: The 3D Concert Experience", + "Jungle 2 Jungle", + "Jungle Cat", + "Khoobsurat", + "Kidnapped", + "King of the Grizzlies", + "L'Empereur - March of the Penguins 2: The Next Step[a]", + "Lady and the Tramp", + "Lady and the Tramp", + "Lilly the Witch: The Dragon and the Magic Book", + "Lilly the Witch: The Journey to Mandolan", + "Lilo & Stitch", + "Lt. Robin Crusoe, U.S.N.", + "Make Mine Music", + "Maleficent", + "Maleficent: Mistress of Evil", + "Man of the House", + "Mars Needs Moms", + "Mary Poppins", + "Mary Poppins Returns", + "Max Keeble's Big Move", + "McFarland, USA", + "Meet the Deedles", + "Meet the Robinsons", + "Melody Time", + "Midnight Madness", + "Mighty Joe Young", + "Million Dollar Arm", + "Miracle", + "Miracle of the White Stallions", + "Moana", + "Monkey Kingdom", + "Monkeys, Go Home!", + "Monsters University", + "Monsters, Inc.", + "Moon Pilot", + "Morning Light", + "Mr. Magoo", + "Mulan", + "Muppet Treasure Island", + "Muppets Most Wanted", + "My Favorite Martian", + "Napoleon and Samantha", + "National Treasure", + "National Treasure: Book of Secrets", + "Never Cry Wolf", + "Never a Dull Moment", + "Newsies", + "Night Crossing", + "Nikki, Wild Dog of the North", + "No Deposit, No Return", + "Now You See Him, Now You Don't", + "Oceans", + "Old Dogs", + "Old Yeller", + "Oliver & Company", + "One Hundred and One Dalmatians", + "One Little Indian", + "One Magic Christmas", + "One of Our Dinosaurs Is Missing", + "Operation Dumbo Drop", + "Oz the Great and Powerful", + "Penguins", + "Perri", + "Pete's Dragon", + "Pete's Dragon", + "Peter Pan", + "Piglet's Big Movie", + "Pinocchio", + "Pirates of the Caribbean: At World's End", + "Pirates of the Caribbean: Dead Man's Chest", + "Pirates of the Caribbean: Dead Men Tell No Tales", + "Pirates of the Caribbean: On Stranger Tides", + "Pirates of the Caribbean: The Curse of the Black Pearl", + "Planes", + "Planes: Fire & Rescue", + "Pocahontas", + "Pollyanna", + "Pooh's Heffalump Movie", + "Popeye", + "Prince of Persia: The Sands of Time", + "Prom", + "Queen of Katwe", + "Race to Witch Mountain", + "Ralph Breaks the Internet", + "Rascal", + "Ratatouille", + "Recess: School's Out", + "Remember the Titans", + "Return from Witch Mountain", + "Return to Never Land", + "Return to Oz", + "Return to Snowy River", + "Ride a Wild Pony", + "Roadside Romeo", + "Rob Roy, the Highland Rogue", + "Robin Hood", + "RocketMan", + "Roving Mars", + "Run, Cougar, Run", + "Sacred Planet", + "Saludos Amigos", + "Savage Sam", + "Saving Mr. Banks", + "Scandalous John", + "Secretariat", + "Secrets of Life", + "Shipwrecked", + "Sky High", + "Sleeping Beauty", + "Smith!", + "Snow Dogs", + "Snow White and the Seven Dwarfs", + "Snowball Express", + "So Dear to My Heart", + "Something Wicked This Way Comes", + "Son of Flubber", + "Song of the South", + "Squanto: A Warrior's Tale", + "Summer Magic", + "Superdad", + "Swiss Family Robinson", + "Tall Tale", + "Tangled", + "Tarzan", + "Teacher's Pet", + "Ten Who Dared", + "Tex", + "That Darn Cat", + "That Darn Cat!", + "The Absent-Minded Professor", + "The Adventures of Bullwhip Griffin", + "The Adventures of Huck Finn", + "The Adventures of Ichabod and Mr. Toad", + "The African Lion", + "The Apple Dumpling Gang", + "The Apple Dumpling Gang Rides Again", + "The Aristocats", + "The BFG", + "The Barefoot Executive", + "The Bears and I", + "The Best of Walt Disney's True-Life Adventures", + "The Big Green", + "The Biscuit Eater", + "The Black Cauldron", + "The Black Hole", + "The Boatniks", + "The Book of Masters", + "The Boys: The Sherman Brothers' Story", + "The Castaway Cowboy", + "The Cat from Outer Space", + "The Chronicles of Narnia: Prince Caspian", + "The Chronicles of Narnia: The Lion, the Witch and the Wardrobe", + "The Computer Wore Tennis Shoes", + "The Country Bears", + "The Crimson Wing: Mystery of the Flamingos", + "The Devil and Max Devlin", + "The Emperor's New Groove", + "The Fighting Prince of Donegal", + "The Finest Hours", + "The Fox and the Hound", + "The Game Plan", + "The Gnome-Mobile", + "The Good Dinosaur", + "The Great Locomotive Chase", + "The Great Mouse Detective", + "The Greatest Game Ever Played", + "The Happiest Millionaire", + "The Haunted Mansion", + "The Horse in the Gray Flannel Suit", + "The Hunchback of Notre Dame", + "The Incredible Journey", + "The Incredibles", + "The Island at the Top of the World", + "The Journey of Natty Gann", + "The Jungle Book", + "The Jungle Book", + "The Jungle Book", + "The Jungle Book 2", + "The Last Flight of Noah's Ark", + "The Legend of Lobo", + "The Light in the Forest", + "The Lion King", + "The Lion King", + "The Little Mermaid", + "The Littlest Horse Thieves", + "The Littlest Outlaw", + "The Living Desert", + "The Lizzie McGuire Movie", + "The London Connection", + "The Lone Ranger", + "The Love Bug", + "The Many Adventures of Winnie the Pooh", + "The Mighty Ducks", + "The Million Dollar Duck", + "The Misadventures of Merlin Jones", + "The Monkey's Uncle", + "The Moon-Spinners", + "The Muppet Christmas Carol", + "The Muppets", + "The Nightmare Before Christmas 3D TNBC", + "The North Avenue Irregulars", + "The Nutcracker and the Four Realms", + "The Odd Life of Timothy Green", + "The One and Only, Genuine, Original Family Band", + "The Pacifier", + "The Parent Trap", + "The Parent Trap", + "The Pixar Story", + "The Princess Diaries", + "The Princess Diaries 2: Royal Engagement", + "The Princess and the Frog", + "The Reluctant Dragon", + "The Rescuers", + "The Rescuers Down Under", + "The Rocketeer TR", + "The Rookie", + "The Santa Clause 2", + "The Santa Clause 3: The Escape Clause", + "The Santa Clause TSC", + "The Shaggy D.A.", + "The Shaggy Dog", + "The Shaggy Dog", + "The Sign of Zorro", + "The Sorcerer's Apprentice", + "The Story of Robin Hood and His Merrie Men", + "The Straight Story", + "The Strongest Man in the World", + "The Sword and the Rose", + "The Sword in the Stone", + "The Three Caballeros", + "The Three Lives of Thomasina", + "The Three Musketeers", + "The Tigger Movie", + "The Ugly Dachshund", + "The Vanishing Prairie", + "The Watcher in the Woods", + "The Wild", + "The Wild Country", + "The World's Greatest Athlete", + "The Young Black Stallion", + "Third Man on the Mountain", + "Those Calloways", + "Toby Tyler", + "Tom and Huck", + "Tomorrowland", + "Tonka", + "Toy Story", + "Toy Story 2", + "Toy Story 3", + "Toy Story 4", + "Trail of the Panda", + "Treasure Island", + "Treasure Planet", + "Treasure of Matecumbe", + "Trenchcoat", + "Tron", + "Tron: Legacy", + "Tuck Everlasting", + "Underdog", + "Unidentified Flying Oddball", + "Up", + "Valiant", + "Victory Through Air Power", + "WALL-E", + "Waking Sleeping Beauty", + "Walt & El Grupo", + "Westward Ho the Wagons!", + "White Fang", + "White Fang 2: Myth of the White Wolf", + "White Wilderness", + "Wild Hearts Can't Be Broken", + "Wings of Life", + "Winnie the Pooh", + "Wreck-It Ralph", + "Zokkomon", + "Zootopia", + "Zorro the Avenger", + "Iron Man", +"Hulk", +"Thor", +"Avengers", +"Guardians of the Galaxy", +"Ant-Man", +"Captain America", +"Doctor Strange", +"Guardians of the Galaxy", +"Spider-Man", +"Black Panther", +"Marvel", +"Spider Man", +"SpiderMan", +"Loki", +"Winter Soldier", +"Wanda" + }; + } } \ No newline at end of file diff --git a/src/Ombi/Extensions/StartupExtensions.cs b/src/Ombi/Extensions/StartupExtensions.cs index 860ab40fb..5149c4fea 100644 --- a/src/Ombi/Extensions/StartupExtensions.cs +++ b/src/Ombi/Extensions/StartupExtensions.cs @@ -72,8 +72,6 @@ namespace Ombi services.Configure(configuration.GetSection("TokenAuthentication")); services.Configure(configuration.GetSection("LandingPageBackground")); services.Configure(configuration.GetSection("Demo")); - var enabledDemo = Convert.ToBoolean(configuration.GetSection("Demo:Enabled").Value); - DemoSingleton.Instance.Demo = enabledDemo; } public static void AddJwtAuthentication(this IServiceCollection services)