/// <summary>
        /// Use this method when no Episode Ids are available
        /// </summary>
        public static void RemoveEpisodeFromWatchHistory(TraktShow show, TraktEpisode episode)
        {
            var episodeSync = new TraktSyncShowEx
            {
                Title = show.Title,
                Year = show.Year,
                Ids = show.Ids,
                Seasons = new List<TraktSyncShowEx.Season>
                {
                   new TraktSyncShowEx.Season
                   {
                       Number = episode.Season,
                       Episodes = new List<TraktSyncShowEx.Season.Episode>
                       {
                           new TraktSyncShowEx.Season.Episode
                           {
                               Number = episode.Number
                           }
                       }
                   }
                }
            };

            var syncThread = new Thread((objSyncData) =>
            {
                var response = TraktAPI.TraktAPI.RemoveShowFromWatchedHistoryEx(objSyncData as TraktSyncShowEx);
                TraktLogger.LogTraktResponse<TraktSyncResponse>(response);

                TraktCache.RemoveEpisodeFromWatchHistory(show, episode);
            })
            {
                IsBackground = true,
                Name = "MarkUnWatched"
            };

            syncThread.Start(episodeSync);
        }
        internal static bool RateEpisode(TraktShow show, TraktEpisode episode)
        {
            TraktRateEpisode rateObject = new TraktRateEpisode
            {
                SeriesID = show.Tvdb,
                Title = show.Title,
                Year = show.Year.ToString(),
                Episode = episode.Number.ToString(),
                Season = episode.Season.ToString(),
                Rating = episode.RatingAdvanced.ToString(),
                UserName = TraktSettings.Username,
                Password = TraktSettings.Password
            };

            int prevRating = episode.RatingAdvanced;
            int newRating = int.Parse(GUIUtils.ShowRateDialog<TraktRateEpisode>(rateObject));
            if (newRating == -1) return false;

            // If previous rating not equal to current rating then
            // update skin properties to reflect changes
            // This is not really needed but saves waiting for response
            // from server to calculate fields...we can do it ourselves

            if (prevRating != newRating)
            {
                episode.RatingAdvanced = newRating;

                if (episode.Ratings == null)
                    episode.Ratings = new TraktRatings();

                // if not rated previously bump up the votes
                if (prevRating == 0)
                {
                    episode.Ratings.Votes++;
                    if (episode.RatingAdvanced > 5)
                    {
                        episode.Rating = "love";
                        episode.Ratings.LovedCount++;
                    }
                    else
                    {
                        episode.Rating = "hate";
                        episode.Ratings.HatedCount++;
                    }
                }

                if (prevRating != 0 && prevRating > 5 && newRating <= 5)
                {
                    episode.Rating = "hate";
                    episode.Ratings.LovedCount--;
                    episode.Ratings.HatedCount++;
                }

                if (prevRating != 0 && prevRating <= 5 && newRating > 5)
                {
                    episode.Rating = "love";
                    episode.Ratings.LovedCount++;
                    episode.Ratings.HatedCount--;
                }

                if (newRating == 0)
                {
                    if (prevRating <= 5) show.Ratings.HatedCount++;
                    episode.Ratings.Votes--;
                    episode.Rating = "false";
                }

                // Could be in-accurate, best guess
                if (prevRating == 0)
                {
                    episode.Ratings.Percentage = (int)Math.Round(((show.Ratings.Percentage * (show.Ratings.Votes - 1)) + (10 * newRating)) / (float)show.Ratings.Votes);
                }
                else
                {
                    episode.Ratings.Percentage = (int)Math.Round(((show.Ratings.Percentage * (show.Ratings.Votes)) + (10 * newRating) - (10 * prevRating)) / (float)show.Ratings.Votes);
                }

                return true;
            }

            return false;
        }
 public static void CheckAndPlayEpisode(TraktShow show, TraktEpisode episode)
 {
     if (show == null || episode == null) return;
     CheckAndPlayEpisode(Convert.ToInt32(show.Tvdb), string.IsNullOrEmpty(show.Imdb) ? show.Title : show.Imdb, episode.Season, episode.Number, show.Title);
 }
 private void RateEpisode(TraktEpisode episode)
 {
     GUICommon.RateEpisode(Show, episode);
 }
        private void RemoveEpisodeFromWatchList(TraktEpisode episode)
        {
            Thread syncThread = new Thread(delegate(object obj)
            {
                TraktAPI.TraktAPI.SyncEpisodeWatchList(CreateEpisodeSyncData(obj as TraktEpisode), TraktSyncModes.unwatchlist);
            })
            {
                IsBackground = true,
                Name = "Removing Episode from Watch List"
            };

            syncThread.Start(episode);
        }
