コード例 #1
0
ファイル: Wfmu.cs プロジェクト: daviddw/Kinsky
        public void Add(PodcastShow aShow)
        {
            lock (this)
            {
                foreach (PodcastShow show in iShows)
                {
                    if (show.Id == aShow.Id)
                    {
                        return;
                    }
                }

                iShows.Add(aShow);
            }

            if (EventContentAdded != null)
            {
                EventContentAdded(this, EventArgs.Empty);
            }
        }
コード例 #2
0
ファイル: Wfmu.cs プロジェクト: daviddw/Kinsky
        private void WebFileContentsChanged(object obj, EventArgs e)
        {
            bool added = false;

            string contents = iWebFile.Contents;

            while (true)
            {
                int titleStart = contents.IndexOf("<b>") + 3;

                if (titleStart < 0)
                {
                    break;
                }

                int titleEnd = contents.IndexOf("</b>", titleStart);

                if (titleEnd < 0)
                {
                    break;
                }

                string title = contents.Substring(titleStart, titleEnd - titleStart);

                if (title.StartsWith("Subscribe"))
                {
                    contents = contents.Substring(titleEnd);
                    continue;
                }

                int idStart = contents.IndexOf("/playlists/", titleEnd) + 11;

                contents = contents.Substring(idStart);

                if (contents.Length >= 2)
                {
                    string id = contents.Substring(0, 2);

                    PodcastShow s = FindShow(id);

                    if (s == null)
                    {
                        s = new PodcastShow(id, title, iAlbumArtUri, iWebFetcher);

                        added = true;

                        lock (this)
                        {
                            iShows.Add(s);
                            iMetadata.ChildCount = iShows.Count;
                        }
                    }
                }

                if (added)
                {
                    if (EventContentAdded != null)
                    {
                        EventContentAdded(this, EventArgs.Empty);
                    }
                }
            }
        }