Пример #1
0
    private void CreateScrobbleData(IPlayerSlotController psc)
    {
      IPlayerContext pc = PlayerContext.GetPlayerContext(psc);
      if (pc == null || pc.CurrentMediaItem == null)
        return;
      IMediaPlaybackControl pmc = pc.CurrentPlayer as IMediaPlaybackControl;
      if (pmc == null)
        return;

      var mediaItem = pc.CurrentMediaItem;

      _duration = pmc.Duration;
      bool isMovie = mediaItem.Aspects.ContainsKey(MovieAspect.ASPECT_ID);
      bool isSeries = mediaItem.Aspects.ContainsKey(SeriesAspect.ASPECT_ID);

      if (isMovie)
        _dataMovie = CreateMovieData(mediaItem);

      if (isSeries)
        _dataEpisode = CreateEpisodeData(mediaItem);
    }
Пример #2
0
    private TraktScrobbleEpisode CreateEpisodeData(MediaItem mediaItem)
    {
      var episodeScrobbleData = new TraktScrobbleEpisode
      {
        Episode = new TraktEpisode
        {
          Ids = new TraktEpisodeId
          {
            Tvdb = GetSeriesTvdbId(mediaItem),
            Imdb = GetSeriesImdbId(mediaItem)
          },
          Title = GetSeriesTitle(mediaItem),
          Season = GetSeasonIndex(mediaItem),
          Number = GetEpisodeIndex(mediaItem)
        },
        Show = new TraktShow
        {
          Ids = new TraktShowId
          {
            Tvdb = GetSeriesTvdbId(mediaItem),
            Imdb = GetSeriesImdbId(mediaItem)
          },
          Title = GetSeriesTitle(mediaItem),
          Year = GetVideoYear(mediaItem)
        },
        AppDate = DateTime.Now.ToString(CultureInfo.InvariantCulture),
        AppVersion = APP_VERSION
      };

      return episodeScrobbleData;
    }
Пример #3
0
 public static TraktScrobbleResponse StopEpisodeScrobble(TraktScrobbleEpisode episode)
 {
   var response = TraktWeb.PostToTrakt(TraktURIs.ScrobbleStop, episode.ToJSON());
   return response.FromJSON<TraktScrobbleResponse>();
 }