This commit is contained in:
@@ -23,6 +23,7 @@ import urllib.parse
|
|||||||
import os
|
import os
|
||||||
import json
|
import json
|
||||||
import requests
|
import requests
|
||||||
|
import atexit
|
||||||
if typing.TYPE_CHECKING:
|
if typing.TYPE_CHECKING:
|
||||||
from librespot.core import Session
|
from librespot.core import Session
|
||||||
|
|
||||||
@@ -50,6 +51,28 @@ spoticlub_password = "IfWeFeelLikeEnablingThis"
|
|||||||
### SPOTICLUB CLIENT SERIAL TRACKING (DO NOT EDIT) ###
|
### SPOTICLUB CLIENT SERIAL TRACKING (DO NOT EDIT) ###
|
||||||
spoticlub_client_serial: typing.Optional[str] = None
|
spoticlub_client_serial: typing.Optional[str] = None
|
||||||
spoticlub_loaded_logged: bool = False
|
spoticlub_loaded_logged: bool = False
|
||||||
|
|
||||||
|
def _spoticlub_notify_session_done() -> None:
|
||||||
|
global spoticlub_user, spoticlub_password, spoticlub_client_serial
|
||||||
|
try:
|
||||||
|
if not server_url or not spoticlub_user or not spoticlub_client_serial:
|
||||||
|
return
|
||||||
|
base_url = server_url.rsplit("/", 1)[0]
|
||||||
|
url = base_url + "/client_done"
|
||||||
|
payload = {
|
||||||
|
"user": spoticlub_user,
|
||||||
|
"password": spoticlub_password,
|
||||||
|
"client_serial": spoticlub_client_serial,
|
||||||
|
}
|
||||||
|
requests.post(url, json=payload, timeout=5)
|
||||||
|
except Exception:
|
||||||
|
AudioKeyManager.logger.debug(
|
||||||
|
"[SpotiClub API] Failed to notify server of session completion",
|
||||||
|
exc_info=True,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
atexit.register(_spoticlub_notify_session_done)
|
||||||
########################################
|
########################################
|
||||||
|
|
||||||
class LoadedStream(GeneralAudioStream):
|
class LoadedStream(GeneralAudioStream):
|
||||||
|
|||||||
Reference in New Issue
Block a user