Giter Club home page Giter Club logo

pylast's People

Contributors

amrhassan avatar

Watchers

 avatar

pylast's Issues

A couple patches

commit d95a02ff2aa2ec5d6c6d392b86c9ffe2ef99adb5
Author: Adeodato Simó <[email protected]>
Date:   Tue Oct 20 01:21:45 2009 +0100

    Redefine SCROBBLE_MODE_PLAYED as "", provide SCROBBLE_MODE_LOVED as "L".

    The 'L' rating is only to be used if the user has manually loved the
    track. For a normal play, the documentation clearly says that the rating
    should be the empty string.

commit 6f04ee43f8829c8ecefcc03379f20e1b5fa9f286
Author: Adeodato Simó <[email protected]>
Date:   Tue Oct 20 01:21:08 2009 +0100

    Fix reference to undefined variable in Track._remove_tag().

Original issue reported on code.google.com by [email protected] on 20 Oct 2009 at 12:37

Attachments:

[PATCH] Fix redefine of built-ins

What version of pyLast is this?
r214

Please provide any additional information below.

There are a lot of 'list' and 'id' redefines in the code I fixed most of 
them. there are some remaining:

2038:Playlist.__init__: Redefining built-in 'id'
3379:Venue.__init__: Redefining built-in 'id'
3424:md5: Redefining built-in 'hash'


Original issue reported on code.google.com by [email protected] on 19 Oct 2009 at 11:29

Attachments:

get_loved_tracks doesn't return a timestamp

Please type example code that produces the issue:
user.get_loved_tracks()

What is the expected output? What do you see instead?
I'd like to see something similar to get_recent_tracks() which _does_ include a 
timestamp.

What version of pyLast is this?
0.4

Please provide any additional information below.
Something similar to the get_recent_tracks() method should suffice, and 
shouldn't be to hard to 
implement. I will have a look at it and post some code asap.

Original issue reported on code.google.com by [email protected] on 28 Jan 2010 at 6:17

problem with get_*_by_mbid

Please type example code that produces the issue:
>>  lfn = pylast.get_lastfm_network(API_KEY, API_SECRET)
>>  lfn.get_artist_by_mbid('f467181e-d5e0-4285-b47e-e853dcc89ee7')

What is the expected output? What do you see instead?

/usr/lib/python2.5/site-packages/pylast-0.4.9-py2.5.egg/pylast.pyc in
__init__(self, network, method_name, params)
    775                 self.network = network
    776 
--> 777                 (self.api_key, self.api_secret, self.session_key) =
network._get_ws_auth(False)
    778 
    779                 self.params["api_key"] = self.api_key

AttributeError: 'str' object has no attribute '_get_ws_auth'

What version of pyLast is this?
0.4



Original issue reported on code.google.com by [email protected] on 8 Sep 2009 at 2:49

Unused definitions

There are some unused definitions:
I don't submit a patch for this because they may be some reminders of some 
TODO stuff. It will be good to clear them up.


W:1510:Artist.get_top_fans: Unused variable 'params'
W:1578:Artist.get_images: Unused argument 'order'
W:1666:Event.attend: Unused variable 'doc'
W:2161:Playlist.get_url: Unused variable 'url'
W:2935:User.get_top_tags: Unused argument 'limit'
W:3690:Scrobbler.report_now_playing: Unused variable 'response'
W:3725:Scrobbler.scrobble: Unused variable 'response'
W: 32: Unused import codecs
W: 36: Unused import os


Original issue reported on code.google.com by [email protected] on 19 Oct 2009 at 11:33

non-ascii unicode breaks Album.get_imge_url()

Please type example code that produces the issue:

for alb in albums:
    url = alb.get_image_url()

What is the expected output? What do you see instead?

should get a url, but if name contains non ascii characters get unicode error:

  File "/usr/local/lib/python2.6/dist-packages/pylast.py", line 657, in
get_image_url
    return _extract_all(self._request("album.getInfo", cacheable = True),
'image')[size]
  File "/usr/local/lib/python2.6/dist-packages/pylast.py", line 354, in
_request
    return _Request(method_name, params, *self.auth_data).execute(cacheable)
  File "/usr/local/lib/python2.6/dist-packages/pylast.py", line 152, in