示例#6
0
        private bool EpisodeMatch(DBEpisode localEpisode, TraktEpisode onlineEpisode, TraktShow onlineShow)
        {
            // episode ids are unreliable on themoviedb.org, they seem to be wrong for quite a few episodes!

            //if (onlineEpisode.Ids.TvdbId != null && onlineEpisode.Ids.TvdbId > 0)
            //{
            //    return localEpisode[DBOnlineEpisode.cID] == onlineEpisode.Ids.TvdbId;
            //}

            //else if (BasicHandler.IsValidImdb(onlineEpisode.Ids.ImdbId) && BasicHandler.IsValidImdb(localEpisode[DBOnlineEpisode.cIMDBID]))
            //{
            //    return BasicHandler.GetProperImdbId(localEpisode[DBOnlineEpisode.cIMDBID]) == onlineEpisode.Ids.ImdbId;
            //}

            if (onlineShow.Ids.Tvdb != null && onlineShow.Ids.Tvdb > 0)
            {
                return localEpisode[DBOnlineEpisode.cSeriesID] == onlineShow.Ids.Tvdb &&
                       localEpisode[DBOnlineEpisode.cSeasonIndex] == onlineEpisode.Season &&
                       localEpisode[DBOnlineEpisode.cEpisodeIndex] == onlineEpisode.Number;
            }
            else if (BasicHandler.IsValidImdb(onlineShow.Ids.Imdb))
            {
                var show = Helper.getCorrespondingSeries(localEpisode[DBOnlineEpisode.cSeriesID]);
                if (show == null) return false;

                return BasicHandler.GetProperImdbId(show[DBOnlineSeries.cIMDBID]) == onlineShow.Ids.Imdb &&
                       localEpisode[DBOnlineEpisode.cSeasonIndex] == onlineEpisode.Season &&
                       localEpisode[DBOnlineEpisode.cEpisodeIndex] == onlineEpisode.Number;
            }
            else
            {
                var show = Helper.getCorrespondingSeries(localEpisode[DBOnlineEpisode.cSeriesID]);
                if (show == null) return false;

                return BasicHandler.IsTitleMatch(show[DBOnlineSeries.cOriginalName], onlineShow.Title, onlineShow.Year) &&
                       show.Year.ToNullableInt32() == onlineShow.Year &&
                       localEpisode[DBOnlineEpisode.cSeasonIndex] == onlineEpisode.Season &&
                       localEpisode[DBOnlineEpisode.cEpisodeIndex] == onlineEpisode.Number;
            }
        }
        private TraktEpisodeSync CreateEpisodeSyncData(TraktEpisode episode)
        {
            List<TraktEpisodeSync.Episode> episodes = new List<TraktEpisodeSync.Episode>();

            TraktEpisodeSync.Episode ep = new TraktEpisodeSync.Episode
            {
                EpisodeIndex = episode.Number.ToString(),
                SeasonIndex = episode.Season.ToString()
            };
            episodes.Add(ep);

            TraktEpisodeSync syncData = new TraktEpisodeSync
            {
                UserName = TraktSettings.Username,
                Password = TraktSettings.Password,
                SeriesID = Show.Tvdb,
                Title = Show.Title,
                Year = Show.Year.ToString(),
                EpisodeList = episodes
            };

            return syncData;
        }
示例#8
0
        internal static void AddEpisodeToRatings(TraktShow show, TraktEpisode episode, int rating)
        {
            var ratedEpisodes = (_RatedEpisodes ?? new List<TraktEpisodeRated>()).ToList();

            ratedEpisodes.Add(new TraktEpisodeRated
            {
                RatedAt = DateTime.UtcNow.ToISO8601(),
                Rating = rating,
                Show = new TraktShow
                {
                    Ids = show.Ids,
                    Title = show.Title,
                    Year = show.Year
                },
                Episode = new TraktEpisode
                {
                    Ids = episode.Ids,
                    Number = episode.Number,
                    Season = episode.Season,
                    Title = episode.Title
                }
            });

            _RatedEpisodes = ratedEpisodes;
        }
