reluce / szurubooru-toolkit

Python package and script collection to manage your szurubooru image board.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Sample cron job needs updating

shibaobun opened this issue · comments

Unfortunately, it seems like the example command in crontab_sample for the docker image cannot run, and needs to be modified to the following:

*/30 * * * *    cd /szurubooru-toolkit && /usr/local/bin/auto-tagger --add-tags deepbooru "-deepbooru -deepbooru" >/proc/1/fd/1 2>&1

Also, it seems like if you only want to search for a inverted tag (like -deepbooru), you have to append it twice, otherwise it errors with auto-tagger: error: the following arguments are required: query.

Thank you for all your work on this project!

The problem is that if your query starts with a dash (-), argparse will interpret it as an argument. There are some workarounds where you can use an equal sign between a keyword argument and the value (even if it doesn't make sense, like --add-tags=-foo), but since query is a positional argument, this won't work. In that case, you can just put a space after the double quote (like " -deepbooru").

Maybe there is an option for argparse to tweak that behavior, I'll take a look sometime this weekend. Then I'll also update the crontab command and push a new tag.

I updated the argparse logic, so if the query starts with a -, no errors get thrown in any of the scripts now (16ddbff).