__init__
    self.sign_it()
  File "/usr/local/lib/python2.6/dist-packages/pylast.py", line 158, in sign_it
    self.params['api_sig'] = self._get_signature()
  File "/usr/local/lib/python2.6/dist-packages/pylast.py", line 175, in
_get_signature
    return md5(string)
  File "/usr/local/lib/python2.6/dist-packages/pylast.py", line 2787, in md5
    hash.update(text)
UnicodeEncodeError: 'ascii' codec can't encode character u'\xf6' in
position 12: ordinal not in range(128)


What version of pyLast is this?

0.3.4


Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 14 Jun 2009 at 2:33

Some characters causing trouble in get_top_tags()

#!/usr/bin/env python
import pylast
import os

API_KEY = ""
API_SECRET = ""
u_name = ""
p_hash = pylast.md5("")
lastfm = pylast.get_lastfm_network(api_key = API_KEY, api_secret = API_SECRET, 
username = u_name, password_hash = p_hash)
Artists = os.listdir(".")
Artists.sort()
for ArtistName in Artists:
    print ArtistName
    Artist = lastfm.get_artist(ArtistName)
    TopTags = Artist.get_top_tags()


#
Revision: 226


Reproduce:
Create a folder and cd into it. Then make folder Mötorhead or Ljå
Run the program from the first dir you created.

Output:
~/test$ ls
Enslaved  Leaves' Eyes  Ljå  Lumsk  Mötorhead
~/test$ ~/bin/pytest.py
Enslaved
Leaves' Eyes
Ljå
Traceback (most recent call last):
  File "~/bin/pytest.py", line 17, in <module>
    TopTags = Artist.get_top_tags()
  File "/usr/lib/python2.6/pylast.py", line 1080, in get_top_tags
    doc = self._request(self.ws_prefix + '.getTopTags', True)
  File "/usr/lib/python2.6/pylast.py", line 967, in _request
    return _Request(self.network, method_name, params).execute(cacheable)
  File "/usr/lib/python2.6/pylast.py", line 719, in __init__
    self.sign_it()
  File "/usr/lib/python2.6/pylast.py", line 725, in sign_it
    self.params['api_sig'] = self._get_signature()
  File "/usr/lib/python2.6/pylast.py", line 738, in _get_signature
    string += self.params[name]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 47: 
ordinal not in range(128)

Original issue reported on code.google.com by [email protected] on 4 Oct 2010 at 8:21

Two Library's methods raise exceptions

In version "0.3 alpha", Library.is_end_of_albums() and
Library.get_albums_page() are broken because you are trying to access the
wrong api methods ("library.get_albums" instead of "library.getAlbums").
Diff attached.

And you should rename the "setup" file to "setup.py", so distutils and
setuptools can find it...
$ PYTHONPATH=/tmp/pylast-test; mkdir -p "$PYTHONPATH"; easy_install
--install-dir "$PYTHONPATH"
http://pylast.googlecode.com/files/pylast-0.3.0a.tar.gz
Creating /tmp/pylast-test/site.py
Downloading http://pylast.googlecode.com/files/pylast-0.3.0a.tar.gz
Processing pylast-0.3.0a.tar.gz
error: Couldn't find a setup script in
/tmp/easy_install-KbFrJ2/pylast-0.3.0a.tar.gz

Original issue reported on code.google.com by [email protected] on 4 Feb 2009 at 5:57

Attachments:

Authentication as described in Wiki does not work

I am using revision 124, which was current as of last night (Sept 09, 2008).

When I try to authenticate,  get the following error:

<type 'exceptions.TypeError'>: 'NoneType' object is unsubscriptable

Apparently sg.getSessionData(token) is returning None rather than a
dictionary with the session key.  I took a look in the source code, and
discovered that this happens when the getSessionData method of the
SessionGenerator object tries to execute a Request, and the an exception is
returned.  In my case the exception raised is a ServiceException.

I should also note that the auth_url appears to work correctly, that is,
according to the last.fm website, I successfully give my application
permission to access my account.  I am accessing my own account, to which
the api key is also registered, but this should not cause a problem.

