示例#1
0
        public async Task Test_CommentItemObjectJsonWriter_WriteObject_JsonWriter_Only_Episode_Property()
        {
            ITraktCommentItem traktCommentItem = new TraktCommentItem
            {
                Episode = new TraktEpisode
                {
                    SeasonNumber = 1,
                    Number       = 1,
                    Title        = "Winter Is Coming",
                    Ids          = new TraktEpisodeIds
                    {
                        Trakt  = 73640,
                        Tvdb   = 3254641,
                        Imdb   = "tt1480055",
                        Tmdb   = 63056,
                        TvRage = 1065008299
                    }
                }
            };

            using (var stringWriter = new StringWriter())
                using (var jsonWriter = new JsonTextWriter(stringWriter))
                {
                    var traktJsonWriter = new CommentItemObjectJsonWriter();
                    await traktJsonWriter.WriteObjectAsync(jsonWriter, traktCommentItem);

                    stringWriter.ToString().Should().Be(@"{""episode"":{""season"":1,""number"":1," +
                                                        @"""title"":""Winter Is Coming"",""ids"":{" +
                                                        @"""trakt"":73640,""tvdb"":3254641,""imdb"":""tt1480055""," +
                                                        @"""tmdb"":63056,""tvrage"":1065008299}}}");
                }
        }
示例#2
0
 public async Task Test_CommentItemObjectJsonWriter_WriteObject_StringWriter_Exceptions()
 {
     var traktJsonWriter = new CommentItemObjectJsonWriter();
     ITraktCommentItem     traktCommentItem = new TraktCommentItem();
     Func <Task <string> > action           = () => traktJsonWriter.WriteObjectAsync(default(StringWriter), traktCommentItem);
     await action.Should().ThrowAsync <ArgumentNullException>();
 }
示例#3
0
        public async Task Test_CommentItemObjectJsonWriter_WriteObject_JsonWriter_Only_Season_Property()
        {
            ITraktCommentItem traktCommentItem = new TraktCommentItem
            {
                Season = new TraktSeason
                {
                    Number = 1,
                    Ids    = new TraktSeasonIds
                    {
                        Trakt  = 61430,
                        Tvdb   = 279121,
                        Tmdb   = 60523,
                        TvRage = 36939
                    }
                }
            };

            using (var stringWriter = new StringWriter())
                using (var jsonWriter = new JsonTextWriter(stringWriter))
                {
                    var traktJsonWriter = new CommentItemObjectJsonWriter();
                    await traktJsonWriter.WriteObjectAsync(jsonWriter, traktCommentItem);

                    stringWriter.ToString().Should().Be(@"{""season"":{""number"":1,""ids"":{" +
                                                        @"""trakt"":61430,""tvdb"":279121,""tmdb"":60523,""tvrage"":36939}}}");
                }
        }
示例#4
0
        public async Task Test_CommentItemObjectJsonWriter_WriteObject_JsonWriter_Only_Movie_Property()
        {
            ITraktCommentItem traktCommentItem = new TraktCommentItem
            {
                Movie = new TraktMovie
                {
                    Title = "Star Wars: The Force Awakens",
                    Year  = 2015,
                    Ids   = new TraktMovieIds
                    {
                        Trakt = 94024,
                        Slug  = "star-wars-the-force-awakens-2015",
                        Imdb  = "tt2488496",
                        Tmdb  = 140607
                    }
                }
            };

            using (var stringWriter = new StringWriter())
                using (var jsonWriter = new JsonTextWriter(stringWriter))
                {
                    var traktJsonWriter = new CommentItemObjectJsonWriter();
                    await traktJsonWriter.WriteObjectAsync(jsonWriter, traktCommentItem);

                    stringWriter.ToString().Should().Be(@"{""movie"":{""title"":""Star Wars: The Force Awakens"",""year"":2015," +
                                                        @"""ids"":{""trakt"":94024,""slug"":""star-wars-the-force-awakens-2015""," +
                                                        @"""imdb"":""tt2488496"",""tmdb"":140607}}}");
                }
        }
        private string GetCommentItemTitle(TraktCommentItem comment)
        {
            string title = string.Empty;

            switch (comment.Type)
            {
            case "movie":
                title = comment.Movie.Title;
                break;

            case "show":
                title = comment.Show.Title;
                break;

            case "season":
                title = string.Format("{0} - {1} {2}", comment.Show.Title, Translation.Season, comment.Season.Number);
                break;

            case "episode":
                title = string.Format("{0} - {1}x{2} - {3}", comment.Show.Title, comment.Episode.Season, comment.Episode.Number, comment.Episode.Title ?? string.Format("{0} {1}", Translation.Episode, comment.Episode.Number));
                break;

            case "list":
                title = comment.List.Name;
                break;
            }

            return(title);
        }
