parent
2b67fabcd7
commit
b562f643e6
@ -0,0 +1,11 @@
|
||||
Pár mých skriptů na scrapování map Správy železnic.
|
||||
|
||||
Dokumentace: spuštění `aio.sh` v nějaké dočasné složce udělá tu správnou věc, jinak vizte zdrojáky.
|
||||
|
||||
Napsal jsem to pro sebe, takže to má asi někde hardcodované cesty. Asi se
|
||||
nechystám to opravovat, ale jestli to někdo opraví, tak mi klidně pošlete patch
|
||||
:-)
|
||||
|
||||
Licence: MIT
|
||||
|
||||
Autor: `LEdoian <sz-dl-mapy@pokemon.ledoian.cz>` (dosaďte do template pro MIT licenci :-))
|
@ -0,0 +1,24 @@
|
||||
#!/bin/sh
|
||||
|
||||
scripts="$(dirname "$0")"
|
||||
|
||||
set -e
|
||||
|
||||
tmp=$(mktemp --tmpdir=/tmp tmp_szmapy_XXXXXXXXX)
|
||||
trap "rm $tmp" EXIT
|
||||
|
||||
"$scripts"/stahni.sh
|
||||
rename 'Show.aspx?path=%2FData%2FMapy%2F' '' *.pdf
|
||||
"$scripts"/smaz_duplikaty > "$tmp"
|
||||
echo "Will remove following files:"
|
||||
cat "$tmp"
|
||||
if grep -q --invert-match -E '^\./' "$tmp"; then
|
||||
# Some file is elsewhere
|
||||
echo "Please confirm (^C to kill)"
|
||||
read
|
||||
else
|
||||
echo "All files are in this directory, removing."
|
||||
fi
|
||||
< "$tmp" xargs rm -fv
|
||||
|
||||
#TODO: porovnání
|
@ -0,0 +1 @@
|
||||
for f in *; do diffpdf "$f" "/home/ledoian/SZDC/JR2020/Mapy/$f"; read -p'> ' ; done
|
@ -0,0 +1,21 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -eo pipefail
|
||||
|
||||
in_tmp() {
|
||||
local tmp="$(mktemp)"
|
||||
trap "rm $tmp" EXIT
|
||||
cat > "$tmp"
|
||||
(< "$tmp" xargs realpath -e | grep -v '^/tmp/') && exit 1
|
||||
# All good
|
||||
cat "$tmp"
|
||||
rm "$tmp"
|
||||
trap - EXIT
|
||||
}
|
||||
|
||||
najdi_duplikaty() {
|
||||
fdupes . ~/SZDC/Mapy/ -1 | cut -f2 -d' ' | in_tmp
|
||||
}
|
||||
|
||||
# Tohle neni bezpecne spoustet bez rozmyslu!!
|
||||
najdi_duplikaty # | xargs rm -v
|
Loading…
Reference in New Issue