How to use the pylast.ScrobblingError function in pylast

To help you get started, we’ve selected a few pylast examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mopidy / mopidy / mopidy / frontends / lastfm.py View on Github external
def track_playback_started(self, tl_track):
        track = tl_track.track
        artists = ', '.join([a.name for a in track.artists])
        duration = track.length and track.length // 1000 or 0
        self.last_start_time = int(time.time())
        logger.debug('Now playing track: %s - %s', artists, track.name)
        try:
            self.lastfm.update_now_playing(
                artists,
                (track.name or ''),
                album=(track.album and track.album.name or ''),
                duration=str(duration),
                track_number=str(track.track_no),
                mbid=(track.musicbrainz_id or ''))
        except (pylast.ScrobblingError, pylast.NetworkError,
                pylast.MalformedResponseError, pylast.WSError) as e:
            logger.warning('Error submitting playing track to Last.fm: %s', e)
github asermax / lastfm_extension / pylast.py View on Github external
lines = response.split("\n")
        status_line = lines[0]
        
        if status_line == "OK":
            return
        elif status_line == "BANNED":
            raise BannedClientError()
        elif status_line == "BADAUTH":
            raise BadAuthenticationError()
        elif status_line == "BADTIME":
            raise BadTimeError()
        elif status_line == "BADSESSION":
            raise BadSessionError()
        elif status_line.startswith("FAILED "):
            reason = status_line[status_line.find("FAILED ")+len("FAILED "):]
            raise ScrobblingError(reason)
github maxexcloo / LastDown / pylast.py View on Github external
lines = response.split("\n")
        status_line = lines[0]
        
        if status_line == "OK":
            return
        elif status_line == "BANNED":
            raise BannedClientError()
        elif status_line == "BADAUTH":
            raise BadAuthenticationError()
        elif status_line == "BADTIME":
            raise BadTimeError()
        elif status_line == "BADSESSION":
            raise BadSessionError()
        elif status_line.startswith("FAILED "):
            reason = status_line[status_line.find("FAILED ")+len("FAILED "):]
            raise ScrobblingError(reason)
github maxexcloo / LastDown / pylast.py View on Github external
seq = []
    for i in topitems_or_libraryitems:
        seq.append(i.item)
    
    return seq

class ScrobblingError(Exception):
    def __init__(self, message):
        Exception.__init__(self)
        self.message = message
    
    @_string_output
    def __str__(self):
        return self.message

class BannedClientError(ScrobblingError):
    def __init__(self):
        ScrobblingError.__init__(self, "This version of the client has been banned")

class BadAuthenticationError(ScrobblingError):
    def __init__(self):
        ScrobblingError.__init__(self, "Bad authentication token")

class BadTimeError(ScrobblingError):
    def __init__(self):
        ScrobblingError.__init__(self, "Time provided is not close enough to current time")

class BadSessionError(ScrobblingError):
    def __init__(self):
        ScrobblingError.__init__(self, "Bad session id, consider re-handshaking")

class _ScrobblerRequest(object):
github asermax / lastfm_extension / pylast.py View on Github external
def __str__(self):
        return self.message

class BannedClientError(ScrobblingError):
    def __init__(self):
        ScrobblingError.__init__(self, "This version of the client has been banned")

class BadAuthenticationError(ScrobblingError):
    def __init__(self):
        ScrobblingError.__init__(self, "Bad authentication token")

class BadTimeError(ScrobblingError):
    def __init__(self):
        ScrobblingError.__init__(self, "Time provided is not close enough to current time")

class BadSessionError(ScrobblingError):
    def __init__(self):
        ScrobblingError.__init__(self, "Bad session id, consider re-handshaking")

class _ScrobblerRequest(object):
    
    def __init__(self, url, params, network, type="POST"):
        
        for key in params:
                params[key] = str(params[key])
        
        self.params = params
        self.type = type
        (self.hostname, self.subdir) = url_split_host(url[len("http:"):])
        self.network = network
    
    def execute(self):
github pylast / pylast / pylast.py View on Github external
def __init__(self):
        ScrobblingError.__init__(self, "Bad session id, consider re-handshaking")
github asermax / lastfm_extension / pylast.py View on Github external
Exception.__init__(self)
        self.message = message
    
    @_string_output
    def __str__(self):
        return self.message

class BannedClientError(ScrobblingError):
    def __init__(self):
        ScrobblingError.__init__(self, "This version of the client has been banned")

class BadAuthenticationError(ScrobblingError):
    def __init__(self):
        ScrobblingError.__init__(self, "Bad authentication token")

class BadTimeError(ScrobblingError):
    def __init__(self):
        ScrobblingError.__init__(self, "Time provided is not close enough to current time")

class BadSessionError(ScrobblingError):
    def __init__(self):
        ScrobblingError.__init__(self, "Bad session id, consider re-handshaking")

class _ScrobblerRequest(object):
    
    def __init__(self, url, params, network, type="POST"):
        
        for key in params:
                params[key] = str(params[key])
        
        self.params = params
        self.type = type
github maxexcloo / LastDown / pylast.py View on Github external
def __str__(self):
        return self.message

class BannedClientError(ScrobblingError):
    def __init__(self):
        ScrobblingError.__init__(self, "This version of the client has been banned")

class BadAuthenticationError(ScrobblingError):
    def __init__(self):
        ScrobblingError.__init__(self, "Bad authentication token")

class BadTimeError(ScrobblingError):
    def __init__(self):
        ScrobblingError.__init__(self, "Time provided is not close enough to current time")

class BadSessionError(ScrobblingError):
    def __init__(self):
        ScrobblingError.__init__(self, "Bad session id, consider re-handshaking")

class _ScrobblerRequest(object):
    
    def __init__(self, url, params, network, type="POST"):
        
        for key in params:
                params[key] = str(params[key])
        
        self.params = params
        self.type = type
        (self.hostname, self.subdir) = url_split_host(url[len("http:"):])
        self.network = network
    
    def execute(self):
github maxexcloo / LastDown / pylast.py View on Github external
def __init__(self):
        ScrobblingError.__init__(self, "Time provided is not close enough to current time")
github asermax / lastfm_extension / pylast.py View on Github external
def __init__(self):
        ScrobblingError.__init__(self, "This version of the client has been banned")