Skip to content

Commit

Permalink
(#938) When doing ID lookups, use filesystem name instead of the name…
Browse files Browse the repository at this point in the history
… saved in DB
  • Loading branch information
Difegue committed Apr 13, 2024
1 parent 344156d commit d4f5eb1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
6 changes: 4 additions & 2 deletions lib/LANraragi/Plugin/Metadata/Hitomi.pm
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use warnings;
use URI::Escape;
use Mojo::UserAgent;
use Mojo::JSON qw(decode_json);
use File::Basename;

#You can also use the LRR Internal API when fitting.
use LANraragi::Model::Plugins;
Expand Down Expand Up @@ -57,7 +58,7 @@ sub get_tags {
} else {

#Get Gallery ID by hand if the user didn't specify a URL
$galleryID = get_gallery_id_from_title( $lrr_info->{archive_title} );
$galleryID = get_gallery_id_from_title( $lrr_info->{file_path} );
}

# Did we detect a Hitomi gallery?
Expand Down Expand Up @@ -89,7 +90,8 @@ sub get_tags {

sub get_gallery_id_from_title {

my ($title) = @_;
my $file = shift;
my ( $title, $filepath, $suffix ) = fileparse( $file, qr/\.[^.]*/ );

my $logger = get_plugin_logger();

Expand Down
8 changes: 5 additions & 3 deletions lib/LANraragi/Plugin/Metadata/nHentai.pm
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use warnings;
use URI::Escape;
use Mojo::JSON qw(decode_json);
use Mojo::UserAgent;
use File::Basename;

#You can also use the LRR Internal API when fitting.
use LANraragi::Model::Plugins;
Expand All @@ -23,7 +24,7 @@ sub plugin_info {
namespace => "nhplugin",
login_from => "nhentaicfbypass",
author => "Difegue and others",
version => "1.7.3",
version => "1.8.0",
description => "Searches nHentai for tags matching your archive.
<br>Supports reading the ID from files formatted as \"{Id} Title\" and if not, tries to search for a matching gallery.
<br><i class='fa fa-exclamation-circle'></i> This plugin will use the source: tag of the archive if it exists.",
Expand Down Expand Up @@ -59,7 +60,7 @@ sub get_tags {
} else {

#Get Gallery ID by hand if the user didn't specify a URL
$galleryID = get_gallery_id_from_title( $lrr_info->{archive_title}, $ua );
$galleryID = get_gallery_id_from_title( $lrr_info->{file_path}, $ua );
}

# Did we detect a nHentai gallery?
Expand Down Expand Up @@ -115,7 +116,8 @@ sub get_gallery_dom_by_title {

sub get_gallery_id_from_title {

my ( $title, $ua ) = @_;
my ( $file, $ua ) = @_;
my ( $title, $filepath, $suffix ) = fileparse( $file, qr/\.[^.]*/ );

my $logger = get_plugin_logger();

Expand Down

0 comments on commit d4f5eb1

Please sign in to comment.