Пример #1
0
        private bool ConfirmAdd(TVShowFromTVDBDto show)
        {
            string response = "";
            bool   addToDb  = false;

            while (IsNotYesOrNo(response))
            {
                MenuHelpers.WriteColor($"Add ");
                MenuHelpers.WriteColor($"{show.SeriesNameTVDB} ", ConsoleColor.Yellow);
                MenuHelpers.WriteColor($"to TVDB Favorites & database? (Y/N) ");
                response = Console.ReadLine().ToUpper();
                if (response == "Y")
                {
                    addToDb = true;
                }
                else if (response == "N")
                {
                    addToDb = false;
                }
                else
                {
                    continue;
                }
            }
            return(addToDb);
        }
Пример #2
0
        private int DisplayIndividualShowMenu()
        {
            DisplayShowBanner();
            MenuHelpers.PrintMenuNumber(1);
            MenuHelpers.WriteLineColorVT24Bit("Display all episodes in database", "#7a918d");
            MenuHelpers.PrintMenuNumber(2);
            MenuHelpers.WriteLineColorVT24Bit("Check for new/updated episodes in TVDB", "#93b1a7");
            MenuHelpers.PrintMenuNumber(3);
            MenuHelpers.WriteLineColorVT24Bit("Add/Change Preferred Name", "#99c2a2");
            MenuHelpers.PrintMenuNumber(4);
            MenuHelpers.WriteLineColorVT24Bit($"Toggle Active Status", "#c5edac");
            MenuHelpers.PrintMenuNumber(5);
            MenuHelpers.WriteLineColorVT24Bit($"Get episodes from specific Json page", "#ce5374");
            MenuHelpers.PrintMenuNumber(9);
            MenuHelpers.WriteLineColor("Return to List of Shows", ConsoleColor.DarkCyan);
            MenuHelpers.WriteColorVT24Bit($"Enter your selection: ", "#C0D684");
            string userInput = Console.ReadLine();

            if (userInput.IsNumeric())
            {
                return(userInput.ToInt());
            }
            else
            {
                return(0);
            }
        }
Пример #3
0
        private async Task DisplayResultsAndPromptToAddShow(List <TVShowFromTVDBDto> searchResults)
        {
            string userShowSelection = "INITIAL";
            string exitCharUpper     = "X";

            while (MenuHelpers.StringIsNotNumericOrExitChar(userShowSelection, exitCharUpper))
            {
                userShowSelection = DisplaySearchResults(searchResults, exitCharUpper);
                if (userShowSelection.IsNumeric())
                {
                    int userSelection = userShowSelection.ToInt();
                    int numberOfShows = searchResults.Count;
                    if ((userSelection >= 0) && (userSelection < numberOfShows))
                    {
                        TVShowFromTVDBDto selectedShow = searchResults[userSelection];
                        await ConfirmThenAddShowToDatabase(selectedShow);
                    }
                    else
                    {
                        Console.WriteLine("That's not one of the shows on the list");
                        continue;
                    }
                }
                else if (userShowSelection.ToUpper() == exitCharUpper)
                {
                    return;
                }
            }
        }
Пример #4
0
        private TVShow DisplayTVShowMenu(TVShow[] showArray)
        {
            int    userSelection = -1;
            string userInput     = "INITIAL";
            string exitCharUpper = "X";
            int    numberOfShows = showArray.Count();

            while (MenuHelpers.StringIsNotNumericOrExitChar(userInput, exitCharUpper))
            {
                userInput = DisplayListOfShows(showArray, exitCharUpper);
                if (userInput.IsNumeric())
                {
                    userSelection = userInput.ToInt();
                    if ((userSelection >= 0) && (userSelection < numberOfShows))
                    {
                        return(showArray[userSelection]);
                    }
                    else
                    {
                        Console.WriteLine("That's not a valid selection, dude");
                        continue;
                        // at this point, we return to the while loop
                    }
                }
                else if (userInput.ToUpper() == exitCharUpper)
                {
                    return(null);
                }
            }
            // if user selected "X", it returns null
            // if user selected a valid number, it returns the corresponding TV Show
            // if invalid number or string that isn't "X", it stays in the loop
            // so we should never actually hit this
            return(showArray[userSelection]);
        }
