| | |
- __builtin__.object
-
- Scrobbler
- SessionKeyGenerator
- __builtin__.tuple(__builtin__.object)
-
- Image
- ImageSizes
- LibraryItem
- LovedTrack
- PlayedTrack
- Shout
- SimilarItem
- TopItem
- exceptions.Exception(exceptions.BaseException)
-
- MalformedResponseError
- NetworkError
- ScrobblingError
-
- BadAuthenticationError
- BadSessionError
- BadTimeError
- BannedClientError
- WSError
- _BaseObject(__builtin__.object)
-
- Album(_BaseObject, _Taggable)
- Artist(_BaseObject, _Taggable)
- Country
- Event
- Group
- Library
- Playlist
- Tag
- Track(_BaseObject, _Taggable)
- User
-
- AuthenticatedUser
- Venue
- XSPF
- _Network(__builtin__.object)
-
- LastFMNetwork
- LibreFMNetwork
- _Search(_BaseObject)
-
- AlbumSearch
- ArtistSearch
- TagSearch
- TrackSearch
- VenueSearch
- _Taggable(__builtin__.object)
-
- Album(_BaseObject, _Taggable)
- Artist(_BaseObject, _Taggable)
- Track(_BaseObject, _Taggable)
class Album(_BaseObject, _Taggable) |
| |
An album. |
| |
- Method resolution order:
- Album
- _BaseObject
- _Taggable
- __builtin__.object
Methods defined here:
- __eq__(self, other)
- __init__(self, artist, title, network)
- Create an album instance.
# Parameters:
* artist: An artist name or an Artist object.
* title: The album title.
- __ne__(self, other)
- __repr__(self)
- __str__ = r(*args)
- get_artist(self)
- Returns the associated Artist object.
- get_cover_image(self, size=3)
- Returns a uri to the cover image
size can be one of:
COVER_EXTRA_LARGE
COVER_LARGE
COVER_MEDIUM
COVER_SMALL
- get_id(self)
- Returns the ID
- get_listener_count(self)
- Returns the number of liteners on the network
- get_mbid(self)
- Returns the MusicBrainz id of the album.
- get_name(self)
- Returns the album title (alias to Album.get_title).
- get_playcount(self)
- Returns the number of plays on the network
- get_release_date(self)
- Retruns the release date of the album.
- get_title(self)
- Returns the album title.
- get_top_tags(self, limit=None)
- Returns a list of the most-applied tags to this album.
- get_tracks(self)
- Returns the list of Tracks on this album.
- get_url(self, domain_name=0)
- Returns the url of the album page on the network.
# Parameters:
* domain_name str: The network's language domain. Possible values:
o DOMAIN_ENGLISH
o DOMAIN_GERMAN
o DOMAIN_SPANISH
o DOMAIN_FRENCH
o DOMAIN_ITALIAN
o DOMAIN_POLISH
o DOMAIN_PORTUGUESE
o DOMAIN_SWEDISH
o DOMAIN_TURKISH
o DOMAIN_RUSSIAN
o DOMAIN_JAPANESE
o DOMAIN_CHINESE
- get_wiki_content(self)
- Returns the content of the wiki.
- get_wiki_published_date(self)
- Returns the date of publishing this version of the wiki.
- get_wiki_summary(self)
- Returns the summary of the wiki.
Data and other attributes defined here:
- artist = None
- title = None
Methods inherited from _BaseObject:
- __hash__(self)
Data descriptors inherited from _BaseObject:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
Data and other attributes inherited from _BaseObject:
- network = None
Methods inherited from _Taggable:
- add_tag(self, tag)
- Adds one tag.
* tag: a tag name or a Tag object.
- add_tags(self, tags)
- Adds one or several tags.
* tags: A sequence of tag names or Tag objects.
- clear_tags(self)
- Clears all the user-set tags.
- get_tags(self)
- Returns a list of the tags set by the user to this object.
- remove_tag(self, tag)
- Remove a user's tag from this object.
- remove_tags(self, tags)
- Removes one or several tags from this object.
* tags: a sequence of tag names or Tag objects.
- set_tags(self, tags)
- Sets this object's tags to only those tags.
* tags: a sequence of tag names or Tag objects.
|
class Artist(_BaseObject, _Taggable) |
| |
An artist. |
| |
- Method resolution order:
- Artist
- _BaseObject
- _Taggable
- __builtin__.object
Methods defined here:
- __eq__(self, other)
- __init__(self, name, network)
- Create an artist object.
# Parameters:
* name str: The artist's name.
- __ne__(self, other)
- __repr__(self)
- __str__ = r(*args)
- get_bio_content(self)
- Returns the content of the artist's biography.
- get_bio_published_date(self)
- Returns the date on which the artist's biography was published.
- get_bio_summary(self)
- Returns the summary of the artist's biography.
- get_cover_image(self, size=4)
- Returns a uri to the cover image
size can be one of:
COVER_MEGA
COVER_EXTRA_LARGE
COVER_LARGE
COVER_MEDIUM
COVER_SMALL
- get_images(self, order='popularity', limit=None)
- Returns a sequence of Image objects
if limit is None it will return all
order can be IMAGES_ORDER_POPULARITY or IMAGES_ORDER_DATE.
If limit==None, it will try to pull all the available data.
- get_listener_count(self)
- Returns the number of liteners on the network.
- get_mbid(self)
- Returns the MusicBrainz ID of this artist.
- get_name(self, properly_capitalized=False)
- Returns the name of the artist.
If properly_capitalized was asserted then the name would be downloaded
overwriting the given one.
- get_playcount(self)
- Returns the number of plays on the network.
- get_shouts(self, limit=50)
- Returns a sequqence of Shout objects
- get_similar(self, limit=None)
- Returns the similar artists on the network.
- get_top_albums(self)
- Retuns a list of the top albums.
- get_top_fans(self, limit=None)
- Returns a list of the Users who played this artist the most.
# Parameters:
* limit int: Max elements.
- get_top_tracks(self)
- Returns a list of the most played Tracks by this artist.
- get_upcoming_events(self)
- Returns a list of the upcoming Events for this artist.
- get_url(self, domain_name=0)
- Returns the url of the artist page on the network.
# Parameters:
* domain_name: The network's language domain. Possible values:
o DOMAIN_ENGLISH
o DOMAIN_GERMAN
o DOMAIN_SPANISH
o DOMAIN_FRENCH
o DOMAIN_ITALIAN
o DOMAIN_POLISH
o DOMAIN_PORTUGUESE
o DOMAIN_SWEDISH
o DOMAIN_TURKISH
o DOMAIN_RUSSIAN
o DOMAIN_JAPANESE
o DOMAIN_CHINESE
- is_streamable(self)
- Returns True if the artist is streamable.
- share(self, users, message=None)
- Shares this artist (sends out recommendations).
# Parameters:
* users [User|str,]: A list that can contain usernames, emails, User objects, or all of them.
* message str: A message to include in the recommendation message.
- shout(self, message)
- Post a shout
Data and other attributes defined here:
- name = None
Methods inherited from _BaseObject:
- __hash__(self)
Data descriptors inherited from _BaseObject:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
Data and other attributes inherited from _BaseObject:
- network = None
Methods inherited from _Taggable:
- add_tag(self, tag)
- Adds one tag.
* tag: a tag name or a Tag object.
- add_tags(self, tags)
- Adds one or several tags.
* tags: A sequence of tag names or Tag objects.
- clear_tags(self)
- Clears all the user-set tags.
- get_tags(self)
- Returns a list of the tags set by the user to this object.
- get_top_tags(self, limit=None)
- Returns a list of the most frequently used Tags on this object.
- remove_tag(self, tag)
- Remove a user's tag from this object.
- remove_tags(self, tags)
- Removes one or several tags from this object.
* tags: a sequence of tag names or Tag objects.
- set_tags(self, tags)
- Sets this object's tags to only those tags.
* tags: a sequence of tag names or Tag objects.
|
class AuthenticatedUser(User) |
| | |
- Method resolution order:
- AuthenticatedUser
- User
- _BaseObject
- __builtin__.object
Methods defined here:
- __init__(self, network)
- get_name(self)
- Returns the name of the authenticated user.
- get_recommended_artists(self, limit=50)
- Returns a sequence of Event objects
if limit==None it will return all
- get_recommended_events(self, limit=50)
- Returns a sequence of Event objects
if limit==None it will return all
Methods inherited from User:
- __eq__(self, another)
- __ne__(self, another)
- __repr__(self)
- __str__ = r(*args)
- compare_with_user(self, user, shared_artists_limit=None)
- Compare this user with another Last.fm user.
Returns a sequence (tasteometer_score, (shared_artist1, shared_artist2, ...))
user: A User object or a username string/unicode object.
- get_age(self)
- Returns the user's age.
- get_country(self)
- Returns the name of the country of the user.
- get_friends(self, limit=50)
- Returns a list of the user's friends.
- get_gender(self)
- Returns the user's gender. Either USER_MALE or USER_FEMALE.
- get_id(self)
- Returns the user id.
- get_image(self)
- Returns the user's avatar.
- get_language(self)
- Returns the language code of the language used by the user.
- get_library(self)
- Returns the associated Library object.
- get_loved_tracks(self, limit=50)
- Returns this user's loved track as a sequence of LovedTrack objects
in reverse order of their timestamp, all the way back to the first track.
If limit==None, it will try to pull all the available data.
This method uses caching. Enable caching only if you're pulling a
large amount of data.
Use extract_items() with the return of this function to
get only a sequence of Track objects with no playback dates.
- get_neighbours(self, limit=50)
- Returns a list of the user's friends.
- get_now_playing(self)
- Returns the currently playing track, or None if nothing is playing.
- get_past_events(self, limit=50)
- Returns a sequence of Event objects
if limit==None it will return all
- get_playcount(self)
- Returns the user's playcount so far.
- get_playlists(self)
- Returns a list of Playlists that this user owns.
- get_recent_tracks(self, limit=10)
- Returns this user's played track as a sequence of PlayedTrack objects
in reverse order of their playtime, all the way back to the first track.
If limit==None, it will try to pull all the available data.
This method uses caching. Enable caching only if you're pulling a
large amount of data.
Use extract_items() with the return of this function to
get only a sequence of Track objects with no playback dates.
- get_shouts(self, limit=50)
- Returns a sequqence of Shout objects
- get_top_albums(self, period='overall')
- Returns the top albums played by a user.
* period: The period of time. Possible values:
o PERIOD_OVERALL
o PERIOD_7DAYS
o PERIOD_3MONTHS
o PERIOD_6MONTHS
o PERIOD_12MONTHS
- get_top_artists(self, period='overall')
- Returns the top artists played by a user.
* period: The period of time. Possible values:
o PERIOD_OVERALL
o PERIOD_7DAYS
o PERIOD_3MONTHS
o PERIOD_6MONTHS
o PERIOD_12MONTHS
- get_top_tags(self, limit=None)
- Returns a sequence of the top tags used by this user with their counts as (Tag, tagcount).
* limit: The limit of how many tags to return.
- get_top_tracks(self, period='overall')
- Returns the top tracks played by a user.
* period: The period of time. Possible values:
o PERIOD_OVERALL
o PERIOD_7DAYS
o PERIOD_3MONTHS
o PERIOD_6MONTHS
o PERIOD_12MONTHS
- get_upcoming_events(self)
- Returns all the upcoming events for this user.
- get_url(self, domain_name=0)
- Returns the url of the user page on the network.
* domain_name: The network's language domain. Possible values:
o DOMAIN_ENGLISH
o DOMAIN_GERMAN
o DOMAIN_SPANISH
o DOMAIN_FRENCH
o DOMAIN_ITALIAN
o DOMAIN_POLISH
o DOMAIN_PORTUGUESE
o DOMAIN_SWEDISH
o DOMAIN_TURKISH
o DOMAIN_RUSSIAN
o DOMAIN_JAPANESE
o DOMAIN_CHINESE
- get_weekly_album_charts(self, from_date=None, to_date=None)
- Returns the weekly album charts for the week starting from the from_date value to the to_date value.
- get_weekly_artist_charts(self, from_date=None, to_date=None)
- Returns the weekly artist charts for the week starting from the from_date value to the to_date value.
- get_weekly_chart_dates(self)
- Returns a list of From and To tuples for the available charts.
- get_weekly_track_charts(self, from_date=None, to_date=None)
- Returns the weekly track charts for the week starting from the from_date value to the to_date value.
- is_subscriber(self)
- Returns whether the user is a subscriber or not. True or False.
- shout(self, message)
- Post a shout
Data and other attributes inherited from User:
- name = None
Methods inherited from _BaseObject:
- __hash__(self)
Data descriptors inherited from _BaseObject:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
Data and other attributes inherited from _BaseObject:
- network = None
|
class Country(_BaseObject) |
| |
A country at Last.fm. |
| |
- Method resolution order:
- Country
- _BaseObject
- __builtin__.object
Methods defined here:
- __eq__(self, other)
- __init__(self, name, network)
- __ne__(self, other)
- __repr__(self)
- __str__ = r(*args)
- get_name(self)
- Returns the country name.
- get_top_artists(self)
- Returns a sequence of the most played artists.
- get_top_tracks(self)
- Returns a sequence of the most played tracks
- get_url(self, domain_name=0)
- Returns the url of the event page on the network.
* domain_name: The network's language domain. Possible values:
o DOMAIN_ENGLISH
o DOMAIN_GERMAN
o DOMAIN_SPANISH
o DOMAIN_FRENCH
o DOMAIN_ITALIAN
o DOMAIN_POLISH
o DOMAIN_PORTUGUESE
o DOMAIN_SWEDISH
o DOMAIN_TURKISH
o DOMAIN_RUSSIAN
o DOMAIN_JAPANESE
o DOMAIN_CHINESE
Data and other attributes defined here:
- name = None
Methods inherited from _BaseObject:
- __hash__(self)
Data descriptors inherited from _BaseObject:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
Data and other attributes inherited from _BaseObject:
- network = None
|
class Event(_BaseObject) |
| |
An event. |
| |
- Method resolution order:
- Event
- _BaseObject
- __builtin__.object
Methods defined here:
- __eq__(self, other)
- __init__(self, event_id, network)
- __ne__(self, other)
- __repr__(self)
- __str__ = r(*args)
- attend(self, attending_status)
- Sets the attending status.
* attending_status: The attending status. Possible values:
o EVENT_ATTENDING
o EVENT_MAYBE_ATTENDING
o EVENT_NOT_ATTENDING
- get_artists(self)
- Returns a list of the participating Artists.
- get_attendance_count(self)
- Returns the number of attending people.
- get_attendees(self)
- Get a list of attendees for an event
- get_cover_image(self, size=4)
- Returns a uri to the cover image
size can be one of:
COVER_MEGA
COVER_EXTRA_LARGE
COVER_LARGE
COVER_MEDIUM
COVER_SMALL
- get_description(self)
- Returns the description of the event.
- get_headliner(self)
- Returns the headliner of the event.
- get_id(self)
- Returns the id of the event on the network.
- get_review_count(self)
- Returns the number of available reviews for this event.
- get_shouts(self, limit=50)
- Returns a sequqence of Shout objects
- get_start_date(self)
- Returns the date when the event starts.
- get_title(self)
- Returns the title of the event.
- get_url(self, domain_name=0)
- Returns the url of the event page on the network.
* domain_name: The network's language domain. Possible values:
o DOMAIN_ENGLISH
o DOMAIN_GERMAN
o DOMAIN_SPANISH
o DOMAIN_FRENCH
o DOMAIN_ITALIAN
o DOMAIN_POLISH
o DOMAIN_PORTUGUESE
o DOMAIN_SWEDISH
o DOMAIN_TURKISH
o DOMAIN_RUSSIAN
o DOMAIN_JAPANESE
o DOMAIN_CHINESE
- get_venue(self)
- Returns the venue where the event is held.
- share(self, users, message=None)
- Shares this event (sends out recommendations).
* users: A list that can contain usernames, emails, User objects, or all of them.
* message: A message to include in the recommendation message.
- shout(self, message)
- Post a shout
Data and other attributes defined here:
- id = None
Methods inherited from _BaseObject:
- __hash__(self)
Data descriptors inherited from _BaseObject:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
Data and other attributes inherited from _BaseObject:
- network = None
|
class Group(_BaseObject) |
| |
A Last.fm group. |
| |
- Method resolution order:
- Group
- _BaseObject
- __builtin__.object
Methods defined here:
- __eq__(self, other)
- __init__(self, group_name, network)
- __ne__(self, other)
- __repr__(self)
- __str__ = r(*args)
- get_members(self, limit=50)
- Returns a sequence of User objects
if limit==None it will return all
- get_name(self)
- Returns the group name.
- get_url(self, domain_name=0)
- Returns the url of the group page on the network.
* domain_name: The network's language domain. Possible values:
o DOMAIN_ENGLISH
o DOMAIN_GERMAN
o DOMAIN_SPANISH
o DOMAIN_FRENCH
o DOMAIN_ITALIAN
o DOMAIN_POLISH
o DOMAIN_PORTUGUESE
o DOMAIN_SWEDISH
o DOMAIN_TURKISH
o DOMAIN_RUSSIAN
o DOMAIN_JAPANESE
o DOMAIN_CHINESE
- get_weekly_album_charts(self, from_date=None, to_date=None)
- Returns the weekly album charts for the week starting from the from_date value to the to_date value.
- get_weekly_artist_charts(self, from_date=None, to_date=None)
- Returns the weekly artist charts for the week starting from the from_date value to the to_date value.
- get_weekly_chart_dates(self)
- Returns a list of From and To tuples for the available charts.
- get_weekly_track_charts(self, from_date=None, to_date=None)
- Returns the weekly track charts for the week starting from the from_date value to the to_date value.
Data and other attributes defined here:
- name = None
Methods inherited from _BaseObject:
- __hash__(self)
Data descriptors inherited from _BaseObject:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
Data and other attributes inherited from _BaseObject:
- network = None
|
class Image(__builtin__.tuple) |
| |
Image(title, url, dateadded, format, owner, sizes, votes) |
| |
- Method resolution order:
- Image
- __builtin__.tuple
- __builtin__.object
Methods defined here:
- __getnewargs__(self)
- __repr__(self)
Static methods defined here:
- __new__(_cls, title, url, dateadded, format, owner, sizes, votes)
Data descriptors defined here:
- dateadded
- itemgetter(item, ...) --> itemgetter object
Return a callable object that fetches the given item(s) from its operand.
After, f=itemgetter(2), the call f(r) returns r[2].
After, g=itemgetter(2,5,3), the call g(r) returns (r[2], r[5], r[3])
- format
- itemgetter(item, ...) --> itemgetter object
Return a callable object that fetches the given item(s) from its operand.
After, f=itemgetter(2), the call f(r) returns r[2].
After, g=itemgetter(2,5,3), the call g(r) returns (r[2], r[5], r[3])
- owner
- itemgetter(item, ...) --> itemgetter object
Return a callable object that fetches the given item(s) from its operand.
After, f=itemgetter(2), the call f(r) returns r[2].
After, g=itemgetter(2,5,3), the call g(r) returns (r[2], r[5], r[3])
- sizes
- itemgetter(item, ...) --> itemgetter object
Return a callable object that fetches the given item(s) from its operand.
After, f=itemgetter(2), the call f(r) returns r[2].
After, g=itemgetter(2,5,3), the call g(r) returns (r[2], r[5], r[3])
- title
- itemgetter(item, ...) --> itemgetter object
Return a callable object that fetches the given item(s) from its operand.
After, f=itemgetter(2), the call f(r) returns r[2].
After, g=itemgetter(2,5,3), the call g(r) returns (r[2], r[5], r[3])
- url
- itemgetter(item, ...) --> itemgetter object
Return a callable object that fetches the given item(s) from its operand.
After, f=itemgetter(2), the call f(r) returns r[2].
After, g=itemgetter(2,5,3), the call g(r) returns (r[2], r[5], r[3])
- votes
- itemgetter(item, ...) --> itemgetter object
Return a callable object that fetches the given item(s) from its operand.
After, f=itemgetter(2), the call f(r) returns r[2].
After, g=itemgetter(2,5,3), the call g(r) returns (r[2], r[5], r[3])
Methods inherited from __builtin__.tuple:
- __add__(...)
- x.__add__(y) <==> x+y
- __contains__(...)
- x.__contains__(y) <==> y in x
- __eq__(...)
- x.__eq__(y) <==> x==y
- __ge__(...)
- x.__ge__(y) <==> x>=y
- __getattribute__(...)
- x.__getattribute__('name') <==> x.name
- __getitem__(...)
- x.__getitem__(y) <==> x[y]
- __getslice__(...)
- x.__getslice__(i, j) <==> x[i:j]
Use of negative indices is not supported.
- __gt__(...)
- x.__gt__(y) <==> x>y
- __hash__(...)
- x.__hash__() <==> hash(x)
- __iter__(...)
- x.__iter__() <==> iter(x)
- __le__(...)
- x.__le__(y) <==> x<=y
- __len__(...)
- x.__len__() <==> len(x)
- __lt__(...)
- x.__lt__(y) <==> x<y
- __mul__(...)
- x.__mul__(n) <==> x*n
- __ne__(...)
- x.__ne__(y) <==> x!=y
- __rmul__(...)
- x.__rmul__(n) <==> n*x
- __sizeof__(...)
- T.__sizeof__() -- size of T in memory, in bytes
- count(...)
- T.count(value) -> integer -- return number of occurrences of value
- index(...)
- T.index(value, [start, [stop]]) -> integer -- return first index of value.
Raises ValueError if the value is not present.
|
class ImageSizes(__builtin__.tuple) |
| |
ImageSizes(original, large, largesquare, medium, small, extralarge) |
| |
- Method resolution order:
- ImageSizes
- __builtin__.tuple
- __builtin__.object
Methods defined here:
- __getnewargs__(self)
- __repr__(self)
Static methods defined here:
- __new__(_cls, original, large, largesquare, medium, small, extralarge)
Data descriptors defined here:
- extralarge
- itemgetter(item, ...) --> itemgetter object
Return a callable object that fetches the given item(s) from its operand.
After, f=itemgetter(2), the call f(r) returns r[2].
After, g=itemgetter(2,5,3), the call g(r) returns (r[2], r[5], r[3])
- large
- itemgetter(item, ...) --> itemgetter object
Return a callable object that fetches the given item(s) from its operand.
After, f=itemgetter(2), the call f(r) returns r[2].
After, g=itemgetter(2,5,3), the call g(r) returns (r[2], r[5], r[3])
- largesquare
- itemgetter(item, ...) --> itemgetter object
Return a callable object that fetches the given item(s) from its operand.
After, f=itemgetter(2), the call f(r) returns r[2].
After, g=itemgetter(2,5,3), the call g(r) returns (r[2], r[5], r[3])
- medium
- itemgetter(item, ...) --> itemgetter object
Return a callable object that fetches the given item(s) from its operand.
After, f=itemgetter(2), the call f(r) returns r[2].
After, g=itemgetter(2,5,3), the call g(r) returns (r[2], r[5], r[3])
- original
- itemgetter(item, ...) --> itemgetter object
Return a callable object that fetches the given item(s) from its operand.
After, f=itemgetter(2), the call f(r) returns r[2].
After, g=itemgetter(2,5,3), the call g(r) returns (r[2], r[5], r[3])
- small
- itemgetter(item, ...) --> itemgetter object
Return a callable object that fetches the given item(s) from its operand.
After, f=itemgetter(2), the call f(r) returns r[2].
After, g=itemgetter(2,5,3), the call g(r) returns (r[2], r[5], r[3])
Methods inherited from __builtin__.tuple:
- __add__(...)
- x.__add__(y) <==> x+y
- __contains__(...)
- x.__contains__(y) <==> y in x
- __eq__(...)
- x.__eq__(y) <==> x==y
- __ge__(...)
- x.__ge__(y) <==> x>=y
- __getattribute__(...)
- x.__getattribute__('name') <==> x.name
- __getitem__(...)
- x.__getitem__(y) <==> x[y]
- __getslice__(...)
- x.__getslice__(i, j) <==> x[i:j]
Use of negative indices is not supported.
- __gt__(...)
- x.__gt__(y) <==> x>y
- __hash__(...)
- x.__hash__() <==> hash(x)
- __iter__(...)
- x.__iter__() <==> iter(x)
- __le__(...)
- x.__le__(y) <==> x<=y
- __len__(...)
- x.__len__() <==> len(x)
- __lt__(...)
- x.__lt__(y) <==> x<y
- __mul__(...)
- x.__mul__(n) <==> x*n
- __ne__(...)
- x.__ne__(y) <==> x!=y
- __rmul__(...)
- x.__rmul__(n) <==> n*x
- __sizeof__(...)
- T.__sizeof__() -- size of T in memory, in bytes
- count(...)
- T.count(value) -> integer -- return number of occurrences of value
- index(...)
- T.index(value, [start, [stop]]) -> integer -- return first index of value.
Raises ValueError if the value is not present.
|
class LastFMNetwork(_Network) |
| |
A Last.fm network object
api_key: a provided API_KEY
api_secret: a provided API_SECRET
session_key: a generated session_key or None
username: a username of a valid user
password_hash: the output of pylast.md5(password) where password is the user's password
if username and password_hash were provided and not session_key, session_key will be
generated automatically when needed.
Either a valid session_key or a combination of username and password_hash must be present for scrobbling.
Most read-only webservices only require an api_key and an api_secret, see about obtaining them from:
http://www.last.fm/api/account |
| |
- Method resolution order:
- LastFMNetwork
- _Network
- __builtin__.object
Methods defined here:
- __init__(self, api_key='', api_secret='', session_key='', username='', password_hash='')
- __repr__(self)
Methods inherited from _Network:
- __str__(self)
- create_new_playlist(self, title, description)
- Creates a playlist for the authenticated user and returns it
title: The title of the new playlist.
description: The description of the new playlist.
- disable_caching(self)
- Disables all caching features.
- disable_proxy(self)
- Disable using the web proxy
- enable_caching(self, file_path=None)
- Enables caching request-wide for all cachable calls.
In choosing the backend used for caching, it will try _SqliteCacheBackend first if
the module sqlite3 is present. If not, it will fallback to _ShelfCacheBackend which uses shelve.Shelf objects.
* file_path: A file path for the backend storage file. If
None set, a temp file would probably be created, according the backend.
- enable_proxy(self, host, port)
- Enable a default web proxy
- get_album(self, artist, title)
- Return an Album object
- get_album_by_mbid(self, mbid)
- Looks up an album by its MusicBrainz ID
- get_artist(self, artist_name)
- Return an Artist object
- get_artist_by_mbid(self, mbid)
- Loooks up an artist by its MusicBrainz ID
- get_authenticated_user(self)
- Returns the authenticated user
- get_country(self, country_name)
- Returns a country object
- get_group(self, name)
- Returns a Group object
- get_scrobbler(self, client_id, client_version)
- Returns a Scrobbler object used for submitting tracks to the server
Quote from http://www.last.fm/api/submissions:
========
Client identifiers are used to provide a centrally managed database of
the client versions, allowing clients to be banned if they are found to
be behaving undesirably. The client ID is associated with a version
number on the server, however these are only incremented if a client is
banned and do not have to reflect the version of the actual client application.
During development, clients which have not been allocated an identifier should
use the identifier tst, with a version number of 1.0. Do not distribute code or
client implementations which use this test identifier. Do not use the identifiers
used by other clients.
=========
To obtain a new client identifier please contact:
* Last.fm: submissions@last.fm
* # TODO: list others
...and provide us with the name of your client and its homepage address.
- get_tag(self, name)
- Returns a tag object
- get_top_tags(self, limit=None)
- Returns a sequence of the most used tags as a sequence of TopItem objects.
- get_track(self, artist, title)
- Return a Track object
- get_track_by_mbid(self, mbid)
- Looks up a track by its MusicBrainz ID
- get_user(self, username)
- Returns a user object
- is_caching_enabled(self)
- Returns True if caching is enabled.
- is_proxy_enabled(self)
- Returns True if a web proxy is enabled.
- scrobble(self, artist, title, timestamp, album=None, album_artist=None, track_number=None, duration=None, stream_id=None, context=None, mbid=None)
- Used to add a track-play to a user's profile.
Parameters:
artist (Required) : The artist name.
title (Required) : The track name.
timestamp (Required) : The time the track started playing, in UNIX timestamp format (integer number of seconds since 00:00:00, January 1st 1970 UTC). This must be in the UTC time zone.
album (Optional) : The album name.
album_artist (Optional) : The album artist - if this differs from the track artist.
context (Optional) : Sub-client version (not public, only enabled for certain API keys)
stream_id (Optional) : The stream id for this track received from the radio.getPlaylist service.
track_number (Optional) : The track number of the track on the album.
mbid (Optional) : The MusicBrainz Track ID.
duration (Optional) : The length of the track in seconds.
- scrobble_many(self, tracks)
- Used to scrobble a batch of tracks at once. The parameter tracks is a sequence of dicts per
track containing the keyword arguments as if passed to the scrobble() method.
- search_for_album(self, album_name)
- Searches for an album by its name. Returns a AlbumSearch object.
Use get_next_page() to retreive sequences of results.
- search_for_artist(self, artist_name)
- Searches of an artist by its name. Returns a ArtistSearch object.
Use get_next_page() to retreive sequences of results.
- search_for_tag(self, tag_name)
- Searches of a tag by its name. Returns a TagSearch object.
Use get_next_page() to retreive sequences of results.
- search_for_track(self, artist_name, track_name)
- Searches of a track by its name and its artist. Set artist to an empty string if not available.
Returns a TrackSearch object.
Use get_next_page() to retreive sequences of results.
- search_for_venue(self, venue_name, country_name)
- Searches of a venue by its name and its country. Set country_name to an empty string if not available.
Returns a VenueSearch object.
Use get_next_page() to retreive sequences of results.
- update_now_playing(self, artist, title, album=None, album_artist=None, duration=None, track_number=None, mbid=None, context=None)
- Used to notify Last.fm that a user has started listening to a track.
Parameters:
artist (Required) : The artist name
title (Required) : The track title
album (Optional) : The album name.
album_artist (Optional) : The album artist - if this differs from the track artist.
duration (Optional) : The length of the track in seconds.
track_number (Optional) : The track number of the track on the album.
mbid (Optional) : The MusicBrainz Track ID.
context (Optional) : Sub-client version (not public, only enabled for certain API keys)
Data descriptors inherited from _Network:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
|
class Library(_BaseObject) |
| |
A user's Last.fm library. |
| |
- Method resolution order:
- Library
- _BaseObject
- __builtin__.object
Methods defined here:
- __init__(self, user, network)
- __repr__(self)
- __str__ = r(*args)
- add_album(self, album)
- Add an album to this library.
- add_artist(self, artist)
- Add an artist to this library.
- add_track(self, track)
- Add a track to this library.
- get_albums(self, limit=50)
- Returns a sequence of Album objects
if limit==None it will return all (may take a while)
- get_artists(self, limit=50)
- Returns a sequence of Album objects
if limit==None it will return all (may take a while)
- get_tracks(self, limit=50)
- Returns a sequence of Album objects
if limit==None it will return all (may take a while)
- get_user(self)
- Returns the user who owns this library.
Data and other attributes defined here:
- user = None
Methods inherited from _BaseObject:
- __hash__(self)
Data descriptors inherited from _BaseObject:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
Data and other attributes inherited from _BaseObject:
- network = None
|
class LibraryItem(__builtin__.tuple) |
| |
LibraryItem(item, playcount, tagcount) |
| |
- Method resolution order:
- LibraryItem
- __builtin__.tuple
- __builtin__.object
Methods defined here:
- __getnewargs__(self)
- __repr__(self)
Static methods defined here:
- __new__(_cls, item, playcount, tagcount)
Data descriptors defined here:
- item
- itemgetter(item, ...) --> itemgetter object
Return a callable object that fetches the given item(s) from its operand.
After, f=itemgetter(2), the call f(r) returns r[2].
After, g=itemgetter(2,5,3), the call g(r) returns (r[2], r[5], r[3])
- playcount
- itemgetter(item, ...) --> itemgetter object
Return a callable object that fetches the given item(s) from its operand.
After, f=itemgetter(2), the call f(r) returns r[2].
After, g=itemgetter(2,5,3), the call g(r) returns (r[2], r[5], r[3])
- tagcount
- itemgetter(item, ...) --> itemgetter object
Return a callable object that fetches the given item(s) from its operand.
After, f=itemgetter(2), the call f(r) returns r[2].
After, g=itemgetter(2,5,3), the call g(r) returns (r[2], r[5], r[3])
Methods inherited from __builtin__.tuple:
- __add__(...)
- x.__add__(y) <==> x+y
- __contains__(...)
- x.__contains__(y) <==> y in x
- __eq__(...)
- x.__eq__(y) <==> x==y
- __ge__(...)
- x.__ge__(y) <==> x>=y
- __getattribute__(...)
- x.__getattribute__('name') <==> x.name
- __getitem__(...)
- x.__getitem__(y) <==> x[y]
- __getslice__(...)
- x.__getslice__(i, j) <==> x[i:j]
Use of negative indices is not supported.
- __gt__(...)
- x.__gt__(y) <==> x>y
- __hash__(...)
- x.__hash__() <==> hash(x)
- __iter__(...)
- x.__iter__() <==> iter(x)
- __le__(...)
- x.__le__(y) <==> x<=y
- __len__(...)
- x.__len__() <==> len(x)
- __lt__(...)
- x.__lt__(y) <==> x<y
- __mul__(...)
- x.__mul__(n) <==> x*n
- __ne__(...)
- x.__ne__(y) <==> x!=y
- __rmul__(...)
- x.__rmul__(n) <==> n*x
- __sizeof__(...)
- T.__sizeof__() -- size of T in memory, in bytes
- count(...)
- T.count(value) -> integer -- return number of occurrences of value
- index(...)
- T.index(value, [start, [stop]]) -> integer -- return first index of value.
Raises ValueError if the value is not present.
|
class LibreFMNetwork(_Network) |
| |
A preconfigured _Network object for Libre.fm
api_key: a provided API_KEY
api_secret: a provided API_SECRET
session_key: a generated session_key or None
username: a username of a valid user
password_hash: the output of pylast.md5(password) where password is the user's password
if username and password_hash were provided and not session_key, session_key will be
generated automatically when needed. |
| |
- Method resolution order:
- LibreFMNetwork
- _Network
- __builtin__.object
Methods defined here:
- __init__(self, api_key='', api_secret='', session_key='', username='', password_hash='')
- __repr__(self)
Methods inherited from _Network:
- __str__(self)
- create_new_playlist(self, title, description)
- Creates a playlist for the authenticated user and returns it
title: The title of the new playlist.
description: The description of the new playlist.
- disable_caching(self)
- Disables all caching features.
- disable_proxy(self)
- Disable using the web proxy
- enable_caching(self, file_path=None)
- Enables caching request-wide for all cachable calls.
In choosing the backend used for caching, it will try _SqliteCacheBackend first if
the module sqlite3 is present. If not, it will fallback to _ShelfCacheBackend which uses shelve.Shelf objects.
* file_path: A file path for the backend storage file. If
None set, a temp file would probably be created, according the backend.
- enable_proxy(self, host, port)
- Enable a default web proxy
- get_album(self, artist, title)
- Return an Album object
- get_album_by_mbid(self, mbid)
- Looks up an album by its MusicBrainz ID
- get_artist(self, artist_name)
- Return an Artist object
- get_artist_by_mbid(self, mbid)
- Loooks up an artist by its MusicBrainz ID
- get_authenticated_user(self)
- Returns the authenticated user
- get_country(self, country_name)
- Returns a country object
- get_group(self, name)
- Returns a Group object
- get_scrobbler(self, client_id, client_version)
- Returns a Scrobbler object used for submitting tracks to the server
Quote from http://www.last.fm/api/submissions:
========
Client identifiers are used to provide a centrally managed database of
the client versions, allowing clients to be banned if they are found to
be behaving undesirably. The client ID is associated with a version
number on the server, however these are only incremented if a client is
banned and do not have to reflect the version of the actual client application.
During development, clients which have not been allocated an identifier should
use the identifier tst, with a version number of 1.0. Do not distribute code or
client implementations which use this test identifier. Do not use the identifiers
used by other clients.
=========
To obtain a new client identifier please contact:
* Last.fm: submissions@last.fm
* # TODO: list others
...and provide us with the name of your client and its homepage address.
- get_tag(self, name)
- Returns a tag object
- get_top_tags(self, limit=None)
- Returns a sequence of the most used tags as a sequence of TopItem objects.
- get_track(self, artist, title)
- Return a Track object
- get_track_by_mbid(self, mbid)
- Looks up a track by its MusicBrainz ID
- get_user(self, username)
- Returns a user object
- is_caching_enabled(self)
- Returns True if caching is enabled.
- is_proxy_enabled(self)
- Returns True if a web proxy is enabled.
- scrobble(self, artist, title, timestamp, album=None, album_artist=None, track_number=None, duration=None, stream_id=None, context=None, mbid=None)
- Used to add a track-play to a user's profile.
Parameters:
artist (Required) : The artist name.
title (Required) : The track name.
timestamp (Required) : The time the track started playing, in UNIX timestamp format (integer number of seconds since 00:00:00, January 1st 1970 UTC). This must be in the UTC time zone.
album (Optional) : The album name.
album_artist (Optional) : The album artist - if this differs from the track artist.
context (Optional) : Sub-client version (not public, only enabled for certain API keys)
stream_id (Optional) : The stream id for this track received from the radio.getPlaylist service.
track_number (Optional) : The track number of the track on the album.
mbid (Optional) : The MusicBrainz Track ID.
duration (Optional) : The length of the track in seconds.
- scrobble_many(self, tracks)
- Used to scrobble a batch of tracks at once. The parameter tracks is a sequence of dicts per
track containing the keyword arguments as if passed to the scrobble() method.
- search_for_album(self, album_name)
- Searches for an album by its name. Returns a AlbumSearch object.
Use get_next_page() to retreive sequences of results.
- search_for_artist(self, artist_name)
- Searches of an artist by its name. Returns a ArtistSearch object.
Use get_next_page() to retreive sequences of results.
- search_for_tag(self, tag_name)
- Searches of a tag by its name. Returns a TagSearch object.
Use get_next_page() to retreive sequences of results.
- search_for_track(self, artist_name, track_name)
- Searches of a track by its name and its artist. Set artist to an empty string if not available.
Returns a TrackSearch object.
Use get_next_page() to retreive sequences of results.
- search_for_venue(self, venue_name, country_name)
- Searches of a venue by its name and its country. Set country_name to an empty string if not available.
Returns a VenueSearch object.
Use get_next_page() to retreive sequences of results.
- update_now_playing(self, artist, title, album=None, album_artist=None, duration=None, track_number=None, mbid=None, context=None)
- Used to notify Last.fm that a user has started listening to a track.
Parameters:
artist (Required) : The artist name
title (Required) : The track title
album (Optional) : The album name.
album_artist (Optional) : The album artist - if this differs from the track artist.
duration (Optional) : The length of the track in seconds.
track_number (Optional) : The track number of the track on the album.
mbid (Optional) : The MusicBrainz Track ID.
context (Optional) : Sub-client version (not public, only enabled for certain API keys)
Data descriptors inherited from _Network:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
|
class LovedTrack(__builtin__.tuple) |
| |
LovedTrack(track, date, timestamp) |
| |
- Method resolution order:
- LovedTrack
- __builtin__.tuple
- __builtin__.object
Methods defined here:
- __getnewargs__(self)
- __repr__(self)
Static methods defined here:
- __new__(_cls, track, date, timestamp)
Data descriptors defined here:
- date
- itemgetter(item, ...) --> itemgetter object
Return a callable object that fetches the given item(s) from its operand.
After, f=itemgetter(2), the call f(r) returns r[2].
After, g=itemgetter(2,5,3), the call g(r) returns (r[2], r[5], r[3])
- timestamp
- itemgetter(item, ...) --> itemgetter object
Return a callable object that fetches the given item(s) from its operand.
After, f=itemgetter(2), the call f(r) returns r[2].
After, g=itemgetter(2,5,3), the call g(r) returns (r[2], r[5], r[3])
- track
- itemgetter(item, ...) --> itemgetter object
Return a callable object that fetches the given item(s) from its operand.
After, f=itemgetter(2), the call f(r) returns r[2].
After, g=itemgetter(2,5,3), the call g(r) returns (r[2], r[5], r[3])
Methods inherited from __builtin__.tuple:
- __add__(...)
- x.__add__(y) <==> x+y
- __contains__(...)
- x.__contains__(y) <==> y in x
- __eq__(...)
- x.__eq__(y) <==> x==y
- __ge__(...)
- x.__ge__(y) <==> x>=y
- __getattribute__(...)
- x.__getattribute__('name') <==> x.name
- __getitem__(...)
- x.__getitem__(y) <==> x[y]
- __getslice__(...)
- x.__getslice__(i, j) <==> x[i:j]
Use of negative indices is not supported.
- __gt__(...)
- x.__gt__(y) <==> x>y
- __hash__(...)
- x.__hash__() <==> hash(x)
- __iter__(...)
- x.__iter__() <==> iter(x)
- __le__(...)
- x.__le__(y) <==> x<=y
- __len__(...)
- x.__len__() <==> len(x)
- __lt__(...)
- x.__lt__(y) <==> x<y
- __mul__(...)
- x.__mul__(n) <==> x*n
- __ne__(...)
- x.__ne__(y) <==> x!=y
- __rmul__(...)
- x.__rmul__(n) <==> n*x
- __sizeof__(...)
- T.__sizeof__() -- size of T in memory, in bytes
- count(...)
- T.count(value) -> integer -- return number of occurrences of value
- index(...)
- T.index(value, [start, [stop]]) -> integer -- return first index of value.
Raises ValueError if the value is not present.
|
class PlayedTrack(__builtin__.tuple) |
| |
PlayedTrack(track, playback_date, timestamp) |
| |
- Method resolution order:
- PlayedTrack
- __builtin__.tuple
- __builtin__.object
Methods defined here:
- __getnewargs__(self)
- __repr__(self)
Static methods defined here:
- __new__(_cls, track, playback_date, timestamp)
Data descriptors defined here:
- playback_date
- itemgetter(item, ...) --> itemgetter object
Return a callable object that fetches the given item(s) from its operand.
After, f=itemgetter(2), the call f(r) returns r[2].
After, g=itemgetter(2,5,3), the call g(r) returns (r[2], r[5], r[3])
- timestamp
- itemgetter(item, ...) --> itemgetter object
Return a callable object that fetches the given item(s) from its operand.
After, f=itemgetter(2), the call f(r) returns r[2].
After, g=itemgetter(2,5,3), the call g(r) returns (r[2], r[5], r[3])
- track
- itemgetter(item, ...) --> itemgetter object
Return a callable object that fetches the given item(s) from its operand.
After, f=itemgetter(2), the call f(r) returns r[2].
After, g=itemgetter(2,5,3), the call g(r) returns (r[2], r[5], r[3])
Methods inherited from __builtin__.tuple:
- __add__(...)
- x.__add__(y) <==> x+y
- __contains__(...)
- x.__contains__(y) <==> y in x
- __eq__(...)
- x.__eq__(y) <==> x==y
- __ge__(...)
- x.__ge__(y) <==> x>=y
- __getattribute__(...)
- x.__getattribute__('name') <==> x.name
- __getitem__(...)
- x.__getitem__(y) <==> x[y]
- __getslice__(...)
- x.__getslice__(i, j) <==> x[i:j]
Use of negative indices is not supported.
- __gt__(...)
- x.__gt__(y) <==> x>y
- __hash__(...)
- x.__hash__() <==> hash(x)
- __iter__(...)
- x.__iter__() <==> iter(x)
- __le__(...)
- x.__le__(y) <==> x<=y
- __len__(...)
- x.__len__() <==> len(x)
- __lt__(...)
- x.__lt__(y) <==> x<y
- __mul__(...)
- x.__mul__(n) <==> x*n
- __ne__(...)
- x.__ne__(y) <==> x!=y
- __rmul__(...)
- x.__rmul__(n) <==> n*x
- __sizeof__(...)
- T.__sizeof__() -- size of T in memory, in bytes
- count(...)
- T.count(value) -> integer -- return number of occurrences of value
- index(...)
- T.index(value, [start, [stop]]) -> integer -- return first index of value.
Raises ValueError if the value is not present.
|
class Playlist(_BaseObject) |
| |
A Last.fm user playlist. |
| |
- Method resolution order:
- Playlist
- _BaseObject
- __builtin__.object
Methods defined here:
- __init__(self, user, id, network)
- __str__ = r(*args)
- add_track(self, track)
- Adds a Track to this Playlist.
- get_cover_image(self, size=3)
- Returns a uri to the cover image
size can be one of:
COVER_MEGA
COVER_EXTRA_LARGE
COVER_LARGE
COVER_MEDIUM
COVER_SMALL
- get_creation_date(self)
- Returns the creation date of this playlist.
- get_description(self)
- Returns the description of this playlist.
- get_duration(self)
- Returns the duration of this playlist in milliseconds.
- get_id(self)
- Returns the playlist id.
- get_size(self)
- Returns the number of tracks in this playlist.
- get_title(self)
- Returns the title of this playlist.
- get_tracks(self)
- Returns a list of the tracks on this user playlist.
- get_url(self, domain_name=0)
- Returns the url of the playlist on the network.
* domain_name: The network's language domain. Possible values:
o DOMAIN_ENGLISH
o DOMAIN_GERMAN
o DOMAIN_SPANISH
o DOMAIN_FRENCH
o DOMAIN_ITALIAN
o DOMAIN_POLISH
o DOMAIN_PORTUGUESE
o DOMAIN_SWEDISH
o DOMAIN_TURKISH
o DOMAIN_RUSSIAN
o DOMAIN_JAPANESE
o DOMAIN_CHINESE
- get_user(self)
- Returns the owner user of this playlist.
- has_track(self, track)
- Checks to see if track is already in the playlist.
* track: Any Track object.
- is_streamable(self)
- Returns True if the playlist is streamable.
For a playlist to be streamable, it needs at least 45 tracks by 15 different artists.
Data and other attributes defined here:
- id = None
- user = None
Methods inherited from _BaseObject:
- __hash__(self)
Data descriptors inherited from _BaseObject:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
Data and other attributes inherited from _BaseObject:
- network = None
|
class Scrobbler(__builtin__.object) |
| |
A class for scrobbling tracks to Last.fm |
| |
Methods defined here:
- __init__(self, network, client_id, client_version)
- report_now_playing(self, artist, title, album='', duration='', track_number='', mbid='')
- scrobble(self, artist, title, time_started, source, mode, duration, album='', track_number='', mbid='')
- Scrobble a track. parameters:
artist: Artist name.
title: Track title.
time_started: UTC timestamp of when the track started playing.
source: The source of the track
SCROBBLE_SOURCE_USER: Chosen by the user (the most common value, unless you have a reason for choosing otherwise, use this).
SCROBBLE_SOURCE_NON_PERSONALIZED_BROADCAST: Non-personalised broadcast (e.g. Shoutcast, BBC Radio 1).
SCROBBLE_SOURCE_PERSONALIZED_BROADCAST: Personalised recommendation except Last.fm (e.g. Pandora, Launchcast).
SCROBBLE_SOURCE_LASTFM: ast.fm (any mode). In this case, the 5-digit recommendation_key value must be set.
SCROBBLE_SOURCE_UNKNOWN: Source unknown.
mode: The submission mode
SCROBBLE_MODE_PLAYED: The track was played.
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.
- scrobble_many(self, tracks)
- Scrobble several tracks at once.
tracks: A sequence of a sequence of parameters for each trach. The order of parameters
is the same as if passed to the scrobble() method.
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
Data and other attributes defined here:
- nowplaying_url = None
- session_id = None
- submissions_url = None
|
class SessionKeyGenerator(__builtin__.object) |
| |
Methods of generating a session key:
1) Web Authentication:
a. network = get_*_network(API_KEY, API_SECRET)
b. sg = SessionKeyGenerator(network)
c. url = sg.get_web_auth_url()
d. Ask the user to open the url and authorize you, and wait for it.
e. session_key = sg.get_web_auth_session_key(url)
2) Username and Password Authentication:
a. network = get_*_network(API_KEY, API_SECRET)
b. username = raw_input("Please enter your username: ")
c. password_hash = pylast.md5(raw_input("Please enter your password: ")
d. session_key = SessionKeyGenerator(network).get_session_key(username, password_hash)
A session key's lifetime is infinie, unless the user provokes the rights of the given API Key.
If you create a Network object with just a API_KEY and API_SECRET and a username and a password_hash, a
SESSION_KEY will be automatically generated for that network and stored in it so you don't have to do this
manually, unless you want to. |
| |
Methods defined here:
- __init__(self, network)
- get_session_key(self, username, password_hash)
- Retrieve a session key with a username and a md5 hash of the user's password.
- get_web_auth_session_key(self, url)
- Retrieves the session key of a web authorization process by its url.
- get_web_auth_url(self)
- The user must open this page, and you first, then call get_web_auth_session_key(url) after that.
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
|
class Shout(__builtin__.tuple) |
| |
Shout(body, author, date) |
| |
- Method resolution order:
- Shout
- __builtin__.tuple
- __builtin__.object
Methods defined here:
- __getnewargs__(self)
- __repr__(self)
Static methods defined here:
- __new__(_cls, body, author, date)
Data descriptors defined here:
- author
- itemgetter(item, ...) --> itemgetter object
Return a callable object that fetches the given item(s) from its operand.
After, f=itemgetter(2), the call f(r) returns r[2].
After, g=itemgetter(2,5,3), the call g(r) returns (r[2], r[5], r[3])
- body
- itemgetter(item, ...) --> itemgetter object
Return a callable object that fetches the given item(s) from its operand.
After, f=itemgetter(2), the call f(r) returns r[2].
After, g=itemgetter(2,5,3), the call g(r) returns (r[2], r[5], r[3])
- date
- itemgetter(item, ...) --> itemgetter object
Return a callable object that fetches the given item(s) from its operand.
After, f=itemgetter(2), the call f(r) returns r[2].
After, g=itemgetter(2,5,3), the call g(r) returns (r[2], r[5], r[3])
Methods inherited from __builtin__.tuple:
- __add__(...)
- x.__add__(y) <==> x+y
- __contains__(...)
- x.__contains__(y) <==> y in x
- __eq__(...)
- x.__eq__(y) <==> x==y
- __ge__(...)
- x.__ge__(y) <==> x>=y
- __getattribute__(...)
- x.__getattribute__('name') <==> x.name
- __getitem__(...)
- x.__getitem__(y) <==> x[y]
- __getslice__(...)
- x.__getslice__(i, j) <==> x[i:j]
Use of negative indices is not supported.
- __gt__(...)
- x.__gt__(y) <==> x>y
- __hash__(...)
- x.__hash__() <==> hash(x)
- __iter__(...)
- x.__iter__() <==> iter(x)
- __le__(...)
- x.__le__(y) <==> x<=y
- __len__(...)
- x.__len__() <==> len(x)
- __lt__(...)
- x.__lt__(y) <==> x<y
- __mul__(...)
- x.__mul__(n) <==> x*n
- __ne__(...)
- x.__ne__(y) <==> x!=y
- __rmul__(...)
- x.__rmul__(n) <==> n*x
- __sizeof__(...)
- T.__sizeof__() -- size of T in memory, in bytes
- count(...)
- T.count(value) -> integer -- return number of occurrences of value
- index(...)
- T.index(value, [start, [stop]]) -> integer -- return first index of value.
Raises ValueError if the value is not present.
|
class SimilarItem(__builtin__.tuple) |
| |
SimilarItem(item, match) |
| |
- Method resolution order:
- SimilarItem
- __builtin__.tuple
- __builtin__.object
Methods defined here:
- __getnewargs__(self)
- __repr__(self)
Static methods defined here:
- __new__(_cls, item, match)
Data descriptors defined here:
- item
- itemgetter(item, ...) --> itemgetter object
Return a callable object that fetches the given item(s) from its operand.
After, f=itemgetter(2), the call f(r) returns r[2].
After, g=itemgetter(2,5,3), the call g(r) returns (r[2], r[5], r[3])
- match
- itemgetter(item, ...) --> itemgetter object
Return a callable object that fetches the given item(s) from its operand.
After, f=itemgetter(2), the call f(r) returns r[2].
After, g=itemgetter(2,5,3), the call g(r) returns (r[2], r[5], r[3])
Methods inherited from __builtin__.tuple:
- __add__(...)
- x.__add__(y) <==> x+y
- __contains__(...)
- x.__contains__(y) <==> y in x
- __eq__(...)
- x.__eq__(y) <==> x==y
- __ge__(...)
- x.__ge__(y) <==> x>=y
- __getattribute__(...)
- x.__getattribute__('name') <==> x.name
- __getitem__(...)
- x.__getitem__(y) <==> x[y]
- __getslice__(...)
- x.__getslice__(i, j) <==> x[i:j]
Use of negative indices is not supported.
- __gt__(...)
- x.__gt__(y) <==> x>y
- __hash__(...)
- x.__hash__() <==> hash(x)
- __iter__(...)
- x.__iter__() <==> iter(x)
- __le__(...)
- x.__le__(y) <==> x<=y
- __len__(...)
- x.__len__() <==> len(x)
- __lt__(...)
- x.__lt__(y) <==> x<y
- __mul__(...)
- x.__mul__(n) <==> x*n
- __ne__(...)
- x.__ne__(y) <==> x!=y
- __rmul__(...)
- x.__rmul__(n) <==> n*x
- __sizeof__(...)
- T.__sizeof__() -- size of T in memory, in bytes
- count(...)
- T.count(value) -> integer -- return number of occurrences of value
- index(...)
- T.index(value, [start, [stop]]) -> integer -- return first index of value.
Raises ValueError if the value is not present.
|
class Tag(_BaseObject) |
| |
A Last.fm object tag. |
| |
- Method resolution order:
- Tag
- _BaseObject
- __builtin__.object
Methods defined here:
- __eq__(self, other)
- __init__(self, name, network)
- __ne__(self, other)
- __repr__(self)
- __str__ = r(*args)
- get_name(self, properly_capitalized=False)
- Returns the name of the tag.
- get_similar(self)
- Returns the tags similar to this one, ordered by similarity.
- get_top_albums(self)
- Retuns a list of the top albums.
- get_top_artists(self)
- Returns a sequence of the most played artists.
- get_top_tracks(self)
- Returns a list of the most played Tracks by this artist.
- get_url(self, domain_name=0)
- Returns the url of the tag page on the network.
* domain_name: The network's language domain. Possible values:
o DOMAIN_ENGLISH
o DOMAIN_GERMAN
o DOMAIN_SPANISH
o DOMAIN_FRENCH
o DOMAIN_ITALIAN
o DOMAIN_POLISH
o DOMAIN_PORTUGUESE
o DOMAIN_SWEDISH
o DOMAIN_TURKISH
o DOMAIN_RUSSIAN
o DOMAIN_JAPANESE
o DOMAIN_CHINESE
- get_weekly_artist_charts(self, from_date=None, to_date=None)
- Returns the weekly artist charts for the week starting from the from_date value to the to_date value.
- get_weekly_chart_dates(self)
- Returns a list of From and To tuples for the available charts.
Data and other attributes defined here:
- name = None
Methods inherited from _BaseObject:
- __hash__(self)
Data descriptors inherited from _BaseObject:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
Data and other attributes inherited from _BaseObject:
- network = None
|
class TopItem(__builtin__.tuple) |
| |
TopItem(item, weight) |
| |
- Method resolution order:
- TopItem
- __builtin__.tuple
- __builtin__.object
Methods defined here:
- __getnewargs__(self)
- __repr__(self)
Static methods defined here:
- __new__(_cls, item, weight)
Data descriptors defined here:
- item
- itemgetter(item, ...) --> itemgetter object
Return a callable object that fetches the given item(s) from its operand.
After, f=itemgetter(2), the call f(r) returns r[2].
After, g=itemgetter(2,5,3), the call g(r) returns (r[2], r[5], r[3])
- weight
- itemgetter(item, ...) --> itemgetter object
Return a callable object that fetches the given item(s) from its operand.
After, f=itemgetter(2), the call f(r) returns r[2].
After, g=itemgetter(2,5,3), the call g(r) returns (r[2], r[5], r[3])
Methods inherited from __builtin__.tuple:
- __add__(...)
- x.__add__(y) <==> x+y
- __contains__(...)
- x.__contains__(y) <==> y in x
- __eq__(...)
- x.__eq__(y) <==> x==y
- __ge__(...)
- x.__ge__(y) <==> x>=y
- __getattribute__(...)
- x.__getattribute__('name') <==> x.name
- __getitem__(...)
- x.__getitem__(y) <==> x[y]
- __getslice__(...)
- x.__getslice__(i, j) <==> x[i:j]
Use of negative indices is not supported.
- __gt__(...)
- x.__gt__(y) <==> x>y
- __hash__(...)
- x.__hash__() <==> hash(x)
- __iter__(...)
- x.__iter__() <==> iter(x)
- __le__(...)
- x.__le__(y) <==> x<=y
- __len__(...)
- x.__len__() <==> len(x)
- __lt__(...)
- x.__lt__(y) <==> x<y
- __mul__(...)
- x.__mul__(n) <==> x*n
- __ne__(...)
- x.__ne__(y) <==> x!=y
- __rmul__(...)
- x.__rmul__(n) <==> n*x
- __sizeof__(...)
- T.__sizeof__() -- size of T in memory, in bytes
- count(...)
- T.count(value) -> integer -- return number of occurrences of value
- index(...)
- T.index(value, [start, [stop]]) -> integer -- return first index of value.
Raises ValueError if the value is not present.
|
class Track(_BaseObject, _Taggable) |
| |
A Last.fm track. |
| |
- Method resolution order:
- Track
- _BaseObject
- _Taggable
- __builtin__.object
Methods defined here:
- __eq__(self, other)
- __init__(self, artist, title, network)
- __ne__(self, other)
- __repr__(self)
- __str__ = r(*args)
- ban(self)
- Ban this track from ever playing on the radio.
- get_album(self)
- Returns the album object of this track.
- get_artist(self)
- Returns the associated Artist object.
- get_duration(self)
- Returns the track duration.
- get_id(self)
- Returns the track id on the network.
- get_listener_count(self)
- Returns the listener count.
- get_mbid(self)
- Returns the MusicBrainz ID of this track.
- get_name(self, properly_capitalized=False)
- Returns the track title (alias to Track.get_title).
- get_playcount(self)
- Returns the play count.
- get_shouts(self, limit=50)
- Returns a sequqence of Shout objects
- get_similar(self)
- Returns similar tracks for this track on the network, based on listening data.
- get_title(self, properly_capitalized=False)
- Returns the track title.
- get_top_fans(self, limit=None)
- Returns a list of the Users who played this track.
- get_url(self, domain_name=0)
- Returns the url of the track page on the network.
* domain_name: The network's language domain. Possible values:
o DOMAIN_ENGLISH
o DOMAIN_GERMAN
o DOMAIN_SPANISH
o DOMAIN_FRENCH
o DOMAIN_ITALIAN
o DOMAIN_POLISH
o DOMAIN_PORTUGUESE
o DOMAIN_SWEDISH
o DOMAIN_TURKISH
o DOMAIN_RUSSIAN
o DOMAIN_JAPANESE
o DOMAIN_CHINESE
- get_wiki_content(self)
- Returns the content of the wiki.
- get_wiki_published_date(self)
- Returns the date of publishing this version of the wiki.
- get_wiki_summary(self)
- Returns the summary of the wiki.
- is_fulltrack_available(self)
- Returns True if the fulltrack is available for streaming.
- is_streamable(self)
- Returns True if the track is available at Last.fm.
- love(self)
- Adds the track to the user's loved tracks.
- share(self, users, message=None)
- Shares this track (sends out recommendations).
* users: A list that can contain usernames, emails, User objects, or all of them.
* message: A message to include in the recommendation message.
Data and other attributes defined here:
- artist = None
- title = None
Methods inherited from _BaseObject:
- __hash__(self)
Data descriptors inherited from _BaseObject:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
Data and other attributes inherited from _BaseObject:
- network = None
Methods inherited from _Taggable:
- add_tag(self, tag)
- Adds one tag.
* tag: a tag name or a Tag object.
- add_tags(self, tags)
- Adds one or several tags.
* tags: A sequence of tag names or Tag objects.
- clear_tags(self)
- Clears all the user-set tags.
- get_tags(self)
- Returns a list of the tags set by the user to this object.
- get_top_tags(self, limit=None)
- Returns a list of the most frequently used Tags on this object.
- remove_tag(self, tag)
- Remove a user's tag from this object.
- remove_tags(self, tags)
- Removes one or several tags from this object.
* tags: a sequence of tag names or Tag objects.
- set_tags(self, tags)
- Sets this object's tags to only those tags.
* tags: a sequence of tag names or Tag objects.
|
class User(_BaseObject) |
| |
A Last.fm user. |
| |
- Method resolution order:
- User
- _BaseObject
- __builtin__.object
Methods defined here:
- __eq__(self, another)
- __init__(self, user_name, network)
- __ne__(self, another)
- __repr__(self)
- __str__ = r(*args)
- compare_with_user(self, user, shared_artists_limit=None)
- Compare this user with another Last.fm user.
Returns a sequence (tasteometer_score, (shared_artist1, shared_artist2, ...))
user: A User object or a username string/unicode object.
- get_age(self)
- Returns the user's age.
- get_country(self)
- Returns the name of the country of the user.
- get_friends(self, limit=50)
- Returns a list of the user's friends.
- get_gender(self)
- Returns the user's gender. Either USER_MALE or USER_FEMALE.
- get_id(self)
- Returns the user id.
- get_image(self)
- Returns the user's avatar.
- get_language(self)
- Returns the language code of the language used by the user.
- get_library(self)
- Returns the associated Library object.
- get_loved_tracks(self, limit=50)
- Returns this user's loved track as a sequence of LovedTrack objects
in reverse order of their timestamp, all the way back to the first track.
If limit==None, it will try to pull all the available data.
This method uses caching. Enable caching only if you're pulling a
large amount of data.
Use extract_items() with the return of this function to
get only a sequence of Track objects with no playback dates.
- get_name(self, properly_capitalized=False)
- Returns the nuser name.
- get_neighbours(self, limit=50)
- Returns a list of the user's friends.
- get_now_playing(self)
- Returns the currently playing track, or None if nothing is playing.
- get_past_events(self, limit=50)
- Returns a sequence of Event objects
if limit==None it will return all
- get_playcount(self)
- Returns the user's playcount so far.
- get_playlists(self)
- Returns a list of Playlists that this user owns.
- get_recent_tracks(self, limit=10)
- Returns this user's played track as a sequence of PlayedTrack objects
in reverse order of their playtime, all the way back to the first track.
If limit==None, it will try to pull all the available data.
This method uses caching. Enable caching only if you're pulling a
large amount of data.
Use extract_items() with the return of this function to
get only a sequence of Track objects with no playback dates.
- get_shouts(self, limit=50)
- Returns a sequqence of Shout objects
- get_top_albums(self, period='overall')
- Returns the top albums played by a user.
* period: The period of time. Possible values:
o PERIOD_OVERALL
o PERIOD_7DAYS
o PERIOD_3MONTHS
o PERIOD_6MONTHS
o PERIOD_12MONTHS
- get_top_artists(self, period='overall')
- Returns the top artists played by a user.
* period: The period of time. Possible values:
o PERIOD_OVERALL
o PERIOD_7DAYS
o PERIOD_3MONTHS
o PERIOD_6MONTHS
o PERIOD_12MONTHS
- get_top_tags(self, limit=None)
- Returns a sequence of the top tags used by this user with their counts as (Tag, tagcount).
* limit: The limit of how many tags to return.
- get_top_tracks(self, period='overall')
- Returns the top tracks played by a user.
* period: The period of time. Possible values:
o PERIOD_OVERALL
o PERIOD_7DAYS
o PERIOD_3MONTHS
o PERIOD_6MONTHS
o PERIOD_12MONTHS
- get_upcoming_events(self)
- Returns all the upcoming events for this user.
- get_url(self, domain_name=0)
- Returns the url of the user page on the network.
* domain_name: The network's language domain. Possible values:
o DOMAIN_ENGLISH
o DOMAIN_GERMAN
o DOMAIN_SPANISH
o DOMAIN_FRENCH
o DOMAIN_ITALIAN
o DOMAIN_POLISH
o DOMAIN_PORTUGUESE
o DOMAIN_SWEDISH
o DOMAIN_TURKISH
o DOMAIN_RUSSIAN
o DOMAIN_JAPANESE
o DOMAIN_CHINESE
- get_weekly_album_charts(self, from_date=None, to_date=None)
- Returns the weekly album charts for the week starting from the from_date value to the to_date value.
- get_weekly_artist_charts(self, from_date=None, to_date=None)
- Returns the weekly artist charts for the week starting from the from_date value to the to_date value.
- get_weekly_chart_dates(self)
- Returns a list of From and To tuples for the available charts.
- get_weekly_track_charts(self, from_date=None, to_date=None)
- Returns the weekly track charts for the week starting from the from_date value to the to_date value.
- is_subscriber(self)
- Returns whether the user is a subscriber or not. True or False.
- shout(self, message)
- Post a shout
Data and other attributes defined here:
- name = None
Methods inherited from _BaseObject:
- __hash__(self)
Data descriptors inherited from _BaseObject:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
Data and other attributes inherited from _BaseObject:
- network = None
|
|