private async void RechercherAction() { IMovieServices service = DependencyService.Get <IMovieServices>(); MovieResult movies = await service.GetListMovies(this.search); MovieResult = movies.Search; }
public static async void PushPage(Poster _mainPoster, INavigation navigation) { mainPoster = _mainPoster; Page p = new MovieResult();// { mainPoster = mainPoster }; await navigation.PushModalAsync(p, false); }
public Movie ToMovie(MovieResult source, GenreInfo genreInfo) { if (source == null) { throw new ArgumentNullException(nameof(source)); } if (genreInfo == null) { throw new ArgumentNullException(nameof(genreInfo)); } var genres = GetGenres(source, genreInfo); var result = new Movie() { Id = source.Id, Overview = source.Overview, SmallPosterUri = new Uri($"{PosterBaseUrl}{SmallPosterSize}{source.PosterPath}", UriKind.Absolute), LargePosterUri = new Uri($"{PosterBaseUrl}{LargePosterSize}{source.PosterPath}", UriKind.Absolute), Popularity = source.Popularity, Title = source.Title, VoteAverage = source.VoteAverage, VoteCount = source.VoteCount, Genres = genres, ReleaseDate = ParseDate(source.ReleaseDate) }; return(result); }
public void ToMovie_HasMovieResultWithSomeGenres_ReturnsMovieWithCorrectGenres() { var source = new MovieResult() { Adult = true, GenreIds = new int[] { 1, 2 }, Id = 10, Overview = "Some overview text", Popularity = 8.52D, PosterPath = "another.poster.path", ReleaseDate = "2010/01/01", Title = "Movie title", VoteAverage = 7.43D, VoteCount = 54 }; var genreInfo = new GenreInfo() { Genres = new List <GenreResult>() { new GenreResult() { Id = 2, Name = "Genre 2" } } }; var target = new MovieMapper(); var actual = target.ToMovie(source, genreInfo); Assert.AreEqual(1, actual.Genres.Count); Assert.AreEqual(genreInfo.Genres[0].Id, actual.Genres[0].Id); }
// POST: odata/MovieResults public async Task <IHttpActionResult> Post(MovieResult movieResult) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.MovieResults.Add(movieResult); try { await db.SaveChangesAsync(); } catch (DbUpdateException) { if (MovieResultExists(movieResult.ItemId)) { return(Conflict()); } else { throw; } } return(Created(movieResult)); }
public MovieResult <MovieBooking> GetErrorResponseMovieDetail(MovieResult <MovieBooking> ResponseMovieDb) { return(new MovieResult <MovieBooking> { ErrorCode = ResponseMovieDb.ErrorCode, ErrorMessage = ResponseMovieDb.ErrorMessage }); }
internal List <Movie> GetBoxOfficeMovies(string country, int pageLimit) { WebClient client = new WebClient(); string json = client.DownloadString(apiUrl + "movies/box_office?limit=" + pageLimit + "&country=" + country); MovieResult result = JsonConvert.DeserializeObject <MovieResult>(json); return(result.Movies); }
internal MovieResult GetMoviesByFilter(string filter, int page = 1) { WebClient client = new WebClient(); string json = client.DownloadString(apiUrl + "movies?page_limit=6&page=" + page + "&q=" + filter); MovieResult result = JsonConvert.DeserializeObject <MovieResult>(json); return(result); }
public MovieResult <List <MovieBooking> > GetErrorResponseMovieList(MovieResult <MovieGetResponse> ResponseMovieDb) { return(new MovieResult <List <MovieBooking> > { ErrorCode = ResponseMovieDb.ErrorCode, ErrorMessage = ResponseMovieDb.ErrorMessage }); }
public IActionResult MovieConfirm(MovieResult result) { if (!ModelState.IsValid) { return(RedirectToAction("Index")); } return(View(result)); }
private IList <Genre> GetGenres(MovieResult source, GenreInfo genreInfo) { var genreMapper = new GenreMapper(); return(genreInfo .Genres .Where(list => source.GenreIds.Contains(list.Id)) .Select(genre => genreMapper.ToGenre(genre)) .ToList()); }
public List <MovieBooking> UpdateMovieDBField(MovieResult <MovieGetResponse> ResponseMovieData, string moviedb) { List <MovieBooking> dataMovieList = new List <MovieBooking>(); if (ResponseMovieData.Data.movies.Count > 0) { dataMovieList = ResponseMovieData.Data.movies; dataMovieList.ForEach(c => c.MovieDB = moviedb); } return(dataMovieList); }
private static int?GetReleaseYear(MovieResult movieResult) { int? releaseYear = null; DateTime releaseDate; if (DateTime.TryParse(movieResult.release_date, out releaseDate)) { releaseYear = releaseDate.Year; } return(releaseYear); }
private Movie MapSearchResult(MovieResult result) { var movie = _movieService.FindByTmdbId(result.id); if (movie == null) { movie = MapMovie(result); } return(movie); }
public static string GetRatingForMovie(User user, MovieResult movie, Random rand) { string rating = ""; string movieGenres = movie.genres; string userFavGenres = GetUserFavoriteGenres(user.age, user.occupation, user.gender, rand); string movieAvgScore = movie.imdbscore; rating = ComputeRatingForUser(movieGenres, userFavGenres, movieAvgScore, rand); return(rating); }
// DELETE: odata/MovieResults(5) public async Task <IHttpActionResult> Delete([FromODataUri] int key) { MovieResult movieResult = await db.MovieResults.FindAsync(key); if (movieResult == null) { return(NotFound()); } db.MovieResults.Remove(movieResult); await db.SaveChangesAsync(); return(StatusCode(HttpStatusCode.NoContent)); }
public MovieResult GetById(string id) { SolrQueryResults <Movie> results = _solr .Query(new SolrQuery($"id:{id}"), new QueryOptions() { Rows = PageSize }); var result = new MovieResult { Movies = results.ToList(), }; return(result); }
public static async void PushPage(Poster _mainPoster, INavigation navigation) { if (mainPoster.url == _mainPoster.url) { return; } mainPoster = _mainPoster; Page p = new MovieResult();// { mainPoster = mainPoster }; try { await navigation.PushModalAsync(p, false); } catch (Exception) { } }
public MovieResult Search(string term) { SolrQueryResults <Movie> results = _solr .Query(new SolrQuery($"{term}*"), new QueryOptions() { Rows = PageSize, SpellCheck = Spellcheck }); var result = new MovieResult { Movies = results.ToList(), SpellChecking = results.SpellChecking.ToList(), }; return(result); }
// GET: Movie public ActionResult Index(string searchQuery, int page = 1) { MovieResult result = new MovieResult(); result.RecentSearches = GetRecentKeysCookie(); if (!string.IsNullOrEmpty(searchQuery)) { SetCookieItem(searchQuery); MovieService service = new MovieService(); var mr = service.GetMoviesByFilter(searchQuery, page); result.Movies = mr.Movies; result.Total = mr.Total; return(View(result)); } return(View(result)); }
Movie MapDtoToModel(GenresDto genres, MovieResult movieDto) { return(new Movie() { Id = movieDto.Id, Title = movieDto.Title, PosterSmall = string .Concat(BaseUrl, SmallPosterSize, movieDto.PosterPath), PosterBig = string .Concat(BaseUrl, BigPosterSize, movieDto.PosterPath), Genres = genres.Genres.Where(g => movieDto.GenreIds.Contains(g.Id)).Select(j => j.Name).ToList(), ReleaseDate = DateTime.Parse(movieDto.ReleaseDate, new CultureInfo(Language)), Overview = movieDto.Overview }); }
/// <summary> /// Fetches the movie data. /// </summary> /// <param name="tmdbId">The TMDB identifier.</param> /// <param name="imdbId">The imdb identifier.</param> /// <param name="language">The language.</param> /// <param name="preferredCountryCode">The preferred country code.</param> /// <param name="cancellationToken">The cancellation token.</param> /// <returns>Task{`0}.</returns> private async Task <MetadataResult <T> > FetchMovieData(string tmdbId, string imdbId, string language, string preferredCountryCode, CancellationToken cancellationToken) { var item = new MetadataResult <T> { Item = new T() }; string dataFilePath = null; MovieResult movieInfo = null; // Id could be ImdbId or TmdbId if (string.IsNullOrEmpty(tmdbId)) { movieInfo = await TmdbMovieProvider.Current.FetchMainResult(imdbId, false, language, cancellationToken).ConfigureAwait(false); if (movieInfo != null) { tmdbId = movieInfo.Id.ToString(_usCulture); dataFilePath = TmdbMovieProvider.Current.GetDataFilePath(tmdbId, language); Directory.CreateDirectory(Path.GetDirectoryName(dataFilePath)); _jsonSerializer.SerializeToFile(movieInfo, dataFilePath); } } if (!string.IsNullOrWhiteSpace(tmdbId)) { await TmdbMovieProvider.Current.EnsureMovieInfo(tmdbId, language, cancellationToken).ConfigureAwait(false); dataFilePath = dataFilePath ?? TmdbMovieProvider.Current.GetDataFilePath(tmdbId, language); movieInfo = movieInfo ?? _jsonSerializer.DeserializeFromFile <MovieResult>(dataFilePath); var settings = await TmdbMovieProvider.Current.GetTmdbSettings(cancellationToken).ConfigureAwait(false); ProcessMainInfo(item, settings, preferredCountryCode, movieInfo); item.HasMetadata = true; } return(item); }
public void AddMovieResult(MovieResult result) { queryMovieResults.Add(result); var db = App.conn; try { using (var Item = db.Prepare("INSERT INTO Movies (Id,Title,overview,Type) VALUES(?,?,?,?);")) { Item.Bind(1, result.id); Item.Bind(2, result.title); Item.Bind(3, result.overview); Item.Bind(4, 0); Item.Step(); } } catch (Exception ex) { } }
public MovieResult AdvancedSearch(AdvancedSearch model) { FacetParameters parameters = new FacetParameters(); if (model.UseDate) { //parameters.Queries.Add(new SolrFacetDateQuery("")); } SolrQueryResults <Movie> results = _solr .Query(SolrQuery.All, new QueryOptions() { Rows = PageSize, Facet = parameters }); var result = new MovieResult { Movies = results.ToList(), }; return(result); }
private Movie ToMovie(MovieResult movieResult, int i) { var releaseYear = GetReleaseYear(movieResult); var movie = new Movie { Id = movieResult.id, ReleaseYear = releaseYear, Title = movieResult.title, Url = string.Format("http://www.themoviedb.org/movie/{0}", movieResult.id), IsSelected = i == 0 }; if (!string.IsNullOrEmpty(movieResult.poster_path)) { movie.CoverArtImages.Add(new RemoteCoverArt { Uri = _rootImageUrl + movieResult.poster_path, IsSelected = true }); } return(movie); }
public void ToMovie_HasMovieResultWithNoAvailableGenres_ReturnsMovieWithNoGenres() { var smallPosterBaseUrl = "https://image.tmdb.org/t/p/w185"; var largePosterBaseUrl = "https://image.tmdb.org/t/p/w500"; var source = new MovieResult() { Adult = true, GenreIds = new int[] { 1, 2 }, Id = 10, Overview = "Some overview text", Popularity = 8.52D, PosterPath = "/another.poster.path", ReleaseDate = "2010-01-01", Title = "Movie title", VoteAverage = 7.43D, VoteCount = 54 }; var genreInfo = new GenreInfo(); var target = new MovieMapper(); var actual = target.ToMovie(source, genreInfo); Assert.AreEqual($"{smallPosterBaseUrl}{source.PosterPath}", actual.SmallPosterUri.ToString()); Assert.AreEqual($"{largePosterBaseUrl}{source.PosterPath}", actual.LargePosterUri.ToString()); Assert.AreEqual(source.Id, actual.Id); Assert.AreEqual(source.Overview, actual.Overview); Assert.AreEqual(source.Popularity, actual.Popularity); Assert.AreEqual(source.Title, actual.Title); Assert.AreEqual(source.VoteAverage, actual.VoteAverage); Assert.AreEqual(source.VoteCount, actual.VoteCount); Assert.IsEmpty(actual.Genres); Assert.AreEqual(DateTime.Parse( source.ReleaseDate, new CultureInfo("en-US"), DateTimeStyles.AssumeUniversal), actual.ReleaseDate); }
// PUT: odata/MovieResults(5) public async Task <IHttpActionResult> Put([FromODataUri] int key, Delta <MovieResult> patch) { Validate(patch.GetEntity()); if (!ModelState.IsValid) { return(BadRequest(ModelState)); } MovieResult movieResult = await db.MovieResults.FindAsync(key); if (movieResult == null) { return(NotFound()); } patch.Put(movieResult); try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MovieResultExists(key)) { return(NotFound()); } else { throw; } } return(Updated(movieResult)); }
public Movie MapMovie(MovieResult result) { var imdbMovie = new Movie(); imdbMovie.TmdbId = result.id; try { imdbMovie.SortTitle = Parser.Parser.NormalizeTitle(result.title); imdbMovie.Title = result.title; imdbMovie.TitleSlug = Parser.Parser.ToUrlSlug(result.title); try { if (result.release_date.IsNotNullOrWhiteSpace()) { imdbMovie.InCinemas = DateTime.Parse(result.release_date); imdbMovie.Year = imdbMovie.InCinemas.Value.Year; } if (result.physical_release.IsNotNullOrWhiteSpace()) { imdbMovie.PhysicalRelease = DateTime.Parse(result.physical_release); if (result.physical_release_note.IsNotNullOrWhiteSpace()) { imdbMovie.PhysicalReleaseNote = result.physical_release_note; } } } catch (Exception) { _logger.Debug("Not a valid date time."); } var now = DateTime.Now; //handle the case when we have both theatrical and physical release dates if (imdbMovie.InCinemas.HasValue && imdbMovie.PhysicalRelease.HasValue) { if (now < imdbMovie.InCinemas) { imdbMovie.Status = MovieStatusType.Announced; } else if (now >= imdbMovie.InCinemas) { imdbMovie.Status = MovieStatusType.InCinemas; } if (now >= imdbMovie.PhysicalRelease) { imdbMovie.Status = MovieStatusType.Released; } } //handle the case when we have theatrical release dates but we dont know the physical release date else if (imdbMovie.InCinemas.HasValue && (now >= imdbMovie.InCinemas)) { imdbMovie.Status = MovieStatusType.InCinemas; } //handle the case where we only have a physical release date else if (imdbMovie.PhysicalRelease.HasValue && (now >= imdbMovie.PhysicalRelease)) { imdbMovie.Status = MovieStatusType.Released; } //otherwise the title has only been announced else { imdbMovie.Status = MovieStatusType.Announced; } //since TMDB lacks alot of information lets assume that stuff is released if its been in cinemas for longer than 3 months. if (!imdbMovie.PhysicalRelease.HasValue && (imdbMovie.Status == MovieStatusType.InCinemas) && (((DateTime.Now).Subtract(imdbMovie.InCinemas.Value)).TotalSeconds > 60 * 60 * 24 * 30 * 3)) { imdbMovie.Status = MovieStatusType.Released; } imdbMovie.TitleSlug += "-" + imdbMovie.TmdbId; imdbMovie.Images = new List <MediaCover.MediaCover>(); imdbMovie.Overview = result.overview; imdbMovie.Ratings = new Ratings { Value = (decimal)result.vote_average, Votes = result.vote_count }; try { imdbMovie.Images.AddIfNotNull(MapImage(result.poster_path, MediaCoverTypes.Poster)); } catch (Exception) { _logger.Debug(result); } if (result.trailer_key.IsNotNullOrWhiteSpace() && result.trailer_site.IsNotNullOrWhiteSpace()) { if (result.trailer_site == "youtube") { imdbMovie.YouTubeTrailerId = result.trailer_key; } } return(imdbMovie); } catch (Exception e) { _logger.Error(e, "Error occured while searching for new movies."); } return(null); }
private static int? GetReleaseYear(MovieResult movieResult) { int? releaseYear = null; DateTime releaseDate; if (DateTime.TryParse(movieResult.release_date, out releaseDate)) releaseYear = releaseDate.Year; return releaseYear; }
private Movie ToMovie(MovieResult movieResult, int i) { var releaseYear = GetReleaseYear(movieResult); var movie = new Movie { Id = movieResult.id, ReleaseYear = releaseYear, Title = movieResult.title, Url = string.Format("http://www.themoviedb.org/movie/{0}", movieResult.id), IsSelected = i == 0 }; if (!string.IsNullOrEmpty(movieResult.poster_path)) { movie.CoverArtImages.Add(new RemoteCoverArt { Uri = _rootImageUrl + movieResult.poster_path, IsSelected = true }); } return movie; }
void UpdateEpisodes() { var bgColor = Settings.ItemBackGroundColor.ToHex(); MyEpisodeResultCollection.Clear(); try { var header = Download.downloadHeaders[currentId]; var helper = Download.downloadHelper[currentId]; // App.GetDownloadHeaderInfo(currentId); List <EpisodeResult> activeEpisodes = new List <EpisodeResult>(); foreach (var key in helper.infoIds) { var info = App.GetDownloadInfo(key); //Download.downloads[key]; if (info != null) { Download.downloads[key] = info; if (info.state.totalBytes == 0 && info.state.bytesDownloaded != 1) { Download.RemoveDownloadCookie(key); } else { int ep = info.info.episode; int ss = info.info.season; string fileUrl = info.info.fileUrl; string fileName = info.info.name; int dloaded = (int)info.state.ProcentageDownloaded; // string extra = (info.state.state == App.DownloadState.Downloaded ? "" : App.ConvertBytesToAny(info.state.bytesDownloaded, 0, 2) + " MB of " + App.ConvertBytesToAny(info.state.totalBytes, 0, 2) + " MB"); string extra = $" {dloaded }%"; //.TapCom = new Command(async (s) => { long pos; long len; double _progress = 0; if ((pos = App.GetViewPos(info.info.id)) > 0) { if ((len = App.GetViewDur(info.info.id)) > 0) { _progress = (double)pos / (double)len; } } var dPlaySource = App.GetImageSource("nexflixPlayBtt.png"); activeEpisodes.Add(new EpisodeResult() { OgTitle = info.info.name, ExtraColor = bgColor, ExtraDescription = $"{Download.GetExtraString(info.state.state)}{((info.state.state == App.DownloadState.Downloaded || dloaded == -1) ? "" : extra)}", Title = (ep != -1 ? $"S{ss}:E{ep} " : "") + info.info.name, Description = info.info.description, Episode = ep, Season = ss, Id = info.info.id, PosterUrl = info.info.hdPosterUrl, Progress = _progress, TapCom = new Command(async(s) => { if (info.info.dtype == App.DownloadType.Normal) { MovieResult.SetEpisode("tt" + info.info.id); } if (MainChrome.IsConnectedToChromeDevice) { await Download.ChromeCastDownloadedFile(info.info.id); } else { Download.PlayDownloadedFile(info); } //Download.PlayDownloadedFile(fileUrl, fileName, info.info.episode, info.info.season, info.info.episodeIMDBId, info.info.source); // Download.PlayVLCFile(fileUrl, fileName, info.info.id.ToString()); }), DownloadPlayBttSource = dPlaySource }); } } } activeEpisodes = activeEpisodes.OrderBy(t => (t.Episode + t.Season * 1000)).ToList(); for (int i = 0; i < activeEpisodes.Count; i++) { int _id = i; activeEpisodes[i].TapComThree = new Command(async() => { await HandleEpisode(MyEpisodeResultCollection[_id]); }); MyEpisodeResultCollection.Add(activeEpisodes[i]); } episodeView.FadeTo(1, 200, Easing.SinOut); } catch (Exception _ex) { print("EXUpdateDEpisodes::: " + _ex); } SetHeight(); if (MyEpisodeResultCollection.Count == 0) { Navigation.PopModalAsync(); } }
void UpdateNextEpisode() { var epis = App.GetKeys <CloudStreamCore.CachedCoreEpisode>(nameof(CloudStreamCore.CachedCoreEpisode)).OrderBy(t => - t.createdAt.Ticks).ToArray(); bool hasTxt = epis.Length > 0; UpdateHasNext(hasTxt); NextEpisode.Children.Clear(); var pSource = App.GetImageSource("nexflixPlayBtt.png"); for (int i = 0; i < Math.Min(epis.Length, 5); i++) { var ep = epis[i]; Grid stack = new Grid() { }; var ff = new FFImageLoading.Forms.CachedImage { Source = ep.poster, HeightRequest = FastPosterHeight, WidthRequest = FastPosterWith, BackgroundColor = Color.Transparent, VerticalOptions = LayoutOptions.Start, InputTransparent = true, Transformations = { // new FFImageLoading.Transformations.RoundedTransformation(10,1,1.5,10,"#303F9F") new FFImageLoading.Transformations.RoundedTransformation(10, 1.78, 1, 0, "#303F9F") }, // InputTransparent = true, }; const double textAddSpace = 20; Frame boxView = new Frame() { BackgroundColor = Settings.ItemBackGroundColor, // Color.FromRgb(_color, _color, _color), // InputTransparent = true, CornerRadius = 5, HeightRequest = FastPosterHeight + textAddSpace, TranslationY = 0, WidthRequest = FastPosterWith, HasShadow = true, }; const double playSize = 30; var playBtt = new FFImageLoading.Forms.CachedImage { Source = pSource, HeightRequest = playSize, WidthRequest = playSize, TranslationY = -textAddSpace / 2, BackgroundColor = Color.Transparent, HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Center, InputTransparent = true, }; ProgressBar progress = new ProgressBar() { HorizontalOptions = LayoutOptions.Fill, ProgressColor = Color.FromHex("#829eff"), VerticalOptions = LayoutOptions.End, BackgroundColor = Color.Transparent, Progress = ep.progress, WidthRequest = FastPosterWith, TranslationY = -(4 + textAddSpace / 2), }; /* * var brView = new BorderView() { VerticalOptions = LayoutOptions.Fill, HorizontalOptions = LayoutOptions.Fill, CornerRadius = 5 }; * * brView.SetValue(XamEffects.TouchEffect.ColorProperty, Color.White); * Commands.SetTap(brView, new Command((o) => { * //PushPageFromUrlAndName(z.id, z.name); * }));*/ stack.Children.Add(boxView); stack.Children.Add(ff); stack.Children.Add(playBtt); stack.Children.Add(progress); bool isMovie = ep.season <= 0 || ep.episode <= 0; stack.Children.Add(new Label() { Text = (isMovie ? "" : $"S{ep.season}:E{ep.episode} ") + $"{ep.episodeName}", VerticalOptions = LayoutOptions.Start, VerticalTextAlignment = TextAlignment.Center, HorizontalTextAlignment = TextAlignment.Center, HorizontalOptions = LayoutOptions.Center, Padding = 1, TextColor = Color.White, MaxLines = 1, ClassId = "OUTLINE", TranslationY = FastPosterHeight, WidthRequest = FastPosterWith }); stack.Effects.Add(Effect.Resolve("CloudStreamForms.LongPressedEffect")); LongPressedEffect.SetCommand(stack, new Command(async() => { var res = new MovieResult(ep.state); await Navigation.PushModalAsync(res, false); await res.LoadLinksForEpisode(new EpisodeResult() { Episode = ep.episode, Season = ep.season, Id = ep.episode - 1, Description = ep.description, IMDBEpisodeId = ep.imdbId, OgTitle = ep.episodeName }); })); NextEpisode.Children.Add(stack, i, 0); } }