Skip to content

Commit

Permalink
Add restrict to tiles.list
Browse files Browse the repository at this point in the history
If entries are over a month ago, remove them from tiles.list
  • Loading branch information
Hsieh Chin Fan committed Jan 31, 2021
1 parent 0b782c7 commit 15653a2
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion scripts/update-tile-list.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
#! /bin/bash

LIST=tiles.list && touch $LIST
LAST_MONTH_TIMESTAMP=$(date --date='-1 month' +%s)

git status tiles/ --short | awk -v date="$(date +%s)" '{print date, $2}' | cat - $LIST >$LIST.bak
git status tiles/ --short | awk -v date="$(date +%s)" '{print date, $2}' \
| cat - $LIST \
| while read timestamp tile; do
# remove entries that over a month ago
[[ $timestamp -lt $LAST_MOTH_TIMESTAMP ]] && break
echo $timestamp $tile
done >$LIST.bak

sort -u -k2 <$LIST.bak >$LIST
rm $LIST.bak

0 comments on commit 15653a2

Please sign in to comment.