本文整理汇总了C#中Jackett.Models.ReleaseInfo.Clone方法的典型用法代码示例。如果您正苦于以下问题:C# ReleaseInfo.Clone方法的具体用法?C# ReleaseInfo.Clone怎么用?C# ReleaseInfo.Clone使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Jackett.Models.ReleaseInfo
的用法示例。
在下文中一共展示了ReleaseInfo.Clone方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PerformQuery
public async Task<IEnumerable<ReleaseInfo>> PerformQuery(TorznabQuery query)
{
var releases = new List<ReleaseInfo>();
var searchString = query.GetQueryString();
var searchUrl = APIUrl;
var queryCollection = new NameValueCollection();
queryCollection.Add("action", "browse");
//queryCollection.Add("group_results", "0"); # results won't include all information
queryCollection.Add("order_by", "time");
queryCollection.Add("order_way", "desc");
if (!string.IsNullOrWhiteSpace(searchString))
{
queryCollection.Add("searchstr", searchString);
}
foreach (var cat in MapTorznabCapsToTrackers(query))
{
queryCollection.Add("filter_cat[" + cat + "]", "1");
}
searchUrl += "?" + queryCollection.GetQueryString();
var response = await RequestStringWithCookiesAndRetry(searchUrl);
if (response.IsRedirect || query.IsTest)
{
// re-login
await ApplyConfiguration(null);
response = await RequestStringWithCookiesAndRetry(searchUrl);
}
try
{
var json = JObject.Parse(response.Content);
foreach (JObject r in json["response"]["results"])
{
var groupTime = DateTimeUtil.UnixTimestampToDateTime(long.Parse((string)r["groupTime"]));
var groupName = HttpUtility.HtmlDecode((string)r["groupName"]);
var artist = (string)r["artist"];
var cover = (string)r["cover"];
var tags = r["tags"].ToList();
var groupYear = (string)r["groupYear"];
var releaseType = (string)r["releaseType"];
var release = new ReleaseInfo();
release.PublishDate = groupTime;
if (!string.IsNullOrEmpty(cover))
release.BannerUrl = new Uri(cover);
release.Title = "";
if (!string.IsNullOrEmpty(artist))
release.Title += artist + " - ";
release.Title += groupName;
if (!string.IsNullOrEmpty(groupYear))
release.Title += " [" + groupYear + "]";
if (!string.IsNullOrEmpty(releaseType))
release.Title += " [" + releaseType + "]";
release.Description = "";
if (tags != null)
release.Description += "Tags: " + string.Join(", ", tags) + "\n";
if (r["torrents"] is JArray)
{
foreach (JObject torrent in r["torrents"])
{
ReleaseInfo release2 = (ReleaseInfo)release.Clone();
FillReleaseInfoFromJson(release2, torrent);
releases.Add(release2);
}
}
else
{
FillReleaseInfoFromJson(release, r);
releases.Add(release);
}
}
}
catch (Exception ex)
{
OnParseError(response.Content, ex);
}
return releases;
}