Git Product home page Git Product logo

luevano / mangal Goto Github PK

View Code? Open in Web Editor NEW

This project forked from metafates/mangal

2.0 0.0 1.0 31.03 MB

๐Ÿ“– Advanced CLI manga downloader. Lua scrapers, export formats, anilist integration, fancy TUI and more.

Shell 0.18% Go 88.37% Just 0.24% JavaScript 0.13% HTML 0.25% Vue 6.02% TypeScript 4.80%
anilist cli go golang linux lua manga manga-downloader mangal pdf scraper terminal tui

mangal's Introduction

Mangal

Work in progress...

Fork of metafates/mangal@v5.

Version 5 is now based on metafates' mangalorg suite, which I've forked to work on them myself:

Development

For now, just notes for myself while I work on this.

Requirements

The following needs to be installed before starting development:

  • go>=1.21
    • oapi-codegen: go install github.com/deepmap/oapi-codegen/v2/cmd/oapi-codegen@latest
    • enumer: go install github.com/dmarkham/enumer@latest
  • just
  • npm

Setup

Update modules:

just update

Install openapi-typescript:

cd web/ui
npm i -D openapi-typescript
npm audit fix
cd ../..

Generate assets and code:

just generate

Then it can be used without compiling for testing purposes:

go run main.go ...

Or compiled/installed:

just build # or full or install
./mangal

Usage

By default if just executing the mangal command, it will start the TUI. To list all options:

mangal -h

Note: If the previous mangal (v4) was used, then remove the config (usually located at ~/.config/mangal) as otherwise these commands will fail.

Config

Mangal contains sensitive defaults that can be edited with some command flags or by editing a config file. By default no config is written to disk, to write the default config to disk run:

mangal config write

It will be written to $XDG_CONFIG_HOME/mangal/mangal.toml.

Then, the config can be set either by modifying the file itself or by running:

mangal config set <key> <value>

For example:

mangal config set download.path $HOME/downloads_test

Providers

These are Lua scripts that handle the site scrape logic (search mangas, list mangas/chapters/images, etc). As shown in mangalorg/saturno, each provider is a directory with the main.lua (scraper) and mangal.toml (metadata) files inside.

Providers need to be placed in $XDG_CONFIG_HOME/mangal/providers.

A new provider can be created by running:

mangal providers new

It is automatically placed in the required path.

Templates

Special functions are available and can be shown by running:

mangal templates funcs

Run a template with custom functions available:

mangal templates exec <template> -v <values>

Where <template> is in the form of a go text/template and <values> a JSON. For example:

mangal templates exec "{{sanitizeWindows .Test}}" -v "{\"Test\":\"asdfg<>:?\"}"

Which will output asdfg.

Modes

Inline

Similar to mangal v4 inline mode. Two submodes available, download which is the expected option and json to fetch the metadata only useful to see what would be downloaded.

JSON

The minimal usage only fetches mangas found in the provider:

mangal inline json -p <provider-id> -q <query>

A more advanced use that fetches just some chapters with anilist output:

mangal inline json -p saturno-mangapill -q "Tengoku Daimakyou" -m exact -c 10-15 --chapter-populate

For more, use the -h flag.

Download

Works exactly like the json option but needs to select only one manga and has couple different flags:

mangal inline download -p saturno-mangapill -q "Tengoku Daimakyou" -m exact -c 10-15 -f CBZ -d "/custom/manga/root/path"

For more, use the -h flag.

Script

Similar to mangalorg/mangalcli where a run.lua and a "provider" is required:

mangal script -f run.lua -p mangapill -v "title=tengoku"

I'm using the sample mangapill.lua mentioned in Providers with the following modified run.lua:

local mangal = require('mangal')
local client = mangal.client
local fzf = mangal.prompt.fzf
local json = mangal.json

local mangas = client.search_mangas(Vars.title) -- search with the given title
local volumes = client.manga_volumes(fzf.find_one(mangas, function(manga)
  return manga:info().title
end)) -- select the first manga

local chapters = {}

-- get all chapters of the manga
for _, volume in ipairs(volumes) do
  for _, chapter in ipairs(client.volume_chapters(volume)) do
    table.insert(chapters, chapter)
  end
end

-- chapters encoded in json format for later use, e.g. pipe to jq
json.print(chapters)

mangal's People

Contributors

metafates avatar luevano avatar an-prata avatar jojoxd avatar 2096779623 avatar arabcoders avatar avidseeker avatar folliehiyuki avatar abbit avatar raj23689 avatar dependabot[bot] avatar

Stargazers

 avatar  avatar

Forkers

abbit

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.