forked from TotalBattleBots/Exchange-Beep
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathLinux-foreach.py
More file actions
60 lines (52 loc) · 1.61 KB
/
Linux-foreach.py
File metadata and controls
60 lines (52 loc) · 1.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!python3
#####################################################################
#
# Works with Python 3.12+
#
# Linux version patch from Polish K103 clan: [PSS] Krzys
#
#
# DOWNLOAD THIS:
# https://codeload.github.com/fdd26/Exchange-Beep/zip/refs/heads/main?file=Exchange-Beep-main.zip
#
# Extract it
#
# OPEN bash in that folder
#
# TYPE THIS to install Python3 dependencies:
# pip3 install pyautogui
# pip3 install python_imagesearch
#
# TYPE THIS to run the program
# python3 Linux.py
#
# OPEN exchange.png to test, you should hear some beeps.
#
#####################################################################
#
# Original Python3 script forked from:
# https://github.com/TotalBattleBots/Exchange-Beep
#
#####################################################################
import os
import time
from python_imagesearch.imagesearch import imagesearch
# Merc frequency is set to 500Hz
freqMerc = 500
# Gold frequency is set to 800Hz
freqGold = 800
# duration is set to 500 milliseconds
dur = 0.500
# List of images
images_to_search = ["exchange1.png", "exchange2.png", "exchange3.png", "exchange4.png", "gold-dm1.png", "gold-dm2.png"]
# Forever loop...
while True:
for image in images_to_search:
pos = imagesearch(image)
if pos[0] != -1:
if "exchange" in image:
os.system('play -n synth {} sine {}'.format(dur, freqMerc)) # Play if find "exchange"
elif "gold-dm" in image:
os.system('play -n synth {} sine {}'.format(dur, freqGold)) # Play if find "gold-dm"
del pos
time.sleep(0.05)