Exemple #1
0
        static void _RunShowDemo(int id = 2919 /*Burn Notice*/)
        {
            // fetch a show - you can use SearchShows() or if you already know the id
            // of the object you want, just create it with the given id.
            var show = new TmdbShow(id);

            //Console.WriteLine(show.Json); // write the json - for now just an id


            Console.WriteLine();

            var name     = show.Name;
            var overview = show.Overview;

            // watch how it grew after getting some properties
            Console.WriteLine(show.Json);
            Console.WriteLine();

            Console.WriteLine(name);
            Console.WriteLine(overview);
            Console.WriteLine();
            //
            // write out the genres
            Console.Write("Genres:");
            var gbid = show.GenresById;

            if (null != gbid)
            {
                foreach (var g in gbid)
                {
                    Console.Write(string.Concat(" ", g.Value));
                }
            }
            Console.WriteLine();

            Console.WriteLine();

            // write out the cast
            Console.Write("Cast:");
            foreach (var c in show.Cast)
            {
                Console.WriteLine("\t{0} as {1}", c.Name, c.Character);
            }

            Console.WriteLine();

            // write out the crew.
            Console.Write("Crew:");
            foreach (var c in from cs in show.Crew select cs)
            {
                Console.WriteLine("\t{1} - {0}", c.Name, c.Job);
            }
            Console.WriteLine();
            // Seasons zero is Specials when the series has them
            // To account for that, we look to TotalSeasons instead
            // of Seasons.Length
            Console.WriteLine(
                "{0} Seasons and {1} Episodes in {2} years",
                show.TotalSeasons,
                show.TotalEpisodes,
                Math.Round((show.LastAirDate - show.FirstAirDate).TotalDays / 365)
                );

            // write out the reviews we found, if their are any.
            // this is not cached, which is why it's a paged method
            // the individual reviews are still cached
            var reviews = show.GetReviews();

            if (0 < reviews.Length)
            {
                Console.WriteLine();
                Console.WriteLine("Reviews:");
                foreach (var r in reviews)
                {
                    Console.WriteLine("\t\"{1}\" - {0}", r.Author, r.Content);
                }
            }
            var images = show.Images;

            if (0 < images.Length)
            {
                Console.WriteLine();
                Console.WriteLine("Images:");
                foreach (var i in images)
                {
                    Console.WriteLine("{0}: {1}", i.ImageType, Tmdb.GetImageUrl(i.Path));
                }
            }
            // note how the Json data associated with the object grew even more
            // in response to use using the object.
            // Console.WriteLine(show.Json); // write the json again
        }