skip to navigation
skip to content

Not Logged In

pyAniSort 1.0.2

Automatically sorts anime using information from anidb.net

Latest Version: 1.0.3

pyAniSort
=========

pyAniSort is a command line utility that will sort and rename anime
video files into folders separated by the name of the series.

Usage
-----

| There are two different commands that pyAnisort has:
| The first being ``sort``
| And the second ``undo``

The sort command
~~~~~~~~~~~~~~~~

The sort command requires two arguments the from directory and the to
directory

| The silent option turns off any parts of the script that would ask for
user input
| ``-s, --silent`` Turn off console interactivity

| The history argument takes the name of a csv file that will store the
renaming history
| ``--history FILE`` changes where to save history file ('history.csv'
is the default)

``$ pyAniSort sort 'from/directory' 'to/directory' -s --history history.csv``

The program will sort this:

::

    |-- From Folder/
    |   | [Sub Group A] Series Name - 01 [ABCD1234].mkv
    |   | [Sub Group A] Series Name - 02 [ABCD1234].mkv
    |   | [Sub Group A] Series Name - 03 [ABCD1234].mkv
    |   | [Sub Group B] Other Series Name Ep01 [ABCD1234].mkv
    |   | [Sub Group B] Other Series Name Ep02 [ABCD1234].mkv
    |   | [Sub Group B] Other Series Name Ep03 [ABCD1234].mkv

To This:

::

    |-- To Folder/
    |   |-- Series Name/
    |   |   |-- Series Name - 01 - title.mkv
    |   |   |-- Series Name - 02 - title.mkv
    |   |   |-- Series Name - 03 - title.mkv
    |   |-- Other Series Name/
    |   |   |-- Other Series Name - 01 - title.mkv
    |   |   |-- Other Series Name - 02 - title.mkv
    |   |   |-- Other Series Name - 03 - title.mkv

The undo command
~~~~~~~~~~~~~~~~

The undo command will use the history.csv file to undo the sorting
operation in case there was an error.

There are two required positional arguments that are required for the
undo command

| The history argument takes the name of a csv file that will store the
renaming history
| ``--history FILE`` changes where to save history file ('history.csv'
is the default)

``$ pyanisort undo startLine endLine --history history.csv``

| The first one will tell the program what line of the file to start on
and the second will tell it what line to end on.
| This allows better control of what files to undo

| Running the following command will start undoing the files stored in
history.csv from line 30 to line 40, or until the end of the file if
there are less than 40 lines.
| ``$ pyanisort undo 30 40``

| this next command will undo all of the files stored in the history.csv
file.
| ``$ pyanisort undo 0 0``

| Both of the following commands will only undo the file at line 44 of
the history.csv file
| ``$ pyanisort undo 44 44``
| ``$ pyanisort undo 44 0``

After any one of these commands are used the history.csv file will be
modified to reflect the undo operation.

Logs and other Important Files
------------------------------

| Logs and program data is stored in the following locations:
| Windows: ``%APPDATA%\pyAniSort``
| Linux: ``~/.pyanisort``

| There are two files that are automatically created when pyAniSort is
run.
| prefNames.csv and history.csv

``prefNames.csv`` - Prefered show names
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

| This file is for storing information about the show. This helps save
time when gathering show information multiple times.
| There are three values stored in the csv file the **anime ID (aid)**,
**official show name**, and the **parsed name**

| The **aid** is the unique id that the anidb database uses for the show
| The **official show name** is the full series name pulled from the
anidb.
| It is also the name that will be used when renaming and sorting the
video files.
| The **parsed name** is the name that has been pulled from the filename
before it was sorted.

+--------+----------------------------------------------------------------------------+----------------------+
| aid    | Official Name                                                              | Parsed Name          |
+========+============================================================================+======================+
| 9541   | Shingeki no Kyojin                                                         | Shingeki no Kyojin   |
+--------+----------------------------------------------------------------------------+----------------------+
| 9787   | Ore no Nounai Sentakushi ga, Gakuen Lovecome o Zenryoku de Jama Shiteiru   | NouCome              |
+--------+----------------------------------------------------------------------------+----------------------+

This is the contents of prefNames.csv that match the table

::

    prefName.csv
    9541,Shingeki no Kyojin,Shingeki no Kyojin
    9787,"Ore no Nounai Sentakushi ga, Gakuen Lovecome o Zenryoku de Jama Shiteiru",NouCome

--------------

One of the useful things about putting this information in a csv file
like this is that the changes can be made to it outside of the program.

| For example:
| The official name of ``NouCome`` above is quite a mouthfull. It also
takes up a lot of space and might even make new filenames run into the
255 character limit on windows.

| So wouldn't it be better if you could change this:
| ``Ore no Nounai Sentakushi ga, Gakuen Lovecome o Zenryoku de Jama Shiteiru``

