Exemple #1
0
        public async Task <PlexTrack[]> GetTracks(PlexAlbum artist)
        {
            var retval = new List <PlexTrack>();

            XmlDocument response = await connection.RequestXml(artist.MetadataUrl);

            XmlNode mediaContainer = response.SelectSingleNode("/MediaContainer");

            foreach (XmlNode track in mediaContainer.SelectNodes("Track"))
            {
                retval.Add(new PlexTrack(track));
            }

            return(retval.ToArray());
        }
Exemple #2
0
        internal PlexTrack(XmlNode track)
        {
            MetadataUrl    = track.Attributes["key"].InnerText;
            Title          = HttpUtility.HtmlDecode(track.Attributes["title"].InnerText);
            Thumb          = track.Attributes["thumb"] == null ? null : track.Attributes["thumb"].InnerText;
            PlaylistItemID = track.Attributes["playlistItemID"] == null ? -1 : int.Parse(track.Attributes["playlistItemID"].InnerText);
            Media          = new List <PlexMediaPart>();
            Album          = new PlexAlbum(track);
            Artist         = new PlexArtist(track);

            // parse media part
            foreach (XmlNode media in track.SelectNodes("Media/Part"))
            {
                Media.Add(new PlexMediaPart(media));
            }
        }