Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/atreyagaurav/anime-helper-shell
A python shell for searching, watching, and downloading anime.
https://github.com/atreyagaurav/anime-helper-shell
anime cli python
Last synced: 2 months ago
JSON representation
A python shell for searching, watching, and downloading anime.
- Host: GitHub
- URL: https://github.com/atreyagaurav/anime-helper-shell
- Owner: Atreyagaurav
- License: gpl-3.0
- Created: 2020-12-13T08:23:28.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2022-10-27T02:20:16.000Z (over 2 years ago)
- Last Synced: 2023-03-05T09:52:48.200Z (almost 2 years ago)
- Topics: anime, cli, python
- Language: Python
- Homepage:
- Size: 1.56 MB
- Stars: 23
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.org
- License: LICENSE
Awesome Lists containing this project
README
* Anime Helper Shell [play/stream/download temporarily fixed]
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.
* NOTE:
It may stop working all of a sudden one day if the site goes down, so I can't guarantee till when it'll work.In such cases:
~play~, ~download~, ~continue~ commands won't work because of changes in the gogoanime website which was the only source for now. You can try to fix it by changing the website link in ~sources/gogoanime.py~ file or some other logic in that module.I have added a ~web~ & ~webcontinue~ command to browse the episode page and watch it in the browser in such cases.
If I find some other sources which are easier to get the videos from I'll update it.
I also found recently another CLI interface known as [[https://github.com/pystardust/ani-cli][ani-cli]] that has the functionality of ~play~ and ~download~ commands from here (probably more), and have used a small script from there to patch the problem for now, but it might not last long without other people to contribute. My understanding of networking is pretty low so I can't always track down how to reach the source videos to stream.
* Disclaimer
I do not own the videos or the right to distribute the videos which can be accessed through this program. It is just a helper program created for personal purposes and is like a terminal api for gogoanime site to ease the access as well as add the functionality of recording the watched animes and updates.* Installation (Linux & Mac OS)
Clone this repository.
#+begin_src bash
git clone https://github.com/Atreyagaurav/anime-helper-shell.git && cd anime-helper-shell
#+end_srcInstall the requirements.
#+begin_src bash
pip install -r requirements.txt
#+end_srcMake 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_srcIf 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_srcBe 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.* Usages
** Supported devices
Till now it works on (tested only on these; can probably work on others 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
- Watch anime from online stream
- Download anime for offline watch
- Search anime from keywords
- Automatic/manual record list of watched anime
- Continue from where you left off (episode wise not time of the episode)
- Keep track of ongoing anime- Other utilities:
* get notification on updates (notify command - UNIX only)
* use shell commands with ! (e.g. !clear)** 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.
* Known Bugs
- Sometimes the input has residue texts from long command lines.
- Sometimes the mpv can't stream the stream link obtained with 403: Forbidden error.
- The quality selection doesn't work unless the upstream provides m3u8 file.
- Debug shell is a prototype and has glitches.
* Future plans
- Quality selection
- Import watched logs from myanimelist.(dropped)
- Choose the source for the video
* ScreenshotsLatest 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]]