コード例 #1
0
 internal static void SetSeasonProperties(TraktShowSummary show, TraktSeasonSummary season)
 {
     SetProperty("#Trakt.Season.TmdbId", season.Ids.Tmdb);
     SetProperty("#Trakt.Season.TvdbId", season.Ids.Tvdb);
     SetProperty("#Trakt.Season.TvRageId", season.Ids.TvRage);
     SetProperty("#Trakt.Season.Number", season.Number);
     SetProperty("#Trakt.Season.Url", string.Format("http://trakt.tv/shows/{0}/seasons/{1}", show.Ids.Slug, season.Number));
     //SetProperty("#Trakt.Season.PosterImageFilename", season.Images == null ? string.Empty : season.Images.Poster.LocalImageFilename(ArtworkType.SeasonPoster));
     SetProperty("#Trakt.Season.EpisodeCount", season.EpisodeCount);
     SetProperty("#Trakt.Season.EpisodeAiredCount", season.EpisodeAiredCount);
     SetProperty("#Trakt.Season.Overview", season.Overview ?? show.Overview);
     SetProperty("#Trakt.Season.Watched", season.IsWatched(show));
     SetProperty("#Trakt.Season.Plays", season.Plays(show));
     SetProperty("#Trakt.Season.InCollection", season.IsCollected(show));
     SetProperty("#Trakt.Season.InWatchList", season.IsWatchlisted(show));
     SetProperty("#Trakt.Season.Collected", season.Collected(show));
     SetProperty("#Trakt.Season.Rating", season.UserRating(show));
     SetProperty("#Trakt.Season.Ratings.Percentage", season.Rating.ToPercentage());
     SetProperty("#Trakt.Season.Ratings.Votes", season.Votes);
     SetProperty("#Trakt.Season.Ratings.Icon", (season.Rating >= 6) ? "love" : "hate");
 }
コード例 #2
0
        internal static bool RateSeason(TraktShowSummary show, TraktSeasonSummary season)
        {
            var rateObject = new TraktSyncSeasonRatedEx
            {
                Ids = show.Ids,
                Title = show.Title,
                Year = show.Year,
                Seasons = new List<TraktSyncSeasonRatedEx.Season>
                {
                    new TraktSyncSeasonRatedEx.Season
                    {
                        Number = season.Number,
                        RatedAt = DateTime.UtcNow.ToISO8601()
                    }
                }
            };

            int? prevRating = season.UserRating(show);
            int newRating = 0;

            newRating = GUIUtils.ShowRateDialog<TraktSyncSeasonRatedEx>(rateObject);
            if (newRating == -1) return false;

            // If previous rating not equal to current rating then
            // update skin properties to reflect changes
            if (prevRating == newRating)
                return false;

            if (prevRating == null || prevRating == 0)
            {
                // add to ratings
                TraktCache.AddSeasonToRatings(show, season, newRating);
                season.Votes++;
            }
            else if (newRating == 0)
            {
                // remove from ratings
                TraktCache.RemoveSeasonFromRatings(show, season);
                season.Votes--;
            }
            else
            {
                // rating changed, remove then add
                TraktCache.RemoveSeasonFromRatings(show, season);
                TraktCache.AddSeasonToRatings(show, season, newRating);
            }

            // update ratings until next online update
            // if we have the ratings distribution we could calculate correctly
            if (season.Votes == 0)
            {
                season.Rating = 0;
            }
            else if (season.Votes == 1 && newRating > 0)
            {
                season.Rating = newRating;
            }

            return true;
        }
コード例 #3
0
 public static void ShowTVSeasonShouts(TraktShowSummary show, TraktSeasonSummary season)
 {
     var showImages = TmdbCache.GetShowImages(show.Ids.Tmdb, true);
     ShowTVSeasonShouts(show.Title, show.Year, show.Ids.Tvdb, show.Ids.Trakt, show.Ids.Imdb, season.Number, season.IsWatched(show), TmdbCache.GetShowBackdropFilename(showImages), TmdbCache.GetShowBackdropUrl(showImages));
 }
コード例 #4
0
 private void PublishSeasonSkinProperties(TraktSeasonSummary season)
 {
     GUICommon.SetSeasonProperties(Show, season);
 }
コード例 #5
0
        private bool GetLoadingParameter()
        {
            if (_loadParameter == null)
            {
                // maybe re-loading, so check previous window id
                if (Show != null && Show.Ids.Trakt != null && Season != null)
                    return true;

                return false;
            }

            var loadingParam = _loadParameter.FromJSON<SeasonLoadingParameter>();
            if (loadingParam == null) return false;

            // reset previous selected index
            if (Show != null && Season != null)
            {
                if (Show.Title != loadingParam.Show.Title || Season.Number != loadingParam.Season.Number)
                    PreviousSelectedIndex = 0;
            }

            Show = loadingParam.Show;
            Season = loadingParam.Season;
            if (Show == null || Show.Ids.Trakt == null || Season == null)
                return false;

            return true;
        }