reluce / szurubooru-toolkit

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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

convert_image tries to convert MP4s

Nota-Nom opened this issue · comments

convert_image in upload_media.py will attempt to convert (shrink) files that it has no business modifying.

EDIT:
Here is the error:

$ poetry run upload-media
[INFO] [23.05.2022, 17:44:58 EDT]: Found 43 file(s). Starting upload...
Traceback (most recent call last):                                              
  File "<string>", line 1, in <module>
  File "/home/user/szurubooru-toolkit/src/szurubooru_toolkit/scripts/upload_media.py", line 292, in main
    upload_post(file, file_ext=Path(file_to_upload).suffix[1:], file_to_upload=file_to_upload)
  File "/home/user/szurubooru-toolkit/src/szurubooru_toolkit/scripts/upload_media.py", line 230, in upload_post
    post.image = convert_image(file, file_ext, file_to_upload)
  File "/home/user/szurubooru-toolkit/src/szurubooru_toolkit/scripts/upload_media.py", line 223, in convert_image
    return image
UnboundLocalError: local variable 'image' referenced before assignment

Yes, I don't work with with video files that often, so there might be a few other instances that I overlooked.

I pushed a fix and updated the version, thanks for reporting!