示例#9
0
        internal static void AddEpisodeToWatchHistory(TraktShow show, TraktEpisode episode)
        {
            var watchedEpisodes = (_WatchedEpisodes ?? new List<EpisodeWatched>()).ToList();

            var existingWatchedEpisode = watchedEpisodes.FirstOrDefault(e => (((e.ShowId == show.Ids.Trakt) && e.ShowId != null) || ((e.ShowTvdbId == show.Ids.Tvdb) && e.ShowTvdbId != null)) &&
                                                                                e.Season == episode.Season &&
                                                                                e.Number == episode.Number);

            // if it exists already, increment the play count only
            if (existingWatchedEpisode != null)
            {
                existingWatchedEpisode.Plays++;
                existingWatchedEpisode.WatchedAt = DateTime.UtcNow.ToISO8601();
            }
            else
            {
                watchedEpisodes.Add(new EpisodeWatched
                {
                    Number = episode.Number,
                    Season = episode.Season,
                    ShowId = show.Ids.Trakt,
                    ShowImdbId = show.Ids.Imdb,
                    ShowTvdbId = show.Ids.Tvdb,
                    ShowTitle = show.Title,
                    ShowYear = show.Year,
                    Plays = 1,
                    WatchedAt = DateTime.UtcNow.ToISO8601()
                });
            }

            _WatchedEpisodes = watchedEpisodes;

            // now remove from watchlist and paused state since it will be removed from online in these cases
            RemoveEpisodeFromWatchlist(episode);
            RemoveEpisodeFromPausedData(show, episode);
            RemoveShowFromWatchlist(show);
        }
示例#10
0
        internal static void AddEpisodeToCollection(TraktShow show, TraktEpisode episode)
        {
            var collectedEpisodes = (_CollectedEpisodes ?? new List<EpisodeCollected>()).ToList();

            collectedEpisodes.Add(new EpisodeCollected
            {
                Number = episode.Number,
                Season = episode.Season,
                ShowId = show.Ids.Trakt,
                ShowImdbId = show.Ids.Imdb,
                ShowTvdbId = show.Ids.Tvdb,
                ShowTitle = show.Title,
                ShowYear = show.Year,
                CollectedAt = DateTime.UtcNow.ToISO8601()
            });

            _CollectedEpisodes = collectedEpisodes;
        }
示例#11
0
        internal static void AddEpisodeToPausedData(TraktShow show, TraktEpisode episode, float progress)
        {
            var pausedEpisodes = (_PausedEpisodes ?? new List<TraktSyncPausedEpisode>()).ToList();

            var existingPausedEpisode = pausedEpisodes.FirstOrDefault(e => (((e.Show.Ids.Trakt == show.Ids.Trakt) && e.Show.Ids.Trakt != null) || ((e.Show.Ids.Tvdb == show.Ids.Tvdb) && e.Show.Ids.Tvdb != null)) &&
                                                                              e.Episode.Season == episode.Season &&
                                                                              e.Episode.Number == episode.Number);

            // if it exists already, increment the play count only
            if (existingPausedEpisode != null)
            {
                existingPausedEpisode.Progress = progress;
                existingPausedEpisode.PausedAt = DateTime.UtcNow.ToISO8601();
            }
            else
            {
                pausedEpisodes.Add(new TraktSyncPausedEpisode
                {
                    PausedAt = DateTime.UtcNow.ToISO8601(),
                    Progress = progress,
                    Show = new TraktShow
                    {
                        Ids = show.Ids,
                        Title = show.Title,
                        Year = show.Year
                    },
                    Episode = new TraktEpisode
                    {
                        Ids = episode.Ids,
                        Number = episode.Number,
                        Season = episode.Season,
                        Title = episode.Title
                    }
                });
            }

            _PausedEpisodes = pausedEpisodes;
        }
