more scripts cleanup, added "yarn rebuild-hashes"

This commit is contained in:
Bobby Wibowo 2020-12-27 19:00:00 +07:00
parent 7f3b947eb0
commit 8c85f977fd
No known key found for this signature in database
GPG Key ID: 51C3A1E1E22D26CF
3 changed files with 27 additions and 10 deletions

View File

@ -94,16 +94,16 @@ To generate thumbnails for those files, you can use `yarn thumbs`.
```none
$ yarn thumbs
$ node ./scripts/thumbs.js
Generate thumbnails.
Usage :
node scripts/thumbs.js <mode=1|2|3> [force=0|1] [verbose=0|1] [cfcache=0|1]
Usage:
node scripts/thumbs.js <mode=1|2|3> [force=0|1] [verbose=0|1] [cfcache=0|1] [parallel]
mode : 1 = images only, 2 = videos only, 3 = both images and videos
force : 0 = no force (default), 1 = overwrite existing thumbnails
verbose: 0 = only print missing thumbs (default), 1 = print all
cfcache: 0 = do not clear cloudflare cache (default), 1 = clear cloudflare cache
mode : 1 = images only, 2 = videos only, 3 = both images and videos
force : 0 = no force (default), 1 = overwrite existing thumbnails
verbose : 0 = only print missing thumbs (default), 1 = print all, 2 = print nothing
cfcache : 0 = do not clear cloudflare cache (default), 1 = clear cloudflare cache
parallel: amount of thumbs to generate in parallel (not to be confused with multi-threading).
```
For example, if you only want to generate thumbnails for image files without overwriting existing ones, you can run `yarn thumbs 1`, or if you want to generate thumbnails for both image and video files, while also overwriting existsing ones, you can run `yarn thumbs 3 1`.

View File

@ -25,6 +25,7 @@
"cf-purge": "node ./scripts/cf-purge.js",
"clean-up": "node ./scripts/clean-up.js",
"delete-expired": "node ./scripts/delete-expired.js",
"rebuild-hashes": "node ./scripts/rebuild-hashes.js",
"thumbs": "node ./scripts/thumbs.js",
"pull": "git pull && yarn --production",
"stash": "git stash || true",

View File

@ -5,7 +5,6 @@
```none
$ yarn cf-purge
$ node ./scripts/cf-purge.js
Purge Cloudflare's cache.
Usage:
@ -20,7 +19,6 @@ Upload names separated by space (will automatically include their thumbs if avai
```none
$ yarn clean-up -h
$ node ./scripts/clean-up.js -h
Clean up files that are not in the database.
Usage:
@ -36,7 +34,6 @@ mode:
```none
$ yarn delete-expired -h
$ node ./scripts/delete-expired.js -h
Bulk delete expired files.
Usage:
@ -48,6 +45,25 @@ mode:
2 = Delete expired files (no output).
```
## rebuild-hashes.js
```none
$ yarn rebuild-hashes -h
$ node ./scripts/rebuild-hashes.js -h
Rebuild file hashes.
Usage:
node scripts/rebuild-hashes.js <mode=0|1|2> [parallel]
mode:
0 = Dry run (recalculate hashes, print them, but do NOT store to DB).
1 = Recalculate hashes and store to DB.
2 = Verbose (recalculate hashes, print them, and store to DB).
parallel:
Amount of uploads to hash in parallel (not to be confused with multi-threading).
```
## thumbs.js
[\[...\]](https://github.com/BobbyWibowo/lolisafe#script-for-missing-thumbnails)