private void AskUserAboutShow([NotNull] PossibleNewTvShow folder, IDialogParent owner) { if (folder.CodeKnown) { return; } BulkAddSeriesManager.GuessShowItem(folder, MDoc.TvLibrary, true); if (folder.CodeKnown) { return; } BulkAddEditShow ed = new BulkAddEditShow(folder); owner.ShowChildDialog(ed); DialogResult x = ed.DialogResult; int code = ed.Code; ed.Dispose(); if (x != DialogResult.OK || code == -1) { return; } folder.SetId(code, TVDoc.ProviderType.TheTVDB); }
protected override void DoCheck(SetProgressDelegate prog, TVDoc.ScanSettings settings) { BulkAddSeriesManager bam = new BulkAddSeriesManager(MDoc); bam.CheckFolders(settings.Token, prog, false, !settings.Unattended); AskUserAboutShows(settings, bam); if (!bam.AddItems.Any(s => s.CodeKnown)) { return; } var idsToAdd = bam.AddItems.Where(s => s.CodeKnown).Select(folder => new { Code = folder.ProviderCode, folder.Provider }).ToList(); bam.AddAllToMyShows(); List <ShowConfiguration> addedShows = idsToAdd.Select(s => MDoc.TvLibrary.GetShowItem(s.Code, s.Provider)).ToList(); //add each new show into the shows being scanned foreach (ShowConfiguration si in addedShows) { settings.Shows.Add(si); } LOGGER.Info("Added new shows called: {0}", addedShows.Select(si => si.ShowName).ToCsv()); MDoc.TvAddedOrEdited(true, settings.Unattended, settings.Hidden, settings.Owner, addedShows); }
private void AskUserAboutShow([NotNull] PossibleNewTvShow folder, IDialogParent owner) { if (folder.CodeKnown) { return; } BulkAddSeriesManager.GuessShowItem(folder, MDoc.TvLibrary, true); if (folder.CodeKnown) { return; } FolderMonitorEdit ed = new FolderMonitorEdit(folder); owner.ShowChildDialog(ed); DialogResult x = ed.DialogResult; int code = ed.Code; ed.Dispose(); if (x != DialogResult.OK || code == -1) { return; } folder.TVDBCode = code; }
protected override void DoCheck(SetProgressDelegate prog, TVDoc.ScanSettings settings) { BulkAddSeriesManager bam = new BulkAddSeriesManager(MDoc); bam.CheckFolders(settings.Token, prog, false, !settings.Unattended); AskUserAboutShows(settings, bam); if (!bam.AddItems.Any(s => s.CodeKnown)) { return; } List <int> idsToAdd = bam.AddItems.Where(s => s.CodeKnown).Select(folder => folder.TVDBCode).ToList(); bam.AddAllToMyShows(); MDoc.SetDirty(); MDoc.DoDownloadsFG(settings.Unattended, settings.Hidden, settings.Owner); List <ShowConfiguration> addedShows = idsToAdd.Select(s => MDoc.TvLibrary.GetShowItem(s)).ToList(); //add each new show into the shows being scanned foreach (ShowConfiguration si in addedShows) { settings.Shows.Add(si); } LOGGER.Info("Added new shows called: {0}", addedShows.Select(si => si.ShowName).ToCsv()); MDoc.DoWhenToWatch(true, settings.Unattended, settings.Hidden, settings.Owner); MDoc.WriteUpcoming(); MDoc.WriteRecent(); }
public FolderMonitor(TVDoc doc, BulkAddSeriesManager bam) { mDoc = doc; engine = bam; InitializeComponent(); FillFolderStringLists(); TokenSource = new CancellationTokenSource(); tbResults.Parent = null; FmpUpto = string.Empty; }
private void AskUserAboutShows(TVDoc.ScanSettings settings, [NotNull] BulkAddSeriesManager bam) { foreach (PossibleNewTvShow folder in bam.AddItems) { if (settings.Token.IsCancellationRequested) { break; } AskUserAboutShow(folder, settings.Owner); } }
private void bnFullAuto_Click(object _, System.EventArgs e) { if (engine.AddItems.Count == 0) { return; } CancellationTokenSource cts = new CancellationTokenSource(); TokenSource = cts; FmpUpto = "Identifying shows"; FmpPercent = 0; Thread fmpshower = new Thread(FmpShower) { Name = "Bulk Add Shows Progress (Full Auto)" }; fmpshower.Start(); while (progressDialog is null || !progressDialog.Ready) { Thread.Sleep(10); } int n = 0; int n2 = engine.AddItems.Count; foreach (PossibleNewTvShow ai in engine.AddItems) { FmpPercent = 100 * n++ / n2; if (cts.IsCancellationRequested) { break; } if (ai.CodeKnown) { continue; } BulkAddSeriesManager.GuessShowItem(ai, mDoc.TvLibrary, true); // update our display UpdateListItem(ai, true); lvFMNewShows.Update(); Update(); } cts.Cancel(); }