diff --git a/insomniac/__version__.py b/insomniac/__version__.py index eeeaf55..9ce1903 100644 --- a/insomniac/__version__.py +++ b/insomniac/__version__.py @@ -13,7 +13,7 @@ __title__ = 'insomniac' __description__ = 'Simple Instagram bot for automated Instagram interaction using Android.' __url__ = 'https://github.com/alexal1/Insomniac/' -__version__ = '3.7.27' +__version__ = '3.7.28' __debug_mode__ = False __author__ = 'Insomniac Team' __author_email__ = 'info@insomniac-bot.com' diff --git a/insomniac/session.py b/insomniac/session.py index 23df03d..e34bb0d 100644 --- a/insomniac/session.py +++ b/insomniac/session.py @@ -136,7 +136,7 @@ def update_session_speed(args): def should_close_app_after_session(args, device_wrapper): if args.repeat is None: return True - if float(args.repeat) > 0: + if not is_zero_value(args.repeat): return True return not Session.is_next_app_id_same(args, device_wrapper) diff --git a/insomniac/utils.py b/insomniac/utils.py index f18fb9f..a5af710 100644 --- a/insomniac/utils.py +++ b/insomniac/utils.py @@ -174,11 +174,16 @@ def execute_command(cmd) -> Optional[str]: except IndexError: # There's a bug in some Python versions that raises this error https://github.com/python/cpython/pull/24777 return None - err = cmd_res.stderr.strip() - if err: - print(COLOR_FAIL + err + COLOR_ENDC) + err = cmd_res.stderr + out = cmd_res.stdout + if err is not None: + err = err.strip() + if len(err) > 0: + print(COLOR_FAIL + err.strip() + COLOR_ENDC) return None - return cmd_res.stdout.strip() + if out is not None: + return out.strip() + return None def save_crash(device, ex=None): @@ -293,6 +298,16 @@ def print_error(): return value +def is_zero_value(count: str) -> bool: + parts = count.split("-") + if len(parts) == 1: + try: + return float(count) == 0 + except ValueError: + pass + return False + + def get_left_right_values(left_right_str, name, default): def print_error(): print(COLOR_FAIL + name.format(default) + f". Using default value instead of \"{left_right_str}\", because it "