示例#6
0
        public async Task Test_CommentItemObjectJsonWriter_WriteObject_JsonWriter_Only_Show_Property()
        {
            ITraktCommentItem traktCommentItem = new TraktCommentItem
            {
                Show = new TraktShow
                {
                    Title = "Game of Thrones",
                    Year  = 2011,
                    Ids   = new TraktShowIds
                    {
                        Trakt  = 1390,
                        Slug   = "game-of-thrones",
                        Tvdb   = 121361,
                        Imdb   = "tt0944947",
                        Tmdb   = 1399,
                        TvRage = 24493
                    }
                }
            };

            using (var stringWriter = new StringWriter())
                using (var jsonWriter = new JsonTextWriter(stringWriter))
                {
                    var traktJsonWriter = new CommentItemObjectJsonWriter();
                    await traktJsonWriter.WriteObjectAsync(jsonWriter, traktCommentItem);

                    stringWriter.ToString().Should().Be(@"{""show"":{""title"":""Game of Thrones"",""year"":2011," +
                                                        @"""ids"":{""trakt"":1390,""slug"":""game-of-thrones""," +
                                                        @"""tvdb"":121361,""imdb"":""tt0944947"",""tmdb"":1399,""tvrage"":24493}}}");
                }
        }
示例#7
0
        public void Test_CommentItemObjectJsonWriter_WriteObject_JsonWriter_Exceptions()
        {
            var traktJsonWriter = new CommentItemObjectJsonWriter();
            ITraktCommentItem traktCommentItem = new TraktCommentItem();
            Func <Task>       action           = () => traktJsonWriter.WriteObjectAsync(default(JsonTextWriter), traktCommentItem);

            action.Should().Throw <ArgumentNullException>();
        }
        private string GetCommentText(TraktCommentItem item)
        {
            if (item.Comment.IsSpoiler && TraktSettings.HideSpoilersOnShouts)
            {
                return(Translation.HiddenToPreventSpoilers);
            }

            return(item.Comment.Text);
        }