示例#12
0
        public static void RemoveEpisodeFromWatchList(string title, int season, int number, int? tvdbid, string imdbid, int? tmdbid, int? traktid)
        {
            if (!GUICommon.CheckLogin(false)) return;

            var episode = new TraktEpisode
            {
                Ids = new TraktEpisodeId
                {
                    Trakt = traktid,
                    Imdb = imdbid,
                    Tmdb = tmdbid,
                    Tvdb = tvdbid
                },
                Title = title,
                Season = season,
                Number = number
            };

            var syncThread = new Thread((objSyncData) =>
            {
                var response = TraktAPI.TraktAPI.RemoveEpisodeFromWatchlist(objSyncData as TraktEpisode);
            })
            {
                IsBackground = true,
                Name = "RemoveWatchlist"
            };

            syncThread.Start(episode);

            TraktCache.RemoveEpisodeFromWatchlist(episode);
        }
示例#13
0
 public static void RemoveEpisodeFromWatchList(TraktEpisode episode)
 {
     RemoveEpisodeFromWatchList(episode.Title, episode.Season, episode.Number, episode.Ids.Tvdb, episode.Ids.Imdb, episode.Ids.Tmdb, episode.Ids.Trakt);
 }
示例#14
0
        public static void RemoveEpisodeFromWatchHistory(string title, int season, int number, int? tvdbid, string imdbid, int? tmdbid, int? traktid)
        {
            var episode = new TraktEpisode
            {
                Ids = new TraktEpisodeId
                {
                    Trakt = traktid,
                    Imdb = imdbid,
                    Tmdb = tmdbid,
                    Tvdb = tvdbid
                },
                Title = title,
                Season = season,
                Number = number
            };

            var syncThread = new Thread((objSyncData) =>
            {
                var response = TraktAPI.TraktAPI.RemoveEpisodeFromWatchedHistory(objSyncData as TraktEpisode);
                TraktLogger.LogTraktResponse<TraktSyncResponse>(response);
            })
            {
                IsBackground = true,
                Name = "MarkUnWatched"
            };

            syncThread.Start(episode);
        }
示例#15
0
        public static TraktSyncResponse AddEpisodeToWatchlist(TraktEpisode episode)
        {
            var episodes = new TraktSyncEpisodes
            {
                Episodes = new List<TraktEpisode>() { episode }
            };

            return AddEpisodesToWatchlist(episodes);
        }
示例#16
0
        internal static void RemoveEpisodeFromCollection(TraktShow show, TraktEpisode episode)
        {
            if (_CollectedEpisodes == null || show.Ids == null)
                return;

            var collectedEpisodes = _CollectedEpisodes.ToList();
            collectedEpisodes.RemoveAll(e => (((e.ShowId == show.Ids.Trakt) && e.ShowId != null) || ((e.ShowTvdbId == show.Ids.Tvdb) && e.ShowTvdbId != null)) &&
                                                e.Season == episode.Season &&
                                                e.Number == episode.Number);

            // remove using Title + Year
            if (show.Ids.Trakt == null && show.Ids.Tvdb == null)
            {
                collectedEpisodes.RemoveAll(e => e.ShowTitle.ToLowerInvariant() == show.Title.ToLowerInvariant() && e.ShowYear == show.Year &&
                                                 e.Season == episode.Season &&
                                                 e.Number == episode.Number);
            }

            _CollectedEpisodes = collectedEpisodes;
        }
 internal static void SetEpisodeProperties(TraktEpisode episode)
 {
     SetProperty("#Trakt.Episode.Number", episode.Number.ToString());
     SetProperty("#Trakt.Episode.Season", episode.Season.ToString());
     SetProperty("#Trakt.Episode.FirstAired", episode.FirstAired.FromEpoch().ToShortDateString());
     SetProperty("#Trakt.Episode.Title", string.IsNullOrEmpty(episode.Title) ? string.Format("{0} {1}", Translation.Episode, episode.Number.ToString()) : episode.Title);
     SetProperty("#Trakt.Episode.Url", episode.Url);
     SetProperty("#Trakt.Episode.Overview", string.IsNullOrEmpty(episode.Overview) ? Translation.NoEpisodeSummary : episode.Overview);
     SetProperty("#Trakt.Episode.Runtime", episode.Runtime.ToString());
     SetProperty("#Trakt.Episode.InWatchList", episode.InWatchList.ToString());
     SetProperty("#Trakt.Episode.InCollection", episode.InCollection.ToString());
     SetProperty("#Trakt.Episode.Plays", episode.Plays.ToString());
     SetProperty("#Trakt.Episode.Watched", episode.Watched.ToString());
     SetProperty("#Trakt.Episode.Rating", episode.Rating);
     SetProperty("#Trakt.Episode.RatingAdvanced", episode.RatingAdvanced.ToString());
     SetProperty("#Trakt.Episode.Ratings.Icon", (episode.Ratings.LovedCount > episode.Ratings.HatedCount) ? "love" : "hate");
     SetProperty("#Trakt.Episode.Ratings.HatedCount", episode.Ratings.HatedCount.ToString());
     SetProperty("#Trakt.Episode.Ratings.LovedCount", episode.Ratings.LovedCount.ToString());
     SetProperty("#Trakt.Episode.Ratings.Percentage", episode.Ratings.Percentage.ToString());
     SetProperty("#Trakt.Episode.Ratings.Votes", episode.Ratings.Votes.ToString());
     SetProperty("#Trakt.Episode.EpisodeImageFilename", episode.Images.EpisodeImageFilename);
 }
