Пример #1
0
        public static void RateSeries(DBSeries series)
        {
            if (string.IsNullOrEmpty(TraktAPI.Username) || string.IsNullOrEmpty(TraktAPI.Password))
            {
                return;
            }

            new Thread(delegate()
            {
                TraktRateValue loveorhate = series[DBOnlineSeries.cMyRating] >= 7.0 ? TraktRateValue.love : TraktRateValue.hate;

                TraktRateSeries seriesData = new TraktRateSeries()
                {
                    Rating   = loveorhate.ToString(),
                    SeriesID = series[DBOnlineSeries.cID],
                    Year     = series.Year,
                    Title    = series[DBOnlineSeries.cOriginalName],
                    UserName = TraktAPI.Username,
                    Password = TraktAPI.Password,
                };

                TraktRateResponse response = TraktAPI.RateSeries(seriesData);

                // check for any error and notify
                CheckTraktErrorAndNotify(response, false);
            })
            {
                IsBackground = true,
                Name         = "Trakt Rate Series"
            }.Start();
        }
Пример #2
0
        public static void RateEpisode(DBEpisode episode)
        {
            if (string.IsNullOrEmpty(TraktAPI.Username) || string.IsNullOrEmpty(TraktAPI.Password))
            {
                return;
            }

            new Thread(delegate()
            {
                DBSeries series = Helper.getCorrespondingSeries(episode[DBOnlineEpisode.cSeriesID]);

                TraktRateValue loveorhate = episode[DBOnlineEpisode.cMyRating] >= 7.0 ? TraktRateValue.love : TraktRateValue.hate;

                TraktRateEpisode episodeData = new TraktRateEpisode()
                {
                    Episode  = episode[DBOnlineEpisode.cEpisodeIndex],
                    Rating   = loveorhate.ToString(),
                    Season   = episode[DBOnlineEpisode.cSeasonIndex],
                    SeriesID = episode[DBOnlineEpisode.cSeriesID],
                    Year     = series.Year,
                    Title    = series[DBOnlineSeries.cOriginalName],
                    UserName = TraktAPI.Username,
                    Password = TraktAPI.Password
                };

                TraktRateResponse response = TraktAPI.RateEpisode(episodeData);

                // check for any error and notify
                CheckTraktErrorAndNotify(response, false);
            })
            {
                IsBackground = true,
                Name         = "Trakt Rate Episode"
            }.Start();
        }