music.tasks

Module contents

Long running operations of the app including playlist generation and tag update functions

tasks.create_playlist

music.tasks.create_playlist.create_playlist(user: User, name: str) Optional[FullPlaylist]

Create a new playlist on the user’s Spotify account

For creating new playlists, create and return a new playlist object

Parameters:
  • user (User) – Subject user

  • name (str) – Name of new playlist

Returns:

New playlist object if created

Return type:

Optional[FullPlaylist]

tasks.refresh_lastfm_stats

music.tasks.refresh_lastfm_stats.refresh_lastfm_album_stats(username, playlist_name)
music.tasks.refresh_lastfm_stats.refresh_lastfm_artist_stats(username, playlist_name)
music.tasks.refresh_lastfm_stats.refresh_lastfm_track_stats(username, playlist_name)

tasks.run_user_playlist

music.tasks.run_user_playlist.run_user_playlist(user: User, playlist: Playlist, spotnet: Optional[Network] = None, fmnet: Optional[Network] = None) None

Generate and upadate a user’s smart playlist

Parameters:
  • user (User) – Subject user

  • playlist (Playlist) – User’s subject playlist

  • spotnet (SpotNetwork, optional) – Spotframework network for Spotify operations. Defaults to None.

  • fmnet (Network, optional) – Fmframework network for Last.fm operations. Defaults to None.

Raises:
  • NameError – No user provided

  • NameError – No playlist provided

  • AttributeError – Playlist has no URI

  • NameError – No spotframework network available

  • e – spotframework error when retrieving user playlists

Returns:

[description]

Return type:

[type]

tasks.update_tag

music.tasks.update_tag.update_tag(user, tag, spotnet=None, fmnet=None)