mirror of
https://gitea.phreedom.club/localhost_frssoft/funkwlmpv
synced 2024-11-22 15:59:21 +02:00
try catch f*ck the music volume
This commit is contained in:
parent
2301adac39
commit
4a56885e33
|
@ -12,12 +12,13 @@ from loguru import logger
|
||||||
def handle_vol_lvl_as_switch_track():
|
def handle_vol_lvl_as_switch_track():
|
||||||
volume_diff = []
|
volume_diff = []
|
||||||
while True:
|
while True:
|
||||||
debug_time = time.time()
|
for a in range(2): # ~2 secs
|
||||||
volume = subprocess.Popen("termux-volume", stdout=subprocess.PIPE).stdout
|
volume = subprocess.Popen("termux-volume", stdout=subprocess.PIPE).stdout
|
||||||
json_volume = json.loads(volume.read())
|
json_volume = json.loads(volume.read())
|
||||||
for i in json_volume:
|
time.sleep(0.300)
|
||||||
if i['stream'] == 'music':
|
for i in json_volume:
|
||||||
volume_diff.append(i['volume'])
|
if i['stream'] == 'music':
|
||||||
|
volume_diff.append(i['volume'])
|
||||||
if len(volume_diff) == 2:
|
if len(volume_diff) == 2:
|
||||||
before, after = volume_diff
|
before, after = volume_diff
|
||||||
difference = after - before
|
difference = after - before
|
||||||
|
@ -27,11 +28,13 @@ def handle_vol_lvl_as_switch_track():
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
os.system(f'termux-volume music {before}')
|
os.system(f'termux-volume music {before}')
|
||||||
|
elif difference == -2:
|
||||||
|
try:
|
||||||
|
player.playlist_prev()
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
os.system(f'termux-volume music {before}')
|
||||||
volume_diff = []
|
volume_diff = []
|
||||||
debug_time2 = time.time()
|
|
||||||
total = debug_time2 - debug_time
|
|
||||||
print(total)
|
|
||||||
time.sleep(0.300)
|
|
||||||
|
|
||||||
|
|
||||||
handle_vol_lvl = threading.Thread(
|
handle_vol_lvl = threading.Thread(
|
||||||
|
|
Loading…
Reference in New Issue