public void saveFilters() { filters.Clear(); //watchedFilter if (chkWatchedEnabled.Checked) { filters.Add(new BooleanFilterItem(MovieBean.FIELD.WATCHED, rdoWatched.Checked)); } //adult filter if (chkAdultEnabled.Checked) { filters.Add(new BooleanFilterItem(MovieBean.FIELD.ADULT, rdoAdult.Checked)); } //collections if (chkBelongsToCollectionEnabled.Checked) { filters.Add(new CollectionFilteritem(chkCollections.CheckedItems.Cast <string>().ToList())); } //budget if (chkBudgetEnabled.Checked) { String lower = GlobalFunctions.stripNonNumericChars(txtBudget1.Text); String upper = GlobalFunctions.stripNonNumericChars(txtBudget2.Text); int lowerInt = 0; int upperInt = 0; int.TryParse(lower, out lowerInt); int.TryParse(upper, out upperInt); NumberFilterItem.TYPE budgetType = NumberFilterItem.TYPE.BETWEEN; if (rdoBudgetExactly.Checked) { budgetType = NumberFilterItem.TYPE.EXACT; } else if (rdoBudgetGreaterThan.Checked) { budgetType = NumberFilterItem.TYPE.GREATER_THAN; } else if (rdoBudgetLessThan.Checked) { budgetType = NumberFilterItem.TYPE.LESS_THAN; } filters.Add(new NumberFilterItem(MovieBean.FIELD.BUDGET, lowerInt, upperInt, budgetType)); } //genres if (chkGenresEnabled.Checked) { ListFilterItem.TYPE genresType = ListFilterItem.TYPE.STRICT; if (rdoGenresRelaxed.Checked) { genresType = ListFilterItem.TYPE.RELAXED; } filters.Add(new ListFilterItem(MovieBean.FIELD.GENRES, chkGenres.CheckedItems.Cast <String>().ToList(), genresType)); } //overview if (chkOverviewEnabled.Checked) { StringFilterItem.TYPE overviewType = StringFilterItem.TYPE.CONTAINS; if (rdoOverviewEndsWith.Checked) { overviewType = StringFilterItem.TYPE.ENDS_WITH; } else if (rdoOverviewEquals.Checked) { overviewType = StringFilterItem.TYPE.EQUALS; } else if (rdoOverviewStartsWith.Checked) { overviewType = StringFilterItem.TYPE.STARTS_WITH; } filters.Add(new StringFilterItem(MovieBean.FIELD.OVERVIEW, txtOverview.Text, chkOverviewNot.Checked, overviewType)); } //popularity if (chkPopularityEnabled.Checked) { double lower = Double.Parse(GlobalFunctions.stripNonNumericChars(txtPopularity1.Text)); double upper = Double.Parse(GlobalFunctions.stripNonNumericChars(txtPopularity2.Text)); NumberFilterItem.TYPE popularityType = NumberFilterItem.TYPE.BETWEEN; if (rdoPopularityExactly.Checked) { popularityType = NumberFilterItem.TYPE.EXACT; } else if (rdoPopularityGreaterThan.Checked) { popularityType = NumberFilterItem.TYPE.GREATER_THAN; } else if (rdoPopularityLessThan.Checked) { popularityType = NumberFilterItem.TYPE.LESS_THAN; } filters.Add(new NumberFilterItem(MovieBean.FIELD.POPULARITY, lower, upper, popularityType)); } //production companies if (chkProductionCompaniesEnabled.Checked) { ListFilterItem.TYPE productionCompaniesType = ListFilterItem.TYPE.RELAXED; if (rdoProductionCompaniesStrict.Checked) { productionCompaniesType = ListFilterItem.TYPE.STRICT; } filters.Add(new ListFilterItem(MovieBean.FIELD.PRODUCTION_COMPANIES, chkProductionCompanies.CheckedItems.Cast <String>().ToList(), productionCompaniesType)); } //release date if (chkReleaseDateEnabled.Checked) { DateFilterItem.TYPE releaseDateType = DateFilterItem.TYPE.AFTER; if (rdoReleaseDateBetween.Checked) { releaseDateType = DateFilterItem.TYPE.BETWEEN; } else if (rdoReleaseDateEarlierThan.Checked) { releaseDateType = DateFilterItem.TYPE.BEFORE; } else if (rdoReleaseDateExactly.Checked) { releaseDateType = DateFilterItem.TYPE.EXACT; } filters.Add(new DateFilterItem(MovieBean.FIELD.RELEASE_DATE, dtpReleaseDate1.Value, dtpReleaseDate2.Value, releaseDateType)); } //revenue if (chkRevenueEnabled.Checked) { int lower = int.Parse(GlobalFunctions.stripNonNumericChars(txtRevenue1.Text)); int upper = int.Parse(GlobalFunctions.stripNonNumericChars(txtRevenue2.Text)); NumberFilterItem.TYPE revenueType = NumberFilterItem.TYPE.BETWEEN; if (rdoRevenueExactly.Checked) { revenueType = NumberFilterItem.TYPE.EXACT; } else if (rdoRevenueGreaterThan.Checked) { revenueType = NumberFilterItem.TYPE.GREATER_THAN; } else if (rdoRevenueLessThan.Checked) { revenueType = NumberFilterItem.TYPE.LESS_THAN; } filters.Add(new NumberFilterItem(MovieBean.FIELD.REVENUE, lower, upper, revenueType)); } //runtime if (chkRuntimeEnabled.Checked) { int lower = int.Parse(GlobalFunctions.stripNonNumericChars(txtRuntime1.Text)); int upper = int.Parse(GlobalFunctions.stripNonNumericChars(txtRuntime2.Text)); NumberFilterItem.TYPE runtimeType = NumberFilterItem.TYPE.BETWEEN; if (rdoRuntimeExactly.Checked) { runtimeType = NumberFilterItem.TYPE.EXACT; } else if (rdoRuntimeGreaterThan.Checked) { runtimeType = NumberFilterItem.TYPE.GREATER_THAN; } else if (rdoRuntimeLessThan.Checked) { runtimeType = NumberFilterItem.TYPE.LESS_THAN; } filters.Add(new NumberFilterItem(MovieBean.FIELD.RUNTIME, lower, upper, runtimeType)); } //spoken languages if (chkSpokenLanguagesEnabled.Checked) { ListFilterItem.TYPE spokenLanguagesType = ListFilterItem.TYPE.RELAXED; if (rdoLanguagesStrict.Checked) { spokenLanguagesType = ListFilterItem.TYPE.STRICT; } filters.Add(new ListFilterItem(MovieBean.FIELD.SPOKEN_LANGUAGES, chkSpokenLanguages.CheckedItems.Cast <String>().ToList(), spokenLanguagesType)); } //tagline if (chkTaglineEnabled.Checked) { StringFilterItem.TYPE taglineType = StringFilterItem.TYPE.CONTAINS; if (rdoTaglineEndsWith.Checked) { taglineType = StringFilterItem.TYPE.ENDS_WITH; } else if (rdoTaglineEquals.Checked) { taglineType = StringFilterItem.TYPE.EQUALS; } else if (rdoTaglineStartsWith.Checked) { taglineType = StringFilterItem.TYPE.STARTS_WITH; } filters.Add(new StringFilterItem(MovieBean.FIELD.TAGLINE, txtTagline.Text, chkTaglineNot.Checked, taglineType)); } //title if (chkTitleEnabled.Checked) { StringFilterItem.TYPE titleType = StringFilterItem.TYPE.CONTAINS; if (rdoTitleEndsWith.Checked) { titleType = StringFilterItem.TYPE.ENDS_WITH; } else if (rdoTitleEquals.Checked) { titleType = StringFilterItem.TYPE.EQUALS; } else if (rdoTitleStartsWith.Checked) { titleType = StringFilterItem.TYPE.STARTS_WITH; } filters.Add(new StringFilterItem(MovieBean.FIELD.TITLE, txtTitle.Text, chkTitleNot.Checked, titleType)); } //vote if (chkVoteEnabled.Checked) { int lower = int.Parse(GlobalFunctions.stripNonNumericChars(txtVote1.Text)); int upper = int.Parse(GlobalFunctions.stripNonNumericChars(txtVote2.Text)); NumberFilterItem.TYPE voteType = NumberFilterItem.TYPE.BETWEEN; if (rdoVoteExactly.Checked) { voteType = NumberFilterItem.TYPE.EXACT; } else if (rdoVoteGreaterThan.Checked) { voteType = NumberFilterItem.TYPE.GREATER_THAN; } else if (rdoVoteLessThan.Checked) { voteType = NumberFilterItem.TYPE.LESS_THAN; } filters.Add(new NumberFilterItem(MovieBean.FIELD.VOTE, lower, upper, voteType)); } //actors if (chkActorsEnabled.Checked) { ListFilterItem.TYPE actorsType = ListFilterItem.TYPE.RELAXED; if (rdoActorsStrict.Checked) { actorsType = ListFilterItem.TYPE.STRICT; } filters.Add(new ListFilterItem(MovieBean.FIELD.ACTORS, chkActors.CheckedItems.Cast <String>().ToList(), actorsType)); } //directors if (chkDirectorsEnabled.Checked) { ListFilterItem.TYPE directorsType = ListFilterItem.TYPE.RELAXED; if (rdoDirectorsStrict.Checked) { directorsType = ListFilterItem.TYPE.STRICT; } filters.Add(new ListFilterItem(MovieBean.FIELD.DIRECTORS, chkDirectors.CheckedItems.Cast <String>().ToList(), directorsType)); } }
public static MovieBean getMovieBean(MovieBean movie) { String searchString = GlobalFunctions.editFilename(movie.fileName); String TheMovieDB_ID = GlobalFunctions.getTheMovieDbKeyFromGoogle(movie.getTitle()); if (TheMovieDB_ID.Length < 1) { return(movie); } String movieJSON = GlobalFunctions.getHTML("https://api.themoviedb.org/3/movie/" + TheMovieDB_ID + "?api_key=" + THE_MOVIE_DB_API_KEY); String castJSON = GlobalFunctions.getHTML("https://api.themoviedb.org/3/movie/" + TheMovieDB_ID + "/credits?api_key=" + THE_MOVIE_DB_API_KEY); MovieBean importedMovie = parseJSONForBean(movieJSON, castJSON); importedMovie.posterPath = ImageHandler.savePoster(movie, importedMovie.posterPath); importedMovie.backdropPath = ImageHandler.saveBackdrop(movie, importedMovie.backdropPath); //add data to the storage list if (importedMovie.belongsToCollection != null && (!frmMain.files.collections.Contains(importedMovie.belongsToCollection))) { frmMain.files.collections.Add(importedMovie.belongsToCollection); } foreach (String genre in importedMovie.genres) { if (!frmMain.files.genres.Contains(genre)) { frmMain.files.genres.Add(genre); } } foreach (String prod in importedMovie.productionCompanies) { if (!frmMain.files.productionCompanies.Contains(prod)) { frmMain.files.productionCompanies.Add(prod); } } foreach (String lang in importedMovie.spokenLanguages) { if (!frmMain.files.languages.Contains(lang)) { frmMain.files.languages.Add(lang); } } foreach (MovieBean.Movie_DB_ID_Name actor in importedMovie.cast) { if (!frmMain.files.actors.Contains(actor.name)) { frmMain.files.actors.Add(actor.id); } } foreach (MovieBean.Movie_DB_ID_Name director in importedMovie.crew) { if (director.name.ToUpper().Equals("DIRECTOR")) { if (!frmMain.files.actors.Contains(director.id)) { frmMain.files.directors.Add(director.id); } } } return(importedMovie); }