music.model

Module contents

ORM layer containing the data model

model.config

class music.model.config.Config(*args, **kwargs)

Bases: Model

Service-level config data structure for app keys and settings

class Meta

Bases: object

collection_name = 'config'

Set correct path in Firestore

apns_key_id = None
apns_team_id = None
collection: Manager = <fireo.managers.managers.Manager object>
collection_name = 'config'
id = None
jwt_default_length = None
jwt_max_length = None
playlist_cloud_operating_mode = None

Determines whether playlist and tag update operations are done by Cloud Tasks or Functions

model.playlist

class music.model.playlist.Playlist(*args, **kwargs)

Bases: Model

Smart playlist

Parameters:

Model ([type]) – [description]

Returns:

[description]

Return type:

[type]

class Meta

Bases: object

collection_name = 'playlists'
add_last_month = None
add_this_month = None
chart_limit = None
chart_range = None
collection: Manager = <fireo.managers.managers.Manager object>
collection_name = 'playlists'
day_boundary = None
description_overwrite = None
description_suffix = None
id = None
include_library_tracks = None
include_recommendations = None
include_spotify_owned = None
last_updated = None
lastfm_stat_album_count = None
lastfm_stat_album_percent = None
lastfm_stat_artist_count = None
lastfm_stat_artist_percent = None
lastfm_stat_count = None
lastfm_stat_last_refresh = None
lastfm_stat_percent = None
mutable_keys = ['type', 'include_recommendations', 'recommendation_sample', 'include_library_tracks', 'parts', 'playlist_references', 'shuffle', 'sort', 'description_overwrite', 'description_suffix', 'add_last_month', 'add_this_month', 'day_boundary', 'include_spotify_owned', 'chart_range', 'chart_limit']
name = None
parts = None
playlist_references = None
recommendation_sample = None
shuffle = None
sort = None
to_dict()

Convert model into dict

type = None
uri = None
class music.model.playlist.Sort(value)

Bases: Enum

An enumeration.

default = 1
release_date = 3
shuffle = 2

model.tag

class music.model.tag.Tag(*args, **kwargs)

Bases: Model

class Meta

Bases: object

collection_name = 'tags'
albums = None
artists = None
collection: Manager = <fireo.managers.managers.Manager object>
collection_name = 'tags'
count = None
id = None
last_updated = None
name = None
proportion = None
tag_id = None
time_objects = None
to_dict()

Convert model into dict

total_time = None
total_time_ms = None
total_user_scrobbles = None
tracks = None
username = None

model.user

class music.model.user.User(*args, **kwargs)

Bases: Model

class Meta

Bases: object

collection_name = 'spotify_users'
access_token = None
apns_tokens = None
check_password(password)
collection: Manager = <fireo.managers.managers.Manager object>
collection_name = 'spotify_users'
email = None
get_playlist(playlist_name: str, single_return=True, raise_error=True)

Get a user’s playlist by name with smart case sensitivity

Will return an exact match if possible, otherwise will return the first case-insensitive match

Parameters:
  • playlist_name (str) – Subject playlist name

  • single_return (bool, optional) – Return the best match, otherwise return (<exact>, <all matches>). <exact> will be None if not found. Defaults to True.

  • raise_error (bool, optional) – Raise a NameError if nothing found. Defaults to True.

Raises:

NameError – If no matching playlists found

Returns:

Found user’s playlists

Return type:

Optional[Playlist] or (<exact>, <all matches>)

get_playlists()

Get all playlists for a user

Returns:

List of users playlists

Return type:

List[Playlist]

id = None
last_keygen = None
last_login = None
last_refreshed = None
lastfm_username = None
locked = None
notify = None
notify_admins = None
notify_playlist_updates = None
notify_tag_updates = None
password = None
refresh_token = None
spotify_linked = None
to_dict()

Convert model into dict

token_expiry = None
type = None
username = None
validated = None
music.model.user.get_admins()