From 35397427d71051fa6df4e4962285e23c8256c2c2 Mon Sep 17 00:00:00 2001 From: Danilo Reyes Date: Tue, 21 Jan 2025 09:59:59 -0600 Subject: [PATCH] wip migrating scripts --- defase_draws.sh | 7 +++++++ missingmanga.fish | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100755 defase_draws.sh create mode 100755 missingmanga.fish diff --git a/defase_draws.sh b/defase_draws.sh new file mode 100755 index 0000000..8989bd3 --- /dev/null +++ b/defase_draws.sh @@ -0,0 +1,7 @@ +#!/etc/profiles/per-user/jawz/bin/bash + +cd /home/jawz/Development/Websites/portfolio/content/ijwbs || exit + +for file in [0-9][0-9][0-9]_*; do + mv "$file" "$(printf '%03d_%s' $((10#${file%%_*} + 4)) "${file#*_}")" +done diff --git a/missingmanga.fish b/missingmanga.fish new file mode 100755 index 0000000..9f8fd97 --- /dev/null +++ b/missingmanga.fish @@ -0,0 +1,35 @@ +#! /usr/bin/env nix-shell +#! nix-shell -i fish -p fish + +set root_directories /srv/server/pool/multimedia/media/Library/comics \ + /srv/server/pool/multimedia/media/Library/manga/manga \ + /srv/server/pool/multimedia/media/Library/webtoons +set blacklist 'NOBLESSE|Air Gear' +for root_dir in $root_directories + for dir in (find $root_dir -mindepth 1 -type d) + cd $dir + fd -q -tfile $blacklist + if test $status -eq 0 + continue + end + fd -q -tfile '((\d+|\d+\.\d+)(\.cbz|\.pdf))$' + if test $status -eq 1 + continue + end + set max_chapter (find -not -name '*Annual*' -print0 | string match -ar '(\d+|\d+\.\d+)(?=\.cbz|\.pdf)' | sort -h | tail -n 1) + set min_chapter (find -not -name '*Vol.*' -not -name '*TPB*' -print0 | + string match -ar '(\d+|\d+\.\d+)(?=\.cbz|\.pdf)' | + sort -h | + head -n 1) + set ext (fd . | string match -r '(\.cbz|\.pdf)' | tail -n 1) + set base_name (fd . | string match -r '(.*(?