示例#18
0
        internal static void RemoveEpisodeFromRatings(TraktEpisode episode)
        {
            if (_RatedEpisodes == null || episode.Ids == null)
                return;

            var ratedEpisodes = _RatedEpisodes.ToList();
            ratedEpisodes.RemoveAll(e => ((e.Episode.Ids.Trakt == episode.Ids.Trakt) && e.Episode.Ids.Trakt != null) ||
                                         ((e.Episode.Ids.Imdb == episode.Ids.Imdb) && e.Episode.Ids.Imdb.ToNullIfEmpty() != null) ||
                                         ((e.Episode.Ids.Tvdb == episode.Ids.Tvdb) && e.Episode.Ids.Tvdb != null));

            _RatedEpisodes = ratedEpisodes;
        }
        private void AddEpisodeToWatchList(TraktEpisode episode)
        {
            Thread syncThread = new Thread(delegate(object obj)
            {
                TraktAPI.TraktAPI.SyncEpisodeWatchList(CreateEpisodeSyncData(obj as TraktEpisode), TraktSyncModes.watchlist);
            })
            {
                IsBackground = true,
                Name = "Adding Episode to Watch List"
            };

            syncThread.Start(episode);
        }
示例#20
0
        internal static void RemoveEpisodeFromWatchlist(TraktEpisode episode)
        {
            if (_WatchListEpisodes == null || episode.Ids == null)
                return;

            var watchlistEpisodes = _WatchListEpisodes.ToList();
            watchlistEpisodes.RemoveAll(e => ((e.Episode.Ids.Trakt == episode.Ids.Trakt) && e.Episode.Ids.Trakt != null) ||
                                             ((e.Episode.Ids.Imdb == episode.Ids.Imdb) && e.Episode.Ids.Imdb != null) ||
                                             ((e.Episode.Ids.Tvdb == episode.Ids.Tvdb && e.Episode.Ids.Tvdb != null)));

            _WatchListEpisodes = watchlistEpisodes;
        }
        private void MarkEpisodeAsWatched(TraktEpisode episode)
        {
            Thread syncThread = new Thread(delegate(object obj)
            {
                TraktAPI.TraktAPI.SyncEpisodeLibrary(CreateEpisodeSyncData(obj as TraktEpisode), TraktSyncModes.seen);
            })
            {
                IsBackground = true,
                Name = "Mark Episode as Watched"
            };

            syncThread.Start(episode);
        }
