示例#1
0
        private string GetBackgroundColor(EpisodeRequests req)
        {
            if (req.Available)
            {
                return("#469c83");
            }

            if (!req.Available)
            {
                if (req.Approved)
                {
                    // We are approved state
                    return("blue");
                }

                if (!req.Approved)
                {
                    // Processing
                    return("teal");
                }
            }

            return("gray");
        }
示例#2
0
        public static async Task SingleEpisodeCheck(bool useImdb, IQueryable <EmbyEpisode> allEpisodes, EpisodeRequests episode,
                                                    SeasonRequests season, EmbyContent item, bool useTheMovieDb, bool useTvDb)
        {
            EmbyEpisode epExists = null;

            if (useImdb)
            {
                epExists = await allEpisodes.FirstOrDefaultAsync(x =>
                                                                 x.EpisodeNumber == episode.EpisodeNumber && x.SeasonNumber == season.SeasonNumber &&
                                                                 x.Series.ImdbId == item.ImdbId);
            }

            if (useTheMovieDb)
            {
                epExists = await allEpisodes.FirstOrDefaultAsync(x =>
                                                                 x.EpisodeNumber == episode.EpisodeNumber && x.SeasonNumber == season.SeasonNumber &&
                                                                 x.Series.TheMovieDbId == item.TheMovieDbId);
            }

            if (useTvDb)
            {
                epExists = await allEpisodes.FirstOrDefaultAsync(x =>
                                                                 x.EpisodeNumber == episode.EpisodeNumber && x.SeasonNumber == season.SeasonNumber &&
                                                                 x.Series.TvDbId == item.TvDbId);
            }

            if (epExists != null)
            {
                episode.Available = true;
            }
        }
示例#3
0
        public static async Task SingleEpisodeCheck(bool useImdb, IQueryable <PlexEpisode> allEpisodes, EpisodeRequests episode,
                                                    SeasonRequests season, PlexServerContent item, bool useTheMovieDb, bool useTvDb, ILogger log)
        {
            PlexEpisode epExists = null;

            try
            {
                if (useImdb)
                {
                    epExists = await allEpisodes.FirstOrDefaultAsync(x =>
                                                                     x.EpisodeNumber == episode.EpisodeNumber && x.SeasonNumber == season.SeasonNumber &&
                                                                     x.Series.ImdbId == item.ImdbId);
                }

                if (useTheMovieDb)
                {
                    epExists = await allEpisodes.FirstOrDefaultAsync(x =>
                                                                     x.EpisodeNumber == episode.EpisodeNumber && x.SeasonNumber == season.SeasonNumber &&
                                                                     x.Series.TheMovieDbId == item.TheMovieDbId);
                }

                if (useTvDb)
                {
                    epExists = await allEpisodes.FirstOrDefaultAsync(x =>
                                                                     x.EpisodeNumber == episode.EpisodeNumber && x.SeasonNumber == season.SeasonNumber &&
                                                                     x.Series.TvDbId == item.TvDbId);
                }
            }
            catch (Exception e)
            {
                log.LogError(e, "Exception thrown when attempting to check if something is available");
            }

            if (epExists != null)
            {
                episode.Available = true;
            }
        }