public DiscordMovieUserInterface(
     DiscordInteraction interactionContext,
     IMovieSearcher movieSearcher)
 {
     _interactionContext = interactionContext;
     _movieSearcher      = movieSearcher;
 }
Beispiel #2
0
 public MovieNotificationEngine(
     IMovieSearcher movieSearcher,
     IMovieNotifier notifier,
     ILogger <ChatBot> logger,
     MovieNotificationsRepository notificationRequestRepository)
 {
     _movieSearcher = movieSearcher;
     _notifier      = notifier;
     _logger        = logger;
     _notificationRequestRepository = notificationRequestRepository;
 }
Beispiel #3
0
 public MovieNotificationEngine(
     IMovieSearcher movieSearcher,
     UserMovieNotifier userMovieNotifier,
     ILogger <RequestrrBot> logger,
     MovieNotificationsRepository notificationRequestRepository)
 {
     _movieSearcher                 = movieSearcher;
     _userMovieNotifier             = userMovieNotifier;
     _logger                        = logger;
     _notificationRequestRepository = notificationRequestRepository;
 }
Beispiel #4
0
 public MovieNotificationWorkflow(
     MovieNotificationsRepository movieNotificationsRepository,
     IMovieUserInterface userInterface,
     IMovieSearcher movieSearcher,
     bool automaticNotificationForNewRequests)
 {
     _notificationsRepository             = movieNotificationsRepository;
     _userInterface                       = userInterface;
     _movieSearcher                       = movieSearcher;
     _automaticNotificationForNewRequests = automaticNotificationForNewRequests;
 }
 public MovieRequestingWorkflow(
     MovieUserRequester user,
     IMovieSearcher searcher,
     IMovieRequester requester,
     IMovieUserInterface userInterface,
     MovieNotificationsRepository notificationRequestRepository)
 {
     _user          = user;
     _searcher      = searcher;
     _requester     = requester;
     _userInterface = userInterface;
     _notificationRequestRepository = notificationRequestRepository;
 }
 public MovieRequestingWorkflow(
     MovieUserRequester user,
     IMovieSearcher searcher,
     IMovieRequester requester,
     IMovieUserInterface userInterface,
     IMovieNotificationWorkflow movieNotificationWorkflow)
 {
     _user                 = user;
     _searcher             = searcher;
     _requester            = requester;
     _userInterface        = userInterface;
     _notificationWorkflow = movieNotificationWorkflow;
 }
Beispiel #7
0
 public DiscordMovieRequestingWorkFlow(
     SocketCommandContext context,
     DiscordSocketClient discord,
     IMovieSearcher movieSearcher,
     IMovieRequester movieRequester,
     DiscordSettingsProvider discordSettingsProvider,
     MovieNotificationsRepository notificationRequestRepository)
     : base(discord, context, discordSettingsProvider)
 {
     _movieSearcher  = movieSearcher;
     _movieRequester = movieRequester;
     _notificationRequestRepository = notificationRequestRepository;
     _discordSettings = discordSettingsProvider.Provide();
 }
 public LocalMovieSearcher(IMovieSearcher movieSearcher)
 {
     globalMovieSearcher = movieSearcher;
     localMovieDB        = new List <Movie>()
     {
         new Movie()
         {
             Country = "Azerbaijan", Director = "Haci", Genre = "Action", Actors = "Maga", Title = "Rocky"
         },
         new Movie()
         {
             Country = "Azerbaijan", Director = "Samur", Genre = "Dram", Actors = "Bred Pit", Title = "Thinking man"
         },
         new Movie()
         {
             Country = "Azerbaijan", Director = "Elesger", Genre = "Detective", Actors = "Benedict", Title = "Pianist"
         }
     };
 }