示例#22
0
        internal static void RemoveEpisodeFromWatchlist(TraktShow show, TraktEpisode episode)
        {
            if (_WatchListEpisodes == null || show.Ids == null)
                return;

            var watchlistEpisodes = _WatchListEpisodes.ToList();
            watchlistEpisodes.RemoveAll(e => (((e.Show.Ids.Trakt == show.Ids.Trakt) && e.Show.Ids.Trakt != null) || ((e.Show.Ids.Tvdb == show.Ids.Tvdb) && e.Show.Ids.Tvdb != null)) &&
                                                e.Episode.Season == episode.Season &&
                                                e.Episode.Number == episode.Number);

            // remove using Title + Year
            if (show.Ids.Trakt == null && show.Ids.Tvdb == null)
            {
                watchlistEpisodes.RemoveAll(e => e.Show.Title.ToLowerInvariant() == show.Title.ToLowerInvariant() && e.Show.Year == show.Year &&
                                                 e.Episode.Season == episode.Season &&
                                                 e.Episode.Number == episode.Number);
            }

            _WatchListEpisodes = watchlistEpisodes;
        }
        private void RemoveEpisodeFromLibrary(TraktEpisode episode)
        {
            Thread syncThread = new Thread(delegate(object obj)
            {
                TraktAPI.TraktAPI.SyncEpisodeLibrary(CreateEpisodeSyncData(obj as TraktEpisode), TraktSyncModes.unlibrary);
            })
            {
                IsBackground = true,
                Name = "Remove Episode From Library"
            };

            syncThread.Start(episode);
        }
示例#24
0
        public static TraktSyncResponse RemoveEpisodeFromCollection(TraktEpisode episode)
        {
            var episodes = new TraktSyncEpisodes
            {
                Episodes = new List<TraktEpisode>() { episode }
            };

            return RemoveEpisodesFromCollecton(episodes);
        }
示例#25
0
        private TraktSyncAll GetSyncItems(TraktListItem listItem)
        {
            var syncItems = new TraktSyncAll();

            switch (listItem.Type)
            {
                case "movie":
                    var movie = new TraktMovie
                    {
                        Ids = new TraktMovieId { Trakt = listItem.Movie.Ids.Trakt }
                    };
                    syncItems.Movies = new List<TraktMovie>();
                    syncItems.Movies.Add(movie);
                    break;

                case "show":
                    var show = new TraktShow
                    {
                        Ids = new TraktShowId { Trakt = listItem.Show.Ids.Trakt }
                    };
                    syncItems.Shows = new List<TraktShow>();
                    syncItems.Shows.Add(show);
                    break;

                case "season":
                    var season = new TraktSeason
                    {
                        Ids = new TraktSeasonId { Trakt = listItem.Season.Ids.Trakt }
                    };
                    syncItems.Seasons = new List<TraktSeason>();
                    syncItems.Seasons.Add(season);
                    break;

                case "episode":
                    var episode = new TraktEpisode
                    {
                        Ids = new TraktEpisodeId { Trakt = listItem.Episode.Ids.Trakt }
                    };
                    syncItems.Episodes = new List<TraktEpisode>();
                    syncItems.Episodes.Add(episode);
                    break;

                case "person":
                    var person = new TraktPerson
                    {
                        Ids = new TraktPersonId { Trakt = listItem.Person.Ids.Trakt }
                    };
                    syncItems.People = new List<TraktPerson>();
                    syncItems.People.Add(person);
                    break;
            }

            return syncItems;
        }
示例#26
0
        /// <summary>
        /// UnRate a single episode on trakt.tv
        /// </summary>
        public static TraktSyncResponse RemoveEpisodeFromRatings(TraktEpisode episode)
        {
            var episodes = new TraktSyncEpisodes
            {
                Episodes = new List<TraktEpisode>() { new TraktEpisode { Ids = episode.Ids } }
            };

            return RemoveEpisodesFromRatings(episodes);
        }
