public override List<SearchResultItem> Search(string query, string category = null) { if (category == NrkBrowserConstants.MENU_ITEM_ID_NRKBETA) { NrkBetaXmlParser parser = new NrkBetaXmlParser(); parser.SearchFor(query); return VideosFromItems(parser.getClips()).ConvertAll<SearchResultItem>(v => v as SearchResultItem); } else { currentSearchResultsPage = 0; currentSearchString = query; return Search().ConvertAll<SearchResultItem>(v => v as SearchResultItem); } }
public override List<VideoInfo> GetVideos(Category category) { IList<Item> items = null; string id = ((RssLink)category).Url; if (id == NrkBrowserConstants.MENU_ITEM_ID_LIVE) { items = nrkParser.GetDirektePage(); } else if (id == NrkBrowserConstants.MENU_ITEM_ID_LIVE_ALTERNATE) { items = new List<Item>(); items.Add(new Stream(NrkParserConstants.STREAM_PREFIX + "03" + liveStreamUrlSuffix, NrkBrowserConstants.MENU_ITEM_LIVE_ALTERNATE_NRK1)); items.Add(new Stream(NrkParserConstants.STREAM_PREFIX + "04" + liveStreamUrlSuffix, NrkBrowserConstants.MENU_ITEM_LIVE_ALTERNATE_NRK2)); items.Add(new Stream(NrkParserConstants.STREAM_PREFIX + "05" + liveStreamUrlSuffix, NrkBrowserConstants.MENU_ITEM_LIVE_ALTERNATE_3)); items.Add(new Stream(NrkParserConstants.STREAM_PREFIX + "08" + liveStreamUrlSuffix, NrkBrowserConstants.MENU_ITEM_LIVE_ALTERNATE_4)); } else if (id == NrkBrowserConstants.MENU_ITEM_ID_CHOOSE_STREAM_MANUALLY) { items = new List<Item>(); for (int i = 0; i < 10; i++) { items.Add(new Stream(NrkParserConstants.STREAM_PREFIX + i.ToString("D2") + liveStreamUrlSuffix, "Strøm " + i)); } } else if (id == NrkBrowserConstants.MENU_ITEM_ID_LATEST_CLIPS) { items = nrkParser.GetSistePaaForsiden(); } else if (id == NrkBrowserConstants.MENU_ITEM_ID_RECOMMENDED_PROGRAMS) { items = nrkParser.getAnbefalte(); } else if (id == NrkBrowserConstants.MENU_ITEM_ID_MEST_SETTE_UKE) { items = nrkParser.GetMestSette(7); foreach (Item i in items) i.Description = String.Format(NrkTranslatableStrings.DESCRIPTION_CLIP_SHOWN_TIMES, i.Description); } else if (id == NrkBrowserConstants.MENU_ITEM_ID_MEST_SETTE_MAANED) { items = nrkParser.GetMestSette(31); foreach (Item i in items) i.Description = String.Format(NrkTranslatableStrings.DESCRIPTION_CLIP_SHOWN_TIMES, i.Description); } else if (id == NrkBrowserConstants.MENU_ITEM_ID_MEST_SETTE_TOTALT) { items = nrkParser.GetMestSette(3650); foreach (Item i in items) i.Description = String.Format(NrkTranslatableStrings.DESCRIPTION_CLIP_SHOWN_TIMES, i.Description); } else if (id == NrkBrowserConstants.MENU_ITEM_ID_NRKBETA_SISTE_KLIPP) { items = new NrkBetaXmlParser().FindLatestClips().getClips(); } else if (id == NrkBrowserConstants.MENU_ITEM_ID_NRKBETA_TVSERIER || id == NrkBrowserConstants.MENU_ITEM_ID_NRKBETA_FRA_TV) { NrkBetaXmlParser nrkBetaParser = new NrkBetaXmlParser(NrkParserConstants.NRK_BETA_FEEDS_KATEGORI_URL, NrkParserConstants.NRK_BETA_SECTION_FRA_TV); items = nrkBetaParser.getClips(); } else if (id == NrkBrowserConstants.MENU_ITEM_ID_NRKBETA_DIVERSE) { NrkBetaXmlParser nrkBetaParser = new NrkBetaXmlParser(NrkParserConstants.NRK_BETA_FEEDS_KATEGORI_URL, NrkParserConstants.NRK_BETA_SECTION_DIVERSE); items = nrkBetaParser.getClips(); } else if (id == NrkBrowserConstants.MENU_ITEM_ID_NRKBETA_KONFERANSER_OG_MESSER) { NrkBetaXmlParser nrkBetaParser = new NrkBetaXmlParser(NrkParserConstants.NRK_BETA_FEEDS_KATEGORI_URL, NrkParserConstants.NRK_BETA_SECTION_KONFERANSER_OG_MESSER); items = nrkBetaParser.getClips(); } else if (id == NrkBrowserConstants.MENU_ITEM_ID_NRKBETA_PRESENTASJONER) { NrkBetaXmlParser nrkBetaParser = new NrkBetaXmlParser(NrkParserConstants.NRK_BETA_FEEDS_KATEGORI_URL, NrkParserConstants.NRK_BETA_SECTION_PRESENTASJONER); items = nrkBetaParser.getClips(); } else if (id == NrkBrowserConstants.MENU_ITEM_ID_NRKBETA_HD_KLIPP) { items = new NrkBetaXmlParser().FindHDClips().getClips(); } else if (category.Other is Program) { items = nrkParser.GetClips((Program)category.Other); } else if (category.Other is Folder) { items = nrkParser.GetClips((Folder)category.Other); } else if (category.Other is PodKast) { PodkastXmlParser pxp = new PodkastXmlParser(id); items = pxp.getClips(); } return VideosFromItems(items); }