Giter Site home page Giter Site logo

raitaroh / adl Goto Github PK

View Code? Open in Web Editor NEW
135.0 7.0 15.0 772 KB

๐Ÿฟ anime scraper/downloader + trackma wrapper

License: GNU General Public License v3.0

Shell 97.39% Python 2.14% Batchfile 0.47%
anime-downloader anime-search anime-watch anime watch trackma wrapper vlc mpv animdl

adl's Introduction

adl
GitHub Repo stars GitHub Repo stars

This is wrapper for animdl + trackma.
The goal? Type adl, hit enter, choose show, watch show, update episode number with as little input as possible.

Note: any visual glitches in the above are caused by the terminal recorder.

Features

  • fetch currently watching anime from your account;
  • ability to switch between lists: watching, completed, rewatching, paused, dropped, plantowatch;
  • option to change account used by trackma;
  • option to update local list;
  • select multiple anime to be watched in sequence;
  • watch any episode from the anime chosen, default is the next episode;
  • easily watch all available episodes after last watched, in order to catch up. Also update list accordingly;
  • prompt user for watching another show;
  • prompt user to add a score to an anime if the anime in question will be set as completed;
  • option to skip all user input - works in combination with the other options as well;
  • download instead of watching; everything from above still applies;
  • use local media instead of streaming:
    • requires identical folder name to anilist anime title; ex: Fruits Basket: 2nd Season should be a folder inside animedir containing the vidoes, otherwise adl will not find the anime folder;
    • considering different naming conventions, fzf is used for episode selecting and perl is used for better matching, but it will search for 0# format;
    • to avoid Scans and other such extras, the find maxdepth is set to 1, as such don't have folders inside folders; use a symlink instead, or change the maxdepth variable.
  • do not display verbose vlc output;
  • warn user if episode wasn't found;
  • download covers from anilist and show them in the terminal. Example:

Requirements

Note: vn-ki/anime-downloader seems to be depricated. As such I have ported to animdl.

  • animdl - make sure this works. Settings for animdl, such as provider, need to be placed in your configuration file.
  • z411/trackma - tested with anilist (you need to set up trackma before using adl). Also adl now needs the following PR merge that fixes issue #9;
  • junegunn/fzf - needed for show selection and cover previews. Make sure you install the latest version from github to prevent issue #35;
  • MPV - used to play the anime (better integration with anime-downloader). VLC can also be used: $adl -p vlc;
  • perl - for regular expressions;
  • frece - optional - $adl -f will show most watched anime at the top of the list. By default frece is not used;
  • ueberzug - optional - $adl -c will download covers from anilist to /tmp/ using cURL and wget, then will display the covers using ueberzug in the fzf anime selection window. Alternatively, the script adl_covers.py in this repo also downloads covers.

Installation

Linux

  • Install all the dependencies from above.
  • Simply download the script into your ~/bin or ~/local/bin folder and make it executable. ~/bin should be added to your $PATH.
mkdir -p "$HOME/bin"
wget https://raw.githubusercontent.com/RaitaroH/adl/master/adl -O "$HOME/bin/adl"
chmod +x "$HOME/bin/adl"

Or:

wget https://raw.githubusercontent.com/RaitaroH/adl/master/adl -O "$HOME/.local/bin/adl"
chmod +x "$HOME/.local/bin/adl"

Windows

Windows platform is not officially supported. User discretion is advised.

  • Install Chocolatey package manager (used to install other dependencies).
  • Install git-for-windows (used to run the bash script).
  • Should not be needed to be installed separately, but perl and curl are also required.
  • Open CMD/PowerShell as /Administrator/ and run the following dependencies. nodejs is not strictly needed, but many providers need it.
choco install -y python3 aria2 mpv fzf nodejs
refreshenv
  • Install trackma and anime-downloader using pip. Note: if needed you may install youtube-dl as well.
pip install -U git+https://github.com/anime-dl/anime-downloader Trackma
  • Setup trackma as seen below. If you already have trackma set up, then skip this step.

  • Change default provider, Anime Downloader Configuration.

  • Download this repository. You will need adl and player_check.bat at the least. You may download the zip or clone the repository. Be mindful of the folder you are in:

git clone https://github.com/RaitaroH/adl.git
cd adl
  • To run the script execute the command from below. C:\Program Files\Git\bin\ should be added to your PATH to simply use bash.exe. You may type refreshenv to reload the environment variables after adding to PATH, or reopen the CMD/PowerShell. Note: .\adl assumes you are currently in the folder where adl is; otherwise specify the full path.
