From 355f55f28c675fc1877d214aeda7fab0dd24bcbc Mon Sep 17 00:00:00 2001 From: Phantop Date: Fri, 21 Aug 2020 15:12:16 -0400 Subject: [PATCH] Move ao3dl from fish to two bash scripts --- .config/fish/functions/ao3dl.fish | 16 ---------------- .local/bin/ao3.1 | 5 +++++ .local/bin/ao3.2 | 5 +++++ 3 files changed, 10 insertions(+), 16 deletions(-) delete mode 100644 .config/fish/functions/ao3dl.fish create mode 100755 .local/bin/ao3.1 create mode 100755 .local/bin/ao3.2 diff --git a/.config/fish/functions/ao3dl.fish b/.config/fish/functions/ao3dl.fish deleted file mode 100644 index c3d6725..0000000 --- a/.config/fish/functions/ao3dl.fish +++ /dev/null @@ -1,16 +0,0 @@ -function ao3dl - set dir (sed (math (grep -n '' $argv | cut -d: -f1) + 1)!d $argv | sed -e 's/^[ \t]*//') - mkdir $dir; cd $dir - for i in (grep works/[0-9]\* ../$argv -o | uniq | sed 's/works\///g' | sed '/^$/d') - dl https://download.archiveofourown.org/downloads/$i/\*.epub - end - cd .. - - for i in (lynx -dump -hiddenlinks=listonly out.html | grep '\.epub' | awk 'FNR > 2 {print$2}' | grep http) - dl $i - end - - for i in (find . -maxdepth 2 -printf "%f\n" | sort -f | uniq -di) - mv $i */$i - end -end diff --git a/.local/bin/ao3.1 b/.local/bin/ao3.1 new file mode 100755 index 0000000..b2ffc4c --- /dev/null +++ b/.local/bin/ao3.1 @@ -0,0 +1,5 @@ +#!/bin/bash +for i in $(grep works/[0-9]\* $@ -o | uniq | sed 's/works\///g' | sed '/^$/d') +do + aria2c https://download.archiveofourown.org/downloads/$i/\*.epub +done diff --git a/.local/bin/ao3.2 b/.local/bin/ao3.2 new file mode 100755 index 0000000..4b7d9db --- /dev/null +++ b/.local/bin/ao3.2 @@ -0,0 +1,5 @@ +#!/bin/bash +for i in $(lynx -dump -hiddenlinks=listonly $@ | grep '\.epub' | awk 'FNR > 2 {print$2}' | grep http) +do + aria2c $i +done