Пример #5
0
        private string DisplaySearchResults(List <TVShowFromTVDBDto> showList, string exitCharUpper)
        {
            int numberOfShows = showList.Count;

            MenuHelpers.WriteLineColor("Search Results", ConsoleColor.White, ConsoleColor.DarkMagenta);
            for (int i = 0; i < numberOfShows; i++)
            {
                MenuHelpers.PrintMenuNumber(i);
                MenuHelpers.WriteColor($"{showList[i].SeriesNameTVDB}", ConsoleColor.Yellow);
                MenuHelpers.WriteColor(" | ");
                MenuHelpers.WriteColor($"{showList[i].Network}", ConsoleColor.Cyan);
                MenuHelpers.WriteColor(" | ");
                MenuHelpers.WriteColor("First Aired: ", ConsoleColor.Gray);
                MenuHelpers.WriteColor($"{showList[i].FirstAired}", ConsoleColor.Magenta);
                MenuHelpers.WriteColor(" | ");
                PrintShowStatus(showList[i].Status);
                MenuHelpers.WriteColor(" | ");
                MenuHelpers.WriteColor("SeriesId: ", ConsoleColor.Gray);
                MenuHelpers.WriteLineColor($"{showList[i].SeriesId}");
            }
            Console.Write($"Enter the number of the show to add it to DB (");
            MenuHelpers.WriteColor($"{ exitCharUpper} to return to Main Menu", ConsoleColor.DarkCyan);
            Console.WriteLine("):");
            string userInput = Console.ReadLine();

            return(userInput);
        }
Пример #6
0
        private static void PrintEpisodeInfo(Episode ep)
        {
            int epNumber = (int)ep.AiredEpisodeNumber;

            MenuHelpers.WriteColorVT24Bit($"{ep.Season}.{epNumber.ToString("D2")}", "#d88373");
            MenuHelpers.WriteColor(" - ", ConsoleColor.DarkGray);
            MenuHelpers.WriteLineGradientWhiteToBlue($"{ep.EpisodeName}", 30);
        }
Пример #7
0
 private void DisplayShowBanner()
 {
     MenuHelpers.DisplayShowName(Show.SeriesName, Show.IsActive);
     MenuHelpers.DisplayShowActiveStatus(Show.IsActive);
     MenuHelpers.WriteColorVT24Bit($"SeriesId: ", "#adcad6");
     MenuHelpers.WriteColor($"{Show.SeriesId} ", ConsoleColor.White);
     MenuHelpers.WriteColor("| ", ConsoleColor.Magenta);
     MenuHelpers.WriteColorVT24Bit("Preferred Name: ", "#adcad6");
     MenuHelpers.WriteLineColor($"{Show.SeriesNamePreferred}", ConsoleColor.Yellow);
 }
Пример #8
0
        private void PrintShowStatus(string showStatus)
        {
            ConsoleColor fontColor = ConsoleColor.Red;

            if (showStatus == "Continuing")
            {
                fontColor = ConsoleColor.Green;
            }
            MenuHelpers.WriteColor($"{showStatus}", fontColor);
        }
Пример #9
0
        private static string PromptForSearchTerms()
        {
            string userSearch;

            Console.Write("Enter a show to search for (");
            MenuHelpers.WriteColor("blank to return to menu", ConsoleColor.DarkCyan);
            Console.WriteLine("):");
            userSearch = Console.ReadLine();
            return(userSearch);
        }
Пример #10
0
 public static void DisplayShowActiveStatus(bool isActive)
 {
     if (isActive)
     {
         MenuHelpers.WriteLineColor("(Active)", ConsoleColor.Green);
     }
     else
     {
         MenuHelpers.WriteLineColor("(Inactive)", ConsoleColor.DarkGray);
     }
 }
Пример #11
0
 private void DisplayTokenStatus(bool IsValid)
 {
     if (IsValid)
     {
         // MenuHelpers.WriteLineColor("(Token is Valid! \u306F hey)", ConsoleColor.Green);
         MenuHelpers.WriteLineColorVT24Bit("(Token is Valid!)", "#00FF00");
     }
     else
     {
         MenuHelpers.WriteLineColor("(Token Expired!)", ConsoleColor.Red);
     }
 }
Пример #12
0
        private void PrintTokenExpiration(TVDBInfo tvdbInfo)
        {
            DateTime expiration = tvdbInfo.GetExpiration();
            string   expireWord = "expires";

            if (tvdbInfo.TokenIsExpired)
            {
                expireWord = "expired";
            }
            MenuHelpers.WriteColorVT24Bit($"Token {expireWord} on ", "#dbbbf5");
            MenuHelpers.WriteColorVT24Bit($"{expiration.ToString("MM/dd/yyyy hh:mm tt")}", "#ce5374");
            Console.WriteLine();
        }