bash .\adl
  • see adl -h for more information.

Windows sepcific issues

  • covers don't work;
  • in the event that adl cannot count watched episodes:
    1. verify that mpv.com exists at C:\ProgramData\chocolatey\lib\mpv.install\tools;
    2. from a CMD run echo %PATHEXT% to test if you get .COM;.EXE;... and not .EXE;.COM.... Change the PATHEXT if needed.
    3. use bash .\adl -p 'mpv.com' as last option. This might break some providers.

Trackma Setup

Setting up Trackma can be done using the GTK and Qt interfaces. Alternatively:

  • In the CMD/PowerShell/Terminal type trackma;
  • Type a to add an account;
  • Type anilist/myanimelist etc;
  • Enter your username;
  • Copy the url in a browser and get your token from the anime site;
  • Paste the pin in the CMD/PowerShell/Terminal;
  • Type retrieve to get your list. Note: you may use adl -r to force retrieve before getting the anime list.

Anime Downloader Configuration

The provider animdl is using, may not work for you. As such configure animdl by editing the config file.

Note - adl used to be able to change providers, as "anime dl" had a flag for it; "animdl" does not, so you will ned to modify the file manually.

Updating

adl also has a function for updating itself from source. To use it run adl -u or adl --update and follow the prompts.

Issues

If the show doesn't start for you, the script will inform you of this. If you are positive that the episode number has aired, then most likely the provider you are using is NOT yet up-to-date.

Contributors โœจ

Thanks goes to these wonderful people (emoji key):


Baitinq

๐Ÿ› ๐Ÿ’ป ๐Ÿค”

Justaus3r

๐Ÿ’ป โœ…

This project follows the all-contributors specification. Contributions of any kind welcome!

adl's People

Contributors

allcontributors[bot] avatar baitinq avatar justaus3r avatar raitaroh avatar vednoc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

adl's Issues

Can't download anime

I can't download any anime from any provider using adl, while I can do it with barebones anime-downloader. It just skips over the episodes like it downloaded them already.

Can't use external video player with "-" in the name

so, I was trying out different players to settle on one and keep watching with it.
I've tried mplayer and it worked like a charm, but the issue is that mplayer doesnt have a gui.

So i decided that I wanna use gnome-mplayer, and because the player is made out of two words that has a "-" in between
adl doesn't recognize it and it thinks that i am trying to type a command.

plz fix this soon
thx

head: illegal line count -- -2 OSX Ventura 13.4.1

adl seems to be having a problem with trackma when it invokes it, as the following exception is seen before adl exits:

head: illegal line count -- -2
Exception ignored in: <_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>
BrokenPipeError: [Errno 32] Broken pipe
trackma returned empty 'watching' list. Choose another list query. 
Available queries: watching, completed, rewatching, paused, dropped, plantowatch;

Using tee when running adl gets a little more information:

Platform:Windows
ESC[HESC[2JESC[3JESC[HESC[2JESC[3JESC[HESC[2JESC[3JESC[HESC[2JESC[3JESC[HESC[2JESC[3JESC[HESC[2JESC[3JESC[HESC[2JESC[3JESC[HESC[2JESC[3JESC[HESC[2JESC[3JESC[;36mtrackma returned empty 'watching' list. Choose another list query. ESC[0m
Available queries: watching, completed, rewatching, paused, dropped, plantowatch;
adl.error (END)

'git show' for adl:

adl % git show
commit ed469f43f1f8aaa2a90f974bed1094ba875c78f5 (HEAD -> master, origin/master, origin/HEAD)
Author: RaitaroHikami <[email protected]>
Date:   Thu Feb 23 18:55:28 2023 +0000

    fix for 3.2.4
    
    copy paste issue

macports bash version:

bash -v
bash-5.2$ 

trackma version:

trackma
Trackma v0.8.6  Copyright (C) 2012-2023  z411

trackma is configured with some shows:

quarterturn [anilist] (anime) watching >> list
| Index  Title                                                Progress  Score  |
|   1    Mushoku Tensei: Jobless Reincarnation Season 2......   6 / 13    0    |
|   2    Rurouni Kenshin.....................................   5 / 94    0    |
2 results

Trackma cuts long anime names

When you have an anime in your anime list with a lot of characters (as an example: JoJo's Bizarre Adventure: Stardust Crusaders - Battle in Egypt), fzf shortens it to JoJo's Bizarre Adventure: Stardust Crusaders -, meaning that it will not show up as the first option in the next screen. This isnt a problem right now but if you end up implementing the -y option it could become a problem. (Also it isnt aesthetic to see your anime name shortened like that). I know it is a fzf problem but maybe there is an option to prevent this?

Thanks

EDIT: It also makes it so you cant increase the nr, resulting in a real problem

fzf throws "invalid preview window layout: down,5%" on Pop!_os

Os:Pop!_os

Issue:
I am facing this issue while running adl on Pop!_Os ,when ever i do ./adl,i get :

invalid preview window layout: down,5%
Nothing was selected. Exiting. 

Thank you for using adl โœจ! 
Exiting. 

Did you install all the dependencies?
Yes i did,infact i also installed all the optional dependencies.
Did you try to install adl on any other distro
No i didn't,but i think that this issue might might be Os specific.

Edit:

Workaround\Solution:

Below is the solution to the problem

Trackma list not being updated

After you are done watching an episode and you choose to increase the nr by 1 (next episode in trackma) when the fzf menu pops up the new nr is not there and you have to restart the program for it to be updated on the list, if not it stills shows the previous episode.

Thanks a lot (Using this all the time now)

[Improvement] Sorting the fzf output by watch history.

It would be really nice if the fzf list was ordered by watch history. That way if you just finished watching an episode from series X, that series (X) would be at the top of the list, making it faster to play the next episode. Then the series you rarely watch would be at the bottom of the list and the ones you frequenlty watch at the top, saving much time.

Thanks

Adl chooses top option for anime-downloader automatically

In the last couple of days I have had the problem of adl automatically choosing the top option of anime-downloader search. That is done without the adl-y flag so I dont know why does it happen. I installed adl form the github and anime-downloader from the pip. (I used arch aur packages before but had the same problem so I tried official installation methods.). Adl -y does work,.

[Suggestion] Make yes the default answer to watch another anime

It would be nice if when you pressed enter at the input of Do you want to watch another anime? it would be interpreted as yes instead of no. That way the process of watching the next episode could be much faster, as it would just be pressing enter a few times instead of having to type "y" and then enter.

Thanks

Make mpv default player

@Baitinq I am considering using mpv as default. I have started to use mpv a lot myself so perhaps making the change will be better. Thoughts?

Issue if episode number > 100

When tracking something over 100 episodes, ADL struggles to find the next episode.

e.g.

Selection:

>  |    4    Black Clover..................................................... 109 / ?

Post-selection

Black Clover > 0 / 

adl not showing the covers in the fish shell

It seems that the way it execute escapes the bash shell environment of the script, so the preview will not work.
To fix this, the SHELL variable needs to be set at the beginning:

readonly BASH_BINARY="$(which bash)"
SHELL="${BASH_BINARY}"

anime dl output hidden (python 3.8 stderr)

I noticed python changed to 3.8 on my system. After having to readd the change needed in trackma (issue #9) I noticed that adl had another issue: 2> /dev/null redirection now also hides everything anime dl is outputting. This wasn't the behavior in the past. I decided to remove the null redirection here: e590c2a .

@Baitinq can you test this out a bit as well? Perhaps this is an anime dl bug or something in python 3.8?

trackma > fzf gets cutoff in small terminal sizes

When having smaller sizes of terminal, output is not properly displayed due to its length. Maybe getting rid of excess dots or switching position of elements...

image

I didn't read through the whole code, this will break scraping.

Some of the ideas:

entry="$(echo "$tlist" | sed 's#\(.*\)\(\. \+[0-9]\+ / [0-9]\+ \+ [0-9]\+\)#\2\1#g' | sed 's#[0-9]\+|#|#g' | sed 's#\. \+|##g' | sed 's#\.##g' | fzf_select | process_list)"

image

entry="$(echo "$tlist" | sed 's#\(\. \+[0-9]\+ / [0-9]\+ \+[0-9]\+\)\|\.\||##g' | fzf_select | process_list)"

image

Or maybe come with other solutions since trackma is displaying list correctly with any sizes:
image

I don't think it's important at all. I personally like trackma style.

Sometimes adl does not terminate properly

When closing adl, sometimes, it prints an error like:

  • cannot find matching "
  • unexpected EOF
  • command not found (some letter or portion of a letter

This seems to happen when skipping watching another, right before cleanup. Then it seems as if bash is interpreting comments or portions of commands.

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.