示例#9
0
        public async Task Test_CommentItemObjectJsonWriter_WriteObject_JsonWriter_Only_List_Property()
        {
            ITraktCommentItem traktCommentItem = new TraktCommentItem
            {
                List = new TraktList
                {
                    Name           = "Star Wars in machete order",
                    Description    = "Next time you want to introduce someone to Star Wars for the first time, watch the films with them in this order: IV, V, II, III, VI.",
                    Privacy        = TraktAccessScope.Public,
                    DisplayNumbers = true,
                    AllowComments  = true,
                    SortBy         = "rank",
                    SortHow        = "asc",
                    CreatedAt      = CREATED_UPDATED_AT,
                    UpdatedAt      = CREATED_UPDATED_AT,
                    ItemCount      = 5,
                    CommentCount   = 1,
                    Likes          = 2,
                    Ids            = new TraktListIds
                    {
                        Trakt = 55,
                        Slug  = "star-wars-in-machete-order"
                    },
                    User = new TraktUser
                    {
                        Username  = "******",
                        IsPrivate = false,
                        Name      = "Sean Rudford",
                        IsVIP     = true,
                        IsVIP_EP  = true,
                        Ids       = new TraktUserIds
                        {
                            Slug = "sean"
                        }
                    }
                }
            };

            using (var stringWriter = new StringWriter())
                using (var jsonWriter = new JsonTextWriter(stringWriter))
                {
                    var traktJsonWriter = new CommentItemObjectJsonWriter();
                    await traktJsonWriter.WriteObjectAsync(jsonWriter, traktCommentItem);

                    stringWriter.ToString().Should().Be(@"{""list"":{""name"":""Star Wars in machete order""," +
                                                        @"""description"":""Next time you want to introduce someone to Star Wars for the first time, watch the films with them in this order: IV, V, II, III, VI.""," +
                                                        @"""privacy"":""public"",""display_numbers"":true,""allow_comments"":true," +
                                                        @"""sort_by"":""rank"",""sort_how"":""asc""," +
                                                        $"\"created_at\":\"{CREATED_UPDATED_AT.ToTraktLongDateTimeString()}\"," +
                                                        $"\"updated_at\":\"{CREATED_UPDATED_AT.ToTraktLongDateTimeString()}\"," +
                                                        @"""item_count"":5,""comment_count"":1,""likes"":2," +
                                                        @"""ids"":{""trakt"":55,""slug"":""star-wars-in-machete-order""}," +
                                                        @"""user"":{""username"":""sean"",""private"":false," +
                                                        @"""ids"":{""slug"":""sean""},""name"":""Sean Rudford""," +
                                                        @"""vip"":true,""vip_ep"":true}}}");
                }
        }
示例#10
0
        public void Test_TraktCommentItem_Default_Constructor()
        {
            var traktCommentItem = new TraktCommentItem();

            traktCommentItem.Type.Should().BeNull();
            traktCommentItem.Movie.Should().BeNull();
            traktCommentItem.Show.Should().BeNull();
            traktCommentItem.Season.Should().BeNull();
            traktCommentItem.Episode.Should().BeNull();
            traktCommentItem.List.Should().BeNull();
        }
        public async Task Test_CommentItemObjectJsonWriter_WriteObject_StringWriter_Empty()
        {
            ITraktCommentItem traktCommentItem = new TraktCommentItem();

            using (var stringWriter = new StringWriter())
            {
                var    traktJsonWriter = new CommentItemObjectJsonWriter();
                string json            = await traktJsonWriter.WriteObjectAsync(stringWriter, traktCommentItem);

                json.Should().Be(@"{}");
            }
        }
