public static void Copy(RottenTomatoesMovies response, string groupId, string groupName) { try { MovieGroup mg = APIMASH_RottenTomatoesCollection.GetGroupByTitle(groupName); if (mg != null) mg.Items.Clear(); else mg = new MovieGroup(groupId, groupName, response.Movies[0].Posters.Original); foreach (var mi in response.Movies.Select(t => new MovieItem( t.Id, t.Title, t.MPAARating, t.Ratings.AudienceRating, t.Ratings.CriticsRating, t.Links.Clips, t.Links.Reviews, t.Links.Cast, t.Posters.Original, t.Synopsis, mg))) { mg.Items.Add(mi); } _movieData._allGroups.Add(mg); } catch (Exception e) { throw; } }
public FileDetail(MovieContents myMovieContents, MovieGroup myGroup) { ExistPath = myMovieContents.GetExistPath(myGroup); ContentsName = myMovieContents.Name; if (ExistPath != null) DataSet(ExistPath, ContentsName + "*"); }
public Image(MovieContents myData, MovieGroup myGroup) { data = myData; listImageFileInfo = new List<FileInfo>(); targetGroup = myGroup; Settting(); }
public void Execute(MovieContents myMovieContents, string myPlayerName, MovieGroup myGroup) { string path = myMovieContents.GetExistPath(myGroup); if (path == null) return; string executePathname = ""; // 複数ファイルのためPlayerに対応したリストを作成する if (myMovieContents.ExistMovie != null && myMovieContents.ExistMovie.Length > 1) { string[] arrTargetExt = null; arrTargetExt = new string[1]; arrTargetExt[0] = myMovieContents.Name + "*" + myMovieContents.Extension; // プレイリストは一時ディレクトリに書き込むのでパスを取得 //string tempPath = Path.GetTempPath(); if (myPlayerName.Equals("GOM")) executePathname = PlayList.MakeAsxFile(myMovieContents.Label, arrTargetExt, Path.GetTempPath(), myMovieContents.Name); else if (myPlayerName.Equals("WMP")) executePathname = PlayList.MakeWplFile(myMovieContents.Label, arrTargetExt, Path.GetTempPath(), myMovieContents.Name); } else if (myMovieContents.ExistMovie != null && myMovieContents.ExistMovie.Length == 1) { executePathname = myMovieContents.ExistMovie[0]; } else { SiteDetail ColViewSiteDetail = new SiteDetail(path); if (ColViewSiteDetail.ListCount >= 1) { List<common.FileContents> list = ColViewSiteDetail.GetList(); // Playerリストが存在する場合はPlayerの選択を無視して再生実行 if (list.Count >= 1) { executePathname = list[0].FileInfo.FullName; Process.Start(@executePathname); return; } } } var targets = from player in listPlayer where player.Name.ToUpper() == myPlayerName.ToUpper() select player; foreach(PlayerInfo info in targets) { // 起動するファイル名の前後を""でくくる 例) test.mp4 --> "test.mp4" Process.Start(info.ExecuteName, "\"" + @executePathname + "\""); break; } }
public Image(MovieContents myData, int myNumberSheets, MovieGroup myGroup) { data = myData; numberSheets = myNumberSheets; listImageFileInfo = new List<FileInfo>(); targetGroup = myGroup; DisplayPage = ""; Settting(); }
private static void SortList(ObservableCollection <MovieGroup> list, MovieDetails movie, int indexOfLetter) { if (indexOfLetter >= 0) { list[indexOfLetter].Add(movie, true); } else { var newMovieList = new MovieGroup(movie.FirstLetter) { movie }; list.Add(newMovieList); } }
public async Task <IEnumerable <MovieGroup> > GetMovieGroupsAsync(Action <MovieGroup> onEachMovieGroupCallback) { var movieGroups = new List <MovieGroup>(); MovieGroup movieGroup = null; var urls = URLS_TO_MOVIE_GROUP_NAMES_MAPPING.Keys; foreach (var url in urls) { movieGroup = await GetMovieGroupAsync(url); movieGroups.Add(movieGroup); onEachMovieGroupCallback?.Invoke(movieGroup); } return(movieGroups); }
public ICollection <Movie> GetTop5RatedMovies(int?userId = null) { return((from movie in movies join rating in ratings on movie.MovieId equals rating.MovieId where (userId == null || rating.UserId == userId) group rating by new { movie.MovieId, movie.Title, movie.YearOfRelease, movie.RunningTime, movie.Genres } into MovieGroup orderby MovieGroup.Average(x => x.Value) descending, MovieGroup.Key.Title select new Movie { MovieId = MovieGroup.Key.MovieId, Title = MovieGroup.Key.Title, YearOfRelease = MovieGroup.Key.YearOfRelease, RunningTime = MovieGroup.Key.RunningTime, Genres = MovieGroup.Key.Genres, AverageRating = Math.Round(2 * MovieGroup.Average(x => x.Value)) / 2 }).Take(5).ToList()); }
public ICollection <Movie> GetMovies(string title = null, int?yearOfRelease = null, List <Genre> genres = null) { return((from movie in movies join rating in ratings on movie.MovieId equals rating.MovieId into RatingLeftJoin from r in RatingLeftJoin.DefaultIfEmpty() where (title == null || movie.Title.ToLower().Contains(title.ToLower())) && (yearOfRelease == null || movie.YearOfRelease == yearOfRelease) && (genres == null || !genres.Any() || movie.Genres.Where(g => genres.Contains(g)).Any()) group r by new { movie.MovieId, movie.Title, movie.YearOfRelease, movie.RunningTime, movie.Genres } into MovieGroup select new Movie { MovieId = MovieGroup.Key.MovieId, Title = MovieGroup.Key.Title, YearOfRelease = MovieGroup.Key.YearOfRelease, RunningTime = MovieGroup.Key.RunningTime, Genres = MovieGroup.Key.Genres, AverageRating = Math.Round(2 * MovieGroup.Average(x => x != null ? x.Value : 0)) / 2 }).ToList()); }
private async Task <MovieGroup> GetMovieGroupAsync(string url) { List <Movie> movies = null; try { var response = await _httpClient.GetAsync(url); var content = await response.Content.ReadAsStringAsync(); var jsonObject = JObject.Parse(content); var results = jsonObject.Property("results").Value.ToString(); var settings = new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore, MissingMemberHandling = MissingMemberHandling.Ignore }; movies = JsonConvert.DeserializeObject <List <Movie> >(results, settings); } catch (Exception ex) { throw ex; } var baseUrl = TMDbApiConfig.BASE_URL; var backdropSize = TMDbApiConfig.BACKDROP_SIZE; movies?.ForEach(m => m.PosterPath = $"{baseUrl}{backdropSize}{m.PosterPath}"); string movieGroupName; URLS_TO_MOVIE_GROUP_NAMES_MAPPING.TryGetValue(url, out movieGroupName); var movieGroup = new MovieGroup { GroupName = movieGroupName }; movieGroup.Movies = movies ?? new List <Movie>(); return(movieGroup); }
public MovieGroupWrapper(MovieGroup movieGroup, Action <Movie> onMovieSelectedCallback) { GroupName = movieGroup?.GroupName; Movies = movieGroup?.Movies; _onMovieSelectedCallback = onMovieSelectedCallback; }