Inheritance: TraktScrobble
        /// <summary>
        /// Creates data object for movie scrobbling
        /// </summary>
        internal static TraktScrobbleMovie CreateMovieScrobbleData(VideoInfo info)
        {
            // create scrobble data
            var scrobbleData = new TraktScrobbleMovie
            {
                Movie = new TraktMovie
                {
                    Ids = new TraktMovieId(),
                    Title = info.Title,
                    Year = info.Year.ToNullableInt32()
                },
                Progress = GetPlayerProgress(info),
                AppDate = TraktSettings.BuildDate,
                AppVersion = TraktSettings.Version
            };

            return scrobbleData;
        }
Esempio n. 2
0
        /// <summary>
        /// Creates Scrobble data based on a IMDBMovie object
        /// </summary>
        /// <param name="movie">The movie to base the object on</param>
        /// <returns>The Trakt scrobble data to send</returns>
        private static TraktScrobbleMovie CreateScrobbleData(IMDBMovie movie)
        {
            double progress = (g_Player.CurrentPosition / (g_Player.Duration == 0.0 ? movie.RunTime * 60.0 : g_Player.Duration)) * 100.0;

            var scrobbleData = new TraktScrobbleMovie
            {
                Movie = new TraktMovie
                {
                    Ids = new TraktMovieId { Imdb = movie.IMDBNumber.ToNullIfEmpty() },
                    Title = movie.Title,
                    Year = movie.Year
                },
                AppDate = TraktSettings.BuildDate,
                AppVersion = TraktSettings.Version,
                Progress = Math.Round(progress, 2)
            };

            return scrobbleData;
        }
 private TraktScrobbleMovie CreateMovieScrobbleData(ITrackingInfo info, double progress = 0)
 {
     var scrobbleData = new TraktScrobbleMovie
     {
         Movie = new TraktMovie
         {
             Ids = new TraktMovieId { Imdb = info.ID_IMDB, Tmdb = info.ID_TMDB.ToNullableInt32() },
             Title = info.Title,
             Year = (int)info.Year
         },
         AppDate = TraktSettings.BuildDate,
         AppVersion = TraktSettings.Version,
         Progress = progress
     };
     return scrobbleData;
 }
        /// <summary>
        /// Creates Scrobble data based on a DBMovieInfo object
        /// </summary>
        private TraktScrobbleMovie CreateScrobbleData(DBMovieInfo movie)
        {
            // MovingPictures stores duration in milliseconds, g_Player reports in seconds
            double currentPosition = g_Player.CurrentPosition;
            double duration = GetMovieDuration(movie, IsDVDPlaying);

            // g_Player reports in seconds
            double progress = duration != 0.0 ? (currentPosition / duration * 100.0) : 0.0;

            var scrobbleData = new TraktScrobbleMovie
            {
                Movie = new TraktMovie
                {
                    Ids = new TraktMovieId { Imdb = movie.ImdbID.ToNullIfEmpty(), Tmdb = GetTmdbID(movie).ToNullableInt32() },
                    Title = movie.Title,
                    Year = movie.Year
                },
                Progress = Math.Round(progress, 2),
                AppVersion = TraktSettings.Version,
                AppDate = TraktSettings.BuildDate
            };

            return scrobbleData;
        }
Esempio n. 5
0
        /// <summary>
        /// Creates Scrobble data based on a MFMovie object
        /// </summary>
        /// <param name="movie">The movie to base the object on</param>
        /// <returns>The Trakt scrobble data to send</returns>
        public static TraktScrobbleMovie CreateScrobbleData(MFMovie movie)
        {
            double duration = g_Player.Duration;
            double progress = 0.0;

            // get current progress of player (in seconds) to work out percent complete
            if (duration > 0.0)
                progress = (g_Player.CurrentPosition / duration) * 100.0;

            var scrobbleData = new TraktScrobbleMovie
            {
                Movie = new TraktMovie
                {
                    Ids = new TraktMovieId { Imdb = movie.IMDBNumber.ToNullIfEmpty(), Tmdb = movie.TMDBNumber.ToNullableInt32() },
                    Title = movie.Title,
                    Year = movie.Year
                },
                Progress = Math.Round(progress, 2),
                AppVersion = TraktSettings.Version,
                AppDate = TraktSettings.BuildDate
            };

            return scrobbleData;
        }
Esempio n. 6
0
 public static TraktScrobbleResponse StopMovieScrobble(TraktScrobbleMovie movie)
 {
     var response = PostToTrakt(TraktURIs.ScrobbleStop, movie.ToJSON());
     return response.FromJSON<TraktScrobbleResponse>();
 }