mirror of
https://gitea.phreedom.club/localhost_frssoft/funkwlmpv
synced 2024-11-23 23:19:21 +02:00
Compare commits
No commits in common. "2301adac39bf3c635a553a88e8a196f2d6776b48" and "8e793572876e35335f0c76c010cce3cbe6cf46f6" have entirely different histories.
2301adac39
...
8e79357287
|
@ -1,39 +0,0 @@
|
||||||
import subprocess
|
|
||||||
import os
|
|
||||||
import json
|
|
||||||
import threading
|
|
||||||
import time
|
|
||||||
from src.mpv_control import player
|
|
||||||
from loguru import logger
|
|
||||||
'''Warning! This module can be very battery drain'''
|
|
||||||
|
|
||||||
|
|
||||||
@logger.catch
|
|
||||||
def handle_vol_lvl_as_switch_track():
|
|
||||||
volume_diff = []
|
|
||||||
while True:
|
|
||||||
debug_time = time.time()
|
|
||||||
volume = subprocess.Popen("termux-volume", stdout=subprocess.PIPE).stdout
|
|
||||||
json_volume = json.loads(volume.read())
|
|
||||||
for i in json_volume:
|
|
||||||
if i['stream'] == 'music':
|
|
||||||
volume_diff.append(i['volume'])
|
|
||||||
if len(volume_diff) == 2:
|
|
||||||
before, after = volume_diff
|
|
||||||
difference = after - before
|
|
||||||
if difference == 2:
|
|
||||||
try:
|
|
||||||
player.playlist_next()
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
os.system(f'termux-volume music {before}')
|
|
||||||
volume_diff = []
|
|
||||||
debug_time2 = time.time()
|
|
||||||
total = debug_time2 - debug_time
|
|
||||||
print(total)
|
|
||||||
time.sleep(0.300)
|
|
||||||
|
|
||||||
|
|
||||||
handle_vol_lvl = threading.Thread(
|
|
||||||
target=handle_vol_lvl_as_switch_track, daemon=True)
|
|
||||||
handle_vol_lvl.start()
|
|
|
@ -27,9 +27,6 @@ share_to_fediverse_token = get_config('share_to_fediverse_token')
|
||||||
share_to_fediverse_instance = get_config('share_to_fediverse_instance')
|
share_to_fediverse_instance = get_config('share_to_fediverse_instance')
|
||||||
shuffle = False
|
shuffle = False
|
||||||
|
|
||||||
if get_config('termux_handle_track_switch_by_volume'):
|
|
||||||
import src.android_termux_api
|
|
||||||
|
|
||||||
|
|
||||||
class player_fw_storage:
|
class player_fw_storage:
|
||||||
storage = {}
|
storage = {}
|
||||||
|
|
|
@ -44,8 +44,7 @@ default_conf = {
|
||||||
'enable_persistent_cache': False,
|
'enable_persistent_cache': False,
|
||||||
'mpv_volume': 100,
|
'mpv_volume': 100,
|
||||||
'show_like_button': True,
|
'show_like_button': True,
|
||||||
'show_artist_name_in_albums': False,
|
'show_artist_name_in_albums': False
|
||||||
'termux_handle_track_switch_by_volume': False
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue