feat(scripts): added scripts for generating next batch
Browse files
next.sh
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/bin/bash
|
2 |
+
|
3 |
+
set -e
|
4 |
+
|
5 |
+
increment=20
|
6 |
+
|
7 |
+
first=$1
|
8 |
+
n_items=${2:-$increment}
|
9 |
+
offset=${3:-0}
|
10 |
+
|
11 |
+
first_to_fetch=$(($first + $offset))
|
12 |
+
|
13 |
+
first_index="$(printf '%04d' $first)"
|
14 |
+
last_index="$(printf '%04d' $(($first + $increment - 1)))"
|
15 |
+
|
16 |
+
folder="threads/$first_index-$last_index"
|
17 |
+
|
18 |
+
if test ! -d "$folder"; then
|
19 |
+
mkdir $folder
|
20 |
+
fi
|
21 |
+
|
22 |
+
last_to_fetch=$(($first_to_fetch + $n_items - 1))
|
23 |
+
|
24 |
+
for i in $(seq $first_to_fetch $last_to_fetch); do
|
25 |
+
printf "Fetching page %04d...\n" $i
|
26 |
+
# python -m much fetch $i -p "$folder" -i index.tsv
|
27 |
+
done
|
28 |
+
|
29 |
+
echo "Number of files in the directory '$folder': $(ls $folder | wc -l)"
|
30 |
+
echo "Number of lines in the 'index.tsv': $(cat index.tsv | wc -l)"
|
push.sh
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/bin/bash
|
2 |
+
|
3 |
+
set -e
|
4 |
+
|
5 |
+
increment=20
|
6 |
+
|
7 |
+
first=$1
|
8 |
+
|
9 |
+
first_index="$(printf '%04d' $first)"
|
10 |
+
last_index="$(printf '%04d' $(($first + $increment - 1)))"
|
11 |
+
|
12 |
+
folder="threads/$first_index-$last_index"
|
13 |
+
archive="threads-compressed/$first_index-$last_index.tar.xz"
|
14 |
+
|
15 |
+
tar -C "$folder" -cJvf "$archive" .
|
16 |
+
git add "$folder" "$archive" 'index.tsv'
|
17 |
+
git commit -m 'feat(batch): added next batch'
|
18 |
+
git push
|