Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Anime name lose its round brackets after renaming process. #18

Open
hergonoway opened this issue Feb 17, 2020 · 1 comment
Open

Anime name lose its round brackets after renaming process. #18

hergonoway opened this issue Feb 17, 2020 · 1 comment

Comments

@hergonoway
Copy link

hergonoway commented Feb 17, 2020

Hello,

renaming feature removes round brackets around year in anime name. Tested without --strict, can reproduce with ou without --noclean.

Format used : (custom) : /[%anime_type%]/%anime_name_romaji% [anidb-%aid%]/%anime_name_romaji% - %episode%%version% - [%group_short%][%source%]%resolution%.%filetype%

Example (https://anidb.net/anime/12414) :

  • Romanji : Berserk (2017)
  • Adbren after renaming : Berserk 2017

it's for both folder name and episode filename.

@hergonoway hergonoway changed the title Year in anime name lose their brackets after rename Anime name lose its brackets after renaming process. Feb 17, 2020
@hergonoway hergonoway changed the title Anime name lose its brackets after renaming process. Anime name lose its round brackets after renaming process. Feb 17, 2020
@sjorge
Copy link

sjorge commented Nov 24, 2022

I actually ran into this and fixed it in my local copy, probably not the best fix, but this worked for me:

--- adbren.pl	2022-11-24 22:12:12
+++ adbren_custom	2022-11-24 22:14:14
@@ -228,14 +228,19 @@
     while ( $newname =~ /\%([^\%]+)\%/ ) {
         my $key = $1;
         if ( defined $fileinfo->{$key} ) {
+	    my ($title, $year) = ($fileinfo->{$key} =~ m/(.+)_(\d{4})_/);
+	    if ($year) {
+	      $fileinfo->{$key} = $title . "(" . $year . ")";
+	    }
             $fileinfo->{$key} = substr $fileinfo->{$key}, 0, 180;
             if ( !$noclean ) {
                 $fileinfo->{$key} =~ s/[?:%\/]//g;
+                $fileinfo->{$key} =~ s/[`]/'/g;
                 if ($strict) {
                     $fileinfo->{$key} =~ s/[^a-zA-Z0-9-]/_/g;
                 }
                 else {
-                    $fileinfo->{$key} =~ s/[^a-zA-Z0-9-&!`',.~+\- ]/_/g;
+                    $fileinfo->{$key} =~ s/[^a-zA-Z0-9-&!`',.~+\- \(\)]/_/g;
                 }
                 $fileinfo->{$key} =~ s/[_]+/_/g;
             }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants