예제 #1
0
        private static void addItemFromSearchHitToList(List<Item> items, Match x)
        {
            String link = x.Groups["link"].Value;
            String type = x.Groups["type"].Value;
            String title = string.Format("{0}", x.Groups[3].Value);
            String description = x.Groups["desc"].Value;

            String id = link.Substring(x.Groups["link"].Value.LastIndexOf("/", x.Groups["link"].Value.Length) + 1);

            if (type.Equals("Videoindeks") || type.Equals("Audioindeks"))
            {
                Clip c = CreateIndexClip(id, title, x);
                items.Add(c);
            }
            else if (type.Equals("Video") || type.Equals("Audio"))
            {
                Clip c = CreateClip(id, title, x);
                items.Add(c);
            }
            else if (type.Equals("Program"))
            {
                Program p = new Program(id, title, description, "");
                items.Add(p);
            }
            else if (type.Equals("Folder"))
            {
                Folder f = new Folder(id, title);
                f.Description = x.Groups[4].Value;
                items.Add(f);
            }
            else
            {
                Console.WriteLine("feil: " + type);
                //Log.Error(NrkParserConstants.PLUGIN_NAME + ": unsupported type: " + x.Groups[2].Value);
            }
        }
예제 #2
0
 public IList<Item> GetFolders(Folder folder)
 {
     return GetFolders(int.Parse(folder.ID));
 }
예제 #3
0
        public IList<Item> GetClips(Folder folder)
        {
            string data = FetchUrl(FOLDER_URL + folder.ID);

            List<Item> clips = new List<Item>();

            Regex query =
                new Regex("<a href=\"/nett-tv/klipp/(.*?)\"\\s+title=\"(.*?)\"\\s+class=\"(.*?)\".*?>(.*?)</a>");
            MatchCollection matches = query.Matches(data);
            foreach (Match x in matches)
            {
                clips.Add(new Clip(x.Groups[1].Value, x.Groups[4].Value));
            }

            return clips;
        }