Beispiel #1
0
		internal void Load(IQueryAdapter DbClient)
		{
			this.Playlists.Clear();
			DbClient.setQuery("SELECT * FROM youtube_playlists");
			DataTable table = DbClient.getTable();
			if (table != null)
			{
				foreach (DataRow dataRow in table.Rows)
				{
                    this.Playlists.Add(dataRow["playlist_id"].ToString(), new Playlist(int.Parse(dataRow["id"].ToString()), dataRow["playlist_id"].ToString(), dataRow["name"].ToString(), dataRow["description"].ToString()));
				}
			}
            if (Playlists.Count == 0)
                DefaultPlaylist = new Playlist(-1, "", "", "");
            else
                DefaultPlaylist = Playlists.Values.First();
		}
Beispiel #2
0
		internal static void GetVideosForPL(Playlist Playlist)
		{
            if (Playlist.Id == -1)
                return;

            try
            {
                XmlDocument xmlDocument = new XmlDocument();
                string filename = "http://gdata.youtube.com/feeds/api/playlists/" + Playlist.PlaylistId + "?v=2.1";
                xmlDocument.Load(filename);
                if (xmlDocument != null)
                {
                    XmlNodeList elementsByTagName = xmlDocument.GetElementsByTagName("yt:videoid");
                    foreach (XmlNode xmlNode in elementsByTagName)
                    {
                        try
                        {
                            string innerText = xmlNode.InnerText;
                            if (!Playlist.Videos.ContainsKey(innerText))
                            {
                                if (!Playlist.Videos.Keys.Contains(innerText))
                                {
                                    Playlist.Videos.Add(innerText, 720);
                                }
                            }
                        }
                        catch
                        {
                            continue;
                        }
                    }
                }
            }
            catch
            {
            }
		}
Beispiel #3
0
		internal void SetPlaylist(Playlist Playlist)
		{
            this.CustomVideo = "";
			this.CurrentOrder = 1;
			this.Playlist = Playlist;
		}