Пример #1
0
 public TVShowViewModel(WebTVShowDetailed show, IEnumerable<WebTVSeasonDetailed> seasons)
 {
     Show = show;
     Seasons = seasons;
 }
Пример #2
0
 public TVEpisodeViewModel(WebTVShowDetailed show, WebTVSeasonDetailed season, WebTVEpisodeDetailed episode)
 {
     Episode = episode;
     _show = show;
     _season = season;
 }
Пример #3
0
 public bool StartWatchingEpisode(WebTVShowDetailed show, WebTVSeasonDetailed season, WebTVEpisodeDetailed episode)
 {
     Log.Debug("WSD: Start watching episode {0}, season {1}, show {2}", episode.Title, episode.SeasonId, episode.ShowId);
     return true;
 }
Пример #4
0
 public TVSeasonViewModel(WebTVShowDetailed show, WebTVSeasonDetailed season, IEnumerable<WebTVEpisodeDetailed> episodes)
 {
     Show = show;
     Season = season;
     Episodes = episodes;
 }
Пример #5
0
 public bool CancelWatchingEpisode(WebTVShowDetailed show, WebTVSeasonDetailed season, WebTVEpisodeDetailed episode)
 {
     Log.Debug("WSD: Canceled episode {0}", episode.Title);
     return true;
 }
Пример #6
0
 public bool FinishEpisode(WebTVShowDetailed show, WebTVSeasonDetailed season, WebTVEpisodeDetailed episode)
 {
     Log.Debug("WSD: Finished episode {0}", episode.Title);
     return true;
 }
Пример #7
0
 public bool WatchingEpisode(WebTVShowDetailed show, WebTVSeasonDetailed season, WebTVEpisodeDetailed episode, int progress)
 {
     // Follw.it doesn't require to send a status each X minutes or something
     return true;
 }
Пример #8
0
 public bool WatchingEpisode(WebTVShowDetailed show, WebTVSeasonDetailed season, WebTVEpisodeDetailed episode, int progress)
 {
     Log.Debug("WSD: Watching episode {0} ({1}%)", episode.Title, progress);
     return true;
 }
Пример #9
0
 public bool StartWatchingEpisode(WebTVShowDetailed show, WebTVSeasonDetailed season, WebTVEpisodeDetailed episode)
 {
     return CallFollwitEpisode(episode, FollwitWatchStatus.Watching);
 }
Пример #10
0
 public bool StartWatchingEpisode(WebTVShowDetailed show, WebTVSeasonDetailed season, WebTVEpisodeDetailed episode)
 {
     return CallShowAPI(show, season, episode, TraktWatchStatus.Watching, 0);
 }
Пример #11
0
 public bool FinishEpisode(WebTVShowDetailed show, WebTVSeasonDetailed season, WebTVEpisodeDetailed episode)
 {
     return CallShowAPI(show, season, episode, TraktWatchStatus.Scrobble, 100);
 }
Пример #12
0
        private bool CallShowAPI(WebTVShowDetailed show, WebTVSeasonDetailed season, WebTVEpisodeBasic episode, TraktWatchStatus state, int? progress)
        {
            var data = new TraktEpisodeScrobbleData()
            {
                MediaCenter = TraktConfig.MediaCenter,
                MediaCenterBuildDate = TraktConfig.MediaCenterDate,
                MediaCenterVersion = TraktConfig.MediaCenterVersion,
                PluginVersion = TraktConfig.PluginVersion,
                Password = Configuration["passwordHash"],
                UserName = Configuration["username"],

                Duration = show.Runtime.ToString(),
                Episode = episode.EpisodeNumber.ToString(),
                Season = season.SeasonNumber.ToString(),
                Title = show.Title,
                Year = show.Year.ToString(),
            };

            if (progress != null)
                data.Progress = progress.Value.ToString();

            if (show.ExternalId.Count(x => x.Site == "IMDB") > 0)
                data.IMDBID = show.ExternalId.First(x => x.Site == "IMDB").Id;
            if (show.ExternalId.Count(x => x.Site == "TVDB") > 0)
                data.TVDBID = show.ExternalId.First(x => x.Site == "TVDB").Id;
            if (data.IMDBID == null && data.TVDBID == null)
            {
                Log.Info("Trakt: IMDB and TVDB unknown of episode {0}, not sending", episode.Title);
                return false;
            }

            try
            {
                Log.Debug("Trakt: calling service for show {0} (episode {1}) with progress {2} and state {3}", data.Title, episode.Title, data.Progress, state.ToString());
                TraktResponse response = TraktAPI.ScrobbleEpisode(data, state);
                if (response.Status != "success")
                {
                    Log.Warn("Trakt: failed to update watch status of episode '{0}' ({1}): {2}", episode.Title, episode.Id, response.Error);
                    return false;
                }
                Log.Trace("Trakt: finished service call");
                return true;
            }
            catch (Exception ex)
            {
                Log.Warn("Trakt: failed to call service", ex);
                return false;
            }
        }
Пример #13
0
 public bool WatchingEpisode(WebTVShowDetailed show, WebTVSeasonDetailed season, WebTVEpisodeDetailed episode, int progress)
 {
     return CallShowAPI(show, season, episode, TraktWatchStatus.Watching, progress);
 }