| To it's shorthand name:
| ``NouCome``

You can do this by editing the ``prefName.csv`` file. I suggest using a
standard text editor than Excel. Excel might mess up the file and cause
a problem when the program reads it.

So you would edit the ``prefName.csv`` file from:

::

    prefName.csv
    9541,Shingeki no Kyojin,Shingeki no Kyojin
    9787,"Ore no Nounai Sentakushi ga, Gakuen Lovecome o Zenryoku de Jama Shiteiru",NouCome

To this:

::

    prefName.csv
    9541,Shingeki no Kyojin,Shingeki no Kyojin
    9787,"NouCome",NouCome

Now when the program goes to rename your files it will use ``NouCome``
instead of
``Ore no Nounai Sentakushi ga, Gakuen Lovecome o Zenryoku de Jama Shiteiru``

``history.csv`` - File rename history
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

There are two columns in the history.csv file. The first refers to the
original location of a video file and the second refers to the sorted
location

+----------------------------------------------------------------------+--------------------------------------------------------------------+
| Original Name                                                        | Sorted Name                                                        |
+======================================================================+====================================================================+
| D:\\test\_files[Sub Group A] Series Name - 01 [ABCD1234].mkv         | D:\\Anime\\Series Name\\Series Name - 01 - title.mkv               |
+----------------------------------------------------------------------+--------------------------------------------------------------------+
| D:\\test\_files[Sub Group B] Other Series Name Ep01 [ABCD1234].mkv   | D:\\Anime\\Other Series Name\\Other Series Name - 01 - title.mkv   |
+----------------------------------------------------------------------+--------------------------------------------------------------------+

This is an example ot the contents of history.csv useing real filenames

::

    history.csv
    D:\test_files\[EveTaku] Shingeki no Kyojin - 25 (1280x720 x264-Hi10P AAC)[783716E5].mkv,D:\Anime\Shingeki no Kyojin\Shingeki no Kyojin - 25 - The Wall Raid on Stohess District (3).mkv
    D:\test_files\[Irrational Typesetting Wizardry] NouCome - 01 [F87C6CC0].mkv,"D:\Anime\Ore no Nounai Sentakushi ga, Gakuen Lovecome o Zenryoku de Jama Shiteiru\Ore no Nounai Sentakushi ga, Gakuen Lovecome o Zenryoku de Jama Shiteiru - 01 - That Choice Put My Life in Motion.mkv"

Installation
------------

| Link to PyPI page: https://pypi.python.org/pypi/pyAniSort
| There is also a windows installation binary if you don't want to
install pip.

| Make sure that you are using the python3 version of pip when
installing.
| This program only works with python3

``$ pip install pyanisort``

| If you don't have pip installed you can run these commands from the
terminal to get it
| ``$ sudo curl http://python-distribute.org/distribute_setup.py | python3``
| ``$ sudo curl https://raw.github.com/pypa/pip/master/contrib/get-pip.py | python3``

Possible Errors
---------------

There are a few possible errors that may occur when running this script

Banned
''''''

``0000-00-00 00:00:00,000 - pyanisort.findtitle - ERROR - findtitle : 62 - Error parsing through cache\0000.xml.gz: Banned``

| This means that the anidb.net server has gotten too many requests from
the machines IP address.
| It will refuse any more connections for the next couple hours.

This is a security measure put in place by the server and I have not
found any other method of getting around it other than by waiting a
couple hours to run the script again

Contact Me
----------

Questions or comments about ``pyAniSort``? send me an email at
`jotaro0010@gmail.com <mailto:jotaro0010@gmail.com>`__.
pyAniSort 1.0.2 (February 11, 2014)
-----------------------------------

-  Program files are now created and saved to ~/.pyanisort on Linux and
   %APPDATA%\\pyAniSort on windows
-  Short pause between downloads of series xml files. this will help
   prevent temp bans - February 12, 2014
-  Fixed bugs with program data creation on Linux - February 12, 2014

pyAniSort 1.0.1 (February 09, 2014)
-----------------------------------

-  Restructured program so that it could be downloaded and installed
   through the Python Package Index
-  Created setup.py and init.py
-  Program now changes working directory to program location to use data
   files stored there

pyAniSort 1.0.0 (February 06, 2014)
-----------------------------------

-  Initial upload
 
File Type Py Version Uploaded on Size
pyAniSort-1.0.2-py3.3.egg (md5, pgp) Python Egg 3.3 2014-02-13 34KB
pyAniSort-1.0.2.win32-py3.3.exe (md5, pgp) MS Windows installer 3.3 2014-02-13 250KB
pyAniSort-1.0.2.zip (md5, pgp) Source 2014-02-13 30KB
  • Downloads (All Versions):
  • 33 downloads in the last day
  • 175 downloads in the last week
  • 903 downloads in the last month