Пример #13
0
        private async Task ProcessUserSearch(string userSearch)
        {
            List <TVShowFromTVDBDto> searchResults = await Facade.SearchForTVShows(userSearch);

            if (searchResults != null)
            {
                await DisplayResultsAndPromptToAddShow(searchResults);
            }
            else
            {
                MenuHelpers.WriteLineColor($"NO RESULTS FOUND FOR {userSearch}", ConsoleColor.Red);
            }
        }
Пример #14
0
        private async Task SearchForShowsToAddtoDb()
        {
            MenuHelpers.WriteLineColor("Let's search for a show!");
            string userSearch = "temp";

            while (userSearch != "")
            {
                userSearch = PromptForSearchTerms();
                if (userSearch != "")
                {
                    await ProcessUserSearch(userSearch);
                }
            }
        }
Пример #15
0
        private string DisplayListOfShows(TVShow[] showArray, string exitCharUpper)
        {
            int numberOfShows = showArray.Count();

            Console.WriteLine("TV Show Menu");
            for (int i = 0; i < numberOfShows; i++)
            {
                MenuHelpers.PrintMenuNumber(i);
                MenuHelpers.DisplayShowName(showArray[i].SeriesName, showArray[i].IsActive);
                MenuHelpers.DisplayShowActiveStatus(showArray[i].IsActive);
            }
            MenuHelpers.WriteColorVT24Bit($"Enter the number of the show (", "#F3F9D2");
            MenuHelpers.WriteColor($"{ exitCharUpper} to return to Main Menu", ConsoleColor.DarkCyan);
            MenuHelpers.WriteColorVT24Bit("): ", "#F3F9D2");
            string userInput = Console.ReadLine();

            return(userInput);
        }
Пример #16
0
        private int DisplayMainMenu(TVDBInfo tvdbInfo)
        {
            bool tokenIsValid = !tvdbInfo.TokenIsInvalid;

            PrintTokenExpiration(tvdbInfo);
            MenuHelpers.WriteLineColor("\u001b[4mEpisode Renamer!\u001b[0m", ConsoleColor.Yellow, ConsoleColor.DarkMagenta);
            // MenuHelpers.WriteLineGradientWhiteToBlue("Episode Renamer!");
            Console.WriteLine();

            MenuHelpers.PrintMenuNumber(1);
            MenuHelpers.WriteColorVT24Bit("Get or refresh token  ", "#e56399");
            DisplayTokenStatus(tokenIsValid);

            MenuHelpers.PrintMenuNumber(2);
            MenuHelpers.WriteLineColorVT24Bit("Populate Shows table from User Favorites", "#e5d4ce");

            MenuHelpers.PrintMenuNumber(3);
            MenuHelpers.WriteLineColorVT24Bit("Populate Episodes for existing Active shows", "#7fd1b9");

            MenuHelpers.PrintMenuNumber(4);
            MenuHelpers.WriteLineColorVT24Bit("TV Show menu", "#FF6C2C");

            MenuHelpers.PrintMenuNumber(5);
            MenuHelpers.WriteLineColor("RENAME FILES!!", ConsoleColor.Yellow);

            MenuHelpers.PrintMenuNumber(6);
            MenuHelpers.WriteLineColor("Search for shows on TVDB", ConsoleColor.White);


            MenuHelpers.PrintMenuNumber(9);
            MenuHelpers.WriteLineColor("Exit, if you dare", ConsoleColor.DarkCyan);
            var result = Console.ReadLine();

            if (result.IsNumeric())
            {
                return(result.ToInt());
            }
            else
            {
                return(0);
            }
        }
Пример #17
0
 private async Task ProcessMainMenuUserInput(int selection)
 {
     if (selection == 1)
     {
         await Facade.FetchTokenIfNeeded();
     }
     else if (selection == 2)
     {
         await Facade.PopulateShowsFromFavorites();
     }
     else if (selection == 3)
     {
         await Facade.PopulateEpisodesFromExistingActiveShows();
     }
     else if (selection == 4)
     {
         await CreateTVShowMenu();
     }
     else if (selection == 5)
     {
         Console.WriteLine("OK we are getting down to business");
         Facade.RenameFiles();
     }
     else if (selection == 6)
     {
         await CreateSearchMenu();
     }
     else if (selection == 9)
     {
         return;
     }
     else
     {
         MenuHelpers.WriteLineColor("Not a valid choice, bro!", ConsoleColor.Red);
     }
 }
Пример #18
0
        private void DisplayShowName(TVShow show)
        {
            var displayColor = ConsoleColor.White;

            MenuHelpers.WriteColor($"{show.SeriesName} ", displayColor);
        }