Any ideas what could be raising this ServiceException?  Also, it might be
nice if the .getSessionData method raised a ServiceException rather than
simply returning None.  Returning None means that developers have to do
some detective work, and it causes unexpected problems.

Conrad Lee

Original issue reported on code.google.com by [email protected] on 10 Sep 2008 at 3:58

Wrong constant name

The constant PERIOD_7DAYs you've added in r223 has a small 's' on the end.
Capitalize it, please.

Original issue reported on code.google.com by [email protected] on 28 Mar 2010 at 8:47

caching does not scale and create thousands of tiny files in a single directory

Please type example code that produces the issue:
enable_caching('.cache')

What is the expected output? What do you see instead?
each individual object is serialized to disk in its own file. This cannot
scale as it end up creating tens of thousands of individual files on disk.

It would be more appropriate to use something like shelve to store it or
even sqllite

What version of pyLast is this?
0.3.1

Please provide any additional information below.

Original issue reported on code.google.com by [email protected] on 25 Jun 2009 at 11:49

breaks on XML errors.

Trying to get a users' get_tracks(). Breaks, because XML contains 'illegal'
characters.

Example:
http://ws.audioscrobbler.com/2.0/?method=library.gettracks&api_key=b25b959554ed7
6058ac220b7b2e0a026&user=klokop&limit=30&page=320

What version of pyLast is this?
0.4


Any clues as to how to handle this?

Original issue reported on code.google.com by arne.heijenga on 18 Feb 2010 at 11:44

getTopWeeklyTracks does not extract playcount

Please type example code that produces the issue:
The last.fm api shows that there is a playcount variable returned for this
call http://www.last.fm/api/show?service=282 but it's not extracted into
the results.

for track in user.getTopWeeklyTracks(from,to):
    print track.playcount

What version of pyLast is this?
> trunk

Please provide any additional information below.

the attached diff patch extracts the playcount and the url

Original issue reported on code.google.com by jehiah on 19 Dec 2008 at 12:55

Attachments:

Lack of get_cover_image() in User class.

Latest last.fm API allows free access to user's avatars so it'll be useful
to move get_cover_image() method from AuthenticatedUser class to its base
class - User.


Original issue reported on code.google.com by [email protected] on 23 Mar 2010 at 2:39

Page parameter is not supported in some API calls

API calls like getRecentTracks have a Page parameter, which works together with 
the Limit parameter and the totalPages response so that data can be retrieved 
in a per-page basis.

PyLast does not support this.

Original issue reported on code.google.com by [email protected] on 22 Sep 2010 at 8:41

Allow service customization

Since there are other services compatible with last.fm API (such as
libre.fm), it could be interesting to be able to use this library with any
of these services.

Attached you can find a patch of the idea, allowing to initialize the
object with a new service URI, but without break the backward compatibility.

Original issue reported on code.google.com by [email protected] on 11 May 2009 at 1:52

Attachments:

Geo support

Can we get support for the Geo class so that we can search for events by 
location?  Thanks!

Original issue reported on code.google.com by [email protected] on 7 Jun 2010 at 3:32

_do_handshake in scrobbler never called if scrobbling without reporting nowplaying

In line 3651 of pylast.py, in method report_now_playing, if scrobbler request 
fails, handshake is forced and submissions_url as well as nowplaying_url are 
obtained. 

These values are never requested elsewhere so if one tries scrobbling without 
reporting nowplaying, as in line 3683 in method scrobble, handshake is not 
performed and scrobbles are never submitted. Probably should be as below 
(replacing line 3683), right?

try:
            ScrobblerRequest(self.submissions_url, params, self.network).execute()
        except BadSessionError:
            self._do_handshake()
            self.scrobble( artist, title, time_started, source, mode, duration, album, track_number, mbid);

Original issue reported on code.google.com by [email protected] on 20 Oct 2010 at 10:21

  • Merged into: #51

track.getBuylinks unavailabe in pylast