示例#12
0
        public async Task Test_CommentItemObjectJsonWriter_WriteObject_JsonWriter_Empty()
        {
            ITraktCommentItem traktCommentItem = new TraktCommentItem();

            using (var stringWriter = new StringWriter())
                using (var jsonWriter = new JsonTextWriter(stringWriter))
                {
                    var traktJsonWriter = new CommentItemObjectJsonWriter();
                    await traktJsonWriter.WriteObjectAsync(jsonWriter, traktCommentItem);

                    stringWriter.ToString().Should().Be(@"{}");
                }
        }
        public async Task Test_CommentItemObjectJsonWriter_WriteObject_StringWriter_Only_Type_Property()
        {
            ITraktCommentItem traktCommentItem = new TraktCommentItem
            {
                Type = TraktObjectType.Movie
            };

            using (var stringWriter = new StringWriter())
            {
                var    traktJsonWriter = new CommentItemObjectJsonWriter();
                string json            = await traktJsonWriter.WriteObjectAsync(stringWriter, traktCommentItem);

                json.Should().Be(@"{""type"":""movie""}");
            }
        }
        private GUITmdbImage GetTmdbImage(TraktCommentItem comment)
        {
            var images = new GUITmdbImage();

            switch (comment.Type)
            {
            case "movie":
                images.MovieImages = new TmdbMovieImages {
                    Id = comment.Movie.Ids.Tmdb
                };
                break;

            case "show":
                images.ShowImages = new TmdbShowImages {
                    Id = comment.Show.Ids.Tmdb
                };
                break;

            case "season":
                images.ShowImages = new TmdbShowImages {
                    Id = comment.Show.Ids.Tmdb
                };
                images.SeasonImages = new TmdbSeasonImages
                {
                    Id     = comment.Show.Ids.Tmdb,
                    Season = comment.Season.Number
                };
                break;

            case "episode":
                images.ShowImages = new TmdbShowImages {
                    Id = comment.Show.Ids.Tmdb
                };
                images.SeasonImages = new TmdbSeasonImages
                {
                    Id     = comment.Show.Ids.Tmdb,
                    Season = comment.Episode.Season
                };
                break;

            case "list":
                break;
            }

            return(images);
        }
        private void PublishCommentSkinProperties(TraktCommentItem item)
        {
            if (item == null || item.Comment == null)
            {
                return;
            }

            // set shout/review properties
            GUICommon.SetCommentProperties(item.Comment, item.IsWatched());

            // set user properties
            GUICommon.SetUserProperties(item.Comment.User);

            // set movie, show, season, episode or list properties
            // set show and episode properties for episode comments
            // set show and season for season comments
            if (item.Movie != null)
            {
                GUICommon.SetMovieProperties(item.Movie);
            }
            else if (item.Show != null)
            {
                GUICommon.SetShowProperties(item.Show);
                if (item.Season != null)
                {
                    GUICommon.SetSeasonProperties(item.Show, item.Season);
                }
                if (item.Episode != null)
                {
                    GUICommon.SetEpisodeProperties(item.Show, item.Episode);
                }
            }
            else if (item.List != null)
            {
                GUICommon.SetListProperties(item.List, CurrentUser);
            }
        }
        private List<GUIListItem> GetContextMenuItemsForComment(TraktCommentItem commentItem)
        {
            GUIListItem listItem = null;
            var listItems = new List<GUIListItem>();

            // Add Watchlist
            if (!commentItem.IsWatchlisted())
            {
                listItem = new GUIListItem(Translation.AddToWatchList);
                listItem.ItemId = (int)ActivityContextMenuItem.AddToWatchList;
                listItems.Add(listItem);
            }
            else if (commentItem.Type != ActivityType.list.ToString())
            {
                listItem = new GUIListItem(Translation.RemoveFromWatchList);
                listItem.ItemId = (int)ActivityContextMenuItem.RemoveFromWatchList;
                listItems.Add(listItem);
            }

            // Mark As Watched
            if (commentItem.Type == ActivityType.episode.ToString() || commentItem.Type == ActivityType.movie.ToString())
            {
                if (!commentItem.IsWatched())
                {
                    listItem = new GUIListItem(Translation.MarkAsWatched);
                    listItem.ItemId = (int)ActivityContextMenuItem.MarkAsWatched;
                    listItems.Add(listItem);
                }
                else
                {
                    listItem = new GUIListItem(Translation.MarkAsUnWatched);
                    listItem.ItemId = (int)ActivityContextMenuItem.MarkAsUnwatched;
                    listItems.Add(listItem);
                }
            }

            // Add To Collection
            if (commentItem.Type == ActivityType.episode.ToString() || commentItem.Type == ActivityType.movie.ToString())
            {
                if (!commentItem.IsCollected())
                {
                    listItem = new GUIListItem(Translation.AddToLibrary);
                    listItem.ItemId = (int)ActivityContextMenuItem.AddToCollection;
                    listItems.Add(listItem);
                }
                else
                {
                    listItem = new GUIListItem(Translation.RemoveFromLibrary);
                    listItem.ItemId = (int)ActivityContextMenuItem.RemoveFromCollection;
                    listItems.Add(listItem);
                }
            }

            // Add to Custom list
            listItem = new GUIListItem(Translation.AddToList);
            listItem.ItemId = (int)ActivityContextMenuItem.AddToList;
            listItems.Add(listItem);

            // Shouts
            listItem = new GUIListItem(Translation.Comments);
            listItem.ItemId = (int)ActivityContextMenuItem.Shouts;
            listItems.Add(listItem);

            // Rate
            listItem = new GUIListItem(Translation.Rate + "...");
            listItem.ItemId = (int)ActivityContextMenuItem.Rate;
            listItems.Add(listItem);

            // Cast and Crew
            if (commentItem.Type == ActivityType.show.ToString() || commentItem.Type == ActivityType.movie.ToString())
            {
                listItem = new GUIListItem(Translation.Cast);
                listItem.ItemId = (int)ActivityContextMenuItem.Cast;
                listItems.Add(listItem);

                listItem = new GUIListItem(Translation.Crew);
                listItem.ItemId = (int)ActivityContextMenuItem.Crew;
                listItems.Add(listItem);
            }

            // Trailers
            if (TraktHelper.IsTrailersAvailableAndEnabled)
            {
                listItem = new GUIListItem(Translation.Trailers);
                listItem.ItemId = (int)ActivityContextMenuItem.Trailers;
                listItems.Add(listItem);
            }

            return listItems;
        }
        private List <GUIListItem> GetContextMenuItemsForComment(TraktCommentItem commentItem)
        {
            GUIListItem listItem  = null;
            var         listItems = new List <GUIListItem>();

            // Add Watchlist
            if (!commentItem.IsWatchlisted())
            {
                listItem        = new GUIListItem(Translation.AddToWatchList);
                listItem.ItemId = (int)ActivityContextMenuItem.AddToWatchList;
                listItems.Add(listItem);
            }
            else if (commentItem.Type != ActivityType.list.ToString())
            {
                listItem        = new GUIListItem(Translation.RemoveFromWatchList);
                listItem.ItemId = (int)ActivityContextMenuItem.RemoveFromWatchList;
                listItems.Add(listItem);
            }

            // Mark As Watched
            if (commentItem.Type == ActivityType.episode.ToString() || commentItem.Type == ActivityType.movie.ToString())
            {
                if (!commentItem.IsWatched())
                {
                    listItem        = new GUIListItem(Translation.MarkAsWatched);
                    listItem.ItemId = (int)ActivityContextMenuItem.MarkAsWatched;
                    listItems.Add(listItem);
                }
                else
                {
                    listItem        = new GUIListItem(Translation.MarkAsUnWatched);
                    listItem.ItemId = (int)ActivityContextMenuItem.MarkAsUnwatched;
                    listItems.Add(listItem);
                }
            }

            // Add To Collection
            if (commentItem.Type == ActivityType.episode.ToString() || commentItem.Type == ActivityType.movie.ToString())
            {
                if (!commentItem.IsCollected())
                {
                    listItem        = new GUIListItem(Translation.AddToLibrary);
                    listItem.ItemId = (int)ActivityContextMenuItem.AddToCollection;
                    listItems.Add(listItem);
                }
                else
                {
                    listItem        = new GUIListItem(Translation.RemoveFromLibrary);
                    listItem.ItemId = (int)ActivityContextMenuItem.RemoveFromCollection;
                    listItems.Add(listItem);
                }
            }

            // Add to Custom list
            listItem        = new GUIListItem(Translation.AddToList);
            listItem.ItemId = (int)ActivityContextMenuItem.AddToList;
            listItems.Add(listItem);

            // Shouts
            listItem        = new GUIListItem(Translation.Comments);
            listItem.ItemId = (int)ActivityContextMenuItem.Shouts;
            listItems.Add(listItem);

            // Rate
            listItem        = new GUIListItem(Translation.Rate + "...");
            listItem.ItemId = (int)ActivityContextMenuItem.Rate;
            listItems.Add(listItem);

            // Cast and Crew
            if (commentItem.Type == ActivityType.show.ToString() || commentItem.Type == ActivityType.movie.ToString())
            {
                listItem        = new GUIListItem(Translation.Cast);
                listItem.ItemId = (int)ActivityContextMenuItem.Cast;
                listItems.Add(listItem);

                listItem        = new GUIListItem(Translation.Crew);
                listItem.ItemId = (int)ActivityContextMenuItem.Crew;
                listItems.Add(listItem);
            }

            // Trailers
            if (TraktHelper.IsTrailersAvailableAndEnabled)
            {
                listItem        = new GUIListItem(Translation.Trailers);
                listItem.ItemId = (int)ActivityContextMenuItem.Trailers;
                listItems.Add(listItem);
            }

            return(listItems);
        }
        private GUITmdbImage GetTmdbImage(TraktCommentItem comment)
        {
            var images = new GUITmdbImage();

            switch (comment.Type)
            {
                case "movie":
                    images.MovieImages = new TmdbMovieImages { Id = comment.Movie.Ids.Tmdb };
                    break;

                case "show":
                    images.ShowImages = new TmdbShowImages { Id = comment.Show.Ids.Tmdb };
                    break;
                case "season":
                    images.ShowImages = new TmdbShowImages { Id = comment.Show.Ids.Tmdb };
                    images.SeasonImages = new TmdbSeasonImages
                    {
                        Id = comment.Show.Ids.Tmdb,
                        Season = comment.Season.Number
                    };
                    break;
                case "episode":
                    images.ShowImages = new TmdbShowImages { Id = comment.Show.Ids.Tmdb };
                    images.SeasonImages = new TmdbSeasonImages
                    {
                        Id = comment.Show.Ids.Tmdb,
                        Season = comment.Episode.Season
                    };
                    break;
                case "list":
                    break;
            }

            return images;
        }
        private void PublishCommentSkinProperties(TraktCommentItem item)
        {
            if (item == null || item.Comment == null)
                return;

            // set shout/review properties
            GUICommon.SetCommentProperties(item.Comment, item.IsWatched());

            // set user properties
            GUICommon.SetUserProperties(item.Comment.User);

            // set movie, show, season, episode or list properties
            // set show and episode properties for episode comments
            // set show and season for season comments
            if (item.Movie != null)
            {
                GUICommon.SetMovieProperties(item.Movie);
            }
            else if (item.Show != null)
            {
                GUICommon.SetShowProperties(item.Show);
                if (item.Season != null)
                    GUICommon.SetSeasonProperties(item.Show, item.Season);
                if (item.Episode != null)
                    GUICommon.SetEpisodeProperties(item.Show, item.Episode);
            }
            else if (item.List != null)
            {
                GUICommon.SetListProperties(item.List, CurrentUser);
            }
        }
