Skip to content

Commit

Permalink
Merge pull request #159 from sdaqo/api_rewrite
Browse files Browse the repository at this point in the history
Api rewrite
  • Loading branch information
sdaqo authored May 10, 2024
2 parents da3b146 + 649a2b5 commit 57166b9
Show file tree
Hide file tree
Showing 136 changed files with 10,875 additions and 4,756 deletions.
10 changes: 0 additions & 10 deletions .github/pypi.sh

This file was deleted.

28 changes: 28 additions & 0 deletions .github/workflows/docs-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: ci
on:
push:
branches:
- master
permissions:
contents: write
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Configure Git Credentials
run: |
git config user.name github-actions[bot]
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
- uses: actions/setup-python@v5
with:
python-version: 3.x
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
- uses: actions/cache@v4
with:
key: mkdocs-material-${{ env.cache_id }}
path: .cache
restore-keys: |
mkdocs-material-
- run: pip install mkdocs-material
- run: mkdocs gh-deploy --force
50 changes: 17 additions & 33 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
@@ -1,38 +1,22 @@
# This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

name: Upload Python Package

name: Python package
on:
push:
branches:
- 'master'

permissions:
contents: read

tags:
- "v*.*.*"
jobs:
deploy:

build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
pip install twine
- name: Run Publishing Script
run: bash .github/pypi.sh
env:
PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
- uses: actions/checkout@v3
- name: Build and publish cli to pypi
uses: JRubics/[email protected]
with:
pypi_token: ${{ secrets.PYPI_API_TOKEN }}
package_directory: "cli"
allow_poetry_pre_release: "yes"
- name: Build and publish api to pypi
uses: JRubics/[email protected]
with:
pypi_token: ${{ secrets.PYPI_API_TOKEN }}
package_directory: "api"
allow_poetry_pre_release: "yes"
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,13 @@ user_files/
anipy_cli/config_personal.py
pypi.sh
.idea/
site/
*.pyc
.ruff_cache/

# VSCode
.vscode/

# Venv
.venv/
.venv/
venv/
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
If you like this project, and would like to help out fixing bugs, fixing typos, adding features etc. please feel free to make a PR.