Beispiel #9
0
 public LocalMovieSearcher(IMovieSearcher global)
 {
     globalSearch = global;
     localMovies  = new List <Movie>()
     {
         new Movie()
         {
             Title = "Unfinished project", Country = "Azerbaijan", Director = "Alex", Genre = "Horor", Actors = "Tom Hanks"
         },
         new Movie()
         {
             Title = "Finished project", Country = "Azerbaijan", Director = "Samir", Genre = "Fantasy", Actors = "Harison Ford"
         },
         new Movie()
         {
             Title = "The project: Last chance", Country = "Azerbaijan", Director = "Maga", Genre = "Dram", Actors = "Will Smith"
         },
     };
 }
        public static async Task <Embed> GenerateMovieDetailsAsync(Movie movie, SocketUser user, IMovieSearcher movieSearcher = null)
        {
            var embedBuilder = new EmbedBuilder()
                               .WithTitle($"{movie.Title} {(!string.IsNullOrWhiteSpace(movie.ReleaseDate) ? $"({movie.ReleaseDate.Split("T")[0].Substring(0, 4)})" : string.Empty)}")
                               .WithDescription(movie.Overview.Substring(0, Math.Min(movie.Overview.Length, 255)) + "(...)")
                               .WithFooter(user.Username, $"https://cdn.discordapp.com/avatars/{user.Id.ToString()}/{user.AvatarId}.png")
                               .WithTimestamp(DateTime.Now)
                               .WithUrl($"https://www.themoviedb.org/movie/{movie.TheMovieDbId}")
                               .WithThumbnailUrl("https://i.imgur.com/44ueTES.png");

            if (!string.IsNullOrEmpty(movie.PosterPath) && movie.PosterPath.StartsWith("http", StringComparison.InvariantCultureIgnoreCase))
            {
                embedBuilder.WithImageUrl(movie.PosterPath);
            }
            if (!string.IsNullOrWhiteSpace(movie.Quality))
            {
                embedBuilder.AddField("__Quality__", $"{movie.Quality}p", true);
            }
            if (!string.IsNullOrWhiteSpace(movie.PlexUrl))
            {
                embedBuilder.AddField("__Plex__", $"[Watch now]({movie.PlexUrl})", true);
            }
            if (!string.IsNullOrWhiteSpace(movie.EmbyUrl))
            {
                embedBuilder.AddField("__Emby__", $"[Watch now]({movie.EmbyUrl})", true);
            }

            if (movieSearcher != null)
            {
                try
                {
                    var details = await movieSearcher.GetMovieDetails(movie.TheMovieDbId);

                    if (!string.IsNullOrWhiteSpace(details.InTheatersDate))
                    {
                        embedBuilder.AddField("__In Theaters__", $"{details.InTheatersDate}", true);
                    }

                    if (!string.IsNullOrWhiteSpace(details.PhysicalReleaseName) && !string.IsNullOrWhiteSpace(details.PhysicalReleaseDate))
                    {
                        embedBuilder.AddField($"__{details.PhysicalReleaseName} Release__", $"{details.PhysicalReleaseDate}", true);
                    }
                }
                catch
                {
                    // Ignore
                }
            }

            return(embedBuilder.Build());
        }
        public static async Task <DiscordEmbed> GenerateMovieDetailsAsync(Movie movie, IMovieSearcher movieSearcher = null)
        {
            var embedBuilder = new DiscordEmbedBuilder()
                               .WithTitle($"{movie.Title} {(!string.IsNullOrWhiteSpace(movie.ReleaseDate) && movie.ReleaseDate.Length >= 4 ? $"({movie.ReleaseDate.Split("T")[0].Substring(0, 4)})" : string.Empty)}")
                               .WithTimestamp(DateTime.Now)
                               .WithUrl($"https://www.themoviedb.org/movie/{movie.TheMovieDbId}")
                               .WithThumbnail("https://i.imgur.com/44ueTES.png")
                               .WithFooter("Powered by Requestrr");

            if (!string.IsNullOrWhiteSpace(movie.Overview))
            {
                embedBuilder.WithDescription(movie.Overview.Substring(0, Math.Min(movie.Overview.Length, 255)) + "(...)");
            }

            if (!string.IsNullOrEmpty(movie.PosterPath) && movie.PosterPath.StartsWith("http", StringComparison.InvariantCultureIgnoreCase))
            {
                embedBuilder.WithImageUrl(movie.PosterPath);
            }
            if (!string.IsNullOrWhiteSpace(movie.Quality))
            {
                embedBuilder.AddField($"__{Language.Current.DiscordEmbedMovieQuality}__", $"{movie.Quality}p", true);
            }

            if (movieSearcher != null)
            {
                try
                {
                    var details = await movieSearcher.GetMovieDetails(new MovieRequest(null, int.MinValue), movie.TheMovieDbId);

                    if (!string.IsNullOrWhiteSpace(details.InTheatersDate))
                    {
                        embedBuilder.AddField($"__{Language.Current.DiscordEmbedMovieInTheaters}__", $"{details.InTheatersDate}", true);
                    }
                    else if (!string.IsNullOrWhiteSpace(movie.ReleaseDate))
                    {
                        embedBuilder.AddField($"__{Language.Current.DiscordEmbedMovieInTheaters}__", $"{DateTime.Parse(movie.ReleaseDate).ToString("MMMM dd yyyy", DateTimeFormatInfo.InvariantInfo)}", true);
                    }

                    if (!string.IsNullOrWhiteSpace(details.PhysicalReleaseName) && !string.IsNullOrWhiteSpace(details.PhysicalReleaseDate))
                    {
                        embedBuilder.AddField($"__{details.PhysicalReleaseName} {Language.Current.DiscordEmbedMovieRelease}__", $"{details.PhysicalReleaseDate}", true);
                    }
                }
                catch
                {
                    // Ignore
                }
            }

            if (!string.IsNullOrWhiteSpace(movie.PlexUrl))
            {
                embedBuilder.AddField($"__Plex__", $"[{Language.Current.DiscordEmbedMovieWatchNow}]({movie.PlexUrl})", true);
            }
            if (!string.IsNullOrWhiteSpace(movie.EmbyUrl))
            {
                embedBuilder.AddField($"__Emby__", $"[{Language.Current.DiscordEmbedMovieWatchNow}]({movie.EmbyUrl})", true);
            }

            return(embedBuilder.Build());
        }
Beispiel #12
0
 public MainSearchPresenter(IMainSearchView mainSearchView)
 {
     this.mainSearchView = mainSearchView;
     movieSearcher       = new MovieSearcherService("ba0ef793");
 }