public CombinedCodeFinder(string?initialHint, MediaConfiguration.MediaType type, TVDoc.ProviderType source) { Type = type; Source = source; mInternal = false; InitializeComponent(); txtFindThis.Text = initialHint; if (string.IsNullOrEmpty(initialHint)) { ListViewItem lvi = new ListViewItem(""); lvi.SubItems.Add("Enter the show's name, and click \"Search\""); lvMatches.Items.Add(lvi); } SetupColumns(); lvwCodeFinderColumnSorter = new ListViewColumnSorter(new DoubleAsTextSorter(5)); lvwCodeFinderColumnSorter.Order = SortOrder.Descending; lvMatches.ListViewItemSorter = lvwCodeFinderColumnSorter; label3.Text = GetPromptLabel(Source); }
private void olvDuplicates_CellRightClick(object sender, BrightIdeasSoftware.CellRightClickEventArgs e) { if (e.Model is null) { return; } CollectionMember mlastSelected = (CollectionMember)e.Model; possibleMergedEpisodeRightClickMenu.Items.Clear(); if (mlastSelected.IsInLibrary) { TVDoc.ProviderType providerToUse = TVSettings.Instance.DefaultMovieProvider == TVDoc.ProviderType.TMDB? TVSettings.Instance.DefaultMovieProvider :TVDoc.ProviderType.TMDB; MovieConfiguration?si = mDoc.FilmLibrary.GetMovie(mlastSelected.TmdbCode, providerToUse); if (si != null) { AddRcMenuItem("Force Refresh", (o, args) => mainUi.ForceMovieRefresh(si, false)); AddRcMenuItem("Edit Movie", (o, args) => mainUi.EditMovie(si)); } } else { AddRcMenuItem("Add to Library...", (o, args) => AddToLibrary(mlastSelected.Movie)); } //possibleMergedEpisodeRightClickMenu.Items.Add(new ToolStripSeparator()); }
public CombinedCodeFinder(string?initialHint, MediaConfiguration.MediaType type, TVDoc.ProviderType source) { Type = type; Source = source; mInternal = false; InitializeComponent(); txtFindThis.Text = initialHint; SetupColumns(); if (!initialHint.HasValue()) { ListViewItem lvi = new ListViewItem(string.Empty); lvi.SubItems.Add(DEFAULT_MESSAGE); lvMatches.Items.Add(lvi); } lvwCodeFinderColumnSorter = new ListViewColumnSorter(new DoubleAsTextSorter(5)) { Order = SortOrder.Descending }; lvMatches.ListViewItemSorter = lvwCodeFinderColumnSorter; label3.Text = GetPromptLabel(Source); }
public BulkAddEditMovie([NotNull] PossibleNewMovie hint) { InitializeComponent(); codeFinderControl = new CombinedCodeFinder("", MediaConfiguration.MediaType.movie, TVSettings.Instance.DefaultMovieProvider) { Dock = DockStyle.Fill }; codeFinderControl.SelectionChanged += CodeChanged; codeFinderControl.lvMatches.DoubleClick += MatchDoubleClick; label1.Text = $"Search for {TVSettings.Instance.DefaultMovieProvider} entry, by partial name or ID:"; pnlCF.SuspendLayout(); pnlCF.Controls.Add(codeFinderControl); pnlCF.ResumeLayout(); if (hint.CodeKnown) { codeFinderControl.SetHint(hint.ProviderCode.ToString(), hint.Provider); } else { codeFinderControl.SetHint(string.IsNullOrWhiteSpace(hint.RefinedHint) ? hint.Directory.Name : hint.RefinedHint, TVSettings.Instance.DefaultMovieProvider); } Code = -1; Provider = TVDoc.ProviderType.libraryDefault; }
private void bnOK_Click(object sender, EventArgs e) { DialogResult = DialogResult.OK; Code = codeFinderControl.SelectedCode(); Provider = codeFinderControl.Source; Close(); }
internal int IdCode(TVDoc.ProviderType provider) { return((provider) switch { TVDoc.ProviderType.TVmaze => TVmazeCode, TVDoc.ProviderType.TMDB => TmdbCode, _ => TvdbCode });
private static string DataProviderName(TVDoc.ProviderType provider) { return(provider switch { TVDoc.ProviderType.TVmaze => "TVmaze", TVDoc.ProviderType.TheTVDB => "TheTVDB", TVDoc.ProviderType.TMDB => "TMDB", _ => throw new ArgumentOutOfRangeException(nameof(provider), provider, null) });
public int IdFor(TVDoc.ProviderType provider) { return(provider switch { TVDoc.ProviderType.TVmaze => TvMazeSeriesId, TVDoc.ProviderType.TheTVDB => TvdbSeriesId, TVDoc.ProviderType.TMDB => TmdbId, _ => throw new ArgumentOutOfRangeException(nameof(provider), provider, null) });
public void SetSource(TVDoc.ProviderType source, MediaConfiguration?mi) { UpdateSource(source); if (txtFindThis.Text.IsNumeric() && mi != null && mi.IdCode(source) > 0) { mInternal = true; txtFindThis.Text = GenerateNewHintForProvider(mi); mInternal = false; } DoFind(false); }
public int IdCode(TVDoc.ProviderType source) { return(source switch { TVDoc.ProviderType.libraryDefault => IdCode(MediaType() == MediaConfiguration.MediaType.movie ? TVSettings.Instance.DefaultMovieProvider : TVSettings.Instance.DefaultProvider), TVDoc.ProviderType.TVmaze => TvMazeCode, TVDoc.ProviderType.TheTVDB => TvdbCode, TVDoc.ProviderType.TMDB => TmdbCode, _ => throw new ArgumentOutOfRangeException(nameof(source), source, null) });
private void SetMovieItem(int code, TVDoc.ProviderType type, string folderbase) { MovieConfiguration.SetId(type, code); MovieConfiguration.UseAutomaticFolders = true; MovieConfiguration.AutomaticFolderRoot = folderbase; MovieConfiguration.Format = MovieConfiguration.MovieFolderFormat.singleDirectorySingleFile; MovieConfiguration.UseCustomFolderNameFormat = false; MovieConfiguration.ConfigurationProvider = type == TVSettings.Instance.DefaultMovieProvider ? TVDoc.ProviderType.libraryDefault : type; if (!originalHint.Contains(movieCodeFinder.SelectedMovie()?.Name ?? string.Empty, StringComparison.OrdinalIgnoreCase)) { MovieConfiguration.AliasNames.Add(originalHint); } }
private void SetShowItem(int code, TVDoc.ProviderType type, string folderbase) { ShowConfiguration.SetId(type, code); ShowConfiguration.AutoAddFolderBase = folderbase; ShowConfiguration.ConfigurationProvider = type == TVSettings.Instance.DefaultProvider? TVDoc.ProviderType.libraryDefault: type; //Set Default Timezone and if not then set on Network ShowConfiguration.ShowTimeZone = TVSettings.Instance.DefaultShowTimezoneName ?? TimeZoneHelper.TimeZoneForNetwork(tvCodeFinder.SelectedShow()?.Network, ShowConfiguration.ShowTimeZone); if (!originalHint.Contains(tvCodeFinder.SelectedShow()?.Name ?? string.Empty, StringComparison.OrdinalIgnoreCase)) { ShowConfiguration.AliasNames.Add(originalHint); } }
private void UpdateSource(TVDoc.ProviderType source) { if (source == TVDoc.ProviderType.libraryDefault) { Source = Type == MediaConfiguration.MediaType.movie ? TVSettings.Instance.DefaultMovieProvider : TVSettings.Instance.DefaultProvider; } else { Source = source; } label3.Text = GetPromptLabel(Source); }
// internal void Remove([NotNull] ShowConfiguration si) // { // if (!TryTake()(si.TvdbCode, out _)) // { // Logger.Error($"Failed to remove {si.ShowName} from the library with TVDBId={si.TvdbCode}"); // } // } public ShowConfiguration?GetShowItem(int id, TVDoc.ProviderType provider) { List <ShowConfiguration>?matching = this.Where(configuration => configuration.IdCode(provider) == id).ToList(); if (!matching.Any()) { return(null); } if (matching.Count == 1) { return(matching.First()); } Logger.Error($"TV Library has multiple: {matching.Select(x=>x.ToString()).ToCsv()}"); return(matching.First()); }
public ShowConfiguration(int code, TVDoc.ProviderType type) : this() { switch (type) { case TVDoc.ProviderType.TVmaze: TVmazeCode = code; break; case TVDoc.ProviderType.TheTVDB: TvdbCode = code; break; case TVDoc.ProviderType.TMDB: TmdbCode = code; break; default: throw new ArgumentOutOfRangeException(nameof(type), type, null); } }
public SeriesSpecifier(int tvdb, int tvmaze, int tmdb, bool useCustomLanguage, string?customLanguageCode, string name, TVDoc.ProviderType p, string?imdb, MediaConfiguration.MediaType t) { TvdbSeriesId = tvdb; TvMazeSeriesId = tvmaze; Name = name; ImdbCode = imdb; Provider = p; Type = t; TmdbId = tmdb; if (string.IsNullOrWhiteSpace(customLanguageCode)) { UseCustomLanguage = false; CustomLanguageCode = TVSettings.Instance.PreferredLanguageCode; } else { UseCustomLanguage = useCustomLanguage; CustomLanguageCode = customLanguageCode; } }
public ShowNotFoundException(int id, string message, TVDoc.ProviderType showIdProvider, TVDoc.ProviderType errorProvider) : base(message) { ShowId = id; ShowIdProvider = showIdProvider; ErrorProvider = errorProvider; }
public string LanguageCodeToUse(TVDoc.ProviderType provider) => UseCustomLanguage && (TargetLanguageCode.HasValue()) ? TargetLanguageCode : provider == TVDoc.ProviderType.TMDB ? TVSettings.Instance.TMDBLanguage : TVSettings.Instance.PreferredLanguageCode;
private int CountIdsFrom(TVDoc.ProviderType provider, MediaConfiguration.MediaType type) { return(downloadIds.Count(s => s.Provider == provider && s.Type == type)); }
private int CountDirtyIdsFrom(TVDoc.ProviderType provider, MediaConfiguration.MediaType type) { return(type == MediaConfiguration.MediaType.tv ?downloadIds.Count(s => s.Provider == provider && s.Type == type && (TVDoc.GetMediaCache(provider).GetSeries(s.IdFor(provider))?.Dirty ?? true)) :downloadIds.Count(s => s.Provider == provider && s.Type == type && (TVDoc.GetMediaCache(provider).GetMovie(s.IdFor(provider))?.Dirty ?? true))); }
// Thrown if an error occurs in the XML when reading TheTVDB.xml public SourceConsistencyException(string message, TVDoc.ProviderType provider) : base(DataProviderName(provider) + ": " + message) { }
public void SetSource(TVDoc.ProviderType source) => SetSource(source, null);
public MovieConfiguration(int code, TVDoc.ProviderType type) : this() { ConfigurationProvider = type; SetId(type, code); }
private static bool HaveSameNonZeroId(MediaConfiguration item, MediaConfiguration currentlyMatchedTvShow, TVDoc.ProviderType p) { return((item.IdCode(p) == currentlyMatchedTvShow.IdCode(p)) && (item.IdCode(p) > 0) && (currentlyMatchedTvShow.IdCode(p) > 0)); }
// Thrown if an error occurs in the XML when reading TheTVDB.xml public SourceConsistencyException(string message, TVDoc.ProviderType provider) : base(provider.PrettyPrint() + ": " + message) { }
public void SetId(int code, TVDoc.ProviderType provider) { ProviderCode = code; Provider = provider; }