private void RefreshMovieBindings() { this.layoutControl1.Enabled = !MovieDBFactory.IsMultiSelected; if (MovieDBFactory.IsMultiSelected) { return; } xmlPreviewMediaInfoOutput.Clear(); cmbFiles.Properties.Items.Clear(); foreach (var file in MovieDBFactory.GetCurrentMovie().AssociatedFiles.Media) { cmbFiles.Properties.Items.Add(file.PathAndFilename); } cmbFiles.SelectedIndex = 0; if (MovieDBFactory.GetCurrentMovie().AssociatedFiles.Media.Count > 0) { PopulateMediaInfoModel(MovieDBFactory.GetCurrentMovie().AssociatedFiles.Media[0].MiResponseModel); } PopulateFileInfo(); }
/// <summary> /// Handles the SelectionChanged event of the grdViewByTitle control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="DevExpress.Data.SelectionChangedEventArgs"/> instance containing the event data.</param> private void GrdViewByTitle_SelectionChanged(object sender, DevExpress.Data.SelectionChangedEventArgs e) { var rows = grdViewByTitle.GetSelectedRows(); this.UpdatedSelectedMoviesInFactory(rows); if (rows.Length == 1) { MovieDBFactory.IsMultiSelected = false; var selectedRow = grdViewByTitle.GetRow(rows[0]) as MovieModel; if (MovieDBFactory.IsSameAsCurrentMovie(selectedRow)) { return; } MovieDBFactory.SetCurrentMovie(selectedRow); } else if (rows.Length > 1) { MovieDBFactory.IsMultiSelected = true; MovieDBFactory.SetCurrentMovie( new MovieModel { Title = "Mutiple Movies Selected", MultiSelectModel = true }); } }
/// <summary> /// Handles the CurrentMovieChanged event of the MovieDBFactory control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> private void MovieDBFactory_CurrentMovieChanged(object sender, EventArgs e) { if (this.layoutControl1.TabIndex == 0) { AddColouredText(MovieDBFactory.GetCurrentMovie().YamjXml, this.rtbYAMJ); } }
/// <summary> /// Validates the sets to ensure all movies are in database. /// </summary> public static void ValidateSets() { foreach (var set in CurrentDatabase) { var removeIndex = new List <string>(); for (int index = 0; index < set.Movies.Count; index++) { var movie = set.Movies[index]; var check = MovieDBFactory.GetMovie(movie.MovieUniqueId); if (check == null) { removeIndex.Add(movie.MovieUniqueId); } } foreach (var i in removeIndex) { set.Movies.Remove((from m in set.Movies where m.MovieUniqueId == i select m).SingleOrDefault()); } var count = 1; foreach (var movieInSet in set.Movies) { movieInSet.Order = count; count++; } } }
private static void StartMovieFile() { if (File.Exists(MovieDBFactory.GetCurrentMovie().AssociatedFiles.Media[0].PathAndFilename)) { Process.Start(MovieDBFactory.GetCurrentMovie().AssociatedFiles.Media[0].PathAndFilename); } }
/// <summary> /// Setup Data Bindings /// </summary> private void SetupBindings() { txtImdbID.DataBindings.Clear(); txtImdbID.DataBindings.Add("Text", MovieDBFactory.GetCurrentMovie(), "ImdbId"); txtTmdbId.DataBindings.Clear(); txtTmdbId.DataBindings.Add("Text", MovieDBFactory.GetCurrentMovie(), "TmdbId"); txtAllocineID.DataBindings.Clear(); txtAllocineID.DataBindings.Add("Text", MovieDBFactory.GetCurrentMovie(), "AllocineId"); txtFilmAffinityID.DataBindings.Clear(); txtFilmAffinityID.DataBindings.Add("Text", MovieDBFactory.GetCurrentMovie(), "FilmAffinityId"); txtFilmDeltaID.DataBindings.Clear(); txtFilmDeltaID.DataBindings.Add("Text", MovieDBFactory.GetCurrentMovie(), "FilmDeltaId"); txtFilmUpID.DataBindings.Clear(); txtFilmUpID.DataBindings.Add("Text", MovieDBFactory.GetCurrentMovie(), "FilmUpId"); txtFilmWebID.DataBindings.Clear(); txtFilmWebID.DataBindings.Add("Text", MovieDBFactory.GetCurrentMovie(), "FilmWebId"); txtImpawardsID.DataBindings.Clear(); txtImpawardsID.DataBindings.Add("Text", MovieDBFactory.GetCurrentMovie(), "ImpawardsId"); txtKinopoiskID.DataBindings.Clear(); txtKinopoiskID.DataBindings.Add("Text", MovieDBFactory.GetCurrentMovie(), "KinopoiskId"); }
/// <summary> /// The update movie from grid. /// </summary> private void UpdateMovieFromGrid() { var rows = this.grdViewByTitle.GetSelectedRows(); this.UpdatedSelectedMoviesInFactory(rows); btnMutliWatchedFalse.Visible = rows.Length != 1; this.btnMultiWatchedTrue.Visible = rows.Length != 1; btnWatched.Visible = rows.Length == 1; if (rows.Length == 1) { MovieDBFactory.IsMultiSelected = false; var selectedRow = this.grdViewByTitle.GetRow(rows[0]) as MovieModel; if (MovieDBFactory.IsSameAsCurrentMovie(selectedRow)) { return; } MovieDBFactory.SetCurrentMovie(selectedRow); } else if (rows.Length > 1) { MovieDBFactory.IsMultiSelected = true; MovieDBFactory.SetCurrentMovie( new MovieModel { Title = "Multiple Movies Selected", MultiSelectModel = true }); } }
/// <summary> /// Handles the RunWorkerCompleted event of the bgw control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.ComponentModel.RunWorkerCompletedEventArgs"/> instance containing the event data.</param> private void bgw_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { this.frmMain.Show(); DatabaseIOFactory.AppLoading = false; MovieDBFactory.InvokeDatabaseChanged(new EventArgs()); this.Hide(); }
/// <summary> /// Handles the ItemClick event of the btnGetImageFromUrl control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="DevExpress.XtraBars.ItemClickEventArgs"/> instance containing the event data.</param> private void BtnGetImageFromUrl_ItemClick(object sender, ItemClickEventArgs e) { var enterUrl = new FrmEnterAValue("Enter a URL"); enterUrl.ShowDialog(); if (!string.IsNullOrEmpty(enterUrl.Response)) { switch (this.galleryType) { case GalleryType.MovieFanart: MovieDBFactory.GetCurrentMovie().FanartPathOnDisk = string.Empty; MovieDBFactory.GetCurrentMovie().CurrentFanartImageUrl = enterUrl.Response; this.ProcessMovieFanartDownload(); break; case GalleryType.MoviePoster: MovieDBFactory.GetCurrentMovie().PosterPathOnDisk = string.Empty; MovieDBFactory.GetCurrentMovie().CurrentPosterImageUrl = enterUrl.Response; this.ProcessMoviePosterDownload(); break; case GalleryType.TvSeriesBanner: TvDBFactory.CurrentSeries.SeriesBannerUrl = enterUrl.Response; this.ProcessSeriesBannerDownload(); break; case GalleryType.TvSeriesPoster: TvDBFactory.CurrentSeries.PosterUrl = string.Empty; this.ProcessSeriesPosterDownload(); break; case GalleryType.TvSeriesFanart: TvDBFactory.CurrentSeries.FanartUrl = string.Empty; this.ProcessSeriesFanartDownload(); break; case GalleryType.TvSeasonBanner: TvDBFactory.CurrentSeason.BannerUrl = string.Empty; this.ProcessSeasonBannerDownload(); break; case GalleryType.TvSeasonFanart: TvDBFactory.CurrentSeason.FanartUrl = string.Empty; this.ProcessSeasonFanartDownload(); break; case GalleryType.TvSeasonPoster: TvDBFactory.CurrentSeason.PosterUrl = string.Empty; this.ProcessSeasonPosterDownload(); break; case GalleryType.TvEpisodeScreenshot: TvDBFactory.CurrentEpisode.EpisodeScreenshotUrl = string.Empty; this.ProcessEpisodeScreenshotDownload(); break; } } }
private void UpdateImagePath(string fileName) { switch (this.galleryType) { case GalleryType.MoviePoster: MovieDBFactory.GetCurrentMovie().PosterPathOnDisk = fileName; MovieDBFactory.GetCurrentMovie().CurrentPosterImageUrl = string.Empty; this.MovieDBFactory_PosterLoaded(this, new EventArgs()); break; case GalleryType.MovieFanart: MovieDBFactory.GetCurrentMovie().FanartPathOnDisk = fileName; MovieDBFactory.GetCurrentMovie().CurrentFanartImageUrl = string.Empty; this.MovieDBFactory_FanartLoaded(this, new EventArgs()); break; case GalleryType.TvSeriesPoster: TvDBFactory.CurrentSeries.PosterPath = fileName; TvDBFactory.CurrentSeries.PosterUrl = string.Empty; this.TvDbFactory_SeriesPosterLoaded(this, new EventArgs()); break; case GalleryType.TvSeriesFanart: TvDBFactory.CurrentSeries.FanartPath = fileName; TvDBFactory.CurrentSeries.FanartUrl = string.Empty; this.TvDbFactory_SeriesFanartLoaded(this, new EventArgs()); break; case GalleryType.TvSeriesBanner: TvDBFactory.CurrentSeries.SeriesBannerPath = fileName; TvDBFactory.CurrentSeries.SeriesBannerUrl = string.Empty; this.TvDbFactory_SeriesFanartLoaded(this, new EventArgs()); break; case GalleryType.TvSeasonPoster: TvDBFactory.CurrentSeason.PosterPath = fileName; TvDBFactory.CurrentSeason.PosterUrl = string.Empty; this.TvDBFactory_SeasonPosterLoaded(this, new EventArgs()); break; case GalleryType.TvSeasonFanart: TvDBFactory.CurrentSeason.FanartPath = fileName; TvDBFactory.CurrentSeason.FanartUrl = string.Empty; this.TvDBFactory_SeasonFanartLoaded(this, new EventArgs()); break; case GalleryType.TvSeasonBanner: TvDBFactory.CurrentSeason.BannerPath = fileName; TvDBFactory.CurrentSeason.BannerUrl = string.Empty; this.TvDBFactory_SeasonBannerLoaded(this, new EventArgs()); break; case GalleryType.TvEpisodeScreenshot: TvDBFactory.CurrentEpisode.EpisodeScreenshotPath = fileName; TvDBFactory.CurrentEpisode.EpisodeScreenshotUrl = string.Empty; this.TvDBFactory_SeasonBannerLoaded(this, new EventArgs()); break; } }
/// <summary> /// Merges the import database with main movie database /// </summary> public static void MergeImportDatabaseWithMain() { ValidateDatabaseExistance(); MovieDBFactory.MergeWithDatabase(ImportDatabase); MasterMediaDBFactory.PopulateMasterMovieMediaDatabase(); MovieDBFactory.MergeWithDatabase(ImportDuplicatesDatabase, MovieDBFactory.MovieDBTypes.Duplicates); MovieSetManager.ScanForSetImages(); }
/// <summary> /// Handles the DoubleClick event of the BtnNew control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> private void BtnNew_DoubleClick(object sender, EventArgs e) { var button = sender as SimpleButton; MovieDBFactory.GetCurrentMovie().IsNew = false; button.Visible = false; }
/// <summary> /// The set movie binding. /// </summary> private void SetMovieBinding() { this.imageMain.DataBindings.Clear(); this.imageMain.Image = Resources.picturefaded128; layoutControl2.DataBindings.Clear(); layoutControl2.DataBindings.Add("Enabled", MovieDBFactory.GetCurrentMovie(), "Unlocked"); hideContainerLeft.DataBindings.Clear(); hideContainerLeft.DataBindings.Add("Enabled", MovieDBFactory.GetCurrentMovie(), "Unlocked"); switch (this.galleryType) { case GalleryType.MoviePoster: if (!string.IsNullOrEmpty(MovieDBFactory.GetCurrentMovie().PosterPathOnDisk)) { this.MovieDBFactory_PosterLoaded(null, null); } else { this.ProcessMoviePosterDownload(); } if (this.populateGallery) { this.galleryControl.Gallery.Groups.Clear(); this.galleryControl.Gallery.ImageSize = new Size(100, 160); this.galleryControl.Gallery.Groups.Add(MovieDBFactory.GetCurrentMovie().PosterAltGallery); this.populateGallery = false; } break; case GalleryType.MovieFanart: if (!string.IsNullOrEmpty(MovieDBFactory.GetCurrentMovie().FanartPathOnDisk)) { this.MovieDBFactory_FanartLoaded(null, null); } else { this.ProcessMovieFanartDownload(); } if (this.populateGallery) { this.galleryControl.Gallery.Groups.Clear(); this.galleryControl.Gallery.Groups.Add(MovieDBFactory.GetCurrentMovie().FanartAltGallery); this.populateGallery = false; this.galleryControl.Gallery.ImageSize = new Size(100, 60); } break; } }
/// <summary> /// Removes the movie from set. /// </summary> private void RemoveMovieFromSet() { foreach (int movieIndex in this.gridView.GetSelectedRows()) { var movie = this.gridView.GetRow(movieIndex) as MovieSetObjectModel; MovieSetManager.RemoveFromSet(movie.MovieUniqueId); MovieDBFactory.GetMovie(movie.MovieUniqueId).ChangedText = true; } }
/// <summary> /// Handles the ItemClick event of the galleryControlGallery1 control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="DevExpress.XtraBars.Ribbon.GalleryItemClickEventArgs"/> instance containing the event data.</param> private void GalleryControlGallery1_ItemClick(object sender, GalleryItemClickEventArgs e) { var type = e.Item.Tag.ToString().Split('|')[0]; var url = e.Item.Tag.ToString().Split('|')[1]; switch (type) { case "moviePoster": MovieDBFactory.GetCurrentMovie().PosterPathOnDisk = string.Empty; MovieDBFactory.GetCurrentMovie().CurrentPosterImageUrl = url; this.SetMovieBinding(); break; case "movieFanart": MovieDBFactory.GetCurrentMovie().FanartPathOnDisk = string.Empty; MovieDBFactory.GetCurrentMovie().CurrentFanartImageUrl = url; this.SetMovieBinding(); break; case "tvSeriesFanart": TvDBFactory.CurrentSeries.FanartPath = string.Empty; TvDBFactory.CurrentSeries.FanartUrl = url; this.SetTvSeriesBinding(); break; case "tvSeriesPoster": TvDBFactory.CurrentSeries.PosterPath = string.Empty; TvDBFactory.CurrentSeries.PosterUrl = url; this.SetTvSeriesBinding(); break; case "tvSeriesBanner": TvDBFactory.CurrentSeries.SeriesBannerPath = string.Empty; TvDBFactory.CurrentSeries.SeriesBannerUrl = url; this.SetTvSeriesBinding(); break; case "tvSeasonFanart": TvDBFactory.CurrentSeason.FanartPath = string.Empty; TvDBFactory.CurrentSeason.FanartUrl = url; this.SetTvSeasonBinding(); break; case "tvSeasonPoster": TvDBFactory.CurrentSeason.PosterPath = string.Empty; TvDBFactory.CurrentSeason.PosterUrl = url; this.SetTvSeasonBinding(); break; case "tvSeasonBanner": TvDBFactory.CurrentSeason.BannerPath = string.Empty; TvDBFactory.CurrentSeason.BannerUrl = url; this.SetTvSeasonBinding(); break; } }
private static void OpenMovieFolder() { string argument = string.Format( @"/select,""{0}""", File.Exists(MovieDBFactory.GetCurrentMovie().AssociatedFiles.Media[0].PathAndFilename) ? MovieDBFactory.GetCurrentMovie().AssociatedFiles.Media[0].PathAndFilename : MovieDBFactory.GetCurrentMovie().AssociatedFiles.Media[0].FolderPath); Process.Start("explorer.exe", argument); }
/// <summary> /// Handles the CurrentMovieChanged event of the MovieDBFactory control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> private void MovieDBFactory_CurrentMovieChanged(object sender, EventArgs e) { this.btnLock.DataBindings.Clear(); this.btnMarked.DataBindings.Clear(); this.btnLock.DataBindings.Add("Image", MovieDBFactory.GetCurrentMovie(), "LockedImage", true, DataSourceUpdateMode.OnPropertyChanged); this.btnMarked.DataBindings.Add("Image", MovieDBFactory.GetCurrentMovie(), "MarkedImage", true, DataSourceUpdateMode.OnPropertyChanged); this.btnNew.Visible = MovieDBFactory.GetCurrentMovie().IsNew; }
/// <summary> /// Handles the Tick event of the timer control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> private static void Timer_Tick(object sender, EventArgs e) { if (postProcess.Count > 0) { var movie = postProcess[0]; postProcess.Remove(movie); MovieDBFactory.ReplaceMovie(movie); } }
/// <summary> /// Handles the RunWorkerCompleted event of the bgwMulti control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.ComponentModel.RunWorkerCompletedEventArgs"/> instance containing the event data.</param> private static void BgwMulti_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { for (int index = 0; index < postProcess.Count; index++) { var movie = postProcess[index]; movie.IsBusy = false; MovieDBFactory.ReplaceMovie(movie); } postProcess.Clear(); }
/// <summary> /// Determines whether [is ready for scrape]. /// </summary> /// <returns> /// <c>true</c> if [is ready for scrape]; otherwise, <c>false</c>. /// </returns> private bool IsReadyForScrape() { if (string.IsNullOrEmpty(MovieDBFactory.GetCurrentMovie().ImdbId)) { InternalApps.Logs.Log.WriteToLog(LogSeverity.Warning, 0, "Scrape fail", "No IMDB ID found for " + MovieDBFactory.GetCurrentMovie().Title); XtraMessageBox.Show("No IMDB ID Found for this movie"); return(false); } return(true); }
/// <summary> /// Handles the Click event of the GalleryItem control. /// </summary> /// <param name="sender"> /// The source of the event. /// </param> /// <param name="e"> /// The <see cref="DevExpress.XtraBars.Ribbon.GalleryItemClickEventArgs"/> instance containing the event data. /// </param> private void GalleryItem_Click(object sender, GalleryItemClickEventArgs e) { this.grdViewByTitle.ClearSelection(); var selectedMovie = MovieDBFactory.MovieDatabase.IndexOf(MovieDBFactory.GetMovie(e.Item.Tag.ToString())); var handle = this.grdViewByTitle.GetRowHandle(selectedMovie); this.grdViewByTitle.FocusedRowHandle = handle; this.grdViewByTitle.SelectRow(handle); this.UpdateMovieFromGrid(); // MovieDBFactory.SetCurrentMovie(e.Item.Tag.ToString()); }
/// <summary> /// Handles the PosterLoaded event of the MovieDBFactory control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> private void MovieDBFactory_PosterLoaded(object sender, EventArgs e) { Image image = MovieDBFactory.LoadPoster(); if (image == null) { this.populateGallery = false; this.StopLoading(); return; } this.StopLoading(); this.imageMain.Image = image; }
/// <summary> /// Handles the DoWork event of the bgw control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.ComponentModel.DoWorkEventArgs"/> instance containing the event data.</param> private void bgw_DoWork(object sender, DoWorkEventArgs e) { var results = new BindingList <QueryResult>(); var query = new Query { Results = results, Title = MovieDBFactory.GetCurrentMovie().Title, Year = MovieDBFactory.GetCurrentMovie().Year.ToString() }; Factories.Scraper.MovieScrapeFactory.QuickSearchTmdb(query); e.Result = query; }
private void popupHide_ItemClick(object sender, ItemClickEventArgs e) { var check = XtraMessageBox.Show("Are you sure you wish to hide the selected movies?", "Remove Movies", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (check == DialogResult.Yes) { this.grdViewByTitle.GetSelectedRows().Select(row => this.grdViewByTitle.GetRow(row) as MovieModel). ToList().ForEach(MovieDBFactory.HideMovie); } var movieModel = grdViewByTitle.GetFocusedRow() as MovieModel; MovieDBFactory.SetCurrentMovie(movieModel); }
/// <summary> /// Handles the Click event of the btnLoadFromWeb control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> private void btnLoadFromWeb_Click(object sender, EventArgs e) { MovieDBFactory.InvokeCurrentMovieValueChanged(new EventArgs()); var count = MovieDBFactory.MovieDatabase.Count; if (count == 1) { Factories.Scraper.MovieScrapeFactory.RunSingleScrape(MovieDBFactory.GetCurrentMovie()); } else if (count > 1) { Factories.Scraper.MovieScrapeFactory.RunMultiScrape(MovieDBFactory.MultiSelectedMovies); } }
private static List <MovieModel> MovieListTagToList(string movieModelsString) { var movieIds = movieModelsString.Split('|').ToList(); var movieList = new List <MovieModel>(); foreach (var id in movieIds) { if (!string.IsNullOrEmpty(id)) { movieList.Add(MovieDBFactory.GetMovie(id)); } } return(movieList); }
/// <summary> /// Handles the Click event of the btnLoadFromWeb control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> private void BtnLoadFromWeb_Click(object sender, EventArgs e) { grdViewByTitle.RefreshData(); var count = grdViewByTitle.SelectedRowsCount; if (count == 1) { Factories.Scraper.MovieScrapeFactory.RunSingleScrape(MovieDBFactory.GetCurrentMovie()); } else if (count > 1) { Factories.Scraper.MovieScrapeFactory.RunMultiScrape(MovieDBFactory.MultiSelectedMovies); } }
/// <summary> /// Handles the FanartLoaded event of the MovieDBFactory control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> private void MovieDBFactory_FanartLoaded(object sender, EventArgs e) { var image = MovieDBFactory.LoadFanart(); if (image == null) { this.populateGallery = false; this.StopLoading(); this.imageMain.Image = image; return; } this.StopLoading(); this.imageMain.Image = image; }
/// <summary> /// Processes the movie poster download. /// </summary> private void ProcessMoviePosterDownload() { if (Downloader.Downloading.Contains(MovieDBFactory.GetCurrentMovie().CurrentPosterImageUrl)) { return; } MovieDBFactory.PosterLoading += this.ImageLoading; MovieDBFactory.PosterLoaded += this.MovieDBFactory_PosterLoaded; if (!string.IsNullOrEmpty(MovieDBFactory.GetCurrentMovie().CurrentPosterImageUrl)) { MovieDBFactory.GetPoster(); } }
/// <summary> /// Processes the movie fanart download. /// </summary> private void ProcessMovieFanartDownload() { if (Downloader.Downloading.Contains(MovieDBFactory.GetCurrentMovie().CurrentFanartImageUrl)) { return; } MovieDBFactory.FanartLoading += this.ImageLoading; MovieDBFactory.FanartLoaded += this.MovieDBFactory_FanartLoaded; if (!string.IsNullOrEmpty(MovieDBFactory.GetCurrentMovie().CurrentFanartImageUrl)) { MovieDBFactory.GetFanart(); } }