예제 #1
0
        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);
        }
예제 #2
0
        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());
        }
예제 #3
0
        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);
        }
예제 #4
0
        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;
        }
예제 #5
0
 private void bnOK_Click(object sender, EventArgs e)
 {
     DialogResult = DialogResult.OK;
     Code         = codeFinderControl.SelectedCode();
     Provider     = codeFinderControl.Source;
     Close();
 }
예제 #6
0
 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)
     });
예제 #8
0
 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)
     });
예제 #9
0
 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);
 }
예제 #10
0
 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)
     });
예제 #11
0
        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);
            }
        }
예제 #12
0
        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);
            }
        }
예제 #13
0
        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);
        }
예제 #14
0
        // 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());
        }
예제 #15
0
        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);
            }
        }
예제 #16
0
        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;
            }
        }
예제 #17
0
 public ShowNotFoundException(int id, string message, TVDoc.ProviderType showIdProvider, TVDoc.ProviderType errorProvider) : base(message)
 {
     ShowId         = id;
     ShowIdProvider = showIdProvider;
     ErrorProvider  = errorProvider;
 }
예제 #18
0
 public string LanguageCodeToUse(TVDoc.ProviderType provider) => UseCustomLanguage && (TargetLanguageCode.HasValue())
     ? TargetLanguageCode
     : provider == TVDoc.ProviderType.TMDB ? TVSettings.Instance.TMDBLanguage : TVSettings.Instance.PreferredLanguageCode;
예제 #19
0
 private int CountIdsFrom(TVDoc.ProviderType provider, MediaConfiguration.MediaType type)
 {
     return(downloadIds.Count(s => s.Provider == provider && s.Type == type));
 }
예제 #20
0
 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)
 {
 }
예제 #22
0
 public void SetSource(TVDoc.ProviderType source) => SetSource(source, null);
예제 #23
0
 public MovieConfiguration(int code, TVDoc.ProviderType type) : this()
 {
     ConfigurationProvider = type;
     SetId(type, code);
 }
예제 #24
0
 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)
 {
 }
예제 #26
0
 public void SetId(int code, TVDoc.ProviderType provider)
 {
     ProviderCode = code;
     Provider     = provider;
 }