Formatter used for code: [black](https://github.com/psf/black). Please use it when you create a pull request where you change code.
Check ou this page for information on how to get things set up: [https://sdaqo.github.io/anipy-cli/contributing](https://sdaqo.github.io/anipy-cli/contributing)
143 changes: 20 additions & 123 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,142 +1,39 @@
# ANIPY-CLI
**Anime from the comfort of your Terminal**

<p align="center"><img src="https://github.com/sdaqo/anipy-cli/assets/63876564/f0ce4cb9-ef82-4045-8392-8aefc40a7ec6" /> </p>


<p align="center"><img src="https://github.com/sdaqo/anipy-cli/blob/api_rewrite/docs/assets/anipy-logo-full-v3-version.png" /> </p>

https://user-images.githubusercontent.com/63876564/162056019-ed0e7a60-78f6-4a2c-bc73-9be5dc2a4f07.mp4

### Little tool written in python to watch and download anime from the terminal (the better way to watch anime), also applicable as an API.

### Scrapes: https://gogoanime.gg

#### If you dont like to use a cli there is a GUI and other versions [here](#other-versions).

# Contents

- [Installation](#Installation)
- [Usage](#Usage)
- [Library Usage](#library-usage)
- [What it can do](#what-it-can-do)
- [Other Versions](#other-versions)
- [Credits](#Credits)

# Installation

<a href="https://pypi.org/project/anipy-cli/">![PyPI](https://img.shields.io/pypi/v/anipy-cli?style=for-the-badge)</a>

Recommended installation:

`python3 -m pip install anipy-cli --upgrade`

Directly from the repo (may be newer):

`python3 -m pip install git+https://github.com/sdaqo/anipy-cli`

For video playback mpv is needed. Get it here: https://mpv.io/installation/

If you would like to use another video player, you will need to specify its path in the config file.

Optionally, you can install [ffmpeg](https://ffmpeg.org/download.html) to download m3u8 playlists instead of using the internal downloader. You can use it with the `-f` flag. This is something you should use if the internal downlaoder fails since ffmpeg is comparatively slow.

### Config

When you start the program for the first time the config file gets created automatically

Places of the config:
## What even is this?
A Little tool written in python to watch and download anime from the terminal (the better way to watch anime)
This project's main aim is to create a enjoyable anime watching and downloading experience, directly in the terminal - your favorite place.

- Linux: ~/.config/anipy-cli/config.yaml
- Windows: %USERPROFILE%/AppData/Local/anipy-cli/config.yaml
- MacOS: ~/.config/anipy-cli/config.yaml
Since the version 3 rewrite this project is split into api and frontend this makes it easy to integrate this into your project!

[Sample Config](https://github.com/sdaqo/anipy-cli/blob/master/docs/sample_config.yaml)
## You are just here for the client?
As one wise man once said:
> I DONT GIVE A FUCK ABOUT THE FUCKING CODE! i just want to download this stupid fucking application and use it.
>
> WHY IS THERE CODE??? MAKE A FUCKING .EXE FILE AND GIVE IT TO ME. these dumbfucks think that everyone is a developer and understands code. well i am not and i don't understand it. I only know to download and install applications. SO WHY THE FUCK IS THERE CODE? make an EXE file and give it to me. STUPID FUCKING SMELLY NERDS
**Attention Windows Users Using MPV:** If you activate the option `reuse_mpv_window`, you will have to download and put the `mpv-2.dll` in your path. To get it go look here: https://sourceforge.net/projects/mpv-player-windows/files/libmpv/
<sub>Please do not take this seriously this is some stupid copypasta</sub>

**Attention Windows Users on Config File Placement:** If you have downloaded Python from the Microsoft Store, your config file will be cached inside of your Python's AppData. For example: `%USERPROFILE%\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\Local\anipy-cli\config.yaml`.
We do not have a .exe but we have pipx: `pipx install anipy-cli`

# Usage
Check out [Getting Started - CLI](https://sdaqo.github.io/anipy-cli/getting-started-cli) for better instructions and advice!

```
usage: anipy-cli [-D | -B | -H | -S | -M | --delete-history] [-q QUALITY] [-f] [-o] [-a] [-p {mpv,vlc,syncplay,mpvnet}] [-l LOCATION] [--mal-password MAL_PASSWORD] [-h] [-v] [--config-path]
## You want to use the api for your project?
Feel free to - please check out [Getting Started - API](https://sdaqo.github.io/anipy-cli/getting-started-api) for instructions

Play Animes from gogoanime in local video-player or Download them.

Actions:
Different Actions and Modes of anipy-cli (only pick one)
-D, --download Download mode. Download multiple episodes like so: first_number-second_number (e.g. 1-3)
-B, --binge Binge mode. Binge multiple episodes like so: first_number-second_number (e.g. 1-3)
-H, --history Show your history of watched anime
-S, --seasonal Seasonal Anime mode. Bulk download or binge watch newest episodes.
-M, --my-anime-list MyAnimeList mode. Similar to seasonal mode, but using MyAnimeList (requires MAL account credentials to be set in config).
--delete-history Delete your History.
Options:
Options to change the behaviour of anipy-cli
-q QUALITY, --quality QUALITY
Change the quality of the video, accepts: best, worst or 360, 480, 720 etc. Default: best
-f, --ffmpeg Use ffmpeg to download m3u8 playlists, may be more stable but is way slower than internal downloader
-o, --no-seas-search Turn off search in season. Disables prompting if GoGoAnime is to be searched for anime in specific season.
-a, --auto-update Automatically update and download all Anime in seasonals list from start EP to newest.
-p {mpv,vlc,syncplay,mpvnet}, --optional-player {mpv,vlc,syncplay,mpvnet}
Override the player set in the config.
-l LOCATION, --location LOCATION
Override all configured download locations
--mal-password MAL_PASSWORD
Provide password for MAL login (overrides password set in config)
Info:
Info about the current anipy-cli installation
-h, --help show this help message and exit
-v, --version show program's version number and exit
--config-path Print path to the config file.
```

# What it can do

- Faster than watching in the browser.
- Play Animes in Your Local video player
- Select a quality in which the video will be played/downloaded.
- Download Animes
- History of watched Episodes
- Binge Mode to watch a range of episodes back-to-back.
- Seasonal Mode to bulk download or binge watch the latest episodes of animes you pick
- Configurable with config
- (**Optional**) MAL Mode: Like seasonal mode, but uses your anime list at [MyAnimeList.net](https://myanimelist.net/)
- (**Optional**) Search GoGo for animes in specific seasons. Available for the download cli, seasonal mode and MAL mode. Turn it off with -o flag.
- (**Optional**) Discord Presence for the anime you currently watch. This is off by default, activate it in the config (-c)
- (**Optional**) Ffmpeg to download m3u8 playlists, may be more stable but is slower than internal downloader.

# Library Usage

Documentation can be found [here](https://github.com/sdaqo/anipy-cli/blob/master/docs/anipycli_as_lib.py)

#### Important:

To import the library, don't import `anipy-cli`, but `anipy_cli` (no '-' is allowed)

# Advanced Usage Examples
#### Little example of using anipy-cli for automatically keeping anime library up-to-date:
```
# Cronjob runs every 2 minutes and checks whether anipy-cli is still running or not
# (only run the job if last one is finished)
*/2 * * * * username pidof -x anipy-cli || anipy-cli -Ma >> /var/log/anipy-cli.log
```

# Other versions

- GUI Frontend by me (WIP): https://github.com/sdaqo/anipy-gui
- Dmenu script by @Dabbing-Guy: https://github.com/Dabbing-Guy/anipy-dmenu
- Ulauncher extension by @Dankni95 (not maintained):
https://github.com/Dankni95/ulauncher-anime

# Credits
## :heart: Credits!

#### Heavily inspired by https://github.com/pystardust/ani-cli/

#### All contributors for contributing

<a href="https://github.com/sdaqo/anipy-cli/graphs/contributors">
<img src="https://contrib.rocks/image?repo=sdaqo/anipy-cli" alt="anipy-cli contributors" title="anipy-cli contributors" width="800"/>
</a>
13 changes: 0 additions & 13 deletions anipy_cli.py

This file was deleted.

20 changes: 0 additions & 20 deletions anipy_cli/__init__.py

This file was deleted.

1 change: 0 additions & 1 deletion anipy_cli/cli/__init__.py

This file was deleted.

37 changes: 0 additions & 37 deletions anipy_cli/cli/cli.py

This file was deleted.

6 changes: 0 additions & 6 deletions anipy_cli/cli/clis/__init__.py

This file was deleted.

Loading

0 comments on commit 57166b9

Please sign in to comment.