コード例 #1
0
        private void RemoveItemFromLibrary(TraktUserListItem item)
        {
            Thread syncThread = new Thread(delegate(object obj)
            {
                if (SelectedType == TraktItemType.movie)
                    TraktAPI.TraktAPI.SyncMovieLibrary(CreateMovieSyncData((obj as TraktUserListItem).Movie), TraktSyncModes.unlibrary);
                else
                    TraktAPI.TraktAPI.SyncEpisodeLibrary(CreateEpisodeSyncData(obj as TraktUserListItem), TraktSyncModes.unlibrary);
            })
            {
                IsBackground = true,
                Name = "Remove Item From Library"
            };

            syncThread.Start(item);
        }
コード例 #2
0
 private void PublishShowSkinProperties(TraktUserListItem item)
 {
     if (item == null || item.Show == null) return;
     GUICommon.SetShowProperties(item.Show);
 }
コード例 #3
0
 private void RateItem(TraktUserListItem item)
 {
     if (SelectedType == TraktItemType.movie)
     {
         GUICommon.RateMovie(item.Movie);
     }
     else if (SelectedType == TraktItemType.show)
     {
         GUICommon.RateShow(item.Show);
     }
     else if (SelectedType == TraktItemType.episode)
     {
         GUICommon.RateEpisode(item.Show, item.Episode);
     }
 }
コード例 #4
0
 private void PublishMovieSkinProperties(TraktUserListItem item)
 {
     if (item == null || item.Movie == null) return;
     GUICommon.SetMovieProperties(item.Movie);
 }
コード例 #5
0
 private void PublishSeasonSkinProperties(TraktUserListItem item)
 {
     if (item == null) return;
     GUICommon.SetProperty("#Trakt.Season.Number", item.SeasonNumber);
     PublishShowSkinProperties(item);
 }
コード例 #6
0
        private void PublishEpisodeSkinProperties(TraktUserListItem item)
        {
            if (item == null || item.Episode == null) return;
            GUICommon.SetEpisodeProperties(item.Episode);

            // workaround API not having episode number set
            // can be removed later when fixed
            GUICommon.SetProperty("#Trakt.Episode.Number", item.EpisodeNumber);

            PublishSeasonSkinProperties(item);
        }
コード例 #7
0
        private void MarkItemAsWatched(TraktUserListItem item)
        {
            Thread syncThread = new Thread(delegate(object obj)
            {
                if (SelectedType == TraktItemType.movie)
                    TraktAPI.TraktAPI.SyncMovieLibrary(CreateMovieSyncData((obj as TraktUserListItem).Movie), TraktSyncModes.seen);
                else
                    TraktAPI.TraktAPI.SyncEpisodeLibrary(CreateEpisodeSyncData(obj as TraktUserListItem), TraktSyncModes.seen);
            })
            {
                IsBackground = true,
                Name = "Mark Item as Watched"
            };

            syncThread.Start(item);
        }
コード例 #8
0
        private TraktEpisodeSync CreateEpisodeSyncData(TraktUserListItem item)
        {
            if (item == null) return null;

            TraktEpisodeSync.Episode syncEpisode = new TraktEpisodeSync.Episode
            {
                EpisodeIndex = item.EpisodeNumber.ToString(),
                SeasonIndex = item.SeasonNumber.ToString()
            };

            TraktEpisodeSync syncData = new TraktEpisodeSync
            {
                UserName = TraktSettings.Username,
                Password = TraktSettings.Password,
                SeriesID = item.Show.Tvdb,
                Title = item.Show.Title,
                Year = item.Year,
                EpisodeList = new List<TraktEpisodeSync.Episode> { syncEpisode }
            };

            return syncData;
        }
コード例 #9
0
        private void AddItemToWatchList(TraktUserListItem item)
        {
            Thread syncThread = new Thread(delegate(object obj)
            {
                if (SelectedType == TraktItemType.movie)
                    TraktAPI.TraktAPI.SyncMovieLibrary(CreateMovieSyncData((obj as TraktUserListItem).Movie), TraktSyncModes.watchlist);
                else if (SelectedType == TraktItemType.show)
                    TraktAPI.TraktAPI.SyncShowWatchList(CreateShowSyncData((obj as TraktUserListItem).Show), TraktSyncModes.watchlist);
                else
                    TraktAPI.TraktAPI.SyncEpisodeLibrary(CreateEpisodeSyncData(obj as TraktUserListItem), TraktSyncModes.watchlist);
            })
            {
                IsBackground = true,
                Name = "Adding Item to Watch List"
            };

            syncThread.Start(item);
        }
コード例 #10
0
        private void ShowTrailersMenu(TraktUserListItem item)
        {
            IDialogbox dlg = (IDialogbox)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);
            dlg.Reset();
            dlg.SetHeading(Translation.Trailer);

            foreach (TrailerSite site in Enum.GetValues(typeof(TrailerSite)))
            {
                string menuItem = Enum.GetName(typeof(TrailerSite), site);
                if (SelectedType != TraktItemType.movie && menuItem == "iTunes") continue;
                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 Trailers";
                        if (!string.IsNullOrEmpty(item.ImdbId))
                            // Exact search
                            searchParam = item.ImdbId;
                        else
                            searchParam = item.Title;
                        break;

                    case ("iTunes"):
                        siteUtil = "iTunes Movie Trailers";
                        searchParam = item.Movie.Title;
                        break;

                    case ("YouTube"):
                        siteUtil = "YouTube";
                        searchParam = item.Title;
                        break;
                }

                string loadingParam = string.Format("site:{0}|search:{1}|return:Locked", siteUtil, searchParam);
                // Launch OnlineVideos Trailer search
                GUIWindowManager.ActivateWindow((int)ExternalPluginWindows.OnlineVideos, loadingParam);
            }
        }