public Torrent[] Search(Series series, Episode episode) { var query = series.Title + " " + episode.CodedName; var url = string.Format("http://thepiratebay.se/search/{0}/0/7/0", HttpUtility.UrlEncode(query)); var result = new WebClientEx().DownloadString(url); HtmlDocument doc = new HtmlDocument(); doc.LoadHtml(result); var dts = doc.DocumentNode.SelectNodes("/html/body/div[@id='SearchResults']/div[@id='content']/div[@id='main-content']/table[@id='searchResult']/tr/td/div[@class='detName']"); List<Torrent> results = new List<Torrent>(); if (dts != null) { foreach (var dt in dts) { var a = dt.ParentNode.SelectSingleNode("a"); var seed = int.Parse(dt.ParentNode.ParentNode.SelectSingleNode("td[@align='right']").InnerText.Trim('\t', ' ', '\r', '\n')); results.Add(new Torrent() { Magnet = a.Attributes["href"].Value, Title = dt.InnerText.Trim('\t', ' ', '\r', '\n'), Seed = seed }); } } return results.ToArray(); }
public Subtitles[] Search(Series series, Episode episode) { var query = string.Format("http://www.podnapisi.net/ru/ppodnapisi/search?sJ=2&sT=1&sK={2}&sTS={0}&sTE={1}", episode.Season, episode.Number, HttpUtility.UrlEncode(series.Title)); List<Subtitles> subtitleses = new List<Subtitles>(); var result = new WebClientEx().DownloadStringIgnoreAndLog(query); var aas = Regex.Matches(result, "class=\"subtitle_page_link\" href=\"([^\"]*?)\"").OfType<Match>().Select(m => m.Groups[1].Value).ToArray(); var subs = aas.Select(ProcessSubUrl).Where(r => r != null).AsParallel().ToArray(); Thread.Sleep(1000); return subs; }
public EpisodeViewModel(Episode episode) { _episode = episode; _torrents = new BindableCollection<TorrentViewModel>(episode.Torrents.Select(t => new TorrentViewModel(t, _client))); }
private static string GetEpisodePart(Episode episode) { var path = string.Format("{0}\\{1}\\{2}", episode.Series.Title, episode.Season, episode.Number); return path; }
public static string GetTorrentPathForEpisode(Episode e) { return Path.Combine(BasePath, GetEpisodePart(e), "torrent\\"); }
public void ReadSeries(Profile profile) { var url = string.Format("http://api.myshows.ru/rss/{0}/episodes/aired/", profile.UserId); var xml = XDocument.Parse(new WebClientEx().DownloadString(url)); var channel = xml.Root.Element("channel"); foreach (var item in channel.Elements("item")) { var title = item.Element("title").Value; var seriesName = title.Substring(0, title.LastIndexOf(' ')); var episodeName = title.Substring(title.LastIndexOf(' ') + 1); var series = profile.Series.FirstOrDefault(s => s.Title == seriesName); if (series == null) profile.Series.Add(series = new Series(seriesName)); var episode = series.Episodes.FirstOrDefault(e => e.CodedName == episodeName); if (episode == null) series.Episodes.Add(episode = new Episode(episodeName)); } }
/// <summary> /// Create a new Episode object. /// </summary> /// <param name="episodeId">Initial value of the EpisodeId property.</param> /// <param name="title">Initial value of the Title property.</param> /// <param name="number">Initial value of the Number property.</param> /// <param name="season">Initial value of the Season property.</param> /// <param name="seriesId">Initial value of the SeriesId property.</param> /// <param name="watched">Initial value of the Watched property.</param> /// <param name="lastUpdate">Initial value of the LastUpdate property.</param> /// <param name="airDate">Initial value of the AirDate property.</param> public static Episode CreateEpisode(global::System.Int64 episodeId, global::System.String title, global::System.Int32 number, global::System.Int32 season, global::System.Int64 seriesId, global::System.Boolean watched, global::System.DateTime lastUpdate, global::System.DateTime airDate) { Episode episode = new Episode(); episode.EpisodeId = episodeId; episode.Title = title; episode.Number = number; episode.Season = season; episode.SeriesId = seriesId; episode.Watched = watched; episode.LastUpdate = lastUpdate; episode.AirDate = airDate; return episode; }
/// <summary> /// Deprecated Method for adding a new object to the Episodes EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToEpisodes(Episode episode) { base.AddObject("Episodes", episode); }