private List <BaseItem> GetTrailerChildren()
        {
            List <BaseItem> children = new List <BaseItem>();

            var xml = Helper.Fetch(Plugin.PluginOptions.Instance.HDTrailers ? HiFiUrl : LoFiUrl);


            XmlTextReader reader = new XmlTextReader(xml.OuterXml, XmlNodeType.Document, null);

            reader.Read();

            ITunesTrailer trailer = null;

            DateTimeFormatInfo dateFormat = new DateTimeFormatInfo();

            dateFormat.ShortDatePattern = "yyyy-MM-dd";

            while (reader.Read())
            {
                if (reader.NodeType == XmlNodeType.Element)
                {
                    switch (reader.Name)
                    {
                    case "movieinfo":
                        if (trailer != null)
                        {
                            children.Add(trailer);
                        }

                        trailer = new ITunesTrailer();

                        // trailer.Id = reader.GetAttribute(0);
                        break;

                    case "title":
                        trailer.Name = ReadToValue(reader);
                        trailer.Id   = trailer.Name.GetMD5();
                        break;

                    case "runtime":
                        // trailer.RunningTime = ReadToValue(reader);
                        break;

                    case "rating":
                        trailer.MpaaRating = ReadToValue(reader);
                        break;

                    case "studio":
                        if (trailer.Studios == null)
                        {
                            trailer.Studios = new List <string>();
                        }
                        trailer.Studios.Add(Name = ReadToValue(reader));
                        break;

                    case "postdate":
                        trailer.DateCreated = DateTime.Parse(ReadToValue(reader), dateFormat);
                        break;

                    case "releasedate":
                        //  trailer.ProductionYear = DateTime.Parse(ReadToValue(reader), dateFormat).Year;
                        break;

                    case "director":
                        trailer.Directors = new List <string>()
                        {
                            ReadToValue(reader)
                        };
                        break;

                    case "description":
                        trailer.Overview = ReadToValue(reader);
                        break;

                    case "cast":
                        while (reader.Read())
                        {
                            if (reader.NodeType == XmlNodeType.EndElement &&
                                reader.Name == "cast")
                            {
                                break;
                            }

                            if (reader.Name == "name")
                            {
                                if (trailer.Actors == null)
                                {
                                    trailer.Actors = new List <Actor>();
                                }
                                trailer.Actors.Add(new Actor()
                                {
                                    Name = ReadToValue(reader)
                                });
                            }
                        }
                        break;

                    case "genre":
                        while (reader.Read())
                        {
                            if (reader.NodeType == XmlNodeType.EndElement &&
                                reader.Name == "genre")
                            {
                                break;
                            }

                            if (reader.Name == "name")
                            {
                                if (trailer.Genres == null)
                                {
                                    trailer.Genres = new List <string>();
                                }
                                trailer.Genres.Add(ReadToValue(reader));
                            }
                        }
                        break;

                    case "poster":
                        while (reader.Read())
                        {
                            if (reader.NodeType == XmlNodeType.EndElement &&
                                reader.Name == "poster")
                            {
                                break;
                            }

                            if (reader.Name == "xlarge")
                            {
                                trailer.PrimaryImagePath = ReadToValue(reader);
                            }
                        }
                        break;

                    case "preview":
                        while (reader.Read())
                        {
                            if (reader.NodeType == XmlNodeType.EndElement &&
                                reader.Name == "preview")
                            {
                                break;
                            }

                            if (reader.Name == "large")
                            {
                                trailer.Path = ReadToValue(reader).Replace("movies.apple.com", "www.apple.com");
                            }
                        }
                        break;
                    }
                }
            }


            return(children);
        }
        private List<BaseItem> GetTrailerChildren()
        {
            List<BaseItem> children = new List<BaseItem>();

            var xml = Helper.Fetch(Plugin.PluginOptions.Instance.HDTrailers ? HiFiUrl : LoFiUrl);

            XmlTextReader reader = new XmlTextReader(xml.OuterXml,XmlNodeType.Document, null);

            reader.Read();

            ITunesTrailer trailer = null;

            DateTimeFormatInfo dateFormat = new DateTimeFormatInfo();
            dateFormat.ShortDatePattern = "yyyy-MM-dd";

            while (reader.Read())
            {
                if (reader.NodeType == XmlNodeType.Element)
                {
                    switch (reader.Name)
                    {
                        case "movieinfo":
                            if (trailer != null)
                                children.Add(trailer);

                            trailer = new ITunesTrailer();

                            // trailer.Id = reader.GetAttribute(0);
                            break;

                        case "title":
                            trailer.Name = ReadToValue(reader);
                            trailer.Id = trailer.Name.GetMD5();
                            break;

                        case "runtime":
                            // trailer.RunningTime = ReadToValue(reader);
                            break;

                        case "rating":
                            trailer.MpaaRating = ReadToValue(reader);
                            break;

                        case "studio":
                            if (trailer.Studios == null)
                            {
                                trailer.Studios = new List<string>();
                            }
                            trailer.Studios.Add(Name = ReadToValue(reader));
                            break;

                        case "postdate":
                            trailer.DateCreated = DateTime.Parse(ReadToValue(reader), dateFormat);
                            break;

                        case "releasedate":
                            //  trailer.ProductionYear = DateTime.Parse(ReadToValue(reader), dateFormat).Year;
                            break;

                        case "director":
                            trailer.Directors = new List<string>() { ReadToValue(reader) };
                            break;

                        case "description":
                            trailer.Overview = ReadToValue(reader);
                            break;

                        case "cast":
                            while (reader.Read())
                            {
                                if (reader.NodeType == XmlNodeType.EndElement &&
                                    reader.Name == "cast")
                                    break;

                                if (reader.Name == "name")
                                {
                                    if (trailer.Actors == null)
                                    {
                                        trailer.Actors = new List<Actor>();
                                    }
                                    trailer.Actors.Add(new Actor() { Name = ReadToValue(reader) });
                                }
                            }
                            break;

                        case "genre":
                            while (reader.Read())
                            {
                                if (reader.NodeType == XmlNodeType.EndElement &&
                                    reader.Name == "genre")
                                    break;

                                if (reader.Name == "name")
                                {
                                    if (trailer.Genres == null)
                                    {
                                        trailer.Genres = new List<string>();
                                    }
                                    trailer.Genres.Add(ReadToValue(reader));
                                }
                            }
                            break;

                        case "poster":
                            while (reader.Read())
                            {
                                if (reader.NodeType == XmlNodeType.EndElement &&
                                    reader.Name == "poster")
                                    break;

                                if (reader.Name == "xlarge")
                                {
                                    trailer.PrimaryImagePath = ReadToValue(reader);
                                }
                            }
                            break;

                        case "preview":
                            while (reader.Read())
                            {
                                if (reader.NodeType == XmlNodeType.EndElement &&
                                    reader.Name == "preview")
                                    break;

                                if (reader.Name == "large")
                                {
                                    trailer.Path = ReadToValue(reader).Replace("movies.apple.com", "www.apple.com");
                                }
                            }
                            break;
                    }
                }
            }

            return children;
        }
        private List <BaseItem> GetTrailerChildren()
        {
            List <BaseItem> children = new List <BaseItem>();

            using (WebClient client = new WebClient()) {
                using (Stream stream = client.OpenRead(HiFiUrl)) {
                    XmlTextReader reader = new XmlTextReader(stream);

                    reader.Read();

                    ITunesTrailer trailer = null;

                    DateTimeFormatInfo dateFormat = new DateTimeFormatInfo();
                    dateFormat.ShortDatePattern = "yyyy-MM-dd";

                    while (reader.Read())
                    {
                        if (reader.NodeType == XmlNodeType.Element)
                        {
                            switch (reader.Name)
                            {
                            case "movieinfo":
                                if (trailer != null)
                                {
                                    children.Add(trailer);
                                }

                                trailer = new ITunesTrailer();

                                // trailer.Id = reader.GetAttribute(0);
                                break;

                            case "title":
                                trailer.Name = ReadToValue(reader);
                                trailer.Id   = trailer.Name.GetMD5();
                                break;

                            case "runtime":
                                // trailer.RunningTime = ReadToValue(reader);
                                break;

                            case "rating":
                                trailer.MpaaRating = ReadToValue(reader);
                                break;

                            case "studio":
                                trailer.Studios = new List <string>()
                                {
                                    ReadToValue(reader)
                                };
                                break;

                            case "postdate":
                                trailer.DateCreated = DateTime.Parse(ReadToValue(reader), dateFormat);
                                break;

                            case "releasedate":
                                //  trailer.ProductionYear = DateTime.Parse(ReadToValue(reader), dateFormat).Year;
                                break;

                            case "director":
                                trailer.Directors = new List <string>()
                                {
                                    ReadToValue(reader)
                                };
                                break;

                            case "description":
                                trailer.Overview = ReadToValue(reader);
                                break;

                            case "cast":
                                while (reader.Read())
                                {
                                    if (reader.NodeType == XmlNodeType.EndElement &&
                                        reader.Name == "cast")
                                    {
                                        break;
                                    }

                                    if (reader.Name == "name")
                                    {
                                        if (trailer.Actors == null)
                                        {
                                            trailer.Actors = new List <Actor>();
                                        }
                                        trailer.Actors.Add(new Actor()
                                        {
                                            Name = ReadToValue(reader)
                                        });
                                    }
                                }
                                break;

                            case "genre":
                                while (reader.Read())
                                {
                                    if (reader.NodeType == XmlNodeType.EndElement &&
                                        reader.Name == "genre")
                                    {
                                        break;
                                    }

                                    if (reader.Name == "name")
                                    {
                                        if (trailer.Genres == null)
                                        {
                                            trailer.Genres = new List <string>();
                                        }
                                        trailer.Genres.Add(ReadToValue(reader));
                                    }
                                }
                                break;

                            case "poster":
                                while (reader.Read())
                                {
                                    if (reader.NodeType == XmlNodeType.EndElement &&
                                        reader.Name == "poster")
                                    {
                                        break;
                                    }

                                    if (reader.Name == "xlarge")
                                    {
                                        trailer.PrimaryImagePath = ReadToValue(reader);
                                    }
                                }
                                break;

                            case "preview":
                                while (reader.Read())
                                {
                                    if (reader.NodeType == XmlNodeType.EndElement &&
                                        reader.Name == "preview")
                                    {
                                        break;
                                    }

                                    if (reader.Name == "large")
                                    {
                                        trailer.Path = ReadToValue(reader);
                                    }
                                }
                                break;
                            }
                        }
                    }
                }
            }

            return(children);
        }
        private List<BaseItem> GetTrailerChildren()
        {
            List<BaseItem> children = new List<BaseItem>();

            using (WebClient client = new WebClient()) {
                using (Stream stream = client.OpenRead(HiFiUrl)) {
                    XmlTextReader reader = new XmlTextReader(stream);

                    reader.Read();

                    ITunesTrailer trailer = null;

                    DateTimeFormatInfo dateFormat = new DateTimeFormatInfo();
                    dateFormat.ShortDatePattern = "yyyy-MM-dd";

                    while (reader.Read()) {
                        if (reader.NodeType == XmlNodeType.Element) {
                            switch (reader.Name) {
                                case "movieinfo":
                                    if (trailer != null)
                                        children.Add(trailer);

                                    trailer = new ITunesTrailer();

                                    // trailer.Id = reader.GetAttribute(0);
                                    break;

                                case "title":
                                    trailer.Name = ReadToValue(reader);
                                    trailer.Id = trailer.Name.GetMD5();
                                    break;

                                case "runtime":
                                    // trailer.RunningTime = ReadToValue(reader);
                                    break;

                                case "rating":
                                    trailer.MpaaRating = ReadToValue(reader);
                                    break;

                                case "studio":
                                    trailer.Studios = new List<string>() { ReadToValue(reader) };
                                    break;

                                case "postdate":
                                    trailer.DateCreated = DateTime.Parse(ReadToValue(reader), dateFormat);
                                    break;

                                case "releasedate":
                                    //  trailer.ProductionYear = DateTime.Parse(ReadToValue(reader), dateFormat).Year;
                                    break;

                                case "director":
                                    trailer.Directors = new List<string>() { ReadToValue(reader) };
                                    break;

                                case "description":
                                    trailer.Overview = ReadToValue(reader);
                                    break;

                                case "cast":
                                    while (reader.Read()) {
                                        if (reader.NodeType == XmlNodeType.EndElement &&
                                            reader.Name == "cast")
                                            break;

                                        if (reader.Name == "name") {
                                            if (trailer.Actors == null) {
                                                trailer.Actors = new List<Actor>();
                                            }
                                            trailer.Actors.Add(new Actor() { Name = ReadToValue(reader) });
                                        }
                                    }
                                    break;

                                case "genre":
                                    while (reader.Read()) {
                                        if (reader.NodeType == XmlNodeType.EndElement &&
                                            reader.Name == "genre")
                                            break;

                                        if (reader.Name == "name") {
                                            if (trailer.Genres == null) {
                                                trailer.Genres = new List<string>();
                                            }
                                            trailer.Genres.Add(ReadToValue(reader));
                                        }
                                    }
                                    break;

                                case "poster":
                                    while (reader.Read()) {
                                        if (reader.NodeType == XmlNodeType.EndElement &&
                                            reader.Name == "poster")
                                            break;

                                        if (reader.Name == "xlarge") {
                                            trailer.PrimaryImagePath = ReadToValue(reader);
                                        }
                                    }
                                    break;

                                case "preview":
                                    while (reader.Read()) {
                                        if (reader.NodeType == XmlNodeType.EndElement &&
                                            reader.Name == "preview")
                                            break;

                                        if (reader.Name == "large") {
                                            trailer.Path = ReadToValue(reader);
                                        }
                                    }
                                    break;
                            }
                        }
                    }
                }
            }

            return children;
        }