Giter Club home page Giter Club logo

anidbcli's Introduction

anidbcli

Anidbcli is a simple command line interface for managing your anime collection on your local computer or NAS (using only ssh).

Requirements

  • Python 3.6 or newer (version 3.5 seems to work as well)

Key features

  • ed2k hashing library utilizing multiple cores
  • adding anime to mylist
  • utilize data from anidb to move/rename the files
  • moves/renames the subtitle and other files with same extension
  • encryption

Installation

The package can be installed automatically using pip.

pip install anidbcli
pip install --upgrade anidbcli #update

Package can be also installed from source like this.

python setup.py install

After installation anidbcli can be invoked like a python module

python -m anidbcli

or directly by typing following in the command line

anidbcli

Quickstart

The basic syntax is

anidbcli [OPTIONS] ed2k/api [OPTIONS] ARGS

If you want to just generate ed2k links for mkv and mp4 files recursively for given folders and copy them to clipboard, use:

anidbcli -r -e mkv,mp4 ed2k -c "path/to/directory" "path/to/directory2"
Where
  • -r is recursive
  • -e comma separated list of extensions, that are treated as anime files

To add all mkv files from directory resursively to mylist use:

anidbcli -r -e mkv api -u "username" -p "password" -k "apikey" -a "path/to/directory"
Where
  • "password" is your anidb password
  • "username" is your anidb username
  • "apikey" is anidb upd api key, that you can set at https://anidb.net/user/setting. If no key is provided, unencrypted connection will be used.

Optionally, if you don't provide password or username, you will be prompted to input them.

anidbcli -r -e mkv api -k "apikey" -a "path/to/directory"
Enter your username: "username"
Enter your password: "password"

To set files to a specified state use:

anidbcli -r -e mkv api -u "username" -p "password" -k "apikey" --state 0 --show-ed2k -a "path/to/directory"
Where
  • "show-ed2k" is an optional parameter to show/print out ed2k links, while adding/renaming files.
  • "state" is your desired MyList file state (see https://wiki.anidb.net/Filestates).
The number 0 can be substituted for different states:
  • 0 is unknown (default)
  • 1 is internal storage
  • 2 is external storage
  • 3 is deleted
  • 4 is remote storage

To rename all mkv and mp4 files in directory recursively using data from api you can call

anidbcli -r -e mkv,mp4 api -u "username" -p "password" -k "apikey" -sr "%ep_no% - %ep_english% [%g_name%]" "path/to/directory"
Where
  • "-r" rename using provided format string
  • "-s" prepend original file path to each renamed file. Without this flag the files would me moved to current directory.
  • "-U" use with -a (-aU). Adds the files to mylist as unwatched.
Also along with the parameter "-r" you can use one of the following parameters:
  • "-h" Create hardlinks instead of renaming.
  • "-l" Create softlinks instead of renaming.
  • "-t" Save session info instead of logging out (session lifetime is 35 minutes after last command). Use for subsequent calls of anidbcli to avoid api bans.

Anidbcli should be called with all the parameters as usual. If the session was saved before more than 35 minutes, a new session is created instead.

You can also move watched anime from unwatched directory to watched directory and add it to mylist at the same time using following command.

anidbcli -r -e mkv,mp4 api -u "username" -p "password" -k "apikey" -xr "watched/%a_english%/%ep_no% - %ep_english% [%g_name%]" "unwatched/anime1" "unwatched/anime2"
Where
  • "-x" Delete empty folders after moving all files away.

NOTE: All files with same name and different extension (fx. subtitle files) will be renamed/moved as well.

Selected usable tags:
  • %md5% - md5 hash of file.
  • %sha1% - sha1 hash of file.
  • %crc32% - crc32 hash of file.
  • %resolution% - file resolution, for example "1920x1080"
  • %aired% - Episode aired date. Only option that needs "--date-format" option. You can find list of available tags at https://docs.python.org/3.6/library/time.html#time.strftime.
  • %year% - Year, the anime was aired. Can be a timespan, if the anime was aired several years "1990-2005" etc.
  • %a_romaji% - Anime title in romaji.
  • %a_kanji% - Anime title in kanji.
  • %a_english% - English anime title.
  • %ep_no% - Episode number. Prepends the necessary zeros, fx. 001, 01
  • %ep_english% - English episode name.
  • %ep_romaji% - Episode name in romaji.
  • %ep_kanji% - Episode name in kanji.
  • %g_name% - Group that released the anime. fx. HorribleSubs.
  • %g_sname% - Short group name.

Complete list of usable tags in format string:

%fid%, %aid%, %eid%, %gid%, %lid%, %status%, %size%, %ed2k%, %md5%, %sha1%, %crc32%, %color_depth%,
%quality%, %source%, %audio_codec%, %audio_bitrate%, %video_codec%, %video_bitrate%, %resolution%,
%filetype%, %dub_language%, %sub_language%, %length%, %aired%, %filename%, %ep_total%, %ep_last%, %year%,
%a_type%, %a_categories%, %a_romaji%, %a_kanji%, %a_english%, %a_other%, %a_short%, %a_synonyms%, %ep_no%,
%ep_english%, %ep_romaji%, %ep_kanji%, %g_name%, %g_sname%, %version%, %censored%

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.