Jackett/src/Jackett.Common/Indexers/DanishBits.cs

66 lines
2.7 KiB
C#
Raw Normal View History

using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using Jackett.Indexers.Abstract;
using Jackett.Models;
using Jackett.Models.IndexerConfig;
Feature/netcore preparation (#2035) * Move to use package reference for restoring nuget packages. * Return a task result for this async method. * Update to a supported version of the .NET Framework. This also has the side effect of allowing us to automatically generate our binding redirects on build. * Set the solution to target VS2017 * Update test solution csproj file to support being built through MSBuild 15 * Move to use package reference for restoring nuget packages. * Return a task result for this async method. * Update to a supported version of the .NET Framework. This also has the side effect of allowing us to automatically generate our binding redirects on build. * Set the solution to target VS2017 * Update test solution csproj file to support being built through MSBuild 15 * DateTimeRoutines does not have Nuget packages that support .NET Standard (and therefore .NET Core). We will have to include them for now until we can get rid of this dependency. * Move the interfaces into their own files. This will be useful when we share them between the .NET Core and .NET Framework WebAPI * Stage services that need to point to the new interface namespace. * Update CurlSharp to fix memory leak issue and support better runtime compatibility with OSX and Linux * Start spliting some interfaces into their own files - this will help by allowing us to split them out in the future into a seperate project so the actual implementations can stay within their respective architectures when required
2017-10-29 10:19:09 +00:00
using Jackett.Services.Interfaces;
using Jackett.Utils.Clients;
using NLog;
namespace Jackett.Indexers
{
2017-09-15 16:57:43 +00:00
public class DanishBits : CouchPotatoTracker
{
2017-11-30 15:12:10 +00:00
public override string[] LegacySiteLinks { get; protected set; } = new string[] {
"http://danishbits.org/",
};
private new ConfigurationDataUserPasskey configData
{
get { return (ConfigurationDataUserPasskey)base.configData; }
set { base.configData = value; }
}
public DanishBits(IIndexerConfigurationService configService, WebClient c, Logger l, IProtectionService ps)
: base(name: "DanishBits",
description: "A danish closed torrent tracker",
link: "https://danishbits.org/",
2017-09-15 16:57:43 +00:00
endpoint: "couchpotato.php",
configService: configService,
client: c,
logger: l,
p: ps,
configData: new ConfigurationDataUserPasskey("Note about Passkey: This is not your login Password. Find the Passkey by logging into DanishBits with your Browser, and under your account page you'll see your passkey under the 'Personal' section on the left side.")
)
{
Encoding = Encoding.UTF8;
2016-12-09 17:20:58 +00:00
Language = "da-dk";
Type = "private";
2017-09-15 16:57:43 +00:00
AddCategoryMapping("movie", TorznabCatType.Movies);
AddCategoryMapping("tv", TorznabCatType.TV);
2018-01-09 15:13:15 +00:00
AddCategoryMapping("blandet", TorznabCatType.Other); // e.g. games
}
2017-09-19 09:32:12 +00:00
protected override string GetSearchString(TorznabQuery query)
{
if (string.IsNullOrEmpty(query.SearchTerm) && string.IsNullOrEmpty(query.ImdbID))
{
return "%";
}
var searchString = query.GetQueryString();
Regex ReplaceRegex = new Regex("[^a-zA-Z0-9]+");
searchString = ReplaceRegex.Replace(searchString, "%");
return searchString;
}
2017-10-03 12:23:31 +00:00
protected override async Task<WebClientByteResult> RequestBytesWithCookies(string url, string cookieOverride = null, RequestType method = RequestType.GET, string referer = null, IEnumerable<KeyValuePair<string, string>> data = null, Dictionary<string, string> headers = null)
{
2017-10-03 12:23:31 +00:00
CookieHeader = null; // Download fill fail with cookies set
return await base.RequestBytesWithCookies(url, cookieOverride, method, referer, data, headers);
}
}
}