Thanks a lot to NobodX for his help with the commands system and Gelbooru.
First of all, know that using commands can slow down huge batch downloads (a recent computer may need from 100ms to 1s more per image, which is very consequent).
Note: in this wiki, I’ll consider that you’re using Windows. But on Linux & other OSes, it should be pretty much the same (use the cp command instead of copy, LAMP (linux) / MAMP (mac) instead of WAMP, etc.).
First, we’re going to install WAMP, which contains everything required to have a local web server.
C:\wamp
)1
in the images
folder.images
, images/1
and thumbnails
folders writable permissions.utf8_unicode_ci
encoding.SET GLOBAL log_bin_trust_function_creators = 1;
Replace the line | By |
$mysql_user = "gelbooru"; | $mysql_user = "root"; |
$mysql_pass = "test"; | $mysql_pass = ""; |
$mysql_db = "asdf"; | $mysql_db = "gelbooru"; |
$site_url = "http://127.0.0.1/branches/0.1.10/0.1.10/"; | $site_url = "http://localhost/gelbooru"; |
$site_url3 = "Default Booru"; | $site_url2 = $site_url3 = "Localbooru"; |
(you can change “Localbooru” to anything: it will be the name of the booru)
$lowerlimit = 20;
$no_cache = false;
$tag_count = 20;
$new_tag_list = 'iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii';
$new_user_list = 'iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii';
$new_cthreshold = 0;
$new_pthreshold = 0;
$new_my_tags = '';
error_reporting(0);
You can of course change these values to whatever you want.
C:\wamp\www\gelbooru\install
folder.ALTER TABLE `tag_index` ADD PRIMARY KEY (`tag`)
Launch Grabber, then open the options window and go to the “Commands” part. Set it to those values:
C:\Windows\System32\cmd.exe /C copy "%path%" "C:\wamp\www\gelbooru\images\1\%md5%.%ext%"
Note: be careful to put the blank character (ALT+255) between “cmd.exe” and “/C”. Otherwise, the two string were stuck, and the command is not recognized (at least in version 5.4.2 of Grabber).
And, in the Database part:
QMYSQL
localhost
root
gelbooru
INSERT INTO posts(creation_date, hash, image, height, width, ext, rating, tags, directory, active_date) VALUES(NOW(), "%md5%", "%md5%.%ext%", %height%, %width%, ".%ext%", "%rating%", " %allo% ", "1", "20110619");
INSERT INTO tag_index(tag, index_count) VALUES("%tag%", 1) ON DUPLICATE KEY UPDATE index_count = index_count+1;
UPDATE post_count SET pcount = (SELECT COUNT(*) FROM posts), last_update = (CURDATE() + 0) WHERE access_key = "posts";
Now, every time you save an image, a copy will be created in your local booru!
If you test, you’ll see that it doesn’t totally work: thumbnails are not generated when doing this. To fix this, just visit http://localhost/gelbooru/thumbs_fix.php. Note that you must be logged in as administrator in Gelbooru to do this.
By default, the minimal size for tags is 4. You may want to change this behavior to allow the search of shorter tags (some popular tags, such as “v”, are only one character long).
To do this, open your “my.ini” file by clicking on the Wamp icon in the system tray, then “MySQL > my.ini”.
Search for [mysqld]
in the file, and just under, add ft_min_word_len=1
on a new line (1 is to allow tags which are one characters long, you can set it to whatever you want, by default it is 4). Same thing for [myisamchk]
.
The end of your file should now look like this (there can be minor differences):
[myisamchk]
ft_min_word_len=1
key_buffer = 20M
sort_buffer_size = 20M
read_buffer = 2M
write_buffer = 2M
[mysqlhotcopy]
interactive-timeout
[mysqld]
ft_min_word_len=1
port=3306
Then go to phpMyAdmin, in the “gelbooru” database, check all the tables and choose “Repair tables” in the list.