public void TestGetEpisodeBySeriesTitleGood() { var omdb = new OmdbClient(TestData.apikey); var episode = omdb.GetEpisodeBySeriesTitle("arrow", 1, 1); var ratings = episode.Ratings.ToArray(); Assert.Equal("Internet Movie Database", ratings[0].Source); Assert.Equal("Pilot", episode.Title); Assert.Equal("2012", episode.Year); Assert.Equal("TV-PG", episode.Rated); Assert.Equal("10 Oct 2012", episode.Released); Assert.Equal("1", episode.SeasonNumber); Assert.Equal("1", episode.EpisodeNumber); Assert.Equal("45 min", episode.Runtime); Assert.Equal("David Nutter", episode.Director); Assert.Equal("English", episode.Language); Assert.Equal("USA, Canada", episode.Country); Assert.Equal("tt2340185", episode.ImdbId); Assert.Equal("tt2193021", episode.SeriesId); Assert.Equal("episode", episode.Type); Assert.Equal("True", episode.Response); }
public void TestGetItemByTitleGood2() { var omdb = new OmdbClient(TestData.apikey, true); var movie = omdb.GetItemByTitle("Star Wars", OmdbType.Movie, 2017, false); var ratings = movie.Ratings.ToArray(); Assert.Equal("Internet Movie Database", ratings[0].Source); Assert.Equal("Rotten Tomatoes", ratings[1].Source); Assert.Equal("Metacritic", ratings[2].Source); Assert.Equal("Star Wars: Episode VIII - The Last Jedi", movie.Title); Assert.Equal("2017", movie.Year); Assert.Equal("PG-13", movie.Rated); Assert.Equal("15 Dec 2017", movie.Released); Assert.Equal("152 min", movie.Runtime); Assert.Equal("Rian Johnson", movie.Director); Assert.Equal("English", movie.Language); Assert.Equal("USA", movie.Country); Assert.Equal("movie", movie.Type); Assert.Equal("http://www.rottentomatoes.com/m/star_wars_episode_viii/", movie.TomatoUrl); Assert.Equal("Walt Disney Pictures", movie.Production); Assert.Null(movie.TotalSeasons); Assert.Equal("True", movie.Response); }
public MovieNightModule(OmdbClient omdbClient, IMediator mediator, BotService bot, NodaTimeConverterService nodaTimeConverterService) { this.omdbClient = omdbClient; this.mediator = mediator; this.bot = bot; this.nodaTimeConverterService = nodaTimeConverterService; }
public void TestGetSeasonBySeriesTitleGood() { var omdb = new OmdbClient(TestData.apikey); var season = omdb.GetSeasonBySeriesTitle("arrow", 1); var episodes = season.Episodes.ToArray(); Assert.Equal("Pilot", episodes[0].Title); Assert.Equal("2012-10-10", episodes[0].Released); Assert.Equal("1", episodes[0].Episode); Assert.Equal("tt2340185", episodes[0].ImdbId); Assert.Equal("Honor Thy Father", episodes[1].Title); Assert.Equal("2012-10-17", episodes[1].Released); Assert.Equal("2", episodes[1].Episode); Assert.Equal("tt2310910", episodes[1].ImdbId); Assert.Equal("Damaged", episodes[4].Title); Assert.Equal("2012-11-07", episodes[4].Released); Assert.Equal("5", episodes[4].Episode); Assert.Equal("tt2338426", episodes[4].ImdbId); Assert.Equal("Arrow", season.Title); Assert.Equal("1", season.SeasonNumber); Assert.Equal("True", season.Response); }
public void SetUp() { this._client = new OmdbClient(new OmdbClientOptions { ApiKey = TestContext.Parameters["omdbApiKey"] }); }
public void TestGetItemByTitleGood1() { var omdb = new OmdbClient(TestData.apikey); var movie = omdb.GetItemByTitle("Star Wars", true); var ratings = movie.Ratings.ToArray(); Assert.Equal("Internet Movie Database", ratings[0].Source); Assert.Equal("Rotten Tomatoes", ratings[1].Source); Assert.Equal("Metacritic", ratings[2].Source); Assert.Equal("Star Wars: Episode IV - A New Hope", movie.Title); Assert.Equal("1977", movie.Year); Assert.Equal("PG", movie.Rated); Assert.Equal("25 May 1977", movie.Released); Assert.Equal("121 min", movie.Runtime); Assert.Equal("George Lucas", movie.Director); Assert.Equal("George Lucas", movie.Writer); Assert.Equal("English", movie.Language); Assert.Equal("USA", movie.Country); Assert.Equal("tt0076759", movie.ImdbId); Assert.Equal("movie", movie.Type); Assert.Equal("21 Sep 2004", movie.Dvd); Assert.Equal("20th Century Fox", movie.Production); Assert.Equal("http://www.starwars.com/episode-iv/", movie.Website); Assert.Null(movie.TotalSeasons); Assert.Equal("True", movie.Response); }
public async Task GetMovieData_MovieDoesNotExist_MovieNotFoundResponse() { var omdbClient = new OmdbClient(_clientFactory, _appSettings); var res = await omdbClient.GetMovieData("This Movie Doesn't Exist", 1900); Assert.False(res.Success); }
private void Display_Online_Info_Button_Click(object sender, RoutedEventArgs e) { try { if (IsNetworkAvailable) { if (m_lastFocusedTitle != null && m_lastFocusedTitle != "") { OmdbClient _client = new OmdbClient(MyConsts.API_KEY); Item _responce = _client.GetItemByTitle(m_lastFocusedTitle, true); DisplayInfo display = new DisplayInfo(_responce); display.ShowDialog(); } else { DisplayInfo display = new DisplayInfo(); display.ShowDialog(); } } else { MessageBox.Show("No internet connetction found...", "Could not find a connection", MessageBoxButton.OK, MessageBoxImage.Information); } } catch (Exception EX) { MessageBox.Show($"{EX.Message}", "Title Not Found \nPlease enter a valid Title", MessageBoxButton.OK, MessageBoxImage.Warning); } }
/// <summary> /// /// </summary> /// <param name="client"></param> /// <param name="search"></param> /// <param name="resultType"></param> /// <param name="yearOfRelease"></param> internal LazyOmdbList(OmdbClient client, string search, OmdbSearchType resultType, int?yearOfRelease) { this._client = client; this._search = search; this._resultType = resultType; this._yearOfRelease = yearOfRelease; this._omdbItems = new(); }
public async Task GetMovieData_WellFormedMovieInput_MovieDataReturned() { var omdbClient = new OmdbClient(_clientFactory, _appSettings); var res = await omdbClient.GetMovieData("The Invisible Man", 2020); Assert.True(res.Success); Assert.Equal("The Invisible Man", res.Object.Title); }
public MovieNightService(BotService bot, IMediator mediator, IDateTimeZoneProvider timeZoneProvider, OmdbClient omdbClient, IClock clock) { this.bot = bot; this.mediator = mediator; this.timeZoneProvider = timeZoneProvider; this.omdbClient = omdbClient; this.clock = clock; }
public void TestGetItemByTitleBad() { var omdb = new OmdbClient(TestData.apikey, true); Assert.Throws <ArgumentException>(() => omdb.GetItemByTitle(null)); Assert.Throws <ArgumentException>(() => omdb.GetItemByTitle("")); Assert.Throws <ArgumentException>(() => omdb.GetItemByTitle(" ")); Assert.Throws <ArgumentOutOfRangeException>(() => omdb.GetItemByTitle("star wars", 1500)); }
public void TestGetItemByIdBad() { var omdb = new OmdbClient(TestData.apikey); Assert.Throws <ArgumentException>(() => omdb.GetItemById(null)); Assert.Throws <ArgumentException>(() => omdb.GetItemById("")); Assert.Throws <ArgumentException>(() => omdb.GetItemById(" ")); Assert.Throws <HttpRequestException>(() => omdb.GetItemById("wrongID")); }
public void TestGetEpisodeByEpisodeIdBad() { var omdb = new OmdbClient(TestData.apikey); Assert.Throws <ArgumentException>(() => omdb.GetEpisodeByEpisodeId(null)); Assert.Throws <ArgumentException>(() => omdb.GetEpisodeByEpisodeId("")); Assert.Throws <ArgumentException>(() => omdb.GetEpisodeByEpisodeId(" ")); Assert.Throws <HttpRequestException>(() => omdb.GetEpisodeByEpisodeId("asdf")); }
public void TestGetItemByIdGood2() { var omdb = new OmdbClient(TestData.apikey, true); var game = omdb.GetItemById("tt1814884"); Assert.Equal("The Elder Scrolls V: Skyrim", game.Title); Assert.Equal("2011", game.Year); Assert.Equal("N/A", game.Rated); Assert.Equal("11 Nov 2011", game.Released); Assert.Equal("N/A", game.Runtime); }
public void TestGetSeasonBySeriesTitleBad() { var omdb = new OmdbClient(TestData.apikey); Assert.Throws <ArgumentException>(() => omdb.GetSeasonBySeriesTitle(null, 1)); Assert.Throws <ArgumentException>(() => omdb.GetSeasonBySeriesTitle("", 1)); Assert.Throws <ArgumentException>(() => omdb.GetSeasonBySeriesTitle(" ", 1)); Assert.Throws <ArgumentOutOfRangeException>(() => omdb.GetSeasonBySeriesTitle("tt2193021", 0)); Assert.Throws <HttpRequestException>(() => omdb.GetSeasonBySeriesTitle("asdf", 1)); Assert.Throws <HttpRequestException>(() => omdb.GetSeasonBySeriesTitle("arrow", 100)); }
public async void Add_Directory_To_Library() { var options = CreateNewContextOptions(); using (var context = new MediaCollectionContext(options)) { var parser = new ParserService(); var omdbClient = new OmdbClient(); var service = new LibraryService(context, parser, omdbClient); var directory = await service.AddDirectory(@"\\Plex\Movies"); Assert.Equal(context.Directories.FirstOrDefault().DirectoryPath, "\\\\Plex\\Movies"); //ensure we're passing the correct string } }
public void TestGetSearchListBad() { var omdb = new OmdbClient(TestData.apikey); Assert.Throws <ArgumentException>(() => omdb.GetSearchList(null)); Assert.Throws <ArgumentException>(() => omdb.GetSearchList("")); Assert.Throws <ArgumentException>(() => omdb.GetSearchList(" ")); Assert.Throws <ArgumentOutOfRangeException>(() => omdb.GetSearchList("star wars", 0)); Assert.Throws <ArgumentOutOfRangeException>(() => omdb.GetSearchList(1500, "star wars", 0)); Assert.Throws <HttpRequestException>(() => omdb.GetSearchList("asdf")); }
public async void Scan_Subset() { var options = CreateNewContextOptions(); using (var context = new MediaCollectionContext(options)) { var parser = new ParserService(); var omdbClient = new OmdbClient(); var service = new LibraryService(context, parser, omdbClient); await service.AddDirectory(@"C:\Users\Tim\Documents\GitHub\silverscreen\test\TestData\Videos"); await service.ScanLibrary(); Assert.Equal(context.Movies.Count(), 3); } }
public async void AddMovieToWishlist() { var options = CreateNewContextOptions(); using (var context = new MediaCollectionContext(options)) { var omdbClient = new OmdbClient(); var _service = new WishlistService(context, omdbClient); string imdbId = "tt1211837"; //Doctor Strange QualityType desiredQuality = QualityType.HD; Movie movie = await _service.AddMovie(imdbId, desiredQuality); Assert.Equal(movie.Title, "Doctor Strange"); Assert.Equal(movie.Year, 2016); } }
public async void Scan_Library() { var options = CreateNewContextOptions(); using (var context = new MediaCollectionContext(options)) { var parser = new ParserService(); var omdbClient = new OmdbClient(); var service = new LibraryService(context, parser, omdbClient); await service.AddDirectory(@"\\Plex\Movies"); await service.ScanLibrary(); Console.WriteLine("Found {0} movies.", context.Movies.Count()); Assert.Equal(context.Movies.Count(), 10); //Don't expect anything to work yet } }
public MainForm(OSDbClient osdbClient, IGitHubClient githubClient) { InitializeComponent(); InitSearchMethods(); InitFileDialog(); subtitleGrid.SelectionChanged += HandleSubtitleSelectionChanged; this.osdbClient = osdbClient; this.githubClient = githubClient; this.omdbClient = new OmdbClient(); WindowTitle = Application.ProductName; #if DEBUG WindowTitle += " (debug)"; #endif }
public void TestGetSearchListGood2() { var omdb = new OmdbClient(TestData.apikey); var searchList = omdb.GetSearchList("Skyrim", OmdbType.Game); var search = searchList.SearchResults.ToArray(); Assert.Equal("The Elder Scrolls V: Skyrim", search[0].Title); Assert.Equal("2011", search[0].Year); Assert.Equal("tt1814884", search[0].ImdbId); Assert.Equal("game", search[0].Type); Assert.Equal("The Elder Scrolls V: Skyrim - Dawnguard", search[1].Title); Assert.Equal("2012", search[1].Year); Assert.Equal("tt5333506", search[1].ImdbId); Assert.Equal("game", search[1].Type); Assert.Null(searchList.Error); Assert.Equal("True", searchList.Response); }
public void TestGetSearchListGood() { var omdb = new OmdbClient(TestData.apikey); var searchList = omdb.GetSearchList("Arrow", 1); var search = searchList.SearchResults.ToArray(); Assert.Equal("Arrow", search[0].Title); Assert.Equal("2012–", search[0].Year); Assert.Equal("tt2193021", search[0].ImdbId); Assert.Equal("series", search[0].Type); Assert.Equal("Broken Arrow", search[1].Title); Assert.Equal("1996", search[1].Year); Assert.Equal("tt0115759", search[1].ImdbId); Assert.Equal("movie", search[1].Type); Assert.Null(searchList.Error); Assert.Equal("True", searchList.Response); }
public void TestGetItemByTitleGood3() { var omdb = new OmdbClient(TestData.apikey, true); var movie = omdb.GetItemByTitle("Arrow", OmdbType.Series, 2012, false); var ratings = movie.Ratings.ToArray(); Assert.Equal("Internet Movie Database", ratings[0].Source); Assert.Equal("Arrow", movie.Title); Assert.Equal("2012–", movie.Year); Assert.Equal("TV-14", movie.Rated); Assert.Equal("10 Oct 2012", movie.Released); Assert.Equal("42 min", movie.Runtime); Assert.Equal("N/A", movie.Director); Assert.Equal("English", movie.Language); Assert.Equal("USA", movie.Country); Assert.Equal("series", movie.Type); Assert.Equal("N/A", movie.Dvd); Assert.Equal("N/A", movie.BoxOffice); Assert.Equal("N/A", movie.Production); Assert.Equal("N/A", movie.Website); Assert.Equal("True", movie.Response); }
public OClient() { omdb = new OmdbClient("975f33e", true); }
/// <summary> /// Initializes instance according to parameter values. /// </summary> /// <param name="apiKey">Key to get access to OMDb service.</param> /// <exception cref="ArgumentException"> /// <paramref name="apiKey" /> is <c>null</c>, presents empty strings or contains only /// whitespaces. /// </exception> public OmdbCrawler(string apiKey) { _apiKey = apiKey.ThrowIfNullOrWhiteSpace(nameof(apiKey)); _omdbClient = new OmdbClient(_apiKey); }
public MovieAPI() { // enable ratings from Rotten Tomatoes this.omdb = new OmdbClient("f53cef60", true); }
public static async Task MainAsync() { Console.WriteLine("The following is a demonstration the OMDB_API_Wrapper.\n"); #region API Key Validation Demo // Ask user for the OMDB API Key. Console.WriteLine("Please enter a valid OMDB Key:\n"); string omdb_api_key = Console.ReadLine(); // Create the OMDB API Client. OmdbClient omdbClient = new OmdbClient(omdb_api_key); // Verify if the API Key is valid. bool isKeyValid = await omdbClient.IsAPIKeyValidAsync(); while (isKeyValid == false) { Console.WriteLine("Please enter a valid OMDB Key to continue demonstration:\n"); omdb_api_key = Console.ReadLine(); omdbClient = new OmdbClient(omdb_api_key); isKeyValid = omdbClient.IsAPIKeyValidSync(); if (isKeyValid == false) { Console.WriteLine("->The API Key is NOT valid.\n"); } } Console.WriteLine("->The API Key entered is valid.\n"); #endregion #region ByTitleRequest DEMO Console.WriteLine("Here is a demo for requesting a ByTitleRequest:\n"); // Create a ByTitleRequest. ByTitleRequest byTitleRequest = new ByTitleRequest("rick and morty", VideoType.Series, null, PlotSize.Full); // Obtain a ByTitleResponse for the ByTitleRequest asynchronously. ByTitleResponse byTitleResponse = await omdbClient.ByTitleRequestAsync(byTitleRequest); // Print ByTitleRequest object. Console.WriteLine("ByTitleRequest Object Attributes:"); foreach (PropertyDescriptor descriptor in TypeDescriptor.GetProperties(byTitleRequest)) { string name = descriptor.Name; object value = descriptor.GetValue(byTitleRequest); Console.WriteLine("{0}={1}\n", name, value); } // Print ByTitleResponse object's JSON attributes. Console.WriteLine("ByTitleResponse JSON attributes:"); PrintObjectJsonStyle(byTitleResponse); #endregion #region ByIDRequest DEMO Console.WriteLine("Here is a demo for requesting a ByIDRequest:\n"); // Create a ByIDRequest. ByIDRequest byIDRequest = new ByIDRequest("tt1219827", PlotSize.Full); // Obtain a ByTitleResponse for the ByIDRequest asynchronously. ByTitleResponse byTitleResponseForIDRequest = await omdbClient.ByIDRequestAsync(byIDRequest); // Print ByIDRequest object. Console.WriteLine("ByIDRequest Object Attributes:"); Console.WriteLine($"IMDB_ID = {byIDRequest.IMDB_ID}\n"); // Print ByTitleResponse object's JSON attributes. Console.WriteLine("ByTitleResponse JSON attributes:"); PrintObjectJsonStyle(byTitleResponseForIDRequest); #endregion #region Image Download DEMO // Attempt to download the image and write to root of C drive. ImageDownload imageDownload = await omdbClient.GetImageForByTitleResponseAsync(byTitleResponseForIDRequest); if (imageDownload.DownloadSuccessful) { File.WriteAllBytes(@"C:\" + imageDownload.FileName, imageDownload.Data); } #endregion #region BySearchRequest DEMO Console.WriteLine("Here is a demo for requesting a BySearchRequest:\n"); // Create a BySearchRequest. BySearchRequest bySearchRequest = new BySearchRequest("ghost in the shell"); // Obtain a BySearchResponse for the BySearchRequest asynchronously. BySearchResponse bySearchResponse = await omdbClient.BySearchRequestAsync(bySearchRequest); // Print BySearchRequest object. Console.WriteLine("BySearchRequest Object Attributes:"); foreach (PropertyDescriptor descriptor in TypeDescriptor.GetProperties(bySearchRequest)) { string name = descriptor.Name; object value = descriptor.GetValue(bySearchRequest); Console.WriteLine("{0}={1}\n", name, value); } // Print BySearchResponse object's JSON attributes. Console.WriteLine("BySearchResponse JSON attributes:"); PrintObjectJsonStyle(bySearchResponse); #endregion // Prevent console from terminating. string hold = Console.ReadLine(); }
public SearchOmdbController(OmdbClient omdbClient) { _omdbClient = omdbClient; }