|
Methods defined here:
- __init__(self)
- Initialize an AmpacheSession.
- authenticate(self)
- Attempt to authenticate to Ampache. Returns True if successful and False if not.
This will retry AUTH_MAX_RETRY(=3) times.
- get_album_art(self, album_id)
- Takes an album_id and returns the url to the artwork (with the current authentication).
- get_albums_by_artist(self, artist_id)
- Gets all albums by the artist_id and returns as a list of dictionaries.
Example: [
{ 'artist_id' : artist_id,
'artist_name' : artist_name,
'album_id' : album_id,
'album_name' : album_name,
'album_year' : album_year,
'album_tracks' : album_tracks,
'album_disk' : album_disk,
'album_rating' : album_rating,
'precise_rating' : precise_rating,
},
{ ... },
]
- get_artists(self, offset=None)
- Gets all artists and return as a list of dictionaries.
Example: [
{ 'artist_id' : artist_id, 'artist_name' : artist_name},
{ 'artist_id' : 1, 'artist_name' : 'The Reign of Kindo'},
{ ... },
]
- get_credentials(self)
- Retrun the url, username, and password as a tuple.
- get_last_update_time(self)
- Returns the last time the catalog on the Ampache server was updated.
- get_playlist_songs(self, playlist_id, re_auth=False)
- Gets all info about a song from the song_id and returns it as a dictionary.
Example: [
{ 'song_id' : song_id,
'song_title' : song_title,
'artist_id' : artist_id,
'artist_name' : artist_name,
'album_id' : album_id,
'album_name' : album_name,
'song_track' : song_track,
'song_time' : song_time,
'song_size' : song_size,
'precise_rating' : precise_rating,
'rating' : rating,
'art' : art,
'url' : url,
},
{...}
]
- get_playlists(self, re_auth=False)
- Gets a list of all of the playlists on the server.
Example: [
{ 'id' : id,
'owner' : owner,
'name' : name,
'items' : items,
'type' : type,
},
{ ... },
]
- get_song_info(self, song_id)
- Gets all info about a song from the song_id and returns it as a dictionary.
Example: { 'song_id' : song_id,
'song_title' : song_title,
'artist_id' : artist_id,
'artist_name' : artist_name,
'album_id' : album_id,
'album_name' : album_name,
'song_track' : song_track,
'song_time' : song_time,
'song_size' : song_size,
'precise_rating' : precise_rating,
'rating' : rating,
'art' : art,
'url' : url,
}
- get_song_url(self, song_id)
- Takes a song_id and returns the url to the song (with the current authentication).
- get_songs_by_album(self, album_id)
- Gets all songs on album_id and returns as a list of dictionaries.
Example: [
{ 'song_id' : song_id,
'song_title' : song_title,
'artist_id' : artist_id,
'artist_name' : artist_name,
'album_id' : album_id,
'album_name' : album_name,
'song_track' : song_track,
'song_time' : song_time,
'song_size' : song_size,
'precise_rating' : precise_rating,
'rating' : rating,
'art' : art,
'url' : url,
},
{ ... },
]
- has_credentials(self)
- Checks to see if the AmpacheSession object has credentials set.
- is_authenticated(self)
- Returns True if self.auth is set, and False if it is not.
- ping(self)
- Ping extends the current session to Ampache.
Returns None if it fails, or the time the session expires if it is succesful
- set_credentials(self, username, password, url)
- Save the ampache url, username, and password.
|