Exemplo n.º 1
0
        private void PopulateTraktDetails()
        {
            try
            {
                Trakt_ShowRepository repShows = new Trakt_ShowRepository();
                Show = repShows.GetByTraktID(TraktID);
                if (Show == null)
                {
                    return;
                }

                Trakt_EpisodeRepository repTvEps = new Trakt_EpisodeRepository();
                traktEpisodes = repTvEps.GetByShowID(Show.Trakt_ShowID);

                if (traktEpisodes.Count > 0)
                {
                    List <SortPropOrFieldAndDirection> sortCriteria = new List <SortPropOrFieldAndDirection>();
                    sortCriteria.Add(new SortPropOrFieldAndDirection("Season", false, SortType.eInteger));
                    sortCriteria.Add(new SortPropOrFieldAndDirection("EpisodeNumber", false, SortType.eInteger));
                    traktEpisodes = Sorting.MultiSort <Trakt_Episode>(traktEpisodes, sortCriteria);
                }
            }
            catch (Exception ex)
            {
                logger.ErrorException(ex.ToString(), ex);
            }
        }
Exemplo n.º 2
0
        private void GetDictTraktEpisodesAndSeasons(Trakt_Show show, ref Dictionary <int, Trakt_Episode> dictTraktEpisodes, ref Dictionary <int, int> dictTraktSeasons)
        {
            dictTraktEpisodes = new Dictionary <int, Trakt_Episode>();
            dictTraktSeasons  = new Dictionary <int, int>();
            try
            {
                Trakt_EpisodeRepository repEps = new Trakt_EpisodeRepository();

                // create a dictionary of absolute episode numbers for trakt episodes
                // sort by season and episode number
                // ignore season 0, which is used for specials
                List <Trakt_Episode> eps = repEps.GetByShowID(show.Trakt_ShowID);

                List <SortPropOrFieldAndDirection> sortCriteria = new List <SortPropOrFieldAndDirection>();
                sortCriteria.Add(new SortPropOrFieldAndDirection("Season", false, SortType.eInteger));
                sortCriteria.Add(new SortPropOrFieldAndDirection("EpisodeNumber", false, SortType.eInteger));
                eps = Sorting.MultiSort <Trakt_Episode>(eps, sortCriteria);

                int i          = 1;
                int lastSeason = -999;
                foreach (Trakt_Episode ep in eps)
                {
                    if (ep.Season == 0)
                    {
                        continue;
                    }

                    dictTraktEpisodes[i] = ep;

                    if (ep.Season != lastSeason)
                    {
                        dictTraktSeasons[ep.Season] = i;
                    }

                    lastSeason = ep.Season;

                    i++;
                }
            }
            catch (Exception ex)
            {
                logger.ErrorException(ex.ToString(), ex);
            }
        }
Exemplo n.º 3
0
        private void PopulateTraktDetails()
        {
            try
            {
                Trakt_ShowRepository repShows = new Trakt_ShowRepository();
                Show = repShows.GetByTraktSlug(TraktID);
                if (Show == null)
                {
                    return;
                }

                Trakt_EpisodeRepository repTvEps = new Trakt_EpisodeRepository();
                traktEpisodes = repTvEps.GetByShowID(Show.Trakt_ShowID).OrderBy(a => a.Season).ThenBy(a => a.EpisodeNumber).ToList();
            }
            catch (Exception ex)
            {
                logger.ErrorException(ex.ToString(), ex);
            }
        }