Example #1
0
        public List<itemVO> createFeed(string url)
        {
            using (XmlReader reader = XmlReader.Create(url)) //If null måste fixas, blir fel vid tomt eller felaktigt fält
            {
                var i = 0;
                SyndicationFeed feed = SyndicationFeed.Load(reader);
                //Console.WriteLine(feed.Title.Text);
                //Console.WriteLine(feed.Links[0].Uri);

                foreach (SyndicationItem item in feed.Items)
                {
                    itemVO singlePod = new itemVO();
                    singlePod.feedName = item.Title.Text;
                    singlePod.id = i;

                    foreach (var link in item.Links)
                    {
                        singlePod.url = link.Uri.ToString();
                        Console.WriteLine(singlePod.url);
                    }

                    podList.Add(singlePod);
                    Console.WriteLine(podList[i].feedName + " " + podList[i].id);
                    i++;
                    /* foreach (var link in item.Links) {
                         Console.WriteLine(link.Uri);
                     }*/
                }
                Console.WriteLine(podList.Count);
                return podList;

            }
        }
Example #2
0
        public List<itemVO> createFeed(string url)
        {
            podList.Clear();
            if (Validate.validate.useInternal(url) && Validate.validate.checkEmpty(url))
            {
                try
                {
                    using (XmlReader reader = XmlReader.Create(url)) //If null måste fixas, blir fel vid tomt eller felaktigt fält
                    {
                        var i = 0;
                        SyndicationFeed feed = SyndicationFeed.Load(reader);

                        foreach (SyndicationItem item in feed.Items)
                        {
                            itemVO singlePod = new itemVO();
                            singlePod.feedName = item.Title.Text;
                            singlePod.id = i;

                            foreach (var link in item.Links)
                            {
                                singlePod.url = link.Uri.ToString();
                            }
                            podList.Add(singlePod);
                            i++;

                        }
                    }
            }
                catch (Exception e)
                {
                    var checkProblem = e.Message;
                    Console.WriteLine(checkProblem);
                }
            }

            return podList;
        }
Example #3
0
        public void getURLandDownload(string podName)
        {
            try
            {
                itemVO dest = new itemVO();
                //string url = dest.downloadUrl;
                //string podName = dest.downloadPodName;
                //string file = dest.downloadFilename;
                WebClient client = new WebClient();
                client.DownloadProgressChanged += new DownloadProgressChangedEventHandler(progressChanged);

                Console.WriteLine("Downloading...");
                client.DownloadFileAsync(new Uri(podName), "160.mp3");
                Console.WriteLine("Done!");

                //client.DownloadFile(podName, "192.mp3");

            }

            catch (Exception e) {
                var skrivutfel = e.Message;
                Console.WriteLine(skrivutfel);
            }
        }