The last.fm api exposes the api method track.getBuylinks. 
(http://www.last.fm/api/show?service=431)

Are there any plans of adding a counterpart in pylast? Thanks.

Original issue reported on code.google.com by [email protected] on 13 Aug 2010 at 4:34

User.get_friends limit parameter

Please type example code that produces the issue:

User(user, API_KEY, API_SECRET, SESSION_KEY).getFriends(limit=5)

What is the expected output? What do you see instead?

The expected output is a list of 5 friends. Instead, I get this:

Traceback (most recent call last):
  File "retrieveusers.py", line 86, in <module>
    user_friends = get_friends(user)
  File "retrieveusers.py", line 59, in get_friends
    for friend in User(user, API_KEY, API_SECRET, SESSION_KEY).getFriends(limit=5):
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-
packages/pylast.py", line 2270, in getFriends
    doc = Request(self, 'user.getFriends', self.api_key, params).execute()
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-
packages/pylast.py", line 289, in execute
    data.append('='.join((name, urllib.quote_plus(self.params[name].encode('utf-8')))))
AttributeError: 'int' object has no attribute 'encode'


What version of pyLast is this?


Please provide any additional information below.

The problem is that the limit parameter has to be passed as a string, for 
instance limit='5' works, 
while limit=5 as an integer does not work. I guess this should be fixed, or at 
least documented


Original issue reported on code.google.com by [email protected] on 16 Oct 2008 at 2:11

Authentication and MD5 with non-ASCII characters

Please type example code that produces the issue:

user = User('Zazhigalo4ka', API_KEY, API_SECRET, SESSION_KEY)
p = user.getPlaylistIDs()
pid = p[0]
playlist = Playlist('lastfm://playlist/%s' % pid, API_KEY, API_SECRET, 
SESSION_KEY)
tracks = playlist.fetch()
t1 = tracks[1]
t1.getTitle()
t1.getTags()

What is the expected output? What do you see instead?

I expect the title (which is printed) and the tags (which are not printed). The 
following error is 
reported:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/
pylast.py", line 514, in getTags
    doc = Request(self, self.ws_prefix + '.getTags', self.api_key, params, True, self.secret).execute
()
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/
pylast.py", line 285, in execute
    self.params['api_sig'] = self._getSignature()
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/
pylast.py", line 275, in _getSignature
    hash.update(string)
UnicodeEncodeError: 'ascii' codec can't encode characters in position 52-54: 
ordinal not in range
(128)


What version of pyLast is this?

pyLast-0.2b13

Please provide any additional information below.

This happens both with Python 2.5 and Python 2.6, and I guess the problem is 
related to the 
creation of the MD5 hash with a track that contains non-ASCII characters. The 
last.fm page
http://www.last.fm/api/authspec reminds to "Ensure your parameters are utf8 
encoded.", so the 
problem might be there.

(Thanks again for this package, by the way!!)

Original issue reported on code.google.com by [email protected] on 19 Oct 2008 at 4:27

"list index out of range" in User.get_recent_tracks()

Please type example code that produces the issue:

my_user.get_recent_tracks() 

What is the expected output? What do you see instead?

Traceback (most recent call last):
  File "./lastadd.py", line 31, in <module>
    print user.get_recent_tracks()
  File "/usr/lib/python2.5/site-packages/pylast.py", line 2800, in
get_recent_tracks
    timestamp = track.getElementsByTagName("date")[0].getAttribute("uts")
IndexError: list index out of range

What version of pyLast is this?

0.4

Please provide any additional information below.

Looking at the code, I think the continue for attribute "nowplaying" should
be first in the track loop, so that no element gets extracted for the now
playing track at all. This seems particularly important for the date
element which is not present in the now playing track, which results in the
above error.

Original issue reported on code.google.com by [email protected] on 10 Jan 2010 at 4:01

'limit' support in get_loved_tracks

It would be fine if pylast supported 'limit' parameter in the
user.getLovedTracks call.

I can provide a patch to fix it, if that's appreciated.

Original issue reported on code.google.com by [email protected] on 30 Aug 2009 at 1:36

Small Issue on front page

get_lastfm_netowrk should be get_lastfm_network

This is on your example on the home page @ http://code.google.com/p/pylast/

Original issue reported on code.google.com by rwparris2 on 17 Sep 2009 at 7:02

User.fetchPlaylist

Please type example code that produces the issue:

user = User('RJ', API_KEY, API_SECRET, SESSION_KEY) 
for playlist in user.getPlaylistIDs() :
    user.fetchPlaylist(playlist['id'])

What is the expected output? What do you see instead?

I expect the playlist, instead I see this:

  File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-
packages/pylast.py", line 2376, in fetchPlaylist
    return Playlist(uri, self.api_key).fetch()
TypeError: __init__() takes exactly 5 arguments (3 given)


What version of pyLast is this?

0.2b11

Please provide any additional information below.

I think the problem is in the definition of User.fetchPlaylist
While the fetchPlaylist function of other classes returns:
    return Playlist(uri, *self.auth_data).fetch()
using self.auth_data,
the fetchPlaylist function of the class User returns:
    return Playlist(uri, self.api_key).fetch()



Original issue reported on code.google.com by [email protected] on 16 Oct 2008 at 9:11

_get_cache_key is concatening non utf-8 encoded objects

Please type example code that produces the issue:
def _get_cache_key(self):
        """The cache key is a string of concatenated sorted names and values."""

        keys = self.params.keys()
        keys.sort()

        cache_key = str()

        for key in keys:
            if key != "api_sig" and key != "api_key" and key != "sk":
                cache_key += urllib.quote_plus(key) +
urllib.quote_plus(urllib.quote_plus(self.params[key]))

        return hashlib.sha1(cache_key).hexdigest()


What is the expected output? What do you see instead?
There are 2 chained calls to urllib.quote_plus which is likely a typo, plus
the key/params are not utf-8 encoded while this is assembled into a str object.

Should be:

cache_key += urllib.quote_plus(key.encode('utf-8')) +
urllib.quote_plus(self.params[key].encode('utf-8'))


What version of pyLast is this?
0.3.1 

Please provide any additional information below.

Having some unicode params makes it blow up with:

  File "C:\dev\code\lastfm\pylast.py", line 181, in _get_cache_key
    cache_key += urllib.quote_plus(key) +
urllib.quote_plus(urllib.quote_plus(self.params[key]))
  File "c:\dev\Python25\lib\urllib.py", line 1211, in quote_plus
    s = quote(s, safe + ' ')
  File "c:\dev\Python25\lib\urllib.py", line 1205, in quote
    res = map(safe_map.__getitem__, s)

KeyError: u'\xfc'

Original issue reported on code.google.com by [email protected] on 27 Mar 2009 at 1:03

User.getFriends breaks when a user has many friends

Please type example code that produces the issue:

User('cheap_mondays', API_KEY, API_SECRET, SESSION_KEY).getFriends()

What is the expected output? What do you see instead?

I expect the list of friends of 'cheap_mondays', instead I get this:

Traceback (most recent call last):
  File "retrieveusers.py", line 53, in <module>
    User('cheap_mondays', API_KEY, API_SECRET, SESSION_KEY).getFriends()
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-
packages/pylast.py", line 2270, in getFriends
    doc = Request(self, 'user.getFriends', self.api_key, params).execute()
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-
packages/pylast.py", line 304, in execute
    doc = minidom.parse(response)
  File 
"/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/xml/dom/minidom
.py", 
line 1918, in parse
    return expatbuilder.parse(file)
  File 
"/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/xml/dom/expatbu
ilder.py
", line 928, in parse
    result = builder.parseFile(file)
  File 
"/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/xml/dom/expatbu
ilder.py
", line 211, in parseFile
    parser.Parse("", True)
xml.parsers.expat.ExpatError: no element found: line 18585, column 73


What version of pyLast is this?

pyLast-0.2b12.tar.gz

Please provide any additional information below.

This happens because the user cheap_mondays has almost 3,000 friends!
http://www.last.fm/user/cheap_mondays/friends
I guess in this case, the function should not crash, but return something or 
wait.


Original issue reported on code.google.com by [email protected] on 16 Oct 2008 at 2:14

get_album into Track class isn't woriking

line 1698 of version 0.3.0 is

        return Album(_extract(node, "artist"), _extract(node, "title"))

but it should be

        return Album(_extract(node, "artist"), _extract(node, "title"), self.api_key, self.api_secret, 
self.session_key)




Original issue reported on code.google.com by [email protected] on 13 Mar 2009 at 2:35

get_tags() method throws 'Invalid method signature supplied' exception

The get_tags() method throws an "Invalid method signature" error, both on Album 
and Artist objects. 
Sample code:

    lastfm = pylast.get_lastfm_network(api_key=API_KEY, api_secret=API_SECRET)
    obj    = lastfm.get_artist('Air')
    tags   = obj.get_tags()
    print tags

Leads to the following exception:

    Traceback (most recent call last):
      File "test_tag.py", line 15, in <module>
        tags   = obj.get_tags()
      File "/Users/rix0rrr/Documents/Dev/genre_tagger/server/pylast.py", line 1024, in get_tags
        doc = self._request(self.ws_prefix + '.getTags', False, params)
      File "/Users/rix0rrr/Documents/Dev/genre_tagger/server/pylast.py", line 969, in _request
        return _Request(self.network, method_name, params).execute(cacheable)
      File "/Users/rix0rrr/Documents/Dev/genre_tagger/server/pylast.py", line 812, in execute
        response = self._download_response()
      File "/Users/rix0rrr/Documents/Dev/genre_tagger/server/pylast.py", line 803, in _download_response
        self._check_response_for_errors(response_text)
      File "/Users/rix0rrr/Documents/Dev/genre_tagger/server/pylast.py", line 826, in 
_check_response_for_errors
        raise WSError(self.network, status, details)
    server.pylast.WSError: Invalid method signature supplied


Original issue reported on code.google.com by [email protected] on 3 Apr 2010 at 2:28

NoneType object is unsubscripable

Please type example code that produces the issue:
from pylast import *
import cgi

form = cgi.FieldStorage()
# assume a form was submitted with a parameter 'user'
# following line should use form['user'].value, but instead makes
# a mistake and passes an object
lib = Library(form['user'], API_KEY, API_SECRET, "")
tracks = lib.getTracks()

What is the expected output? What do you see instead?
Output: Error: nonetype object is unsubscriptable
Expected output: should indicate that the user does not exist, or have the
same output as passing an invalid user to Library()

What version of pyLast is this?
0.2.17

Please provide any additional information below.
This shouldn't come up if the user uses pylast correctly, but it helps
debugging if they make a mistake.

Original issue reported on code.google.com by [email protected] on 5 Nov 2008 at 7:09

__hash__ should be defined for Artist, Album etc.

Please type example code that produces the issue:

import pylast
network = pylast.get_lastfm_network(api_key = "(KEY)", api_secret = "(KEY)")
# Both rask00 and radio_head247 have RADIOHEAD as top artist
radiohead_1 = network.get_user("rask00").get_top_artists()[0].item
radiohead_2 = network.get_user("radio_head247").get_top_artists()[0].item
# Therefore the following statement correctly returns TRUE
radiohead_1 == radiohead_2
# But the following statement does not work correctly:
set([radiohead_1, radiohead_2])

What is the expected output? What do you see instead?

It is supposed to show set([Radiohead]), while it shows set([Radiohead, 
Radiohead])

What version of pyLast is this?

0.4.13

Please provide any additional information below.

The solution to this bug is to add a function __hash__ to the class Artist and 
the other related 
classes. The reason is explained here: 
http://wiki.python.org/moin/DictionaryKeys
Since __eq__ and __ne__ are already defined in Artist using the artist's name, 
then the solution is 
to add the following code to the class Artist:

    def __hash__(self):
        return hash(self.get_name().lower())

and do the same on the other related classes (Album, etc...)

Original issue reported on code.google.com by [email protected] on 6 Oct 2009 at 2:11

NameError: global name 'unicode' is not defined

hi,
I'm on ubuntu jaunty
when I run

    sudo python setup.py install


I get this

    Traceback (most recent call last):
      File "setup.py", line 25, in <module>
        version = "0.4." + get_build(),
      File "setup.py", line 22, in get_build
        return unicode(build)
    NameError: global name 'unicode' is not defined


pyLast v 0.4.20
Downloaded from http://pypi.python.org/pypi/pylast

my python version

    $ python -V
    Python 3.0.1+

Original issue reported on code.google.com by [email protected] on 2 Jan 2010 at 9:49

Get updated capitalization for names when we can

Just as an example: if you have an artist object and run a get_similar() on it, 
the xml returned will 
contain the artist name with proper capitalization. If you created the artist 
object with improper 
capitalization, running get_name() on it will show it improperly capitalized, 
but if you've done 
get_similar() before you have already gotten the info you need to update that, 
so why not check to 
see if the artist name you got back has the same capitalization as the one we 
have cached and if 
not, update it?

Original issue reported on code.google.com by [email protected] on 20 Mar 2010 at 5:27

_get_signature is incorrectly calling encode(utf-8) for argument in md5 function

Please type example code that produces the issue:

    def _get_signature(self):
        """Returns a 32-character hexadecimal md5 hash of the signature string."""

        keys = self.params.keys()[:]

        keys.sort()

        string = unicode()

        for name in keys:
            string += name
            string += self.params[name]

        string += self.api_secret

        return md5(string.encode('utf-8'))


What is the expected output? What do you see instead?

Should be:

        return md5(string)

Since the md5 function takes care of the encode

What version of pyLast is this?
0.3.1

Please provide any additional information below.
Fetching some artist/track with non ascii characters would lead otherwise
to a flurry of error similar to:

'ascii' codec can't decode byte 0xc3 in position 56: ordinal not in range(128)

Original issue reported on code.google.com by [email protected] on 27 Mar 2009 at 12:52

[PATCH] Whitespace fix

What version of pyLast is this?
r214


Please provide any additional information below.

There are a lot of trailing whitespaces in the code. You can use 
":%s/\s\+$//gc" from VIM to remove them. I've also attached a patch.
You can use the following to see them in vim:
let python_space_errors=1
highlight WhitespaceEOL ctermbg=red guibg=red
match WhitespaceEOL /\s\+$/

Original issue reported on code.google.com by [email protected] on 19 Oct 2009 at 10:11

Attachments:

artist.getImages

the method artist.get_images() doesn't implements page parameter for limit 
amount of images to get

What version of pyLast is this?
0.4 trunk



Original issue reported on code.google.com by [email protected] on 16 Jul 2010 at 5:07

"NoneType object is unsubscriptable" Exception

Hi,

I'm getting a "NoneType object is unsubscriptable" error with multiple API 
methods 
(Album.getImage and Artist.getBioSummary).  I recently updated my copy of 
pylast from the 
alpha version from August 15th to the latest SVN version.  I didn't get this 
error when using the 
alpha code.

Here's the traceback I have for the error when using the getImage method.

Traceback:
File "/Users/brett/Workspace/Development/lastfm.py" in get_data
  137.      album.lf_image_url = lf_album.getImage(pylast.IMAGE_LARGE)
File "/Library/Python/2.5/site-packages/pylast.py" in getImage
  483.      return self._getCachedInfo()['images'][size]

Exception Type: TypeError
Exception Value: 'NoneType' object is unsubscriptable

I apologize if this is a bug in my code and not pylast.  I'm just getting 
started with Python, and I 
was really happy to find this library was available to save me the time of 
having to write my own.  
Thanks for posting your work, and I hope my bug report helps!

Original issue reported on code.google.com by [email protected] on 21 Aug 2008 at 12:27

Return all information from User.getTopAlbums() etc

It would be really great to have all Album/Artist/etc information returned 
from calls to user.getTopAlbums() and similiar methods.

According to Last.fm api it should be simple since that info is returned in 
response anyway.

Original issue reported on code.google.com by [email protected] on 2 Dec 2008 at 10:51

No anonymous access to data

According to last.fm API specs, some services such as album.getinfo do NOT
require authentification (see http://www.lastfm.ru/api/show?service=290 as
an example), but pylast requires it.

Please type example code that produces the issue:
import pylast

api_key = "my api key"
api_secret = "my secret key"

username = "TLemur"
password_hash = pylast.md5("")

network = pylast.get_lastfm_network(api_key = API_KEY, api_secret =
API_SECRET, username = username, password_hash = password_hash)

user = pylast.User(user_name, network)
tracks = user.get_top_tracks(period='overall')
for track in tracks:
    print track 

What is the expected output? What do you see instead?
The expected output is the list of user's top tracks, instead I see a error:
pylast.WSError: Invalid authentication token. Please check
username/password supplied

What version of pyLast is this?
0.4 rev. 222

Original issue reported on code.google.com by [email protected] on 8 Mar 2010 at 12:08

Album.get_cover_image() AttributeError

Please type example code that produces the issue:

a.get_cover_image()

What is the expected output? What do you see instead?

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "pylast.py", line 1184, in get_cover_image
    return _extract_all(self._request("album.getInfo", cacheable = True), 'image
')[size]
  File "pylast.py", line 957, in _request
    return _Request(self.network, method_name, params).execute(cacheable)
  File "pylast.py", line 811, in execute
    response = self._download_response()
  File "pylast.py", line 781, in _download_response
    data.append('='.join((name, urllib.quote_plus(_string(self.params[name])))))

  File "pylast.py", line 3358, in _string
    return text.encode("utf-8")
AttributeError: 'Album' object has no attribute 'encode'

What version of pyLast is this?
0.4.20

Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 22 Dec 2009 at 12:55

_do_handshake in scrobbler never called if scrobbling without reporting nowplaying

In line 3651 of pylast.py, in method report_now_playing, if scrobbler request 
fails, handshake is forced and submissions_url as well as nowplaying_url are 
obtained. 

These values are never requested elsewhere so if one tries scrobbling without 
reporting nowplaying, as in line 3683 in method scrobble, handshake is not 
performed and scrobbles are never submitted. Probably should be as below 
(replacing line 3683), right?

try:
            ScrobblerRequest(self.submissions_url, params, self.network).execute()
        except BadSessionError:
            self._do_handshake()
            self.scrobble( artist, title, time_started, source, mode, duration, album, track_number, mbid);

Original issue reported on code.google.com by [email protected] on 20 Oct 2010 at 10:21

  • Merged into: #51

md5 module is deprecated

Please type example code that produces the issue:

[Any code]

What is the expected output? What do you see instead?

/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-
packages/pylast.py:32: DeprecationWarning: the md5 module is deprecated; use 
hashlib instead
  import md5

What version of pyLast is this?

pyLast-0.2b12.tar.gz

Please provide any additional information below.

This occurs with Python 2.6 (on an Intel-based Mac OS X with MacPython), and 
did not occur with 
Python 2.3

Original issue reported on code.google.com by [email protected] on 16 Oct 2008 at 1:37

BadAuthenticationError when trying to scrobble

Assuming I've got a working Network object,

scrobbler = network.get_scrobbler("tst", "1.0")
    fin = open(FILE)


    for line in fin:
        raw = line.strip()
        trackinfo = raw.split("\t")
        track = network.get_track(trackinfo[0], trackinfo[1])

        artist = track.get_artist()
        title = track.title
        time_started = trackinfo[2]
        source = 'SCROBBLE_SOURCE_UNKNOWN'
        mode = 'SCROBBLE_MODE_PLAYED'
        duration = track.get_duration()
        album = track.get_album()
        track_number = '1'
        mbid = track.get_mbid()

        scrobbler.scrobble(artist, title, time_started, source, mode,
duration, album, track_number, mbid)


Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "migratefm.py", line 36, in main
    scrobbler.scrobble(artist, title, time_started, source, mode, duration,
album, track_number, mbid)
  File "/usr/local/lib/python2.6/dist-packages/pylast.py", line 3650, in
scrobble
    params = {"s": self._get_session_id(), "a[0]": _string(artist), "t[0]":
_string(title),
  File "/usr/local/lib/python2.6/dist-packages/pylast.py", line 3613, in
_get_session_id
    self._do_handshake()
  File "/usr/local/lib/python2.6/dist-packages/pylast.py", line 3602, in
_do_handshake
    response = _ScrobblerRequest(server, params, self.network,
"GET").execute().split("\n")
  File "/usr/local/lib/python2.6/dist-packages/pylast.py", line 3542, in
execute
    self._check_response_for_errors(response)
  File "/usr/local/lib/python2.6/dist-packages/pylast.py", line 3558, in
_check_response_for_errors
    raise BadAuthenticationError()
pylast.BadAuthenticationError: Bad authentication token

Original issue reported on code.google.com by [email protected] on 16 Mar 2010 at 8:52

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.