本文整理汇总了C#中Jackett.Models.ReleaseInfo类的典型用法代码示例。如果您正苦于以下问题:C# ReleaseInfo类的具体用法?C# ReleaseInfo怎么用?C# ReleaseInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ReleaseInfo类属于Jackett.Models命名空间,在下文中一共展示了ReleaseInfo类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: PerformQuery
public async Task<IEnumerable<ReleaseInfo>> PerformQuery(TorznabQuery query)
{
var releases = new List<ReleaseInfo>();
var results = await RequestStringWithCookiesAndRetry(string.Format(SearchUrl, query.GetQueryString()));
try
{
CQ dom = results.Content;
var rows = dom["#torrents-table > tbody > tr.tt_row"];
foreach (var row in rows)
{
CQ qRow = row.Cq();
var release = new ReleaseInfo();
release.MinimumRatio = 1;
release.MinimumSeedTime = 129600;
release.Title = qRow.Find(".ttr_name > a").Text();
release.Description = release.Title;
release.Guid = new Uri(SiteLink + "/" + qRow.Find(".ttr_name > a").Attr("href"));
release.Comments = release.Guid;
release.Link = new Uri(SiteLink + "/" + qRow.Find(".td_dl > a").Attr("href"));
var sizeStr = qRow.Find(".ttr_size").Contents()[0].NodeValue;
release.Size = ReleaseInfo.GetBytes(sizeStr);
var timeStr = qRow.Find(".ttr_added").Text();
DateTime time;
if (DateTime.TryParseExact(timeStr, "yyyy-MM-ddHH:mm:ss", CultureInfo.InvariantCulture, DateTimeStyles.None, out time))
{
release.PublishDate = time;
}
release.Seeders = ParseUtil.CoerceInt(qRow.Find(".ttr_seeders").Text());
release.Peers = ParseUtil.CoerceInt(qRow.Find(".ttr_leechers").Text()) + release.Seeders;
var cat = qRow.Find(".ttr_type a").Attr("href");
if (cat == "?cat=27")
{
release.Category = TorznabCatType.TVHD.ID;
}
else if (cat == "?cat=17")
{
release.Category = TorznabCatType.TVSD.ID;
}
releases.Add(release);
}
}
catch (Exception ex)
{
OnParseError(results.Content, ex);
}
return releases;
}
开发者ID:iheijoushin,项目名称:Jackett,代码行数:56,代码来源:SceneAccess.cs
示例2: PerformQuery
public async Task<IEnumerable<ReleaseInfo>> PerformQuery(TorznabQuery query)
{
var releases = new List<ReleaseInfo>();
var searchString = query.SanitizedSearchTerm + " " + query.GetEpisodeSearchString();
var episodeSearchUrl = string.Format(SearchUrl, HttpUtility.UrlEncode(searchString));
var response = await RequestStringWithCookiesAndRetry(episodeSearchUrl);
var results = response.Content;
try
{
CQ dom = results;
var rows = dom["table.lista > tbody > tr"];
foreach (var row in rows)
{
// this tracker has horrible markup, find the result rows by looking for the style tag before each one
var prev = row.PreviousElementSibling;
if (prev == null || prev.NodeName.ToLowerInvariant() != "style") continue;
CQ qRow = row.Cq();
var release = new ReleaseInfo();
release.MinimumRatio = 1;
release.MinimumSeedTime = 172800;
var qLink = row.ChildElements.ElementAt(1).FirstElementChild.Cq();
release.Title = qLink.Text().Trim();
release.Comments = new Uri(SiteLink + qLink.Attr("href"));
release.Guid = release.Comments;
var qDownload = row.ChildElements.ElementAt(3).FirstElementChild.Cq();
release.Link = new Uri(SiteLink + qDownload.Attr("href"));
//"July 11, 2015, 13:34:09", "Today at 20:04:23"
var dateStr = row.ChildElements.ElementAt(4).Cq().Text().Trim();
if (dateStr.StartsWith("Today"))
release.PublishDate = DateTime.Today + TimeSpan.ParseExact(dateStr.Replace("Today at ", ""), "hh\\:mm\\:ss", CultureInfo.InvariantCulture);
else if (dateStr.StartsWith("Yesterday"))
release.PublishDate = DateTime.Today - TimeSpan.FromDays(1) + TimeSpan.ParseExact(dateStr.Replace("Yesterday at ", ""), "hh\\:mm\\:ss", CultureInfo.InvariantCulture);
else
release.PublishDate = DateTime.SpecifyKind(DateTime.ParseExact(dateStr, "MMMM dd, yyyy, HH:mm:ss", CultureInfo.InvariantCulture), DateTimeKind.Local);
var sizeStr = row.ChildElements.ElementAt(5).Cq().Text();
release.Size = ReleaseInfo.GetBytes(sizeStr);
release.Seeders = ParseUtil.CoerceInt(row.ChildElements.ElementAt(7).Cq().Text());
release.Peers = ParseUtil.CoerceInt(row.ChildElements.ElementAt(8).Cq().Text()) + release.Seeders;
releases.Add(release);
}
}
catch (Exception ex)
{
OnParseError(results, ex);
}
return releases;
}
开发者ID:lin0sspice,项目名称:Jackett,代码行数:56,代码来源:HDSpace.cs
示例3: FillReleaseInfoFromJson
private void FillReleaseInfoFromJson(ReleaseInfo release, JObject r)
{
var id = r["torrentId"];
release.Size = (long)r["size"];
release.Seeders = (int)r["seeders"];
release.Peers = (int)r["leechers"] + release.Seeders;
release.Guid = new Uri(GuidUrl + id);
release.Comments = release.Guid;
release.Link = new Uri(DownloadUrl + id);
}
开发者ID:lin0sspice,项目名称:Jackett,代码行数:10,代码来源:MoreThanTV.cs
示例4: PerformQuery
public async Task<IEnumerable<ReleaseInfo>> PerformQuery(TorznabQuery query)
{
var releases = new List<ReleaseInfo>();
var searchString = query.SanitizedSearchTerm + " " + query.GetEpisodeSearchString();
var episodeSearchUrl = string.Format(SearchUrl, HttpUtility.UrlEncode(searchString));
var results = await RequestStringWithCookiesAndRetry(episodeSearchUrl);
try
{
CQ dom = results.Content;
CQ qRows = dom["#torrenttable > tbody > tr"];
foreach (var row in qRows)
{
var release = new ReleaseInfo();
var qRow = row.Cq();
var debug = qRow.Html();
release.MinimumRatio = 1;
release.MinimumSeedTime = 172800;
CQ qLink = qRow.Find(".title > a").First();
release.Guid = new Uri(SiteLink + qLink.Attr("href"));
release.Comments = release.Guid;
release.Title = qLink.Text();
release.Description = release.Title;
release.Link = new Uri(SiteLink + qRow.Find(".quickdownload > a").Attr("href"));
var dateString = qRow.Find(".name")[0].InnerText.Trim().Replace(" ", string.Empty).Replace("Addedinon", string.Empty);
//"2015-04-25 23:38:12"
//"yyyy-MMM-dd hh:mm:ss"
release.PublishDate = DateTime.ParseExact(dateString, "yyyy-MM-ddHH:mm:ss", CultureInfo.InvariantCulture);
var sizeStr = qRow.Children().ElementAt(4).InnerText;
release.Size = ReleaseInfo.GetBytes(sizeStr);
release.Seeders = ParseUtil.CoerceInt(qRow.Find(".seeders").Text());
release.Peers = release.Seeders + ParseUtil.CoerceInt(qRow.Find(".leechers").Text());
releases.Add(release);
}
}
catch (Exception ex)
{
OnParseError(results.Content, ex);
}
return releases;
}
开发者ID:lin0sspice,项目名称:Jackett,代码行数:53,代码来源:TorrentLeech.cs
示例5: PerformQuery
public async Task<IEnumerable<ReleaseInfo>> PerformQuery(TorznabQuery query)
{
List<ReleaseInfo> releases = new List<ReleaseInfo>();
var searchString = query.SanitizedSearchTerm + " " + query.GetEpisodeSearchString();
var episodeSearchUrl = string.Format(SearchUrl, HttpUtility.UrlEncode(searchString));
var results = await RequestStringWithCookiesAndRetry(episodeSearchUrl);
await FollowIfRedirect(results);
try
{
CQ dom = results.Content;
var rows = dom["table.torrenttable > tbody > tr.browse_color"];
foreach (var row in rows)
{
var release = new ReleaseInfo();
release.MinimumRatio = 1;
release.MinimumSeedTime = 172800;
var qRow = row.Cq();
var qLink = row.ChildElements.ElementAt(2).FirstChild.Cq();
release.Link = new Uri(SiteLink + "/" + qLink.Attr("href"));
var torrentID = qLink.Attr("href").Split('=').Last();
var descCol = row.ChildElements.ElementAt(3);
var qCommentLink = descCol.FirstChild.Cq();
release.Title = qCommentLink.Text();
release.Description = release.Title;
release.Comments = new Uri(SiteLink + "/" + qCommentLink.Attr("href"));
release.Guid = release.Comments;
var dateStr = descCol.ChildElements.Last().Cq().Text().Split('|').Last().ToLowerInvariant().Replace("ago.", "").Trim();
release.PublishDate = DateTimeUtil.FromTimeAgo(dateStr);
var sizeStr = row.ChildElements.ElementAt(7).Cq().Text();
release.Size = ReleaseInfo.GetBytes(sizeStr);
release.Seeders = ParseUtil.CoerceInt(row.ChildElements.ElementAt(9).Cq().Text());
release.Peers = ParseUtil.CoerceInt(row.ChildElements.ElementAt(10).Cq().Text()) + release.Seeders;
releases.Add(release);
}
}
catch (Exception ex)
{
OnParseError(results.Content, ex);
}
return releases;
}
开发者ID:Nibb31,项目名称:Jackett,代码行数:51,代码来源:BeyondHD.cs
示例6: PerformQuery
public async Task<IEnumerable<ReleaseInfo>> PerformQuery(TorznabQuery query)
{
List<ReleaseInfo> releases = new List<ReleaseInfo>();
var searchTerm = string.IsNullOrEmpty(query.SanitizedSearchTerm) ? "2015" : query.SanitizedSearchTerm;
var searchString = searchTerm + " " + query.GetEpisodeSearchString();
var episodeSearchUrl = string.Format(SearchUrl, HttpUtility.UrlEncode(searchString.Trim()));
var results = await RequestStringWithCookiesAndRetry(episodeSearchUrl, string.Empty);
try
{
var jResults = JObject.Parse(results.Content);
foreach (JObject result in (JArray)jResults["torrents"])
{
var release = new ReleaseInfo();
release.MinimumRatio = 1;
release.MinimumSeedTime = 172800;
release.Title = (string)result["torrent_title"];
release.Description = release.Title;
release.Seeders = (int)result["seeds"];
release.Peers = (int)result["leeches"] + release.Seeders;
release.Size = (long)result["size"];
// "Apr 2, 2015", "Apr 12, 2015" (note the spacing)
// some are unix timestamps, some are not.. :/
var dateString = string.Join(" ", ((string)result["upload_date"]).Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries));
float dateVal;
if (ParseUtil.TryCoerceFloat(dateString, out dateVal))
release.PublishDate = DateTimeUtil.UnixTimestampToDateTime(dateVal);
else
release.PublishDate = DateTime.ParseExact(dateString, "MMM d, yyyy", CultureInfo.InvariantCulture);
release.Guid = new Uri((string)result["page"]);
release.Comments = release.Guid;
release.InfoHash = (string)result["torrent_hash"];
release.MagnetUri = new Uri((string)result["magnet_uri"]);
release.Link = new Uri(string.Format(DownloadUrl, release.InfoHash));
releases.Add(release);
}
}
catch (Exception ex)
{
OnParseError(results.Content, ex);
}
return releases;
}
开发者ID:lin0sspice,项目名称:Jackett,代码行数:51,代码来源:Strike.cs
示例7: PerformQuery
async Task<IEnumerable<ReleaseInfo>> PerformQuery(TorznabQuery query, string baseUrl)
{
var releases = new List<ReleaseInfo>();
var searchString = query.SanitizedSearchTerm + " " + query.GetEpisodeSearchString();
var episodeSearchUrl = string.Format(SearchUrl, HttpUtility.UrlEncode(searchString.Trim()));
var xmlDoc = new XmlDocument();
string xml = string.Empty;
var result = await RequestStringWithCookiesAndRetry(episodeSearchUrl);
try
{
xmlDoc.LoadXml(result.Content);
ReleaseInfo release;
TorrentzHelper td;
string serie_title;
foreach (XmlNode node in xmlDoc.GetElementsByTagName("item"))
{
release = new ReleaseInfo();
release.MinimumRatio = 1;
release.MinimumSeedTime = 172800;
serie_title = node.SelectSingleNode("title").InnerText;
release.Title = serie_title;
release.Comments = new Uri(node.SelectSingleNode("link").InnerText);
int category = 0;
int.TryParse(node.SelectSingleNode("category").InnerText, out category);
release.Category = category;
release.Guid = new Uri(node.SelectSingleNode("guid").InnerText);
release.PublishDate = DateTime.Parse(node.SelectSingleNode("pubDate").InnerText, CultureInfo.InvariantCulture);
td = new TorrentzHelper(node.SelectSingleNode("description").InnerText);
release.Description = td.Description;
release.InfoHash = td.hash;
release.Size = td.Size;
release.Seeders = td.Seeders;
release.Peers = td.Peers + release.Seeders;
release.MagnetUri = TorrentzHelper.createMagnetLink(td.hash, serie_title);
releases.Add(release);
}
}
catch (Exception ex)
{
OnParseError(xml, ex);
}
return releases;
}
开发者ID:lin0sspice,项目名称:Jackett,代码行数:50,代码来源:Torrentz.cs
示例8: PerformQuery
public async Task<IEnumerable<ReleaseInfo>> PerformQuery(TorznabQuery query)
{
var releases = new List<ReleaseInfo>();
var searchString = query.SanitizedSearchTerm + " " + query.GetEpisodeSearchString();
var results = await PostDataWithCookiesAndRetry(SearchUrl, GetSearchFormData(searchString));
try
{
CQ dom = results.Content;
var rows = dom["tr.browse"];
foreach (var row in rows)
{
var release = new ReleaseInfo();
release.MinimumRatio = 1;
release.MinimumSeedTime = 172800;
var descCol = row.ChildElements.ElementAt(1);
var qDescCol = descCol.Cq();
var qLink = qDescCol.Find("a");
release.Title = qLink.Text();
release.Description = release.Title;
release.Comments = new Uri(SiteLink + "/" + qLink.Attr("href"));
release.Guid = release.Comments;
var torrentId = qLink.Attr("href").Split('=')[1];
release.Link = new Uri(string.Format(DownloadUrl, torrentId));
var dateStr = descCol.ChildNodes.Last().NodeValue.Trim();
var euDate = DateTime.ParseExact(dateStr, "yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture);
var timezoneString = Environment.OSVersion.Platform == PlatformID.Unix ? "Europe/Berlin" : "Central European Standard Time";
var localDate = TimeZoneInfo.ConvertTimeToUtc(euDate, TimeZoneInfo.FindSystemTimeZoneById(timezoneString)).ToLocalTime();
release.PublishDate = localDate;
var sizeStr = row.ChildElements.ElementAt(5).Cq().Text();
release.Size = ReleaseInfo.GetBytes(sizeStr);
release.Seeders = ParseUtil.CoerceInt(row.ChildElements.ElementAt(6).Cq().Text().Trim());
release.Peers = ParseUtil.CoerceInt(row.ChildElements.ElementAt(7).Cq().Text().Trim()) + release.Seeders;
releases.Add(release);
}
}
catch (Exception ex)
{
OnParseError(results.Content, ex);
}
return releases;
}
开发者ID:Nibb31,项目名称:Jackett,代码行数:47,代码来源:SceneTime.cs
示例9: PerformQuery
public async Task<IEnumerable<ReleaseInfo>> PerformQuery(TorznabQuery query)
{
var releases = new List<ReleaseInfo>();
var searchString = query.SanitizedSearchTerm + " " + query.GetEpisodeSearchString();
var episodeSearchUrl = SearchUrl + HttpUtility.UrlEncode(searchString);
var results = await RequestStringWithCookiesAndRetry(episodeSearchUrl);
try
{
CQ dom = results.Content;
dom["#needseed"].Remove();
var rows = dom["table[width='750'] > tbody"].Children();
foreach (var row in rows.Skip(1))
{
var release = new ReleaseInfo();
var qRow = row.Cq();
var qLink = qRow.Children().ElementAt(2).Cq().Children("a").First();
release.MinimumRatio = 1;
release.MinimumSeedTime = 172800;
release.Title = qLink.Attr("title");
release.Description = release.Title;
release.Guid = new Uri(SiteLink + qLink.Attr("href"));
release.Comments = release.Guid;
release.Link = new Uri(string.Format(DownloadUrl, qLink.Attr("href").Split('=')[1]));
var dateString = qRow.Children().ElementAt(5).Cq().Text().Trim();
var pubDate = DateTime.ParseExact(dateString, "yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture);
release.PublishDate = DateTime.SpecifyKind(pubDate, DateTimeKind.Local);
var sizeStr = qRow.Children().ElementAt(6).Cq().Text();
release.Size = ReleaseInfo.GetBytes(sizeStr);
release.Seeders = ParseUtil.CoerceInt(qRow.Children().ElementAt(8).Cq().Text().Trim());
release.Peers = ParseUtil.CoerceInt(qRow.Children().ElementAt(9).Cq().Text().Trim()) + release.Seeders;
releases.Add(release);
}
}
catch (Exception ex)
{
OnParseError(results.Content, ex);
}
return releases;
}
开发者ID:lin0sspice,项目名称:Jackett,代码行数:47,代码来源:BitHdtv.cs
示例10: PerformQuery
public async Task<IEnumerable<ReleaseInfo>> PerformQuery(TorznabQuery query)
{
var releases = new List<ReleaseInfo>();
var searchString = query.SanitizedSearchTerm + " " + query.GetEpisodeSearchString();
var episodeSearchUrl = string.Format(SearchUrl, HttpUtility.UrlEncode(searchString));
var response = await RequestStringWithCookiesAndRetry(episodeSearchUrl);
try
{
CQ dom = response.Content;
var rows = dom["table > tbody > tr"];
foreach (var row in rows)
{
CQ qRow = row.Cq();
var release = new ReleaseInfo();
release.MinimumRatio = 1;
release.MinimumSeedTime = 172800;
var qLink = row.ChildElements.ElementAt(1).FirstElementChild.Cq();
release.Title = qLink.Text().Trim();
release.Comments = new Uri(qLink.Attr("href"));
release.Guid = release.Comments;
var qDownload = row.ChildElements.ElementAt(3).FirstElementChild.Cq();
release.Link = new Uri(qDownload.Attr("href"));
var dateStr = row.ChildElements.ElementAt(5).Cq().Text().Trim();
release.PublishDate = DateTimeUtil.FromTimeAgo(dateStr);
var sizeStr = row.ChildElements.ElementAt(6).Cq().Text();
release.Size = ReleaseInfo.GetBytes(sizeStr);
release.Seeders = ParseUtil.CoerceInt(row.ChildElements.ElementAt(8).Cq().Text());
release.Peers = ParseUtil.CoerceInt(row.ChildElements.ElementAt(9).Cq().Text()) + release.Seeders;
releases.Add(release);
}
}
catch (Exception ex)
{
OnParseError(response.Content, ex);
}
return releases;
}
开发者ID:lin0sspice,项目名称:Jackett,代码行数:46,代码来源:PrivateHD.cs
示例11: PerformQuery
public async Task<IEnumerable<ReleaseInfo>> PerformQuery(TorznabQuery query)
{
var releases = new List<ReleaseInfo>();
var formData = HttpUtility.ParseQueryString(SearchFormData);
var formDict = formData.AllKeys.ToDictionary(t => t, t => formData[t]);
formDict.Add("search", query.SanitizedSearchTerm);
var response = await PostDataWithCookiesAndRetry(SearchUrl, formDict);
try
{
var jsonResult = JObject.Parse(response.Content);
var resultArray = ((JArray)jsonResult["Fs"])[0]["Cn"]["torrents"];
foreach (var jobj in resultArray)
{
var release = new ReleaseInfo();
var id = (int)jobj["id"];
release.Comments = new Uri(string.Format(CommentsUrl, id));
release.Guid = release.Comments;
release.Link = new Uri(string.Format(DownloadUrl, id));
release.Title = Regex.Replace((string)jobj["name"], "<.*?>", String.Empty);
var SizeStr = ((string)jobj["size"]);
release.Size = ReleaseInfo.GetBytes(SizeStr);
release.Seeders = ParseUtil.CoerceInt((string)jobj["seed"]);
release.Peers = ParseUtil.CoerceInt((string)jobj["leech"]) + release.Seeders;
// ex: Tuesday, May 26, 2015 at 6:00pm
var dateStr = new Regex("title=\"(.*?)\"").Match((string)jobj["added"]).Groups[1].ToString();
dateStr = dateStr.Replace(" at", "");
var dateTime = DateTime.ParseExact(dateStr, "dddd, MMMM d, yyyy h:mmtt", CultureInfo.InvariantCulture);
release.PublishDate = dateTime;
releases.Add(release);
}
}
catch (Exception ex)
{
OnParseError(response.Content, ex);
}
return releases;
}
开发者ID:iheijoushin,项目名称:Jackett,代码行数:43,代码来源:SpeedCD.cs
示例12: PerformQuery
public async Task<IEnumerable<ReleaseInfo>> PerformQuery(TorznabQuery query)
{
var releases = new List<ReleaseInfo>();
var searchString = query.SanitizedSearchTerm + " " + query.GetEpisodeSearchString();
var episodeSearchUrl = string.Format(SearchUrl, HttpUtility.UrlEncode(searchString));
var results = await RequestStringWithCookiesAndRetry(episodeSearchUrl);
try
{
CQ dom = results.Content;
var rows = dom["#torrentTable > tbody > tr.browse"];
foreach (var row in rows)
{
CQ qRow = row.Cq();
var release = new ReleaseInfo();
release.MinimumRatio = 1;
release.MinimumSeedTime = 172800;
release.Title = qRow.Find(".torrentName").Text();
release.Description = release.Title;
release.Guid = new Uri(SiteLink + "/" + qRow.Find(".torrentName").Attr("href"));
release.Comments = release.Guid;
release.Link = new Uri(SiteLink + "/" + qRow.Find(".dlLinksInfo > a").Attr("href"));
var sizeStr = qRow.Find(".sizeInfo").Text();
release.Size = ReleaseInfo.GetBytes(sizeStr);
var dateStr = qRow.Find(".ulInfo").Text().Split('|').Last().Trim();
release.PublishDate = DateTimeUtil.FromTimeAgo(dateStr);
release.Seeders = ParseUtil.CoerceInt(qRow.Find(".seedersInfo").Text());
release.Peers = ParseUtil.CoerceInt(qRow.Find(".leechersInfo").Text()) + release.Seeders;
releases.Add(release);
}
}
catch (Exception ex)
{
OnParseError(results.Content, ex);
}
return releases;
}
开发者ID:lin0sspice,项目名称:Jackett,代码行数:42,代码来源:TorrentDay.cs
示例13: PerformQuery
public async Task<IEnumerable<ReleaseInfo>> PerformQuery(TorznabQuery query)
{
var releases = new List<ReleaseInfo>();
var results = await PostDataWithCookiesAndRetry(SearchUrl, GetSearchFormData(query.GetQueryString()));
try
{
CQ dom = results.Content;
var rows = dom["tr.browse"];
foreach (var row in rows)
{
var release = new ReleaseInfo();
release.MinimumRatio = 1;
release.MinimumSeedTime = 172800;
var descCol = row.ChildElements.ElementAt(1);
var qDescCol = descCol.Cq();
var qLink = qDescCol.Find("a");
release.Title = qLink.Text();
release.Description = release.Title;
release.Comments = new Uri(SiteLink + "/" + qLink.Attr("href"));
release.Guid = release.Comments;
var torrentId = qLink.Attr("href").Split('=')[1];
release.Link = new Uri(string.Format(DownloadUrl, torrentId));
release.PublishDate = DateTimeUtil.FromTimeAgo(descCol.ChildNodes.Last().InnerText);
var sizeStr = row.ChildElements.ElementAt(5).Cq().Text();
release.Size = ReleaseInfo.GetBytes(sizeStr);
release.Seeders = ParseUtil.CoerceInt(row.ChildElements.ElementAt(6).Cq().Text().Trim());
release.Peers = ParseUtil.CoerceInt(row.ChildElements.ElementAt(7).Cq().Text().Trim()) + release.Seeders;
releases.Add(release);
}
}
catch (Exception ex)
{
OnParseError(results.Content, ex);
}
return releases;
}
开发者ID:dardano,项目名称:Jackett,代码行数:42,代码来源:SceneTime.cs
示例14: FillReleaseInfoFromJson
private void FillReleaseInfoFromJson(ReleaseInfo release, JObject r)
{
var id = r["torrentId"];
release.Size = (long)r["size"];
release.Seeders = (int)r["seeders"];
release.Peers = (int)r["leechers"] + release.Seeders;
release.Guid = new Uri(GuidUrl + id);
release.Comments = release.Guid;
if ((string)r["category"] == "TV")
{
release.Category = TorznabCatType.TV.ID;
}
else if ((string)r["category"] == "Movies")
{
release.Category = TorznabCatType.Movies.ID;
}
release.Link = new Uri(DownloadUrl + id);
}
开发者ID:iheijoushin,项目名称:Jackett,代码行数:20,代码来源:MoreThanTV.cs
示例15: PerformQuery
public async Task<IEnumerable<ReleaseInfo>> PerformQuery(TorznabQuery query)
{
List<ReleaseInfo> releases = new List<ReleaseInfo>();
var searchString = query.SanitizedSearchTerm + " " + query.GetEpisodeSearchString();
var episodeSearchUrl = string.Format(SearchUrl, HttpUtility.UrlEncode(searchString));
var response = await RequestStringWithCookiesAndRetry(episodeSearchUrl);
try
{
CQ dom = response.Cookies;
var rows = dom[".results_index ul"];
foreach (var row in rows)
{
var release = new ReleaseInfo();
CQ qRow = row.Cq();
CQ qLink = qRow.Find("li.torrents_name > .torrents_name_link").First();
CQ qDlLink = qRow.Find("li.torrents_download > a").First();
release.MinimumRatio = 1;
release.MinimumSeedTime = 172800;
release.Title = qLink.Text().Trim();
release.Description = release.Title;
release.Comments = new Uri(SiteLink + "/" + qLink.Attr("href").TrimStart('/'));
release.Guid = release.Comments;
release.Link = new Uri(SiteLink + "/" + qDlLink.Attr("href").TrimStart('/'));
release.PublishDate = DateTime.Now;
release.Seeders = ParseUtil.CoerceInt(qRow.Find("li.torrents_seeders").Text());
release.Peers = ParseUtil.CoerceInt(qRow.Find("li.torrents_leechers").Text()) + release.Seeders;
var sizeParts = qRow.Find("li.torrents_size").Text();
release.Size = ReleaseInfo.GetBytes(sizeParts);
releases.Add(release);
}
}
catch (Exception ex)
{
OnParseError(response.Content, ex);
}
return releases;
}
开发者ID:Nibb31,项目名称:Jackett,代码行数:41,代码来源:FrenchTorrentDb.cs
示例16: PerformQuery
public async Task<IEnumerable<ReleaseInfo>> PerformQuery(TorznabQuery query)
{
var releases = new List<ReleaseInfo>();
var searchString = query.GetQueryString();
var episodeSearchUrl = string.Format(SearchUrl, HttpUtility.UrlEncode(searchString));
var results = await RequestStringWithCookiesAndRetry(episodeSearchUrl);
try
{
CQ dom = results.Content;
var rows = dom["#torrent_table > tbody > tr.torrent"];
foreach (var row in rows)
{
CQ qRow = row.Cq();
var release = new ReleaseInfo();
release.MinimumRatio = 1;
release.MinimumSeedTime = 172800;
release.Title = qRow.Find(".torrent_name_link").Text();
release.Description = release.Title;
release.Guid = new Uri(SiteLink + "/" + qRow.Find(".torrent_name_link").Parent().Attr("href"));
release.Comments = release.Guid;
release.Link = new Uri(SiteLink + "/" + qRow.Find(".torrent_handle_links > a").First().Attr("href"));
var dateStr = qRow.Find(".time").Text().Trim();
release.PublishDate = DateTimeUtil.FromTimeAgo(dateStr);
var sizeStr = qRow.Find(".size")[0].ChildNodes[0].NodeValue;
release.Size = ReleaseInfo.GetBytes(sizeStr);
release.Seeders = ParseUtil.CoerceInt(qRow.Children().ElementAt(6).InnerText.Trim());
release.Peers = ParseUtil.CoerceInt(qRow.Children().ElementAt(7).InnerText.Trim()) + release.Seeders;
releases.Add(release);
}
}
catch (Exception ex)
{
OnParseError(results.Content, ex);
}
return releases;
}
开发者ID:CatmanIX,项目名称:Shades,代码行数:40,代码来源:TorrentShack.cs
示例17: CacheRssResults
public void CacheRssResults(string trackerId, ReleaseInfo[] releases)
{
lock (cache)
{
var trackerCache = cache.Where(c => c.TrackerId == trackerId).FirstOrDefault();
if (trackerCache == null)
{
trackerCache = new TrackerCache();
trackerCache.TrackerId = trackerId;
cache.Add(trackerCache);
}
foreach(var release in releases.OrderByDescending(i=>i.PublishDate))
{
// Skip old releases
if(release.PublishDate-DateTime.Now> AGE_LIMIT)
{
continue;
}
var existingItem = trackerCache.Results.Where(i => i.Result.Guid == release.Guid).FirstOrDefault();
if (existingItem == null)
{
existingItem = new CachedResult();
existingItem.Created = DateTime.Now;
trackerCache.Results.Add(existingItem);
}
existingItem.Result = release;
}
// Prune cache
foreach(var tracker in cache)
{
tracker.Results = tracker.Results.OrderByDescending(i => i.Created).Take(MAX_RESULTS_PER_TRACKER).ToList();
}
}
}
开发者ID:BoudewijnGlas,项目名称:Jackett,代码行数:38,代码来源:CacheService.cs
示例18: PerformQuery
public async Task<IEnumerable<ReleaseInfo>> PerformQuery(TorznabQuery query)
{
var releases = new List<ReleaseInfo>();
var episodeSearchUrl = SearchUrl + HttpUtility.UrlEncode(query.GetQueryString());
WebClientStringResult response = null;
response = await RequestStringWithCookiesAndRetry(episodeSearchUrl);
try
{
var json = JObject.Parse(response.Content);
foreach (JObject r in json["response"]["results"])
{
DateTime pubDate = DateTime.MinValue;
double dateNum;
if (double.TryParse((string)r["groupTime"], out dateNum))
{
pubDate = DateTimeUtil.UnixTimestampToDateTime(dateNum);
pubDate = DateTime.SpecifyKind(pubDate, DateTimeKind.Utc).ToLocalTime();
}
var groupName = (string)r["groupName"];
if (r["torrents"] is JArray)
{
foreach (JObject t in r["torrents"])
{
var release = new ReleaseInfo();
release.PublishDate = pubDate;
release.Title = groupName;
release.Description = groupName;
FillReleaseInfoFromJson(release, t);
releases.Add(release);
}
}
else
{
var release = new ReleaseInfo();
release.PublishDate = pubDate;
release.Title = groupName;
release.Description = groupName;
FillReleaseInfoFromJson(release, r);
releases.Add(release);
}
}
}
catch (Exception ex)
{
OnParseError(response.Content, ex);
}
return releases;
}
开发者ID:iheijoushin,项目名称:Jackett,代码行数:53,代码来源:MoreThanTV.cs
示例19: PerformQuery
public async Task<IEnumerable<ReleaseInfo>> PerformQuery(TorznabQuery query)
{
List<ReleaseInfo> releases = new List<ReleaseInfo>();
var searchString = query.GetQueryString();
var searchUrl = SearchUrl;
var queryCollection = new NameValueCollection();
queryCollection.Add("action", "t
|
请发表评论