server/tools: add generate-thumb
This commit is contained in:
parent
accb5a9187
commit
74fba05302
1 changed files with 27 additions and 0 deletions
27
server/generate-thumb
Executable file
27
server/generate-thumb
Executable file
|
@ -0,0 +1,27 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
'''
|
||||||
|
Generates thumbnails for posts from CLI. Useful for testing changes to
|
||||||
|
thumbnail generators, and for weird inputs.
|
||||||
|
'''
|
||||||
|
|
||||||
|
import argparse
|
||||||
|
import os.path
|
||||||
|
import sys
|
||||||
|
from szurubooru.func import posts
|
||||||
|
|
||||||
|
def main():
|
||||||
|
parser = argparse.ArgumentParser('Starts szurubooru using waitress.')
|
||||||
|
parser.add_argument('post_id', metavar='POST', help='post to generate thumbnail for')
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
try:
|
||||||
|
post = posts.get_post_by_id(args.post_id)
|
||||||
|
posts.generate_post_thumbnail(post)
|
||||||
|
except posts.PostNotFoundError:
|
||||||
|
pass
|
||||||
|
except:
|
||||||
|
raise
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
Loading…
Reference in a new issue