added get user scrobble count method
This commit is contained in:
parent
c1e43eb41b
commit
c2561ae9de
@ -69,6 +69,22 @@ class Network:
|
|||||||
else:
|
else:
|
||||||
logger.error(f'{method} {req.status_code}')
|
logger.error(f'{method} {req.status_code}')
|
||||||
|
|
||||||
|
def get_user_scrobble_count(self, username: str = None):
|
||||||
|
if username is None:
|
||||||
|
username = self.username
|
||||||
|
logger.info(f'getting scrobble count {username}')
|
||||||
|
|
||||||
|
params = {
|
||||||
|
'user': username
|
||||||
|
}
|
||||||
|
|
||||||
|
resp = self.get_request(method='user.getinfo', params=params)
|
||||||
|
|
||||||
|
if resp:
|
||||||
|
return int(resp.get('user', {}).get('playcount', None))
|
||||||
|
else:
|
||||||
|
logger.error('no response')
|
||||||
|
|
||||||
def get_recent_tracks(self,
|
def get_recent_tracks(self,
|
||||||
username: str = None,
|
username: str = None,
|
||||||
limit: int = None,
|
limit: int = None,
|
||||||
|
Loading…
Reference in New Issue
Block a user