From 0ed2a2071fe5b7610d4e4122096129857359b651 Mon Sep 17 00:00:00 2001
From: David Luevano Alvarado This Configure it by editing My changes (shown above): If you’re going to run it locally (or LAN/VPN) you can start the If you’re going to run it locally (or LAN/VPN) you can start the Create the reverse proxy configuration (this is for If it’s going to be used as a subdir on another domain then just change the If it’s going to be used as a subdir on another domain then just change the If using a subdir then the same certificate for the subdomain/domain should work fine and no extra stuff is needed, else if following along me then we can create/extend the certificate by running: So instad of installing with Then clone my fork of Then clone my fork of This will use This will use Check it was correctly installed by running Two main ways of using Before continuing, I gotta say I went through some bullshit while trying to use the custom Lua scrapers that use the headless browser (actually just a wrapper of go-rod/rod, and honestly it is not really a “headless” browser, Before continuing, I gotta say I went through some bullshit while trying to use the custom Lua scrapers that use the headless browser (actually just a wrapper of go-rod/rod, and honestly it is not really a “headless” browser, There is no concrete documentation on the “headless” browser, only that it is automatically set up and ready to use… but it doesn’t install any library/dependency needed. I discovered the following libraries that were missing on my Arch minimal install: Download manga using the TUI by selecting the source/scrapper, search the manga/comic you want and then you can select each chapter to download (use Note that some scrapters will contain duplicated chapters, as they have uploaded chapters from the community. This happens a lot with MangaDex. Note that some scrapters will contain duplicated chapters, as they have multiple uploaded chapters from the community, usually for different scanlation groups. This happens a lot with MangaDex. The inline mode is a single terminal command meant to be used to automate stuff or for more advanced options. You can peek a bit into the “documentation” which honestly its ass because it doesn’t explain much. The minimal command for inline according to the help is: But this will not produce anything because it also needs But this will not produce anything because it also needs Something not mentioned anywhere is the Similar to That said, I’ll do an example by using Mangapill as source, and will search for Demon Slayer: Kimetsu no Yaiba: I make sure the json output contains the correct manga information: name, url, etc.. Which means that all “searches” for that Which means that all “searches” for that komga package creates a komga (service) user and group which is tied to the also included komga.service./etc/komga.conf:SERVER_PORT=8989
+SERVER_PORT=8989
SERVER_SERVLET_CONTEXT_PATH=/ # this depends a lot of how it's going to be served (domain, subdomain, ip, etc)
KOMGA_LIBRARIES_SCAN_CRON="0 0 * * * ?"
@@ -176,14 +176,14 @@ KOMGA_DATABASE_BACKUP_SCHEDULE="0 0 */8 * * ?"
8989 because 8080 its too generic.cron schedules
+
-cron schedules.
cron but rather a cron-like syntax used by Spring as stated in the Komga config.komga.service and access it via IP at http://<your-server-ip>:<port>(/base_url) as stated at Komga: Accessing the web interface, else continue with the next steps for the reverse proxy and certificate.komga.service and access it via IP at http://<your-server-ip>:<port>(/base_url) as stated at Komga: Accessing the web interface, then you can continue with the mangal section, else continue with the next steps for the reverse proxy and certificate.Reverse proxy¶
nginx). In my case I’ll use a subdomain, so this is a new config called komga.conf at the usual sites-available/enabled path:
-server {
@@ -203,7 +203,7 @@ KOMGA_DATABASE_BACKUP_SCHEDULE="0 0 */8 * * ?"
}
}
location (with /subdir instead of /) directive to the corresponding .conf file; be careful with the proxy_pass directive, it has to match what you configured at /etc/komga.conf for the SERVER_SERVLET_CONTEXT_PATH regardless of the /subdir you selected at location.location with /subdir instead of /; be careful with the proxy_pass directive, it has to match what you configured at /etc/komga.conf for the SERVER_SERVLET_CONTEXT_PATH regardless of the /subdir you selected at location.SSL certificate¶
certbot --nginx
@@ -259,12 +259,12 @@ default:other::r-x
yay we’ll build it from source. We need to have go installed:
-pacman -S go
mangal and build/install it:mangal and build/install it:
-git clone https://github.com/luevano/mangal.git # not sure if you can use SSH to clone
cd mangal
make install # or just `make build` and then move the binary to somewhere in your $PATH
go install so it will install to a path specified by your environment variables, for more run go help install. It was installed to $HOME/.local/bin/go/mangal for me, then just make sure this is included in your PATH.go install so it will install to a path specified by the go environment variables, for more run go help install. It was installed to $HOME/.local/bin/go/mangal for me because my env vars, then just make sure this is included in your PATH.mangal version, which should print something like:▇▇▇ mangal
@@ -292,11 +292,11 @@ mangal config set -k logs.write -v true # I like to get logs for what happens
Usage¶
mangal:
-
Headless browser¶
-mangal “documentation” is just wrong). For mor on my rant check out my last entry.mangal “documentation” is just wrong). For more on my rant check out my last entry.
mangal
tab to select all). This is what I use when downloading manga that already finished publishing, or when I’m just searching and testing out how it downloads the manga (directory name, and manga information).Inline¶
-mangal inline --manga <option> --query <manga-title>
--source (or set the default using the config key downloader.default_sources) and either --json (for the search result) or --download to actually download whatever was found but it could download something you don’t want so do the --json first.--source (or set the default using the config key downloader.default_sources) and either --json which basically just does the search and returns the result in json format or --download to actually download whatever is found; I recommend to do --json first to check that the correct manga will be downloaded then do --download.--manga flag options (found it at the source code), it has 3 available options:
+first: first manga entry found for the search.last: last manga entry found for the search.exact: exact manga title match. This is the one I use.--chapters, there are a few options not explained (that I found at the source code, too). I usually just use all but other options:
+
all: all chapters found in the chapter list.first: first chapter found in the chapter list.last: last chapter found in the chapter list[from]-[to]: selector for the chapters found in the chapter list, index starts at 0.
+
+from or to) exceed the amount of chapters in the chapterlist it just adjusts to he maximum available.to to be the last chapter, it did to + 1 and it failed due to index out of range.@[sub]@: not sure how this works exactly, my understanding is that it’s for “named” chapters.
mangal inline --source "Mangapill" --manga "exact" --query "Kimetsu no Yaiba" --json | jq # I use jq to pretty format the output
-
---include-anilist-manga to include anilist information (if any) so you can check that the correct anilist id is attached. If the correct one is not attached (and it exists) then you can run the command:sh
-mangal inline anilist set --name "Kimetsu no Yaiba" --id 101922--name flag will be attached to that specific anilist ID.
-3. If I’m okay with the outputs, then I change --json for --download to actually download:
+mangal inline anilist set --name "Kimetsu no Yaiba" --id 101922
+--name flag will be attached to that specific anilist ID.
+
--json for --download to actually download:
@@ -358,26 +370,26 @@ mangal inline anilist set --name "Kimetsu no Yaiba" --id 101922mangal inline --source "Mangapill" --manga "exact" --query "Kimetsu no Yaiba" --download
series.json file and it contains a cover.<img-ext>; this usually means it correctly pulled information from anilist and that it will contain metadata Komga will be able to use.Now I just check that it is correctly added to Komga by clicking on the 3 dots to the right of the library name and click on “Scan library files” to refresh if the cron timer hasn’t pass by yet.
+Now I just check that it is correctly added to Komga by clicking on the 3 dots to the right of the library name and click on “Scan library files” to refresh if the cron timer hasn’t activated this yet.
Then I check that the metadata is correct (once the manga is fully indexed), such as title, summary, chapter count, language, tags, genre, etc., which honestly it never works fine as mangal creates the series.json with the comicId field with an upper case I and Komga expects it to be a lower case i (comicid) so it falls back to using the info from the first chapter. I’ll probably will fix this on mangal side, and see how it goes.
So, what I do is manually edit the metadata for the manga, by changing whatever it’s wrong or add what’s missing (I like adding anilist and MyAnimeList links) and then leave it as is.
The straight forward approach for automation is just to bundle a bunch of mangal inline commands in a shell script and automate either via cron or systemd/Timers. But, as always, I overcomplicated/overengineered my approach, which is the following:
The straight forward approach for automation is just to bundle a bunch of mangal inline commands in a shell script and schedule it’s execution either via cron or systemd/Timers. But, as always, I overcomplicated/overengineered my approach, which is the following:
mangal, this includes anilist bindings.--chapters "all" and it will work. This is mostly to keep the logs/output cleaner/shorter.--chapters "all" and it will work but I do it mostly to keep the logs/output cleaner/shorter.mangal inline.systemd service and timer.systemd service and timer.Manga list example:
mangapill="Berserk|Chainsaw Man|Dandadan|Jujutsu Kaisen|etc..."
-Bash function that handles the download per manga in the list:
+Function that handles the download per manga in the list:
mangal_src_dl () {
source_name=$1
manga_list=$(echo "$2" | tr '|' '\n')
@@ -413,6 +425,22 @@ mangal inline anilist set --name "Kimetsu no Yaiba" --id 101922
}
Where $TRACKER_FILE is just a variable holding a path to some file where you can store the tracking and $DOWNLOAD_FORMAT the format for the mangas, for me it’s cbz. Then the usage would be something like mangal_src_dl "Mangapill" "$mangapill", meaning that it is a function call per source.
A simpler function without “tracking” would be:
+mangal_src_dl () {
+ source_name=$1
+ manga_list=$(echo "$2" | tr '|' '\n')
+
+ while IFS= read -r line; do
+ echo "Downloading all chapters for $line from $source_name..."
+ mangal inline -S "$source_name" -q "$line" -m "exact" -F "$DOWNLOAD_FORMAT" -c "all" -d
+ if [ $? -ne 0 ]; then
+ echo "Failed to download chapters for $line."
+ continue
+ fi
+ echo "Finished downloading chapters for $line."
+ done <<< "$manga_list"
+}
+
The tracker file would have a format like follows:
# Updated: 06/10/23 10:53:15 AM CST
Berserk|0392|392|Mangapill
@@ -420,8 +448,12 @@ Dandadan|0110|110|Mangapill
...
And note that if you already had manga downloaded and you run the script for the first time, then it will show as if it downloaded everything from the first chapter, but that’s just how mangal works, it will actually just discover downloaded chapters and only download anything missing.
Any configuration the downloader/updater might need needs to be done before the mangal_src_dl calls. I like to configure mangal for download path, format, etc.. To clear the mangal cache and rod browser (headless browser used in some custom sources) as well as set up any anilist bindings. An example of an anilist binding I had to do is for Mushoku Tensei, as it has both a light novel and manga version, both having different information, for me it was mangal inline anilist set --name "Mushoku Tensei - Isekai Ittara Honki Dasu" --id 85564.
Finally is just a matter of using your prefered way of scheduling, I’ll use systemd/Timers but anything is fine. You could make the downloader script more sophisticated and only running every week on which each manga gets released usually, but that’s too much work, so I’ll just run it once daily probably, or 2-3 times daily.
Any configuration the downloader/updater might need needs to be done before the mangal_src_dl calls. I like to configure mangal for download path, format, etc.. I found that it is needed to clear the mangal and rod browser cache (headless browser used in some custom sources) from personal experience and from others: mangal#170 and kaizoku#89.
Also you should set any anilist binding necessary for the downloading (as the cache was cleared). An example of an anilist binding I had to do is for Mushoku Tensei, as it has both a light novel and manga version, which for me it’s the following binding:
+mangal inline anilist set --name "Mushoku Tensei - Isekai Ittara Honki Dasu" --id 85564
+
+Finally is just a matter of using your prefered way of scheduling, I’ll use systemd/Timers but anything is fine. You could make the downloader script more sophisticated and only running every week on which each manga gets (usually) released but that’s too much work; I’ll just run it once daily probably.
A feature I want to add and probably will is sending notifications (probably through email) on a summary for manga downloaded or failed to download so I’m on top of the updates. For now this is good enough and it’s been working so far.
Just for the record, here is a list of downloaders/scrapers I considered before starting to use mangal:
By David Luévano
Created: Sat, Jun 10, 2023 @ 19:36 UTC
+Modified: Sun, Jun 11, 2023 @ 10:33 UTC