Atreyagaurav / anime-helper-shell

A python shell for searching, watching, and downloading anime.
GNU General Public License v3.0
23 stars 1 forks source link
anime cli python

Since I was tired of searching for different websites and different animes to watch. And wanted my player to remember what I watched without having to depend on yet another website.

I created this solution. It's not super useful, or the best, but it works fine for me.

Install the requirements.

+begin_src bash

pip install -r requirements.txt

+end_src

Make the ~ggshell.py~ executable and then symlink it to ~/usr/local/bin~ or other ~bin~ directory.

+begin_src bash

chmod +x ggshell.py ln -s /usr/local/bin/ggshell.py

+end_src

If the anime folder doesn't already exist in your home directory "~/" then create one, and move the shell.conf file into there.

+begin_src bash

mkdir ~/anime

+end_src

+begin_src bash

cp shell.conf ~/anime

+end_src

Be sure to edit the ~config.py~ to change the ~ext_media_command~ variable if you use other players than ~mpv~, and change the ~anime_dir~ to the place you want to store your anime.

By defaults it makes ~anime~ directory in your home and stores it there. You can symlink your anime storage directory to home too.

Arch Linux; Windows 10 & Termux android app.

But the notify command doesn't work on windows and termux because of issue with availability of dbus.

** Basic Usages

* Usage instructions Some examples are on [[Screenshots][Screenshots]] section.

Assuming you have symlinked the ~ggshell.py~ to ~/use/bin/gogoanime~. Look at [[*Installation][Installation]] for more detail on this.

For interactive shell, run ~python ggshell.py~, or ~ggshell.py~ (if you made it executable), or ~gogoanime~ (if you symlinked to this name).

After that you can enter the commands in the shell; type ~help~ on overall help, and ~help command~ for specific help on some command. The help is not that detailed for each command for now, but I have tried to write what the command does.

To run shell commands like ~clear~ use ~shell command~ syntax or ~!command~ syntax, where the command is the shell command you want to execute. (not tested in windows).

For single use pass the command & arguments as command line arguments:

+begin_src bash

gogoanime play one-piece

+end_src

** Interactive shell *** inputs The interactive shell is written in python and [[https://www.man7.org/linux/man-pages/man3/readline.3.html][readline]] is used to get the input, hence supports emacs like keybindings. like C-r for reverse search of commands, and others, look at readline manual for other info on this. ~!man readline~ on interactive shell or ~man readline~ on bash.

*** Autocomplete Auto-Completion is supported but it used the log list and cache list (previous search result) for completion of most commands so at the beginning there won't be much. Try searching animes then using the key to autocomplete. As you use more and enter the animes on logs the autocomplete becomes more usable.

Autocomplete for commands like help/ fullscreen/ quality etc doesn't depend on those so are usable from the start.

** Debug Shell for developers If you are familiar with python, now only can you edit the code, you can also use the debug shell to test the code, the history won't be updated on this shell. You can use it just like python REPL but has the necessary modules preloaded for debugging purposes.

You can use the ~shell~ command or ~!~ at the beginning to run that command in ggshell but unlike there you can look at the error and analyze the problem here.

This is still a prototype so it isn't very good.

** Mpv Plugin There is a cfiles folder with c codes for mpv plugin and status checking program, both can be compiled with ~make~ and installed with ~make install~. Just update the path macros on the C files and then compile with make (I don't know how to make that automatic with make right now - help will be appreciated.)

There are some scripts in ~extras~ folders, which can be used to visualize the log from these plugins.

The ~process.py~ processes the log and ~visualize.py~ is for visualization. Here is an example plots.

[[./extras/plot.png]]

The gaps in the plot with no anime watchtime isn't me being responsible but rather the time it was broke and I was watching it in the browser.

Latest episode updates from home page:

~NEW~ and ~WATCHED~ tags are shown for animes on the tracklist.

[[./screenshots/recent.png]]

Searching and getting info on anime:

[[./screenshots/info.png]]

getting info from search list.

[[./screenshots/number.png]]

Watching anime:

[[./screenshots/watch.png]]

Logs on watched anime/episodes:

[[./screenshots/log.png]]

Adjustments: Geometry and fullscreen for player. Quality for stream/download.

[[./screenshots/others.png]]

Tracking an anime, and getting updates:

[[./screenshots/track.png]]

Commands history:

You can use UP arrow key to get old commands, or use Ctrl+r to do reverse search (not tested in windows).

[[./screenshots/history.png]]

help command:

[[./screenshots/help1.png]]

[[./screenshots/help2.png]]