mirror of
https://gitea.phreedom.club/localhost_frssoft/funkwlmpv
synced 2024-11-25 07:59:19 +02:00
changed if's hell
This commit is contained in:
parent
ac73249396
commit
0fb4edc655
|
@ -54,15 +54,13 @@ 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:
|
if value >= 30.0 and value <= 30.1 and player.pause is False:
|
||||||
track = player_fw_storage.storage.get(track_url_to_uuid())
|
|
||||||
time.sleep(0.100)
|
|
||||||
if value > 30.1:
|
|
||||||
time.sleep(1)
|
|
||||||
return
|
|
||||||
if value and src.fw_api.current_instance.token != None and player.pause is False:
|
|
||||||
if value >= 30.0 and value <= 30.1:
|
|
||||||
# detect 30 secs for reporting listen activity
|
# detect 30 secs for reporting listen activity
|
||||||
|
try:
|
||||||
|
track = player_fw_storage.storage.get(track_url_to_uuid())
|
||||||
|
except:
|
||||||
|
return
|
||||||
|
if src.fw_api.current_instance.token is not None:
|
||||||
track_id = track.get('id')
|
track_id = track.get('id')
|
||||||
|
|
||||||
if track_id:
|
if track_id:
|
||||||
|
@ -70,8 +68,7 @@ if track_activity_history or scrobbler_to_fediverse_token != '':
|
||||||
src.fw_api.record_track_in_history(track_id)
|
src.fw_api.record_track_in_history(track_id)
|
||||||
else:
|
else:
|
||||||
logger.error("Can't write track to history: No track id")
|
logger.error("Can't write track to history: No track id")
|
||||||
if value and scrobbler_to_fediverse_token != '' and player.pause is False:
|
if scrobbler_to_fediverse_token != '':
|
||||||
if value >= 30.0 and value <= 30.1:
|
|
||||||
fid = track.get('fid')
|
fid = track.get('fid')
|
||||||
artist = track['artist'].get('name')
|
artist = track['artist'].get('name')
|
||||||
album = track['album'].get('title')
|
album = track['album'].get('title')
|
||||||
|
@ -88,6 +85,10 @@ 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)
|
||||||
|
if value > 30.1:
|
||||||
|
time.sleep(1)
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
def osd_observer(value):
|
def osd_observer(value):
|
||||||
|
|
Loading…
Reference in New Issue