adameste / anidbcli

AniDB UDP API client written in Python
MIT License
33 stars 7 forks source link

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 <https://www.python.org/downloads/>`_ 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.

.. code-block:: bash

pip install anidbcli pip install --upgrade anidbcli #update

Package can be also installed from source like this.

.. code-block:: bash

python setup.py install

After installation anidbcli can be invoked like a python module

.. code-block:: bash

python -m anidbcli

or directly by typing following in the command line

.. code-block:: bash

anidbcli

Quickstart

The basic syntax is

.. code-block:: bash

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:

.. code-block:: bash

anidbcli -r -e mkv,mp4 ed2k -c "path/to/directory" "path/to/directory2"

Where

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

.. code-block:: bash

anidbcli -r -e mkv api -u "username" -p "password" -k "apikey" -a "path/to/directory"

Where

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

.. code-block:: bash

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:

.. code-block:: bash

    anidbcli -r -e mkv api -u "username" -p "password" -k "apikey" --state 0 --show-ed2k -a "path/to/directory"

Where

The number 0 can be substituted for different states:

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

.. code-block:: bash

anidbcli -r -e mkv,mp4 api -u "username" -p "password" -k "apikey" -sr "%ep_no% - %ep_english% [%g_name%]" "path/to/directory"

Where

Also along with the parameter "-r" you can use one of the following parameters:

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

.. code-block:: bash

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

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

Selected usable tags:

Complete list of usable tags in format string:

.. code-block:: bash

%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%