Git Product home page Git Product logo

adbren's Introduction

Description

Hash and renames files based on information from the AniDB API and a user defined format string. Can also add files to MyList. Run adbren.pl without arguments for full usage information.

URL

adbren has a permanent home on github: http://github.com/clip9/adbren

Install / Configuration

Clone the git repository or download a copy, then execute the adbren.pl script. It will ask you for your user name and password to anidb. This configuration is stored in ~/.adbren.config. Delete this file and execute adbren.pl to rerun the configuration.

Usage

adbren.pl [options] <file1/dir1> [file2/dir2] ...

Options

    --format        Format. Default is preset 0
    --preset        Format preset number. See list below;
    --strict        Use stricter cleaning. Only allow [a-Z0-9._]
    --noclean       Do not clean values of format vars. 
                    (Don't remove spaces, etc.7)
    --norename      Do not rename files. Just print the new names.
    --mylist        Add hashed files to mylist.
    --onlyhash      Only print ed2k hashes. 
    --nocorrupt     Don't rename "corrupt" files. (Files not found in AniDB)
    --logfile       Log files renamed to this file. Default: ~/adbren.log
                    This log is used to avoid hashing files already processed.
    --noskip        Do not skip files found in the log.
    --nolog         Do not do any logging.
    --debug         Debug mode.

Format variables

    %fid%, %aid%, %eid%, %gid%, %lid%, %status%, %size%, %ed2k%, 
    %md5%, %sha1%, %crc32%, %lang_dub%, %lang_sub%, %quaility%, %source%, 
    %audio_codec%, %audio_bitrate%, %video_codec%, %video_bitrate%,
    %resolution%, %filetype%, %length%, %description%, %group%, 
    %group_short%, %episode%, %episode_name%, %episode_name_romaji%,
    %episode_name_kanji%, %episode_total%, %episode_last%, %anime_year%,
    %anime_type%, %anime_name_romaji%, %anime_name_kanji%, 
    %anime_name_english%, %anime_name_other%, %anime_name_short%, 
    %anime_synonyms%, %anime_category%, %version%, %censored%,
    %orginal_name%

Notes

Directories on the command line are scanned recursively. Files are renamed in the same directory.

Format Presets

0. %anime_name_english%_%episode%%version%-%group_short%.%filetype%
1. %anime_name_english%_%episode%%version%_%episode_name%-%group_short%.%filetype%
2. %anime_name_english%_%episode%%version%_%episode_name%-%group_short%(%crc32%).%filetype%
3. %anime_name_english% - %episode% - %episode_name% - [%group_short%](%crc32%).%filetype%

Tips & Tricks

You can use an absolute or relative path in the format parameter like this:

	./adbren.pl --format /mnt/raid/%anime_name_english%/%episode%.%filetype%
	./adbren.pl --format %anime_name_english%/%episode%.%filetype%

In the second example the target path is relative to the current directory not the the directory where the file currently is.

adbren's People

Contributors

clip9 avatar thoj avatar timezlicer avatar tobix avatar twpol avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

adbren's Issues

New noob user problem

im on raspbian on raspberry pi3
on first run i got few errors telling to install File::HomeDir File::Pid Digest::MD4 im a noob so googled and did it like this

sudo perl -MCPAN -e 'install "File::HomeDir"' and so on with the rest but then i got a error saying

Can’t kill a non-numeric process ID at /usr/local/share/perl/5.14.2/File/Pid.pm line 124

i googled and got this https://www.omniweb.com/wordpress/?p=977 and did it

sudo nano that file and add "or return undef"

sub running {
my $self = shift;
my $pid = $self->_get_pid_from_file or return undef;

return   kill(0, $pid)
       ? $pid
       : undef;

}

and now it works thanks :)

says it is renaming files when it isn't

When I pass it --norename, it tells me that it's renaming the file, even though it doesn't.

pearson /media/storage/leeching  $  adbren.pl --norename --mylist \[Darksoul-Subs\]\ Umineko\ no\ Naku\ Koro\ ni\ -\ 01\ \[848x480.Xvid\]\[HQ\].avi 
[Darksoul-Subs] Umineko no Naku Koro ni - 01 [848x480.Xvid][HQ].avi: Hashing
[Darksoul-Subs] Umineko no Naku Koro ni - 01 [848x480.Xvid][HQ].avi: Getting info.
[Darksoul-Subs] Umineko no Naku Koro ni - 01 [848x480.Xvid][HQ].avi: Renamed to Umineko no Naku Koro ni_1-Darksoul Subs.avi
611869: Added to mylist.
pearson /media/storage/leeching  $  ls
[snip]
[Darksoul-Subs] Umineko no Naku Koro ni - 01 [848x480.Xvid][HQ].avi

