/// <summary> /// Processes the episode screenshot download. /// </summary> private void ProcessEpisodeScreenshotDownload() { if (!string.IsNullOrEmpty(TvDBFactory.CurrentEpisode.EpisodeScreenshotPath)) { imageMain.Image = ImageHandler.LoadImage(TvDBFactory.CurrentEpisode.EpisodeScreenshotPath); return; } if (Downloader.Downloading.Contains(TvDBFactory.CurrentEpisode.EpisodeScreenshotUrl)) { return; } TvDBFactory.EpisodeLoading += this.ImageLoading; TvDBFactory.EpisodeLoaded += this.TvDBFactory_EpisodeLoaded; if (!string.IsNullOrEmpty(TvDBFactory.CurrentEpisode.EpisodeScreenshotUrl)) { TvDBFactory.GetEpisode(); } else { this.ShowNoImage(); } }
/// <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.tmr.Stop(); TvDBFactory.GeneratePictureGallery(); TvDBFactory.InvokeCurrentEpisodeChanged(new EventArgs()); this.Close(); }
/// <summary> /// TV path image get. /// </summary> /// <param name="path"> /// The image path /// </param> /// <returns> /// The tv path image get. /// </returns> public string TvPathImageGet(string path) { return(Downloader.ProcessDownload( path.ToLower().Contains("http://") ? path : TvDBFactory.GetImageUrl(path), DownloadType.Binary, Section.Tv)); }
/// <summary> /// Handles the GalleryChanged event of the TvDBFactory 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 TvDBFactory_GalleryChanged(object sender, EventArgs e) { tabBanner.Text = string.Format("Banner ({0})", this.galleryBanners.Gallery.Groups.Count); this.galleryBanners.Gallery.Groups.Clear(); this.galleryBanners.Gallery.Groups.Add(TvDBFactory.GetGalleryGroup()); this.galleryBanners.Gallery.ItemClick += this.Gallery_ItemClick; }
/// <summary> /// Handles the Click event of the btnOK 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 btnOK_Click(object sender, EventArgs e) { var series = AddCustomSeriesFactory.GenerateSeries(); TvDBFactory.AddCustomSeries(series); this.Close(); }
private void UpdateSeasons() { grdSeasons.DataSource = null; grdSeasons.DataSource = TvDBFactory.GetCurrentSeasonsList; var season = gridViewSeasons.GetRow(gridViewSeasons.GetSelectedRows()[0]) as Season; TvDBFactory.SetCurrentSeason(season.Guid); }
/// <summary> /// Handles the SelectionChanged event of the gridViewTvTitleList 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 gridViewTvTitleList_SelectionChanged(object sender, SelectionChangedEventArgs e) { var seriesList = this.gridViewTvTitleList.GetSelectedRows().Select( row => this.gridViewTvTitleList.GetRow(row) as MasterSeriesListModel).Select( seriesListModel => TvDBFactory.GetSeriesFromGuid(seriesListModel.SeriesGuid)).ToList(); TvDBFactory.CurrentSelectedSeries = seriesList; }
/// <summary> /// Handles the FocusedRowChanged event of the gridViewEpisodes control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs"/> instance containing the event data.</param> private void gridViewEpisodes_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e) { var episode = gridViewEpisodes.GetRow(e.FocusedRowHandle) as Episode; if (episode == null) { return; } TvDBFactory.SetCurrentEpisode(episode.Guid); }
public void AddHighPriorityToBackgroundQueueCacheOnly(string url) { Downloader.AddToBackgroundQue( new DownloadItem { Priority = DownloadPriority.High, Section = Section.Tv, Type = DownloadType.Binary, Url = TvDBFactory.GetImageUrl(url, true) }); }
/// <summary> /// Handles the DoWork event of the bgwUpdate 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 BgwUpdate_DoWork(object sender, DoWorkEventArgs e) { foreach (UpdateTvRecords series in this.updateDatabase) { if (series.UpdateSeries) { this.bgwUpdate.ReportProgress(0, series.SeriesName); TvDBFactory.UpdateSeries(series.SeriesId); } } }
/// <summary> /// Handles the FocusedRowChanged event of the gridViewEpisodes control. /// </summary> /// <param name="sender"> /// The source of the event. /// </param> /// <param name="e"> /// The <see cref="DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs"/> instance containing the event data. /// </param> private void gridViewEpisodes_FocusedRowChanged( object sender, FocusedRowChangedEventArgs e) { var episode = this.gridViewEpisodes.GetRow(e.FocusedRowHandle) as Episode; if (episode == null) { return; } TvDBFactory.SetCurrentEpisode(episode.Guid); }
/// <summary> /// Handles the SeriesPosterLoaded event of the TvDbFactory 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 TvDbFactory_SeriesPosterLoaded(object sender, EventArgs e) { var image = TvDBFactory.LoadSeriesPoster(); if (image == null) { return; } this.StopLoading(); this.imageMain.Image = image; }
/// <summary> /// Handles the SeasonFanartLoaded event of the TvDBFactory 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 TvDBFactory_SeasonFanartLoaded(object sender, EventArgs e) { Image image = TvDBFactory.LoadSeasonFanart(); if (image == null) { return; } this.StopLoading(); this.imageMain.Image = image; }
/// <summary> /// Handles the EpisodeLoaded event of the TvDBFactory 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 TvDBFactory_EpisodeLoaded(object sender, EventArgs e) { Image image = TvDBFactory.LoadEpisode(); if (image == null) { return; } this.StopLoading(); this.imageMain.Image = image; }
/// <summary> /// Handles the FocusedRowChanged event of the gridViewTvTitleList control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs"/> instance containing the event data.</param> private void gridViewTvTitleList_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e) { var row = gridViewTvTitleList.GetRow(e.FocusedRowHandle) as MasterSeriesListModel; if (row == null) { return; } TvDBFactory.SetCurrentSeries(row.SeriesGuid); TvDBFactory.DefaultCurrentSeasonAndEpisode(); }
/// <summary> /// Handles the SelectionChanged event of the gridViewTvTitleList 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 gridViewTvTitleList_SelectionChanged(object sender, DevExpress.Data.SelectionChangedEventArgs e) { var seriesList = new List <Series>(); foreach (var row in gridViewTvTitleList.GetSelectedRows()) { var seriesListModel = gridViewTvTitleList.GetRow(row) as MasterSeriesListModel; var series = TvDBFactory.GetSeriesFromGuid(seriesListModel.SeriesGuid); seriesList.Add(series); } TvDBFactory.CurrentSelectedSeries = seriesList; }
/// <summary> /// Handles the SeasonPosterLoaded event of the TvDBFactory 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 TvDBFactory_SeasonPosterLoaded(object sender, EventArgs e) { Image image = TvDBFactory.LoadSeasonPoster(); if (image == null) { this.populateGallery = false; return; } this.StopLoading(); this.imageMain.Image = image; }
/// <summary> /// Handles the SeriesFanartLoaded event of the TvDbFactory 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 TvDbFactory_SeriesFanartLoaded(object sender, EventArgs e) { var image = TvDBFactory.LoadSeriesFanart(); if (image == null) { this.populateGallery = false; return; } this.StopLoading(); this.imageMain.Image = image; }
/// <summary> /// Handles the FocusedRowChanged event of the gridViewSeasons control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs"/> instance containing the event data.</param> private void gridViewSeasons_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e) { var season = gridViewSeasons.GetRow(e.FocusedRowHandle) as Season; if (season == null) { return; } TvDBFactory.SetCurrentSeason(season.Guid); TvDBFactory.DefaultCurrentEpisode(); }
/// <summary> /// Processes the series poster download. /// </summary> private void ProcessSeriesPosterDownload() { if (Downloader.Downloading.Contains(TvDBFactory.CurrentSeries.PosterUrl)) { return; } TvDBFactory.SeriesPosterLoading += this.ImageLoading; TvDBFactory.SeriesPosterLoaded += this.TvDbFactory_SeriesPosterLoaded; if (!string.IsNullOrEmpty(TvDBFactory.CurrentSeries.PosterUrl)) { TvDBFactory.GetSeriesPoster(); } }
/// <summary> /// Processes the season fanart download. /// </summary> private void ProcessSeasonFanartDownload() { if (Downloader.Downloading.Contains(TvDBFactory.CurrentSeason.PosterUrl)) { return; } TvDBFactory.SeasonFanartLoading += this.ImageLoading; TvDBFactory.SeasonFanartLoaded += this.TvDBFactory_SeasonFanartLoaded; if (!string.IsNullOrEmpty(TvDBFactory.CurrentSeason.FanartUrl)) { TvDBFactory.GetSeasonFanart(); } }
/// <summary> /// Handles the ItemClick event of the Gallery 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 Gallery_ItemClick(object sender, GalleryItemClickEventArgs e) { this.gridViewTvTitleList.ClearSelection(); var item = (from i in TvDBFactory.MasterSeriesNameList where i.SeriesGuid == e.Item.Tag.ToString() select i).SingleOrDefault(); var selectedSeries = TvDBFactory.MasterSeriesNameList.IndexOf(item); var handle = this.gridViewTvTitleList.GetRowHandle(selectedSeries); this.gridViewTvTitleList.FocusedRowHandle = handle; this.gridViewTvTitleList.SelectRow(handle); TvDBFactory.SetCurrentSeries(e.Item.Tag.ToString()); }
/// <summary> /// Loads the TV DB db /// </summary> private static void LoadTvDB() { string path = Get.FileSystemPaths.PathDatabases + OutputName.TvDb + Path.DirectorySeparatorChar; Directory.CreateDirectory(path); var files = FileHelper.GetFilesRecursive(path, "*.Series.gz"); TvDBFactory.TvDatabase.Clear(); foreach (var file in files) { string json = Gzip.Decompress(file); var series = JsonConvert.DeserializeObject(json, typeof(Series)) as Series; string title = FileNaming.RemoveIllegalChars(series.SeriesName); string poster = path + title + ".poster.jpg"; string fanart = path + title + ".fanart.jpg"; string banner = path + title + ".banner.jpg"; if (File.Exists(poster)) { series.SmallPoster = ImageHandler.LoadImage(poster); } if (File.Exists(fanart)) { series.SmallFanart = ImageHandler.LoadImage(fanart); } if (File.Exists(banner)) { series.SmallBanner = ImageHandler.LoadImage(banner); } TvDBFactory.TvDatabase.Add(series.SeriesName, series); } TvDBFactory.GeneratePictureGallery(); TvDBFactory.GenerateMasterSeriesList(); }
/// <summary> /// Handles the DoWork event of the bgwScan 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 BgwScan_DoWork(object sender, DoWorkEventArgs e) { var tvdb = new TheTvdb(); int count = 0; foreach (UpdateTvRecords record in this.updateDatabase) { InternalApps.Logs.Log.WriteToLog( LogSeverity.Debug, 0, "UI > Dialogs > TV > FrmUpdateShows > BgwScan_DoWork", string.Format( "Checking {0} {1}x{2:00} for update", record.SeriesName, record.SeasonNumber.GetValueOrDefault(0), record.EpisodeNumber.GetValueOrDefault(0) ) ); this.bgwScan.ReportProgress(0, record); Series seriesObj = TvDBFactory.GetSeriesFromName(record.SeriesName); Series newSeries = tvdb.CheckForUpdate(seriesObj.SeriesID, seriesObj.Language, seriesObj.Lastupdated); if (newSeries != null) { InternalApps.Logs.Log.WriteToLog( LogSeverity.Debug, 0, "UI > Dialogs > TV > FrmUpdateShows > BgwScan_DoWork", string.Format( "Update found for {0} {1}x{2:00}", record.SeriesName, record.SeasonNumber.GetValueOrDefault(0), record.EpisodeNumber.GetValueOrDefault(0) ) ); record.NewTime = newSeries.Lastupdated; count++; } } e.Result = count; }
/// <summary> /// Initializes a new instance of the <see cref="TvUserControl"/> class. /// </summary> public TvUserControl() { InitializeComponent(); this.picSeriesBanner.HeaderTitle = "Banner"; this.picSeriesFanart.HeaderTitle = "Fanart"; this.picSeriesPoster.HeaderTitle = "Poster"; this.picEpisodeFrame.HeaderTitle = "Episode Frame"; grdTvTitleList.DataSource = Factories.TvDBFactory.MasterSeriesNameList; TvDBFactory.GalleryChanged += this.TvDBFactory_GalleryChanged; TvDBFactory.GeneratePictureGallery(); TvDBFactory.CurrentSeriesChanged += this.TvDBFactory_CurrentSeriesChanged; TvDBFactory.CurrentSeasonChanged += this.TvDBFactory_CurrentSeasonChanged; }
/// <summary> /// Handles the RowCellStyle event of the gridViewTvTitleList control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="DevExpress.XtraGrid.Views.Grid.RowCellStyleEventArgs"/> instance containing the event data.</param> private void gridViewTvTitleList_RowCellStyle(object sender, DevExpress.XtraGrid.Views.Grid.RowCellStyleEventArgs e) { var row = gridViewTvTitleList.GetRow(e.RowHandle) as MasterSeriesListModel; if (row == null) { return; } var series = TvDBFactory.GetSeriesFromGuid(row.SeriesGuid); if (series.ChangedText || series.ChangedPoster || series.ChangedFanart || series.ChangedBanner) { e.Appearance.Font = Settings.Get.LookAndFeel.TextChanged; } else { e.Appearance.Font = Settings.Get.LookAndFeel.TextNormal; } }
/// <summary> /// Handles the GetActiveObjectInfo event of the toolTipController1 control. /// </summary> /// <param name="sender"> /// The source of the event. /// </param> /// <param name="e"> /// The <see cref="DevExpress.Utils.ToolTipControllerGetActiveObjectInfoEventArgs"/> instance containing the event data. /// </param> private void toolTipController1_GetActiveObjectInfo( object sender, ToolTipControllerGetActiveObjectInfoEventArgs e) { if (e.SelectedControl == this.grdTvTitleList) { GridHitInfo hi = this.gridViewTvTitleList.CalcHitInfo(e.ControlMousePosition); if (hi.InRowCell) { var series = this.gridViewTvTitleList.GetRow(hi.RowHandle) as MasterSeriesListModel; e.Info = new ToolTipControlInfo(hi + " " + hi.Column.Name + " " + hi.RowHandle, string.Empty) { SuperTip = TvDBFactory.GetSeriesSuperTip(series.SeriesGuid) }; } } else if (e.SelectedControl == this.grdSeasons) { GridHitInfo hi = this.gridViewSeasons.CalcHitInfo(e.ControlMousePosition); if (hi.InRowCell) { var season = this.gridViewSeasons.GetRow(hi.RowHandle) as Season; e.Info = new ToolTipControlInfo(hi + " " + hi.Column.Name + " " + hi.RowHandle, string.Empty) { SuperTip = TvDBFactory.GetSeasonSuperTip(season) }; } } else if (e.SelectedControl == this.grdEpisodes) { GridHitInfo hi = this.gridViewEpisodes.CalcHitInfo(e.ControlMousePosition); if (hi.InRowCell) { var episode = this.gridViewEpisodes.GetRow(hi.RowHandle) as Episode; e.Info = new ToolTipControlInfo(hi + " " + hi.Column.Name + " " + hi.RowHandle, string.Empty) { SuperTip = TvDBFactory.GetEpisodeSuperTip(episode) }; } } }
/// <summary> /// Handles the DoWork event of the bgwUpdate 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 BgwUpdate_DoWork(object sender, DoWorkEventArgs e) { foreach (UpdateTvRecords record in this.updateDatabase) { if (record.UpdateSeries) { if (record.EpisodeNumber != null) { this.bgwUpdate.ReportProgress(0, string.Format("{0} episode {1}x{1:00}", record.SeriesName, record.SeasonNumber, record.EpisodeNumber)); } else if (record.SeasonNumber != null) { this.bgwUpdate.ReportProgress(0, string.Format("{0} season {1}", record.SeriesName, record.SeasonNumber)); } else { this.bgwUpdate.ReportProgress(0, record.SeriesName); } TvDBFactory.UpdateSeries(record.SeriesId, record.SeasonNumber, record.EpisodeNumber); } } }
/// <summary> /// Handles the DoWork event of the bgwScan 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 BgwScan_DoWork(object sender, DoWorkEventArgs e) { var tvdb = new TheTvdb(); int count = 0; foreach (UpdateTvRecords series in this.updateDatabase) { this.bgwScan.ReportProgress(0, series.SeriesName); Series seriesObj = TvDBFactory.GetSeriesFromName(series.SeriesName); Series newSeries = tvdb.CheckForUpdate(seriesObj.SeriesID, seriesObj.Language, seriesObj.Lastupdated); if (newSeries != null) { series.NewTime = newSeries.Lastupdated; count++; } } e.Result = count; }
/// <summary> /// The item_ item click. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The e.</param> private void item_ItemClick(object sender, ItemClickEventArgs e) { var rows = this.grdViewUnsorted.GetSelectedRows(); var seriesName = (e.Item as BarButtonItem).Tag.ToString(); var series = TvDBFactory.GetSeriesFromName(seriesName); var failedList = new List <string>(); var successCount = 0; var sb = new StringBuilder(); var failed = new StringBuilder(); if (series != null) { var assignList = new List <ScanNotCatagorized>(); foreach (int row in rows) { var fileObj = this.grdViewUnsorted.GetRow(row) as ScanNotCatagorized; assignList.Add(fileObj); } foreach (var fileObj in assignList) { var episodeDetails = ImportTvFactory.GetEpisodeDetails(fileObj.FilePath); if (episodeDetails.TvMatchSuccess) { try { this.ReplaceShow(series.Seasons[episodeDetails.SeasonNumber].Episodes[episodeDetails.EpisodeNumber - 1], fileObj); } catch (Exception) { failed.AppendLine(fileObj.FilePath); } if (successCount < 10) { sb.AppendLine( string.Format( "{0} -> {3} s{1}e{2}", Path.GetFileName(fileObj.FilePath), episodeDetails.SeasonNumber, episodeDetails.EpisodeNumber, seriesName)); } successCount++; } else { failedList.Add(episodeDetails.FilePath); } } XtraMessageBox.Show( string.Format("{0} files successfully assigned.{1}{2}{1}{1}Failed{1}{3}", successCount, Environment.NewLine, sb.ToString(), failedList.Count)); } }