maybe fix scrobbler/reporter

This commit is contained in:
localhost_frssoft 2023-07-08 21:07:44 +03:00
parent 0fb4edc655
commit 1d6e63e9e9

View File

@ -54,7 +54,7 @@ if track_activity_history or scrobbler_to_fediverse_token != '':
# Here, _value is either None if nothing is playing or a float containing # Here, _value is either None if nothing is playing or a float containing
# fractional seconds since the beginning of the file. # fractional seconds since the beginning of the file.
if value: if value:
if value >= 30.0 and value <= 30.1 and player.pause is False: if value >= 30.0 and value <= 30.2 and player.pause is False:
# detect 30 secs for reporting listen activity # detect 30 secs for reporting listen activity
try: try:
track = player_fw_storage.storage.get(track_url_to_uuid()) track = player_fw_storage.storage.get(track_url_to_uuid())
@ -85,8 +85,8 @@ if track_activity_history or scrobbler_to_fediverse_token != '':
requests.post(f'https://{scrobbler_to_fediverse_instance}/api/v1/statuses', requests.post(f'https://{scrobbler_to_fediverse_instance}/api/v1/statuses',
json=status_obj, json=status_obj,
headers={'Authorization': f'Bearer {scrobbler_to_fediverse_token}'}) headers={'Authorization': f'Bearer {scrobbler_to_fediverse_token}'})
time.sleep(0.100) time.sleep(1)
if value > 30.1: if value > 30.2: # passive mode
time.sleep(1) time.sleep(1)
return return