added a migration tool from file to api
This commit is contained in:
parent
0613e13d0e
commit
5d4888dc1b
|
@ -0,0 +1,36 @@
|
|||
#!/bin/bash
|
||||
|
||||
APP=""
|
||||
SECRET=""
|
||||
BACKEND=""
|
||||
|
||||
# This script should be run on your bitch repository after a sync
|
||||
|
||||
# Get token to work on the API
|
||||
token=$(curl $BACKEND/login -H "Content-type: application/json" -d "{\"app\":\"$APP\",\"secret\":\"$SECRET\"}' | jq -r .token)
|
||||
|
||||
# Add the rejected urls
|
||||
while read url; do
|
||||
curl $BACKEND/images -H "Authorization: Bearer $token" -H "Content-type: application/json" -d "{\"url\": \"$url\", \"status\": \"unavailable\", \"tags\": [\"sleeping\", \"2girl\"]}"
|
||||
echo ""
|
||||
done <rejected.csv
|
||||
|
||||
echo "Posted all rejected urls"
|
||||
read -n 1
|
||||
|
||||
# Add the posted urls
|
||||
while read url; do
|
||||
curl $BACKEND/images -H "Authorization: Bearer $token" -H "Content-type: application/json" -d "{\"url\": \"$url\", \"status\": \"consumed\", \"tags\": [\"sleeping\", \"2girl\"]}"
|
||||
echo ""
|
||||
done <posted.csv
|
||||
|
||||
echo "Posted all posted urls"
|
||||
read -n 1
|
||||
|
||||
# Add the rest of urls
|
||||
while read url; do
|
||||
curl $BACKEND/images -H "Authorization: Bearer $token" -H "Content-type: application/json" -d "{\"url\": \"$url\", \"status\": \"available\", \"tags\": [\"sleeping\", \"2girl\"]}"
|
||||
echo ""
|
||||
done <urls.csv
|
||||
|
||||
echo "Posted all urls, bot database migrated"
|
Loading…
Reference in New Issue