Skip to content

Commit

Permalink
Changed EH Option to default language and enabled imagesearch by default
Browse files Browse the repository at this point in the history
  • Loading branch information
Difegue committed Mar 21, 2018
1 parent 1f614b0 commit 1d66636
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions lib/LANraragi/Plugin/EHentai.pm
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ sub plugin_info {

#If your plugin uses/needs custom arguments, input their name here.
#This name will be displayed in plugin configuration next to an input box for global arguments, and in archive edition for one-shot arguments.
global_arg => "Enable reverse image search? This might bring more false positives. (Type 'yes' to enable)",
global_arg => "Default language to use in searches (This will be overwritten if your archive has a language tag set)",
oneshot_arg => "E-H Gallery URL (Will attach tags matching this exact gallery to your archive)"
);

Expand Down Expand Up @@ -63,8 +63,8 @@ sub get_tags {
if ($gID eq "") {

if ($gToken eq "Banned") {
$logger->error("Banned from EH for excessive pageloads.");
return ( error => "Banned from EH for excessive pageloads." );
$logger->error("Temporarily banned from EH for excessive pageloads.");
return ( error => "Temporarily banned from EH for excessive pageloads." );
}

if ($gToken eq "NoThumb") {
Expand Down Expand Up @@ -93,7 +93,7 @@ sub lookup_by_title {

my $title = $_[0];
my $thumbhash = $_[1];
my $enable_imagesearch = $_[2] eq "yes";
my $defaultlanguage = $_[2];
my $tags = $_[3];

my $logger = LANraragi::Model::Utils::get_logger( "E-Hentai", "plugins" );
Expand All @@ -102,7 +102,8 @@ sub lookup_by_title {

my $URL = "";

if ($enable_imagesearch && $thumbhash ne "") {
#Thumbnail reverse image search
if ($thumbhash ne "") {

$logger->info("Reverse Image Search Enabled, trying first.");

Expand All @@ -124,6 +125,7 @@ sub lookup_by_title {

}

#Regular text search
$URL =
$domain
. "?f_doujinshi=1&f_manga=1&f_artistcg=1&f_gamecg=1&f_western=1&f_non-h=1&f_imageset=1&f_cosplay=1&f_asianporn=1&f_misc=1"
Expand All @@ -133,6 +135,8 @@ sub lookup_by_title {
#Get the language tag, if it exists.
if ( $tags =~ /.*language:\s?([^,]*),*.*/gi ) {
$URL = $URL . "+language:$1";
} else {
$URL = $URL . "+language:$defaultlanguage";
}

#Same for artist tag
Expand Down

0 comments on commit 1d66636

Please sign in to comment.