-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathvolume_controller.py
More file actions
37 lines (30 loc) · 1.11 KB
/
volume_controller.py
File metadata and controls
37 lines (30 loc) · 1.11 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
import subprocess
# Function to reduce volume
def reduce_volume():
# Construct the ADB command to reduce the volume
adb_command = ['adb', 'shell', 'input', 'keyevent', '25']
# Execute the ADB command to reduce the volume
subprocess.call(adb_command)
print("Volume on the Android phone has been reduced. Hoyooo!")
# Function to increase volume
def increase_volume():
# Construct the ADB command to increase the volume
adb_command = ['adb', 'shell', 'input', 'keyevent', '24']
# Execute the ADB command to increase the volume
subprocess.call(adb_command)
print("Volume on the Android phone has been increased. Hoyooo!")
# Main loop
while True:
user_input = input("Enter 0 to reduce volume, 1 to exit, or 2 to increase volume: ")
if user_input == '':
print("No input detected. Rescanning... Hoyooo!")
continue
if user_input == 1:
reduce_volume()
elif user_input == 0:
print("Exiting the program. Take care, my friend!")
break
elif user_input == 2:
increase_volume()
else:
print("Invalid input. Please try again.")