Anime name lose its round brackets after renaming process.

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.

sanitise input and output

When the script reads a file with [1080p-FLAC] in the title it will crash out with the error
Invalid [] range "p-F" in regex; marked by <-- HERE in m/[FFF] Golden Time - 01 [BD][1080p-F <-- HERE LAC][0A94EDB8].mkv/ at /adbren/adbren.pl line 187, <$log> chunk 1419.

When a show such as To Love-Ru: Trouble - Darkness OAD is processed the script wont escape / in the episode titles so when it processes the file it will create sub folders every time there is a / so the processed file ends up looking like

├── To Love-Ru: Trouble - Darkness OAD - 2 - Nostalgia: Back Then at That Place 
│   └──  The Changing Heart: Honest Feelings 
│       └──  Flower: Budding Feelings.mkv

Error inflating response

File:  /anime/Gintama/Season 1/, Gintama - 075 - Someone Said Don't Complain About Your Job at Home, Do It Somewhere Else So Let Me Complain. It's Already Been a Year Since This Anime, Which Began with, Last of the Samurai. The Da.mkv
/anime/Gintama/Season 1/Gintama - 075 - Someone Said Don't Complain About Your Job at Home, Do It Somewhere Else So Let Me Complain. It's Already Been a Year Since This Anime, Which Began with, Last of the Samurai. The Da.mkv: Hashing

/anime/Gintama/Season 1/Gintama - 075 - Someone Said Don't Complain About Your Job at Home, Do It Somewhere Else So Let Me Complain. It's Already Been a Year Since This Anime, Which Began with, Last of the Samurai. The Da.mkv: Getting info.

--> AUTH user=XXX
<-- XXX LOGIN ACCEPTED 
Delay: 1 

--> FILE acode=134156035&viewdate=1542491916&size=124837344&s=9ONZz&ed2k=6f08a5560d9d0ba9f07dbcb32b89fa56&tag=adbr-7606&fcode=268386078 

Error inflating response: unexpected end of file at /home/pascal/adbren/adbren.pl line 846.

--> LOGOUT skey=XXX 


Allow manual configuration of configuration save folder

It would be really great if I could set the configuration folder myself.

Background
I am currently trying to run the script inside a cronjob and it will always default to /root as homedir, even when HOME is set. Of course one could rewrite the detection method of HOME, but I think it might be far more flexible to include a switch for manual configuration

Error

On first run without any parameters or config file, just cloned repo. ubuntu server. Perhaps I need to install something perl related?

Can't locate File/HomeDir.pm in @inc (you may need to install the File::HomeDir module) (@inc contains: /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.28.1 /usr/local/share/perl/5.28.1 /usr/lib/x86_64-linux-gnu/perl5/5.28 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.28 /usr/share/perl/5.28 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base) at adbren.pl line 23.
BEGIN failed--compilation aborted at adbren.pl line 23.

Somwhere (sorry my perl skillz are to weak ) it does not sanitize correctly

if the filename contains an E-A somwhere i get the following message :
Invalid [] range "E-A" in regex; marked by <-- HERE in m/Aa! Megami-sama! 2005 - 10 - Ah! Can the Auto Club Triumph - [AonE-A <-- HERE nY].avi/ at ./adbren.pl line 187, <$log> chunk 66.

i'm very sorry that i cannot contriubute more, but my perl skills are not enough to solve that ....

Kind regards
Nightfire (aka to dumb for perl)

Tool silently renaming files not found on AniDB

As the subject says. It silently and without user consent, renamed hundreds of files, prefixing them with _corrupt_, screwing up my file base. Those files are not corrupt but simply not present in the online DB. It should either be enabled or disabled by a switch. Note that --norename command line argument was in effect. That in itself should disable this behavior.

Error when running the command

Hi there,

I got error when execute the command. The file I want to rename is on same folder as adbren
Below is the error:

[email protected]:~/adbren$ adbren.pl --preset 3 --mylist --state hdd --viewed true "Patlabor_the_Movie_(1987
)_[1080p,BluRay,x264,DTS]_-_THORA.mkv"
Can't kill a non-numeric process ID at /usr/local/share/perl/5.24.1/File/Pid.pm line 124.
Can't kill a non-numeric process ID at /usr/local/share/perl/5.24.1/File/Pid.pm line 124.
END failed--call queue aborted.

Please help me

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.