remove psutil, fix buf in tmux popup

This commit is contained in:
cubernetes 2023-08-11 09:47:55 +02:00
parent 1137636973
commit 718beff199
3 changed files with 7 additions and 15 deletions

View File

@ -2,11 +2,9 @@
import sys import sys
import random import random
import psutil
import numpy as np import numpy as np
import cv2 import cv2
from cv2 import VideoCapture
from utils import * from utils import *
@ -103,9 +101,8 @@ def show_frame(frame: np.ndarray, to_stdout: bool=False) -> None:
def main() -> int: def main() -> int:
music = start_game_sfx() music = start_game_sfx()
music_p = psutil.Process(pid=music.pid)
capture: VideoCapture = cv2.VideoCapture(0) capture: cv2.VideoCapture = cv2.VideoCapture(0)
hands: mp.solutions.hands.Hands = mp_hands.Hands(max_num_hands=1) hands: mp.solutions.hands.Hands = mp_hands.Hands(max_num_hands=1)
collected_42: bool = True collected_42: bool = True
noise_42img: int = 5 noise_42img: int = 5
@ -158,7 +155,6 @@ def main() -> int:
lost_sfx() lost_sfx()
return score return score
for positions in finger_positions: for positions in finger_positions:
index_knuckle_1_pos: tuple[int, int] = (-1, -1) index_knuckle_1_pos: tuple[int, int] = (-1, -1)
for finger_id, finger_x, finger_y in positions: for finger_id, finger_x, finger_y in positions:
@ -182,9 +178,7 @@ def main() -> int:
i = 0 i = 0
score += 42 score += 42
if score == 4200 / 4: # that's 25 collects if score == 4200 / 4: # that's 25 collects
music_p.suspend()
initiate_rick() initiate_rick()
music_p.resume()
timer = 60 + (timer - 60) * .9 timer = 60 + (timer - 60) * .9
collect_sfx() collect_sfx()
show_frame(frame, to_stdout=(not sys.stdout.isatty())) show_frame(frame, to_stdout=(not sys.stdout.isatty()))
@ -192,4 +186,3 @@ def main() -> int:
if __name__ == '__main__': if __name__ == '__main__':
save_score(main()) save_score(main())
sys.exit(0)

View File

@ -23,12 +23,12 @@ def show_highscore() -> None:
'-E', '-E',
'watch', 'watch',
'-tcn.6', '-tcn.6',
r"""bash -c r"""bash -c \
'for _ in $(seq $(($(tput lines) / 3 - 1))); 'for _ in $(seq $(($(tput lines) / 3 - 1)));\
do printf "\n\033[31m"; do printf "\n\033[31m";\
done; done;\
printf "%$(($(tput cols) / 2 + 5))s\n" "Highscore:"; printf "%$(($(tput cols) / 2 + 5))s\n" "Highscore:";\
figlet -w $(tput cols) -c $(cat "/home/tosuman/42/hackthelobby/.score"); figlet -w $(tput cols) -c $(cat "/home/tosuman/42/hackthelobby/.score");\
printf "\n\033[3$((RANDOM % 7 + 1))m%$(($(tput cols) / 2 + 4 + RANDOM % 8))s\n" "Show your hands!"'""", printf "\n\033[3$((RANDOM % 7 + 1))m%$(($(tput cols) / 2 + 4 + RANDOM % 8))s\n" "Show your hands!"'""",
]) ])

View File

@ -14,7 +14,6 @@ opencv-python==4.8.0.76
packaging==23.1 packaging==23.1
Pillow==10.0.0 Pillow==10.0.0
protobuf==3.20.3 protobuf==3.20.3
psutil==5.9.5
pycparser==2.21 pycparser==2.21
pyparsing==3.0.9 pyparsing==3.0.9
python-dateutil==2.8.2 python-dateutil==2.8.2