示例#27
0
        internal static void SetEpisodeProperties(TraktEpisode episode)
        {
            if (episode == null) return;

            SetProperty("#Trakt.Episode.Number", episode.Number.ToString());
            SetProperty("#Trakt.Episode.Season", episode.Season.ToString());
            SetProperty("#Trakt.Episode.FirstAired", episode.FirstAired == 0 ? " " : episode.FirstAired.FromEpoch().ToShortDateString());
            SetProperty("#Trakt.Episode.FirstAiredLocalized", episode.FirstAiredLocalized == 0 ? " " : episode.FirstAiredLocalized.FromEpoch().ToShortDateString());
            SetProperty("#Trakt.Episode.FirstAiredLocalizedDayOfWeek", episode.FirstAiredLocalized == 0 ? " " : episode.FirstAiredLocalized.FromEpoch().DayOfWeek.ToString());
            SetProperty("#Trakt.Episode.Title", string.IsNullOrEmpty(episode.Title) ? string.Format("{0} {1}", Translation.Episode, episode.Number.ToString()) : episode.Title.RemapHighOrderChars());
            SetProperty("#Trakt.Episode.Url", episode.Url);
            SetProperty("#Trakt.Episode.Overview", string.IsNullOrEmpty(episode.Overview) ? Translation.NoEpisodeSummary : episode.Overview.RemapHighOrderChars());
            SetProperty("#Trakt.Episode.Runtime", episode.Runtime.ToString());
            SetProperty("#Trakt.Episode.InWatchList", episode.InWatchList.ToString());
            SetProperty("#Trakt.Episode.InCollection", episode.InCollection.ToString());
            SetProperty("#Trakt.Episode.Plays", episode.Plays.ToString());
            SetProperty("#Trakt.Episode.Watched", episode.Watched.ToString());
            SetProperty("#Trakt.Episode.Rating", episode.Rating);
            SetProperty("#Trakt.Episode.RatingAdvanced", episode.RatingAdvanced.ToString());
            SetProperty("#Trakt.Episode.Ratings.Icon", ((episode.Ratings != null) && (episode.Ratings.LovedCount > episode.Ratings.HatedCount)) ? "love" : "hate");
            SetProperty("#Trakt.Episode.Ratings.HatedCount", episode.Ratings != null ? episode.Ratings.HatedCount.ToString() : "0");
            SetProperty("#Trakt.Episode.Ratings.LovedCount", episode.Ratings != null ? episode.Ratings.LovedCount.ToString() : "0");
            SetProperty("#Trakt.Episode.Ratings.Percentage", episode.Ratings != null ? episode.Ratings.Percentage.ToString() : "0");
            SetProperty("#Trakt.Episode.Ratings.Votes", episode.Ratings != null ? episode.Ratings.Votes.ToString() : "0");
            SetProperty("#Trakt.Episode.EpisodeImageFilename", episode.Images.EpisodeImageFilename);
        }
示例#28
0
        public static TraktSyncResponse RemoveEpisodeFromWatchlist(TraktEpisode episode)
        {
            var episodes = new TraktSyncEpisodes
            {
                Episodes = new List<TraktEpisode>() { episode }
            };

            return RemoveEpisodesFromWatchlist(episodes);
        }
示例#29
0
        public static void ShowTVShowTrailersMenu(TraktShow show, TraktEpisode episode = null)
        {
            IDialogbox dlg = (IDialogbox)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);
            dlg.Reset();
            dlg.SetHeading(Translation.Trailer);

            foreach (TrailerSiteShows site in Enum.GetValues(typeof(TrailerSiteShows)))
            {
                string menuItem = Enum.GetName(typeof(TrailerSiteShows), site);
                GUIListItem pItem = new GUIListItem(menuItem);
                dlg.Add(pItem);
            }

            dlg.DoModal(GUIWindowManager.ActiveWindow);

            if (dlg.SelectedLabel >= 0)
            {
                string siteUtil = string.Empty;
                string searchParam = string.Empty;

                switch (dlg.SelectedLabelText)
                {
                    case ("IMDb"):
                        siteUtil = "IMDb Movie Trailers";
                        if (!string.IsNullOrEmpty(show.Imdb))
                            // Exact search
                            searchParam = show.Imdb;
                        else
                            searchParam = show.Title;
                        break;

                    case ("YouTube"):
                        siteUtil = "YouTube";
                        searchParam = show.Title;
                        if (episode != null)
                        {
                            searchParam += string.Format(" S{0}E{1}", episode.Season.ToString("D2"), episode.Number.ToString("D2"));
                        }
                        break;
                }

                string loadingParam = string.Format("site:{0}|search:{1}|return:Locked", siteUtil, searchParam);

                // Launch OnlineVideos Trailer search
                GUIWindowManager.ActivateWindow((int)ExternalPluginWindows.OnlineVideos, loadingParam);
            }
        }
示例#30
0
 public static void RemoveEpisodeFromCollection(TraktEpisode episode)
 {
     RemoveEpisodeFromCollection(episode.Title, episode.Season, episode.Number, episode.Ids.Tvdb, episode.Ids.Imdb, episode.Ids.Tmdb, episode.Ids.Trakt);
 }