How to use the pylast._ScrobblerRequest 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 pylast / pylast / pylast.py View on Github external
token = md5(self.password + timestamp)
        elif self.network.api_key and self.network.api_secret and self.network.session_key:
            if not self.username:
                self.username = self.network.get_authenticated_user().get_name()
            token = md5(self.network.api_secret + timestamp)

        params = {"hs": "true", "p": "1.2.1", "c": self.client_id,
            "v": self.client_version, "u": self.username, "t": timestamp,
            "a": token}

        if self.network.session_key and self.network.api_key:
            params["sk"] = self.network.session_key
            params["api_key"] = self.network.api_key

        server = self.network.submission_server
        response = _ScrobblerRequest(server, params, self.network, "GET").execute().split("\n")

        self.session_id = response[1]
        self.nowplaying_url = response[2]
        self.submissions_url = response[3]
github asermax / lastfm_extension / pylast.py View on Github external
token = md5(self.password + timestamp)
        elif self.network.api_key and self.network.api_secret and self.network.session_key:
            if not self.username:
                self.username = self.network.get_authenticated_user().get_name()
            token = md5(self.network.api_secret + timestamp)
        
        params = {"hs": "true", "p": "1.2.1", "c": self.client_id,
            "v": self.client_version, "u": self.username, "t": timestamp,
            "a": token}
        
        if self.network.session_key and self.network.api_key:
            params["sk"] = self.network.session_key
            params["api_key"] = self.network.api_key
        
        server = self.network.submission_server
        response = _ScrobblerRequest(server, params, self.network, "GET").execute().split("\n")
        
        self.session_id = response[1]
        self.nowplaying_url = response[2]
        self.submissions_url = response[3]
github pylast / pylast / pylast.py View on Github external
SCROBBLE_MODE_LOVED: The user manually loved the track (implies a listen)
                SCROBBLE_MODE_SKIPPED: The track was skipped (Only if source was Last.fm)
                SCROBBLE_MODE_BANNED: The track was banned (Only if source was Last.fm)
            duration: Track duration in seconds.
            album: The album name.
            track_number: The track number on the album.
            mbid: MusicBrainz ID.
        """

        _deprecation_warning("DeprecationWarning: Use Network.scrobble(...) instead")

        params = {"s": self._get_session_id(), "a[0]": _string(artist), "t[0]": _string(title),
            "i[0]": str(time_started), "o[0]": source, "r[0]": mode, "l[0]": str(duration),
            "b[0]": _string(album), "n[0]": track_number, "m[0]": mbid}

        _ScrobblerRequest(self.submissions_url, params, self.network).execute()
github asermax / lastfm_extension / pylast.py View on Github external
SCROBBLE_MODE_LOVED: The user manually loved the track (implies a listen)
                SCROBBLE_MODE_SKIPPED: The track was skipped (Only if source was Last.fm)
                SCROBBLE_MODE_BANNED: The track was banned (Only if source was Last.fm)
            duration: Track duration in seconds.
            album: The album name.
            track_number: The track number on the album.
            mbid: MusicBrainz ID.
        """
        
        _deprecation_warning("DeprecationWarning: Use Network.scrobble(...) instead")
        
        params = {"s": self._get_session_id(), "a[0]": _string(artist), "t[0]": _string(title),
            "i[0]": str(time_started), "o[0]": source, "r[0]": mode, "l[0]": str(duration),
            "b[0]": _string(album), "n[0]": track_number, "m[0]": mbid}
        
        _ScrobblerRequest(self.submissions_url, params, self.network).execute()
github asermax / lastfm_extension / pylast.py View on Github external
def report_now_playing(self, artist, title, album = "", duration = "", track_number = "", mbid = ""):
        
        _deprecation_warning("DeprecationWarning: Use Netowrk.update_now_playing(...) instead")
        
        params = {"s": self._get_session_id(), "a": artist, "t": title,
            "b": album, "l": duration, "n": track_number, "m": mbid}
        
        try:
            _ScrobblerRequest(self.nowplaying_url, params, self.network).execute()
        except BadSessionError:
            self._do_handshake()
            self.report_now_playing(artist, title, album, duration, track_number, mbid)
github maxexcloo / LastDown / pylast.py View on Github external
def report_now_playing(self, artist, title, album = "", duration = "", track_number = "", mbid = ""):
        
        _deprecation_warning("DeprecationWarning: Use Netowrk.update_now_playing(...) instead")
        
        params = {"s": self._get_session_id(), "a": artist, "t": title,
            "b": album, "l": duration, "n": track_number, "m": mbid}
        
        try:
            _ScrobblerRequest(self.nowplaying_url, params, self.network).execute()
        except BadSessionError:
            self._do_handshake()
            self.report_now_playing(artist, title, album, duration, track_number, mbid)