示例#20
0
        public async Task Test_CommentItemObjectJsonWriter_WriteObject_JsonWriter_Complete()
        {
            ITraktCommentItem traktCommentItem = new TraktCommentItem
            {
                Type  = TraktObjectType.Movie,
                Movie = new TraktMovie
                {
                    Title = "Star Wars: The Force Awakens",
                    Year  = 2015,
                    Ids   = new TraktMovieIds
                    {
                        Trakt = 94024,
                        Slug  = "star-wars-the-force-awakens-2015",
                        Imdb  = "tt2488496",
                        Tmdb  = 140607
                    }
                },
                Show = new TraktShow
                {
                    Title = "Game of Thrones",
                    Year  = 2011,
                    Ids   = new TraktShowIds
                    {
                        Trakt  = 1390,
                        Slug   = "game-of-thrones",
                        Tvdb   = 121361,
                        Imdb   = "tt0944947",
                        Tmdb   = 1399,
                        TvRage = 24493
                    }
                },
                Season = new TraktSeason
                {
                    Number = 1,
                    Ids    = new TraktSeasonIds
                    {
                        Trakt  = 61430,
                        Tvdb   = 279121,
                        Tmdb   = 60523,
                        TvRage = 36939
                    }
                },
                Episode = new TraktEpisode
                {
                    SeasonNumber = 1,
                    Number       = 1,
                    Title        = "Winter Is Coming",
                    Ids          = new TraktEpisodeIds
                    {
                        Trakt  = 73640,
                        Tvdb   = 3254641,
                        Imdb   = "tt1480055",
                        Tmdb   = 63056,
                        TvRage = 1065008299
                    }
                },
                List = new TraktList
                {
                    Name           = "Star Wars in machete order",
                    Description    = "Next time you want to introduce someone to Star Wars for the first time, watch the films with them in this order: IV, V, II, III, VI.",
                    Privacy        = TraktAccessScope.Public,
                    DisplayNumbers = true,
                    AllowComments  = true,
                    SortBy         = "rank",
                    SortHow        = "asc",
                    CreatedAt      = CREATED_UPDATED_AT,
                    UpdatedAt      = CREATED_UPDATED_AT,
                    ItemCount      = 5,
                    CommentCount   = 1,
                    Likes          = 2,
                    Ids            = new TraktListIds
                    {
                        Trakt = 55,
                        Slug  = "star-wars-in-machete-order"
                    },
                    User = new TraktUser
                    {
                        Username  = "******",
                        IsPrivate = false,
                        Name      = "Sean Rudford",
                        IsVIP     = true,
                        IsVIP_EP  = true,
                        Ids       = new TraktUserIds
                        {
                            Slug = "sean"
                        }
                    }
                }
            };

            using (var stringWriter = new StringWriter())
                using (var jsonWriter = new JsonTextWriter(stringWriter))
                {
                    var traktJsonWriter = new CommentItemObjectJsonWriter();
                    await traktJsonWriter.WriteObjectAsync(jsonWriter, traktCommentItem);

                    stringWriter.ToString().Should().Be(@"{""type"":""movie""," +
                                                        @"""movie"":{""title"":""Star Wars: The Force Awakens"",""year"":2015," +
                                                        @"""ids"":{""trakt"":94024,""slug"":""star-wars-the-force-awakens-2015""," +
                                                        @"""imdb"":""tt2488496"",""tmdb"":140607}}," +
                                                        @"""show"":{""title"":""Game of Thrones"",""year"":2011," +
                                                        @"""ids"":{""trakt"":1390,""slug"":""game-of-thrones""," +
                                                        @"""tvdb"":121361,""imdb"":""tt0944947"",""tmdb"":1399,""tvrage"":24493}}," +
                                                        @"""season"":{""number"":1,""ids"":{" +
                                                        @"""trakt"":61430,""tvdb"":279121,""tmdb"":60523,""tvrage"":36939}}," +
                                                        @"""episode"":{""season"":1,""number"":1," +
                                                        @"""title"":""Winter Is Coming"",""ids"":{" +
                                                        @"""trakt"":73640,""tvdb"":3254641,""imdb"":""tt1480055""," +
                                                        @"""tmdb"":63056,""tvrage"":1065008299}}," +
                                                        @"""list"":{""name"":""Star Wars in machete order""," +
                                                        @"""description"":""Next time you want to introduce someone to Star Wars for the first time, watch the films with them in this order: IV, V, II, III, VI.""," +
                                                        @"""privacy"":""public"",""display_numbers"":true,""allow_comments"":true," +
                                                        @"""sort_by"":""rank"",""sort_how"":""asc""," +
                                                        $"\"created_at\":\"{CREATED_UPDATED_AT.ToTraktLongDateTimeString()}\"," +
                                                        $"\"updated_at\":\"{CREATED_UPDATED_AT.ToTraktLongDateTimeString()}\"," +
                                                        @"""item_count"":5,""comment_count"":1,""likes"":2," +
                                                        @"""ids"":{""trakt"":55,""slug"":""star-wars-in-machete-order""}," +
                                                        @"""user"":{""username"":""sean"",""private"":false," +
                                                        @"""ids"":{""slug"":""sean""},""name"":""Sean Rudford""," +
                                                        @"""vip"":true,""vip_ep"":true}}}");
                }
        }
        private string GetCommentText(TraktCommentItem item)
        {
            if (item.Comment.IsSpoiler && TraktSettings.HideSpoilersOnShouts)
                return Translation.HiddenToPreventSpoilers;

            return item.Comment.Text;
        }
        public override async Task <ITraktCommentItem> ReadObjectAsync(JsonTextReader jsonReader, CancellationToken cancellationToken = default)
        {
            CheckJsonTextReader(jsonReader);

            if (await jsonReader.ReadAsync(cancellationToken) && jsonReader.TokenType == JsonToken.StartObject)
            {
                ITraktCommentItem traktCommentItem = new TraktCommentItem();
                var movieObjectJsonReader          = new MovieObjectJsonReader();
                var showObjectJsonReader           = new ShowObjectJsonReader();
                var seasonObjectJsonReader         = new SeasonObjectJsonReader();
                var episodeObjectJsonReader        = new EpisodeObjectJsonReader();
                var listObjectJsonReader           = new ListObjectJsonReader();

                while (await jsonReader.ReadAsync(cancellationToken) && jsonReader.TokenType == JsonToken.PropertyName)
                {
                    var propertyName = jsonReader.Value.ToString();

                    switch (propertyName)
                    {
                    case JsonProperties.PROPERTY_NAME_TYPE:
                        traktCommentItem.Type = await JsonReaderHelper.ReadEnumerationValueAsync <TraktObjectType>(jsonReader, cancellationToken);

                        break;

                    case JsonProperties.PROPERTY_NAME_MOVIE:
                        traktCommentItem.Movie = await movieObjectJsonReader.ReadObjectAsync(jsonReader, cancellationToken).ConfigureAwait(false);

                        break;

                    case JsonProperties.PROPERTY_NAME_SHOW:
                        traktCommentItem.Show = await showObjectJsonReader.ReadObjectAsync(jsonReader, cancellationToken).ConfigureAwait(false);

                        break;

                    case JsonProperties.PROPERTY_NAME_SEASON:
                        traktCommentItem.Season = await seasonObjectJsonReader.ReadObjectAsync(jsonReader, cancellationToken).ConfigureAwait(false);

                        break;

                    case JsonProperties.PROPERTY_NAME_EPISODE:
                        traktCommentItem.Episode = await episodeObjectJsonReader.ReadObjectAsync(jsonReader, cancellationToken).ConfigureAwait(false);

                        break;

                    case JsonProperties.PROPERTY_NAME_LIST:
                        traktCommentItem.List = await listObjectJsonReader.ReadObjectAsync(jsonReader, cancellationToken).ConfigureAwait(false);

                        break;

                    default:
                        await JsonReaderHelper.ReadAndIgnoreInvalidContentAsync(jsonReader, cancellationToken);

                        break;
                    }
                }

                return(traktCommentItem);
            }

            return(await Task.FromResult(default(ITraktCommentItem)));
        }
        private string GetCommentItemTitle(TraktCommentItem comment)
        {
            string title = string.Empty;

            switch (comment.Type)
            {
                case "movie":
                    title = comment.Movie.Title;
                    break;

                case "show":
                    title = comment.Show.Title;
                    break;

                case "season":
                    title = string.Format("{0} - {1} {2}", comment.Show.Title, Translation.Season, comment.Season.Number);
                    break;

                case "episode":
                    title = string.Format("{0} - {1}x{2} - {3}", comment.Show.Title, comment.Episode.Season, comment.Episode.Number, comment.Episode.Title ?? string.Format("{0} {1}", Translation.Episode, comment.Episode.Number));
                    break;

                case "list":
                    title = comment.List.Name;
                    break;
            }

            return title;
        }