Exemple #1
0
        private async Task StartPlexTv()
        {
            var allTv = _plexRepo.GetAll().Where(x =>
                                                 x.Type == PlexMediaTypeEntity.Show && (!x.TheMovieDbId.HasValue() || !x.ImdbId.HasValue() || !x.TvDbId.HasValue()));
            var tvCount = 0;

            foreach (var show in allTv)
            {
                var hasImdb       = show.ImdbId.HasValue();
                var hasTheMovieDb = show.TheMovieDbId.HasValue();
                var hasTvDbId     = show.TvDbId.HasValue();

                if (!hasTheMovieDb)
                {
                    var id = await GetTheMovieDbId(hasTvDbId, hasImdb, show.TvDbId, show.ImdbId, show.Title);

                    show.TheMovieDbId = id;
                }

                if (!hasImdb)
                {
                    var id = await GetImdbId(hasTheMovieDb, hasTvDbId, show.Title, show.TheMovieDbId, show.TvDbId);

                    show.ImdbId = id;
                    _plexRepo.UpdateWithoutSave(show);
                }

                if (!hasTvDbId)
                {
                    var id = await GetTvDbId(hasTheMovieDb, hasImdb, show.TheMovieDbId, show.ImdbId, show.Title);

                    show.TvDbId = id;
                    _plexRepo.UpdateWithoutSave(show);
                }
                tvCount++;
                if (tvCount >= 20)
                {
                    await _plexRepo.SaveChangesAsync();

                    tvCount = 0;
                }
            }
            await _plexRepo.SaveChangesAsync();
        }
Exemple #2
0
        private async Task StartPlexTv(IQueryable <PlexServerContent> allTv)
        {
            var tvCount = 0;

            foreach (var show in allTv)
            {
                var hasImdb       = show.ImdbId.HasValue();
                var hasTheMovieDb = show.TheMovieDbId.HasValue();
                var hasTvDbId     = show.TvDbId.HasValue();

                if (!hasTheMovieDb)
                {
                    var id = await GetTheMovieDbId(hasTvDbId, hasImdb, show.TvDbId, show.ImdbId, show.Title, false);

                    show.TheMovieDbId = id;
                }

                if (!hasImdb)
                {
                    var id = await GetImdbId(hasTheMovieDb, hasTvDbId, show.Title, show.TheMovieDbId, show.TvDbId);

                    show.ImdbId = id;
                    _plexRepo.UpdateWithoutSave(show);
                }

                if (!hasTvDbId)
                {
                    var id = await GetTvDbId(hasTheMovieDb, hasImdb, show.TheMovieDbId, show.ImdbId, show.Title);

                    show.TvDbId = id;
                    _plexRepo.UpdateWithoutSave(show);
                }
                tvCount++;
                if (tvCount >= 75)
                {
                    await _plexRepo.SaveChangesAsync();

                    tvCount = 0;
                }
            }
            await _plexRepo.SaveChangesAsync();
        }
Exemple #3
0
        private async Task StartPlexTv(List <PlexServerContent> allTv)
        {
            foreach (var show in allTv)
            {
                // Just double check there is no associated request id
                if (show.RequestId.HasValue)
                {
                    continue;
                }
                var hasImdb       = show.ImdbId.HasValue();
                var hasTheMovieDb = show.TheMovieDbId.HasValue();
                var hasTvDbId     = show.TvDbId.HasValue();

                if (!hasTheMovieDb)
                {
                    var id = await GetTheMovieDbId(hasTvDbId, hasImdb, show.TvDbId, show.ImdbId, show.Title, false);

                    show.TheMovieDbId = id;
                }

                if (!hasImdb)
                {
                    var id = await GetImdbId(hasTheMovieDb, hasTvDbId, show.Title, show.TheMovieDbId, show.TvDbId, RequestType.TvShow);

                    show.ImdbId = id;
                    _plexRepo.UpdateWithoutSave(show);
                }

                if (!hasTvDbId)
                {
                    var id = await GetTvDbId(hasTheMovieDb, hasImdb, show.TheMovieDbId, show.ImdbId, show.Title);

                    show.TvDbId = id;
                    _plexRepo.UpdateWithoutSave(show);
                }
                await _plexRepo.SaveChangesAsync();
            }
        }