-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
72 lines (56 loc) · 3.02 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# Moebooru host to get your favoirite and download images from
# you should set this from thr command line, like this
# make <target> MOEBOORU_HOST=yande.re
# or just set env variable MOEBOORU_HOST=yande.re
export MOEBOORU_HOST
MOEBOORU_HOSTNAME=$(shell node util/get-hostname-from-url.js $(MOEBOORU_HOST))
# Your directory to store your images (separated by hostname)
ifdef IMAGE_DIR
IMAGE_DIR=$(IMAGE_DIR)
else
IMAGE_DIR=$(HOME)/Pictures/$(MOEBOORU_HOSTNAME)
endif
# Moebooru username to get your favoirite
# you should set this from thr command line, like this
# make <target> MOEBOORU_USERNAME=username
# or just set env variable MOEBOORU_USERNAME=username
export MOEBOORU_USERNAME
# proxy server to use to connect to moebooru (optional)
# you should set this from thr command line, like this
# make <target> PROXY=http://127.0.0.1:1087
export PROXY
all: get_favorites_and_sync_to_danbooru
get-tags-delta:
# get tags from moebooru (only the ones that are not already fetched)
@echo "\033[32;1mGetting tags from moebooru...\033[0m"
export http_proxy=$(PROXY) && export https_proxy=$(PROXY) && node get-tags-delta.js $(MOEBOORU_HOST)
get-tags-all:
# get all tags from moebooru
@echo "\033[32;1mGetting tags from moebooru...\033[0m"
export http_proxy=$(PROXY) && export https_proxy=$(PROXY) && node get-tags-all.js $(MOEBOORU_HOST)
update-tags-delta:
# update tags of your danbooru instance (only the ones that are not already fetched)
@echo "\033[32;1mUpdating tags of your danbooru instance...\033[0m"
node update-tags-delta.js $(MOEBOORU_HOST)
# run this rugularly, since delta update is not always updating the tags that need to be updated
update-tags-all:
# update all tags of your danbooru instance
@echo "\033[32;1mUpdating tags of your danbooru instance...\033[0m"
node update-tags-all.js $(MOEBOORU_HOST)
get-user-favorites-delta:
# get your favorite images from moebooru (only the ones that are not already fetched)
@echo "\033[32;1mGetting your favorites from moebooru...\033[0m"
export http_proxy=$(PROXY) && export https_proxy=$(PROXY) && node get-user-favorites-delta.js $(MOEBOORU_HOST) $(MOEBOORU_USERNAME)
download-post-images:
# download images from moebooru (original images)
@echo "\033[32;1mDownloading the newly added favorites from moebooru ...\033[0m"
export http_proxy=$(PROXY) && export https_proxy=$(PROXY) && node download-post-images.js data/$(MOEBOORU_HOSTNAME)-favorites-delta.json $(IMAGE_DIR)
upload-images-from-dir:
# upload images to your danbooru instance (your danbooru host and account need to be set in the .env)
@echo "\033[32;1mUploading the downloaded images to your danbooru instance...\033[0m"
node upload-images-from-dir.js $(MOEBOORU_HOST) $(IMAGE_DIR)
update-favorites-delta:
# update local status, set them as updated by removing them from the <host>-favorites-delta.json
node update-favorites-delta.js $(MOEBOORU_HOST) $(IMAGE_DIR)
get-and-update-tags-all: get-tags-delta update-tags-all
get_favorites_and_sync_to_danbooru: get-user-favorites-delta download-post-images upload-images-from-dir update-favorites-delta