1
0
Fork 0
mirror of https://github.com/Phantop/dotfiles synced 2024-12-26 15:06:50 +00:00
dotfiles/fish/functions/ao3.fish

9 lines
403 B
Fish

function ao3
grep works/.\*/b $argv | cut -d/ -f3 | uniq | parallel curl -OJL ao3.org/downloads/{}/1.epub
for i in *.epub
set title (tar Oxf $i content.opf | pup | grep -A1 -m1 dc:title | tail -1 | sed 's/^ *//' | tr -d /)
set creator (tar Oxf $i content.opf | pup | grep -A1 -m1 dc:creator | tail -1 | sed 's/^ *//' | tr -d /)
mv $i "$creator - $title.epub"
end
end