McCloudS / subgen

Autogenerate subtitles using OpenAI Whisper Model via Jellyfin, Plex, Emby, Tautulli, or Bazarr
MIT License
532 stars 48 forks source link

alternative lenient bool converter #7

Closed clach04 closed 1 year ago

clach04 commented 1 year ago

https://github.com/McCloudS/subgen/blob/fe3d26d910629d9bf5fc1184900ef21115563e4a/subgen/subgen.py#L19

def force_bool_optimistic(in_bool):
    """Force string value into a Python boolean value
    Everything is True with the exception of; false, off, and 0"""
    value = str(in_bool).lower()
    if value in ('false', 'off', '0'):
        return False
    else:
        return True
McCloudS commented 1 year ago

Thanks. That should be a little more user-proof. Just implemented it into my already poorly named "converttobool".